Skip to content

Commit

Permalink
Split Axe test steps
Browse files Browse the repository at this point in the history
  • Loading branch information
scruti committed Aug 7, 2024
1 parent 51a2bba commit 0f2c637
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/accessibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,25 @@ jobs:
with:
skip-ruby: true

- run: npm install
- name: Run Axe accessibility tests against QA sitemap pages
- name: Install axe-core and sitemap-urls
run: npm install -g @axe-core/cli sitemap-urls

- name: Get list of URLs to test against from QA sitemap
run: |
npm install -g @axe-core/cli sitemap-urls
# Gets all urls from sitemap in an array
urls=($(curl https://$HTTP_BASIC_USER:[email protected]/sitemap.xml | sitemap-urls))
# Removes sitemap urls that are redundant
# Removes redundant sitemap urls
urls=("${urls[@]/*teaching-jobs-in-*}")
urls=("${urls[@]/*\-jobs*}")
# Delete empty elements
for i in ${!urls[@]}; do [[ -z ${urls[i]} ]] && unset urls[i]; done
# Transforms URLS to authenticated URLs
urls=("${urls[@]/qa\./$HTTP_BASIC_USER\:$HTTP_BASIC_PASSWORD\@qa\.}")
# Runs axe against each url from the sitemap
axe $(for url in "${urls[@]}"; do echo $url, ; done;) --exit
echo "URLS=$urls" >> $GITHUB_ENV
- name: Run Axe accessibility tests against QA sitemap pages
run: |
axe $(for url in "${URLS[@]}"; do echo $url, ; done;) --exit
- name: Configure AWS credentials
if: failure()
Expand Down

0 comments on commit 0f2c637

Please sign in to comment.