const assert = require('node:assert/strict'); const { chromium } = require('playwright'); const base = process.env.PD_BROWSER_FIXTURE_URL || 'http://127.0.0.1:5238'; (async () => { const browser = await chromium.launch(); try { for (const pwa of [false, true]) for (const width of [390, 800, 1440]) { const context = await browser.newContext({viewport:{width,height:1000}}); if(pwa) await context.addInitScript(() => Object.defineProperty(navigator, 'standalone', {value:true})); const page = await context.newPage(); for(const theme of ['modern-light','modern-dark','warm-light','warm-dark']) { const response = await page.goto(`${base}/manuscript/reader?bookId=12&chapterId=21`); assert.equal(response.status(),200); assert.match(response.headers()['cache-control'],/no-store/); assert.match(response.headers()['x-robots-tag'],/noindex/); await page.evaluate(theme => PlotDirectorApplyApplicationTheme(theme), theme); const paragraphs = page.locator('.reader-paragraph'); assert.equal(await paragraphs.count(),3); assert.match(await paragraphs.nth(1).textContent(), /First paragraph: