test: add e2e suite for core comparison flows
Adds 17 new specs across six files plus the supporting POM infrastructure: - fixtures with auto-opened comparison + typography helpers - TypographyMenu POM reading values from ComboControl aria-labels - ComparisonPage extended with side selection, font picking, slider-value reader, FontFaceSet inspection, storage snapshot - compare-flow: A/B selection, aria-pressed state, storage write - preview-text: input binding + slider character rendering - slider: keyboard ARIA contract (Arrow / Shift+Arrow / Page / Home / End) - font-loading: FontFaceSet contains selected, excludes unrelated - persistence: font selection + typography settings survive reload - typography: symmetric increase/decrease for all four controls
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { test as base } from '@playwright/test';
|
||||
import { ComparisonPage } from './pages/comparison-page';
|
||||
import { TypographyMenu } from './pages/typography-menu';
|
||||
|
||||
type Fixtures = {
|
||||
/**
|
||||
* Opened ComparisonPage with the root view loaded.
|
||||
*/
|
||||
comparison: ComparisonPage;
|
||||
/**
|
||||
* Typography menu helper bound to the same page.
|
||||
*/
|
||||
typography: TypographyMenu;
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom test that auto-opens the comparison view before each spec.
|
||||
* Playwright gives each test a fresh BrowserContext by default, so
|
||||
* localStorage is empty unless a test seeds it.
|
||||
*/
|
||||
export const test = base.extend<Fixtures>({
|
||||
comparison: async ({ page }, use) => {
|
||||
const view = new ComparisonPage(page);
|
||||
await view.open();
|
||||
await use(view);
|
||||
},
|
||||
// Depends on `comparison` so the root page is opened before the menu is
|
||||
// consulted — TypographyMenu has no markup of its own to load.
|
||||
typography: async ({ comparison, page }, use) => {
|
||||
void comparison;
|
||||
await use(new TypographyMenu(page));
|
||||
},
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
Reference in New Issue
Block a user