| |
| |
| |
| |
| |
| |
| |
| |
| |
| import { test, expect } from '@playwright/test'; |
|
|
| test.describe('export-PDF curated print flow', () => { |
| test('header export button visible on /q/sample, hidden when no snapshot', async ({ page }) => { |
| await page.goto('/q/sample'); |
| await expect(page.locator('button').filter({ hasText: /export PDF/i })).toBeVisible(); |
| }); |
|
|
| test('print route hydrates from localStorage and shows curated layout', async ({ page }) => { |
| |
| await page.goto('/q/sample'); |
| await expect(page.locator('.briefing-prose')).toBeVisible(); |
|
|
| |
| const snapKey = await page.evaluate(() => { |
| const k = 'riprap:print:sample'; |
| return localStorage.getItem(k) ? k : null; |
| }); |
| expect(snapKey).toBe('riprap:print:sample'); |
|
|
| |
| await page.addInitScript(() => { |
| |
| window.__printed = 0; |
| window.print = () => { |
| |
| window.__printed += 1; |
| }; |
| }); |
|
|
| await page.goto('/print/sample'); |
|
|
| |
| await expect(page.locator('.print-doc')).toBeVisible(); |
| await expect(page.locator('.print-title')).toContainText(/Pioneer/i); |
| await expect(page.locator('.briefing-prose')).toBeVisible(); |
| await expect(page.locator('.print-citations h2')).toHaveText('Citations'); |
|
|
| |
| await expect(page.locator('.app-header')).toHaveCount(0); |
| await expect(page.locator('.app-region-map')).toHaveCount(0); |
| await expect(page.locator('.trace-ui')).toHaveCount(0); |
|
|
| |
| await page.waitForFunction( |
| |
| () => window.__printed > 0, |
| undefined, |
| { timeout: 4000 } |
| ); |
| }); |
|
|
| test('print route shows empty-state when no snapshot exists', async ({ page }) => { |
| await page.addInitScript(() => localStorage.clear()); |
| await page.goto('/print/no-such-query'); |
| await expect(page.locator('.empty')).toBeVisible(); |
| await expect(page.locator('.empty')).toContainText(/no briefing snapshot/i); |
| }); |
| }); |
|
|