// Comment bodies are visible on the comments page (B6: they rendered inside a // rastrillo toggle-block, whose body is display:none without a checked switch). // Real server-rendered page and stylesheets, mocked transport; no live data. // SHEETS_COMMENTS_FIXTURE=/tmp/comments.json go test ./internal/sheets -run TestBrowserCommentsFixture -count=1 // PLAYWRIGHT=/path/to/playwright/index.mjs SHEETS_COMMENTS_FIXTURE=/tmp/comments.json node tools/drive/comments.mjs import assert from 'node:assert/strict'; import fs from 'node:fs'; const pw = await import(process.env.PLAYWRIGHT || 'playwright'); const fixture = JSON.parse(fs.readFileSync(process.env.SHEETS_COMMENTS_FIXTURE)); const origin = 'https://sheets.test'; for (const name of ['chromium', 'webkit']) { const options = name === 'webkit' && process.env.WEBKIT_EXECUTABLE_PATH ? {executablePath:process.env.WEBKIT_EXECUTABLE_PATH} : {}; const browser = await pw[name].launch(options); try { for (const viewport of [{width:1440,height:900},{width:390,height:844}]) { const page = await browser.newPage({viewport}); await page.route(origin+'/**', async route => { const path = new URL(route.request().url()).pathname; if (path in fixture.assets) return route.fulfill({body:fixture.assets[path],contentType: path.endsWith('.js')?'application/javascript':path.endsWith('.css')?'text/css':'image/svg+xml'}); return route.fulfill({body:fixture.html,contentType:'text/html'}); }); await page.goto(origin+'/sheets/1/comments'); for (const text of fixture.bodies) { const body = page.getByText(text, {exact:true}); assert.equal(await body.count(), 1, `${name}: "${text}" rendered once`); assert.ok(await body.isVisible(), `${name} ${viewport.width}px: "${text}" is visible`); const box = await body.boundingBox(); assert.ok(box && box.width > 0 && box.height > 0, `${name}: "${text}" has a painted box`); } await page.close(); } console.log(`${name}: comment bodies visible`); } finally { await browser.close(); } }