This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
forked from HHS/simpler-grants-gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,771 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: pa11y tests | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- frontend/** | ||
- .github/workflows/ci-frontend-a11y.yml | ||
|
||
defaults: | ||
run: | ||
working-directory: ./frontend | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
LOCKFILE_PATH: ./frontend/package-lock.json | ||
PACKAGE_MANAGER: npm | ||
|
||
jobs: | ||
build: | ||
name: Building site and running pa11y-ci tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | ||
cache: ${{ env.PACKAGE_MANAGER }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Create screenshots directory | ||
run: mkdir -p screenshots-output | ||
|
||
- name: Start server | ||
run: npm run start & | ||
|
||
- name: Wait for server to be ready | ||
run: npx wait-on http://localhost:3000 | ||
|
||
- name: Run pa11y-ci | ||
run: npm run test:pa11y 2>&1 | tee pa11y_output.txt | ||
|
||
- name: Read pa11y_output file | ||
id: pa11y_output | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./pa11y_output.txt | ||
|
||
- name: Comment on pull request | ||
uses: thollander/actions-comment-pull-request@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
message: | | ||
<details><summary>Pa11y testing results</summary> | ||
``` | ||
${{ steps.pa11y_output.outputs.content }} | ||
``` | ||
</details> | ||
- name: Check for pa11y failures | ||
if: contains(steps.pa11y_output.outputs.content, 'errno 2') | ||
run: | | ||
echo "::error::The site is failing accessibility tests. Please review the comment in the pull request or the pa11y-ci step in the workflow for details." | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,6 @@ npm-debug.log* | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
# pa11y | ||
screenshots-output/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"standard": "WCAG2AAA", | ||
"level": "error", | ||
"defaults": { | ||
"timeout": 20000, | ||
"wait": 2000, | ||
"ignore": [] | ||
}, | ||
"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://pa11y.org", | ||
"viewport": { "width": 1280, "height": 1024 }, | ||
"actions": [ | ||
"wait for element .site-brand to be visible", | ||
"screen capture screenshots-output/desktop-main-view.png" | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.