test(dashboard): qualify responsive layout and preview semantics

This commit is contained in:
cesnimda
2026-10-21 21:21:22 +02:00
parent 77968da90c
commit 9604589785
8 changed files with 491 additions and 12 deletions
@@ -89,16 +89,18 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
}
const customize = page.getByRole('button', { name: t.dashboardCustomize, exact: true });
await customize.focus(); await page.keyboard.press('Enter');
await expect(page.getByRole('menuitemcheckbox').first()).toBeFocused();
const editor = page.getByRole('region', { name: t.dashboardEditing, exact: true });
await expect(editor).toBeVisible();
await expect(editor.locator('..')).toBeFocused();
await expect(editor.getByRole('list', { name: t.dashboardManageWidgets })).toBeVisible();
await expect(editor.getByRole('checkbox')).toHaveCount(9);
if (language === 'en') {
// Measure settled colors, not the menu's entry-opacity transition.
await expect.poll(() => page.getByRole('menu').evaluate(menu => getComputedStyle(menu.parentElement!).opacity)).toBe('1');
const menuScan = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
await info.attach(`dashboard-${mode}-menu-axe`, { body: JSON.stringify({ violations: menuScan.violations, incomplete: menuScan.incomplete }), contentType: 'application/json' });
expect(menuScan.violations).toEqual([]);
const editorScan = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
await info.attach(`dashboard-${mode}-editor-axe`, { body: JSON.stringify({ violations: editorScan.violations, incomplete: editorScan.incomplete }), contentType: 'application/json' });
expect(editorScan.violations).toEqual([]);
}
await page.keyboard.press('Escape'); await expect(customize).toBeFocused();
await expect(page.locator('[role="menuitemcheckbox"]')).toHaveCount(0);
await expect(editor).toHaveCount(0);
if (language === 'en') {
const result = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
await info.attach(`dashboard-${mode}-axe`, { body: JSON.stringify({ violations: result.violations, incomplete: result.incomplete }), contentType: 'application/json' });
@@ -115,8 +117,9 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
expect((await page.request.put(`${apiUrl}/auth/preferences/language`, { headers, data: { language: 'en' } })).status()).toBe(204);
await page.evaluate(() => localStorage.setItem('uiLanguage', 'en')); await page.reload();
await page.getByRole('button', { name: 'Customize dashboard' }).click();
for (const item of await page.getByRole('menuitemcheckbox').all()) await item.click();
await page.keyboard.press('Escape');
for (const item of await page.getByRole('region', { name: 'Editing dashboard', exact: true }).getByRole('checkbox').all()) await item.uncheck();
await page.getByRole('button', { name: 'Save layout', exact: true }).click();
await expect(page.getByRole('region', { name: 'Editing dashboard', exact: true })).toHaveCount(0);
await expect(page.getByText('Your dashboard sections are hidden.')).toBeVisible();
await page.reload();
await expect(page.getByText('Your dashboard sections are hidden.')).toBeVisible();
@@ -137,7 +140,9 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
await expect(page.getByText('Nordlys teknologi og fellestjenester æøå', { exact: true })).toHaveCount(0);
await capture(page, info, 'dashboard-new-account');
await page.getByRole('button', { name: 'Customize dashboard' }).click();
for (const item of await page.getByRole('menuitemcheckbox').all()) await expect(item).toHaveAttribute('aria-checked', 'true');
const newAccountEditor = page.getByRole('region', { name: 'Editing dashboard', exact: true });
await expect(newAccountEditor.getByRole('checkbox')).toHaveCount(9);
for (const item of await newAccountEditor.getByRole('checkbox').all()) await expect(item).toBeChecked();
await page.keyboard.press('Escape');
const b = await login(page.request, emailB);
const bCompany = await (await page.request.post(`${apiUrl}/companies`, { headers: b.headers, data: { name: 'New search' } })).json();