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,41 @@
|
||||
import {
|
||||
expect,
|
||||
test,
|
||||
} from './fixtures';
|
||||
|
||||
test.describe('persistence', () => {
|
||||
test('restores selected fonts after reload', async ({ comparison, page }) => {
|
||||
await comparison.pickPair('Inter', 'Roboto');
|
||||
|
||||
// Confirm the store has flushed before reloading — otherwise we race
|
||||
// the debounce and may reload with empty storage.
|
||||
await expect.poll(async () => {
|
||||
const storage = await comparison.readStorage();
|
||||
return storage['glyphdiff:comparison'];
|
||||
}).toMatch(/roboto/i);
|
||||
|
||||
await page.reload();
|
||||
await comparison.searchInput.waitFor({ state: 'visible' });
|
||||
|
||||
await expect(comparison.primaryFont).toContainText('Inter');
|
||||
await expect(comparison.secondaryFont).toContainText('Roboto');
|
||||
});
|
||||
|
||||
test('restores typography settings after reload', async ({ comparison, typography, page }) => {
|
||||
const baseline = await typography.readValue('size');
|
||||
await typography.bump('size', 'up', 2);
|
||||
|
||||
const bumped = await typography.readValue('size');
|
||||
expect(bumped).not.toBe(baseline);
|
||||
|
||||
await expect.poll(async () => {
|
||||
const storage = await comparison.readStorage();
|
||||
return storage['glyphdiff:comparison:typography'];
|
||||
}).not.toBeNull();
|
||||
|
||||
await page.reload();
|
||||
await comparison.searchInput.waitFor({ state: 'visible' });
|
||||
|
||||
expect(await typography.readValue('size')).toBe(bumped);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user