-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue #677]: Add accessibility checks against pr preview env #84
Open
rylew1
wants to merge
58
commits into
main
Choose a base branch
from
rylew/677-add-pa11y-checks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,505
−1
Open
Changes from 41 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
7d9f20c
initial commit
rylew1 94b95b2
add package.json targets
rylew1 e04c891
updates to workflow file
rylew1 26c864a
move files to app dir
rylew1 9a04a14
add targest to app dir package.json
rylew1 e54ff5a
update a11y workflow file
rylew1 8763389
call a11y tests from pr env update
rylew1 39f293c
fix shellcheck
rylew1 eba0a0f
save service endpoint to file
rylew1 2d56288
attempt shell fixes
rylew1 736ba34
bash shell and quoting
rylew1 4dac90a
format
rylew1 eb86f5b
update accessibility job
rylew1 ed93fa4
double quote fix
rylew1 4102734
add debug steps
rylew1 76f9a6e
debug service endpoint url
rylew1 08ebf2e
update
rylew1 59e3613
update url
rylew1 2a0c57c
cat updated config
rylew1 70f96f1
add outputs
rylew1 6da1354
add actionlint make target
rylew1 5977ac0
add env on a11y job
rylew1 60448cb
add back in comments
rylew1 abd3dc7
get-service-endpoint
rylew1 fc53114
revert GH_TOKEN
rylew1 479a56b
rename to accessibility-scans
rylew1 844de9c
split desktop / mobile into parallel jobs
rylew1 acf36b7
share var b/w jobs
rylew1 4e14352
install in each step
rylew1 9e95374
update service_endpoint reference
rylew1 7c0e855
screenshots output
rylew1 688e5f1
switch back to npm run
rylew1 10c3bc7
add npm ci back in
rylew1 bf873a4
screenshot output folder name
rylew1 1b4df3e
remove debug step
rylew1 1327465
revert app folder package.json
rylew1 2c058d7
update ci to use accessibility folder
rylew1 8dd3a47
move config to accessibility folder
rylew1 b86493c
remove setup step
rylew1 1f66a21
fix naming
rylew1 5e4fea4
remove gitignore space change
rylew1 9f29e2c
remove extra package.json
rylew1 d3cfce7
refactor json to js
rylew1 5984d53
try update config with node call
rylew1 75f364a
resolve path correctly
rylew1 f986fad
add update-config comments
rylew1 2ed792b
add explaining comments on pa11y config files
rylew1 8a27271
add missing bracket
rylew1 e172c18
add optional app_name param
rylew1 a1cbe57
try more universally applicable actions
rylew1 2dede8d
remove wait for document to be ready
rylew1 bda839d
try env var
rylew1 d45abd0
switch to dotenv for localhost
rylew1 ecede82
DRY files with a base config
rylew1 a210e7e
add WCAG standard
rylew1 ef5eb71
start docs
rylew1 891388a
add conditional for multiple app config
rylew1 af8e2bd
fix link
rylew1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,103 @@ | ||
name: Accessibility Scans | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
service_endpoint: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
accessibility-desktop-scans: | ||
name: Run Desktop Accessibility Scans | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
SERVICE_ENDPOINT: ${{ inputs.service_endpoint }} | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache-dependency-path: ./accessibility/package-lock.json | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: ./accessibility | ||
|
||
- name: Create screenshots directory | ||
run: mkdir -p ./accessibility/screenshots-output | ||
|
||
- name: Update pa11y-ci config for desktop | ||
run: | | ||
jq ".urls = [\"${SERVICE_ENDPOINT}\"]" ./accessibility/.pa11yci-desktop.json > ./accessibility/.pa11yci-desktop-temp.json | ||
mv ./accessibility/.pa11yci-desktop-temp.json ./accessibility/.pa11yci-desktop.json | ||
|
||
- name: Cat updated pa11y-ci config for desktop | ||
run: cat ./accessibility/.pa11yci-desktop.json | ||
|
||
- name: Run pa11y-ci Desktop | ||
run: | | ||
set -e # Ensure the script fails if any command fails | ||
npm run test:pa11y-desktop | ||
echo "pa11y-ci desktop tests finished." | ||
working-directory: ./accessibility | ||
|
||
- name: Upload screenshots to artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: screenshots-desktop | ||
path: ./accessibility/screenshots-output | ||
|
||
accessibility-mobile-scans: | ||
name: Run Mobile Accessibility Scans | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
SERVICE_ENDPOINT: ${{ inputs.service_endpoint }} | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache-dependency-path: ./accessibility/package-lock.json | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: ./accessibility | ||
|
||
- name: Create screenshots directory | ||
run: mkdir -p ./accessibility/screenshots-output | ||
|
||
- name: Update pa11y-ci config for mobile | ||
run: | | ||
jq ".urls = [\"${SERVICE_ENDPOINT}\"]" ./accessibility/.pa11yci-mobile.json > ./accessibility/.pa11yci-mobile-temp.json | ||
mv ./accessibility/.pa11yci-mobile-temp.json ./accessibility/.pa11yci-mobile.json | ||
|
||
- name: Cat updated pa11y-ci config for mobile | ||
run: cat ./accessibility/.pa11yci-mobile.json | ||
|
||
- name: Run pa11y-ci Mobile | ||
run: | | ||
set -e # Ensure the script fails if any command fails | ||
npm run test:pa11y-mobile | ||
echo "pa11y-ci mobile tests finished." | ||
working-directory: ./accessibility | ||
|
||
- name: Upload screenshots to artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: screenshots-mobile | ||
path: ./accessibility/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
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 @@ | ||
node_modules/* |
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,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" | ||
] | ||
} | ||
} |
rylew1 marked this conversation as resolved.
Show resolved
Hide resolved
lorenyu marked this conversation as resolved.
Show resolved
Hide resolved
|
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,23 @@ | ||
{ | ||
"defaults": { | ||
"timeout": 240000, | ||
"runners": ["axe"], | ||
"ignore": ["color-contrast"], | ||
rylew1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"concurrency": 1, | ||
"chromeLaunchConfig": { | ||
"ignoreHTTPSErrors": true, | ||
"args": ["--disable-dev-shm-usage", "--no-sandbox"] | ||
}, | ||
"viewport": { | ||
"width": 390, | ||
"height": 844, | ||
rylew1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"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" | ||
lorenyu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at this comment on the e2e PR. I'd think that we'd want to do something similar here in order to support multiple apps and in order to be able to support running the accessibility scans outside the context of a PR environment. In other words, I think we'll want to have this workflow take an
app_name
input in addition to aservice_endpoint
input, then use that to load app-specific configurations (since different apps will have different sets of URLs).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a quick if/else statement in the workflow