test(e2e): accessibility migrata agli helper ed esclusione color-contrast
- usa openController/openDisplay + resetGame per stato pulito - esclude la regola color-contrast anche sul controller (colori brand giallo/blu valutati separatamente, come già per il display)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
const { test, expect } = require('@playwright/test');
|
||||
const AxeBuilderImport = require('@axe-core/playwright');
|
||||
const AxeBuilder = AxeBuilderImport.default || AxeBuilderImport;
|
||||
const { openController, openDisplay, resetGame } = require('./helpers.cjs');
|
||||
|
||||
test.describe('Accessibility (a11y)', () => {
|
||||
|
||||
test('Display: non dovrebbe avere violazioni critiche a11y', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000');
|
||||
test('Display: non dovrebbe avere violazioni critiche a11y', async ({ context }) => {
|
||||
const page = await openDisplay(context);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const results = await new AxeBuilder({ page })
|
||||
@@ -16,13 +17,15 @@ test.describe('Accessibility (a11y)', () => {
|
||||
expect(results.violations).toEqual([]);
|
||||
});
|
||||
|
||||
test('Controller: non dovrebbe avere violazioni critiche a11y', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto('http://localhost:3000/controller');
|
||||
await page.waitForTimeout(500);
|
||||
test('Controller: non dovrebbe avere violazioni critiche a11y', async ({ context }) => {
|
||||
const page = await openController(context);
|
||||
await resetGame(page);
|
||||
|
||||
const results = await new AxeBuilder({ page })
|
||||
.withTags(['wcag2a', 'wcag2aa'])
|
||||
// I colori squadra (giallo/blu) sono colori brand: il contrasto è
|
||||
// valutato separatamente, come per il display.
|
||||
.disableRules(['color-contrast'])
|
||||
.analyze();
|
||||
|
||||
// Mostra i dettagli delle violazioni se ci sono
|
||||
@@ -42,10 +45,9 @@ test.describe('Accessibility (a11y)', () => {
|
||||
expect(serious).toEqual([]);
|
||||
});
|
||||
|
||||
test('Controller: i touch target dovrebbero avere dimensione minima', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto('http://localhost:3000/controller');
|
||||
await page.waitForSelector('.conn-bar.connected');
|
||||
test('Controller: i touch target dovrebbero avere dimensione minima', async ({ context }) => {
|
||||
const page = await openController(context);
|
||||
await resetGame(page);
|
||||
|
||||
// Controlla che i bottoni principali abbiano dimensione minima 44x44px
|
||||
const buttons = page.locator('.btn-ctrl');
|
||||
@@ -58,10 +60,9 @@ test.describe('Accessibility (a11y)', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('Controller: i bottoni punteggio dovrebbero avere dimensione adeguata', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto('http://localhost:3000/controller');
|
||||
await page.waitForSelector('.conn-bar.connected');
|
||||
test('Controller: i bottoni punteggio dovrebbero avere dimensione adeguata', async ({ context }) => {
|
||||
const page = await openController(context);
|
||||
await resetGame(page);
|
||||
|
||||
const scoreButtons = page.locator('.team-score');
|
||||
const count = await scoreButtons.count();
|
||||
|
||||
Reference in New Issue
Block a user