diff --git a/aksel.nav.no/website/components/website-modules/examples/withDsExample.tsx b/aksel.nav.no/website/components/website-modules/examples/withDsExample.tsx index 4fe7888485..a7dfde240b 100644 --- a/aksel.nav.no/website/components/website-modules/examples/withDsExample.tsx +++ b/aksel.nav.no/website/components/website-modules/examples/withDsExample.tsx @@ -8,6 +8,7 @@ import { TabletIcon, } from "@navikt/aksel-icons"; import { HStack } from "@navikt/ds-react"; +import { SEO } from "../seo/SEO"; import styles from "./examples.module.css"; type withDsT = { @@ -75,23 +76,26 @@ export const withDsExample = ( }; return ( -
- {showBreakpoints && } -
+ +
- -
-
+ {showBreakpoints && } +
+ +
+ + ); }; diff --git a/aksel.nav.no/website/e2e/axe.e2e.ts b/aksel.nav.no/website/e2e/axe.e2e.ts index ac50274a84..be91ee1e9c 100644 --- a/aksel.nav.no/website/e2e/axe.e2e.ts +++ b/aksel.nav.no/website/e2e/axe.e2e.ts @@ -1,13 +1,40 @@ import AxeBuilder from "@axe-core/playwright"; import { expect, test } from "@playwright/test"; -import urls from "./sitemap-urls.json"; +import { getDirectories } from "../scripts/update-examples/parts/get-directories"; +import { getFiles } from "../scripts/update-examples/parts/get-files"; + +//import urls from "./sitemap-urls.json"; + +const examples = getDirectories("eksempler"); test.describe("Axe a11y", () => { - for (const url of urls) { + for (const example of examples) { + const testFiles = getFiles(example.path, "eksempler"); + + for (const testFile of testFiles.files) { + const url = `/eksempler/${example.path}/${testFile.replace(".tsx", "")}`; + + test(`Check page ${url}`, async ({ page }) => { + await page.goto(`http://localhost:3000${url}`); + //await page.waitForLoadState("domcontentloaded"); + const a11yScanResults = await new AxeBuilder({ + page, + }) + .disableRules(["page-has-heading-one"]) + .analyze(); + expect(a11yScanResults.violations).toEqual([]); + }); + } + } + + // TODO: Ser ikke ut som axe plukker opp page-attributtet på button i Pagination... + // TODO: Templates + + /* for (const url of urls) { test(`Check page ${url}`, async ({ page }) => { await page.goto(`http://localhost:3000${url}`); await page.waitForLoadState("domcontentloaded"); - const accessibilityScanResults = await new AxeBuilder({ page }) + const a11yScanResults = await new AxeBuilder({ page }) .disableRules(["definition-list", "scrollable-region-focusable"]) .exclude("iframe") .exclude("#aksel-expansioncard") @@ -15,9 +42,9 @@ test.describe("Axe a11y", () => { .exclude("#toc-scroll") .exclude(".aksel-codesnippet") .analyze(); - expect(accessibilityScanResults.violations).toEqual([]); + expect(a11yScanResults.violations).toEqual([]); }); - } + } */ }); /* diff --git a/aksel.nav.no/website/pages/eksempler/pagination/sizes.tsx b/aksel.nav.no/website/pages/eksempler/pagination/sizes.tsx index 1d5aa04217..9681c37b54 100644 --- a/aksel.nav.no/website/pages/eksempler/pagination/sizes.tsx +++ b/aksel.nav.no/website/pages/eksempler/pagination/sizes.tsx @@ -12,24 +12,27 @@ const Example = () => { count={9} boundaryCount={1} siblingCount={1} + aria-label="Paginering medium" /> ); diff --git a/aksel.nav.no/website/playwright.config.ts b/aksel.nav.no/website/playwright.config.ts index 343f005f1e..0450a39da0 100644 --- a/aksel.nav.no/website/playwright.config.ts +++ b/aksel.nav.no/website/playwright.config.ts @@ -2,7 +2,7 @@ import type { PlaywrightTestConfig } from "@playwright/test"; import { devices } from "@playwright/test"; import path from "path"; -const smoketestMatcher = /smoketest(-\w+)?\.test\.ts/; +//const smoketestMatcher = /smoketest(-\w+)?\.test\.ts/; /** * See https://playwright.dev/docs/test-configuration. */ @@ -46,10 +46,11 @@ const config: PlaywrightTestConfig = { ...devices["Desktop Chrome"], }, ...(process.env.FULL_TEST - ? { testMatch: [/.*\.e2e\.(ts|tsx)/] } - : { testMatch: [smoketestMatcher, /search.e2e.ts/] }), + ? { testMatch: [/axe\.e2e\.(ts|tsx)/] } + : { testMatch: [/axe.e2e.ts/] }), }, - { + // TODO: Revert all changes to this file + /* { name: "Safari", use: { ...devices["Desktop Safari"], @@ -62,7 +63,7 @@ const config: PlaywrightTestConfig = { ...devices["iPhone 12"], }, testMatch: [smoketestMatcher], - }, + }, */ /* { name: "firefox",