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,46 @@
|
||||
import {
|
||||
expect,
|
||||
test,
|
||||
} from './fixtures';
|
||||
|
||||
/**
|
||||
* Slider position is spring-animated; aria-valuenow reflects the current
|
||||
* value, not the target. All assertions use `toHaveAttribute` so Playwright
|
||||
* polls until the spring settles.
|
||||
*/
|
||||
test.describe('comparison slider', () => {
|
||||
test.beforeEach(async ({ comparison }) => {
|
||||
await comparison.pickPair('Inter', 'Roboto');
|
||||
await comparison.slider.focus();
|
||||
});
|
||||
|
||||
test('keyboard navigation snaps to End and Home', async ({ comparison }) => {
|
||||
await comparison.slider.press('End');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '100');
|
||||
|
||||
await comparison.slider.press('Home');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0');
|
||||
});
|
||||
|
||||
test('arrow keys nudge by one, Shift+Arrow by ten', async ({ comparison }) => {
|
||||
await comparison.slider.press('Home');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0');
|
||||
|
||||
await comparison.slider.press('ArrowRight');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '1');
|
||||
|
||||
await comparison.slider.press('Shift+ArrowRight');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '11');
|
||||
});
|
||||
|
||||
test('PageUp / PageDown move by ten', async ({ comparison }) => {
|
||||
await comparison.slider.press('Home');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0');
|
||||
|
||||
await comparison.slider.press('PageUp');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '10');
|
||||
|
||||
await comparison.slider.press('PageDown');
|
||||
await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user