import { expect } from '@playwright/test'; import { test } from '@stencil/playwright'; import { expectVrtScreenshot, withGlobalStyles } from '../../../utils/tests/vrt-helpers'; /** * Visual regression tests for ontario-summary-list. * * Companion to the E2E suite: these assert pixel-level rendering of the summary * list variants. Baselines are generated in (or matched against) the CI Playwright * Linux image - see `Stencil-VRT-CI-Plan.md`. * * Snapshots target the component host (a stable element) rather than inner * shadow nodes, with animations disabled and the caret hidden for determinism. */ /** * Wraps component markup with the global stylesheet so that @font-face * declarations (Raleway Modified, Open Sans) are available to shadow-DOM * components that inherit typography from the document root. */ test.describe('ontario-summary-list', () => { test.describe('default', () => { test.beforeEach(async ({ page }) => { await page.setContent( withGlobalStyles(` `), ); await page.waitForChanges(); }); test('default', async ({ page }) => { const host = page.locator('ontario-summary-list'); await expect(host).toHaveClass(/hydrated/); await expectVrtScreenshot(host); }); }); test.describe('full width', () => { test.beforeEach(async ({ page }) => { await page.setContent( withGlobalStyles(` `), ); await page.waitForChanges(); }); test('default', async ({ page }) => { const host = page.locator('ontario-summary-list'); await expect(host).toHaveClass(/hydrated/); await expectVrtScreenshot(host); }); }); test.describe('caption action', () => { test.beforeEach(async ({ page }) => { await page.setContent( withGlobalStyles(` `), ); await page.waitForChanges(); }); test('default', async ({ page }) => { const host = page.locator('ontario-summary-list'); await expect(host).toHaveClass(/hydrated/); await expectVrtScreenshot(host); }); test('focus', async ({ page }) => { const host = page.locator('ontario-summary-list'); await expect(host).toHaveClass(/hydrated/); const changeLink = host.locator('a.ontario-summary-list__change-button'); await changeLink.focus(); await expectVrtScreenshot(host); }); }); test.describe('french', () => { test.beforeEach(async ({ page }) => { await page.setContent( withGlobalStyles(` `), ); await page.waitForChanges(); }); test('default', async ({ page }) => { const host = page.locator('ontario-summary-list'); await expect(host).toHaveClass(/hydrated/); await expectVrtScreenshot(host); }); }); });