diff --git a/.github/workflows/ci-frontend-a11y.yml b/.github/workflows/ci-frontend-a11y.yml index 7bfe2d058..8930c324f 100644 --- a/.github/workflows/ci-frontend-a11y.yml +++ b/.github/workflows/ci-frontend-a11y.yml @@ -51,9 +51,10 @@ jobs: - name: Run pa11y-ci run: | set -e # Ensure the script fails if any command fails - npm run test:pa11y + npm run test:pa11y-desktop + npm run test:pa11y-mobile echo "pa11y-ci tests finished." - + - name: Upload screenshots to artifacts if: always() uses: actions/upload-artifact@v3 diff --git a/frontend/.pa11yci-desktop.json b/frontend/.pa11yci-desktop.json new file mode 100644 index 000000000..2f477b7bc --- /dev/null +++ b/frontend/.pa11yci-desktop.json @@ -0,0 +1,16 @@ +{ + "defaults": { + "timeout": 240000, + "runners": ["axe"], + "ignore": ["color-contrast"], + "concurrency": 1, + "chromeLaunchConfig": { + "ignoreHTTPSErrors": true, + "args": ["--disable-dev-shm-usage", "--no-sandbox"] + }, + "actions": [ + "wait for element #main-content to be visible", + "screen capture screenshots-output/desktop-main-view.png" + ] + } +} diff --git a/frontend/.pa11yci-mobile.json b/frontend/.pa11yci-mobile.json new file mode 100644 index 000000000..36e8032fa --- /dev/null +++ b/frontend/.pa11yci-mobile.json @@ -0,0 +1,23 @@ +{ + "defaults": { + "timeout": 240000, + "runners": ["axe"], + "ignore": ["color-contrast"], + "concurrency": 1, + "chromeLaunchConfig": { + "ignoreHTTPSErrors": true, + "args": ["--disable-dev-shm-usage", "--no-sandbox"] + }, + "viewport": { + "width": 390, + "height": 844, + "mobile": true + }, + "actions": [ + "wait for element #main-content to be visible", + "screen capture screenshots-output/mobile-main-view.png", + "click element .usa-navbar button", + "screen capture screenshots-output/mobile-expand-menu.png" + ] + } +} diff --git a/frontend/.pa11yci.json b/frontend/.pa11yci.json deleted file mode 100644 index 24a1e1769..000000000 --- a/frontend/.pa11yci.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "defaults": { - "timeout": 240000, - "runners": ["axe"], - "ignore": ["color-contrast"], - "concurrency": 1, - "chromeLaunchConfig": { - "ignoreHTTPSErrors": true, - "args": ["--disable-dev-shm-usage", "--no-sandbox"] - } - }, - "urls": [ - { - "url": "http://localhost:3000", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/mobile-main-view.png", - "click element .usa-navbar button", - "screen capture screenshots-output/mobile-expand-menu.png" - ] - }, - { - "url": "http://localhost:3000", - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/desktop-main-view-home.png" - ] - }, - { - "url": "http://localhost:3000/search?status=forecasted,posted", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/mobile-main-view-search.png", - "click element .usa-navbar button", - "screen capture screenshots-output/mobile-expand-menu-search.png" - ] - }, - { - "url": "http://localhost:3000/search?status=forecasted,posted", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/desktop-main-view-search.png" - ] - }, - { - "url": "http://localhost:3000/process", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/mobile-main-view-process.png", - "click element .usa-navbar button", - "screen capture screenshots-output/mobile-expand-menu-process.png" - ] - }, - { - "url": "http://localhost:3000/process", - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/desktop-main-view-process.png" - ] - }, - { - "url": "http://localhost:3000/research", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/mobile-main-view-research.png", - "click element .usa-navbar button", - "screen capture screenshots-output/mobile-expand-menu-research.png" - ] - }, - { - "url": "http://localhost:3000/research", - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/desktop-main-view-research.png" - ] - }, - { - "url": "http://localhost:3000/newsletter", - "viewport": { "width": 320, "height": 480 }, - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/mobile-main-view-newsletter.png", - "click element .usa-navbar button", - "screen capture screenshots-output/mobile-expand-menu-newsletter.png" - ] - }, - { - "url": "http://localhost:3000/newsletter", - "actions": [ - "wait for element #main-content to be visible", - "screen capture screenshots-output/desktop-main-view-newsletter.png" - ] - } - ] -} diff --git a/frontend/package.json b/frontend/package.json index c90957005..36040149d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -17,7 +17,8 @@ "storybook": "storybook dev -p 6006", "storybook-build": "storybook build", "test": "jest --ci --coverage", - "test:pa11y": "pa11y-ci --config .pa11yci.json", + "test:pa11y-desktop": "pa11y-ci --config .pa11yci-desktop.json --sitemap http://localhost:3000/sitemap.xml", + "test:pa11y-mobile": "pa11y-ci --config .pa11yci-mobile.json --sitemap http://localhost:3000/sitemap.xml", "test-update": "jest --update-snapshot", "test-watch": "jest --watch", "test:e2e": "npx playwright test --config ./tests/playwright.config.ts", diff --git a/frontend/src/app/[locale]/health/page.tsx b/frontend/src/app/[locale]/health/page.tsx index 1c4e40ea2..8b1e282e1 100644 --- a/frontend/src/app/[locale]/health/page.tsx +++ b/frontend/src/app/[locale]/health/page.tsx @@ -1,3 +1,10 @@ export default function Health() { - return <>healthy>; + return ( + <> +
+