forked from mozilla/bedrock
-
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.
Add accessibility test job running against home page (mozilla#14773)
- Loading branch information
1 parent
c381337
commit d0824f4
Showing
13 changed files
with
577 additions
and
4 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,74 @@ | ||
# Workflow that runs accessibility tests once per day against dev infra. | ||
|
||
name: Accessibility Tests | ||
run-name: Accessibility Tests for ${{ github.sha }} | ||
env: | ||
SLACK_CHANNEL_ID: CBX0KH5GA # #www-notify in MoCo Slack | ||
SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN_FOR_MEAO_NOTIFICATIONS_APP}} | ||
on: | ||
schedule: | ||
- cron: "0 15 * * *" # 3pm daily | ||
workflow_dispatch: | ||
inputs: | ||
mozorg_service_hostname: | ||
description: The root URL to run tests against. eg "https://www.mozilla.org/" | ||
required: true | ||
|
||
jobs: | ||
notify-of-test-run-start: | ||
if: github.repository == 'mozilla/bedrock' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Notify via Slack that tests are starting | ||
uses: ./.github/actions/slack | ||
with: | ||
env_name: test | ||
label: "Accessibility Tests [${{ github.sha }}]" | ||
status: info | ||
channel_id: ${{ env.SLACK_CHANNEL_ID }} | ||
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | ||
ref: ${{ github.sha }} | ||
message: "Accessibility Tests started" | ||
|
||
accessibility-tests: | ||
runs-on: ubuntu-latest | ||
needs: notify-of-test-run-start | ||
env: | ||
PLAYWRIGHT_BASE_URL: ${{ github.event.inputs.mozorg_service_hostname || 'https://dev.bedrock.nonprod.webservices.mozgcp.net' }} | ||
CI: true | ||
CI_JOB_ID: ${{ github.run_id }} | ||
DRIVER: "" | ||
LABEL: accessibility-tests | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: cd tests/playwright && npm ci && npm run install-deps | ||
- name: Run accessibility tests | ||
run: npm run a11y-tests | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: a11y-report-${{ github.sha }} | ||
path: a11y-report/ | ||
retention-days: 30 | ||
|
||
notify-of-test-run-completion: | ||
if: github.repository == 'mozilla/bedrock' && always() | ||
runs-on: ubuntu-latest | ||
needs: [notify-of-test-run-start, accessibility-tests] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Notify via Slack of test-run outcome | ||
uses: ./.github/actions/slack | ||
with: | ||
env_name: test | ||
label: "Accessibility tests [${{ github.sha }}]" | ||
status: ${{ needs.accessibility-tests.result }} | ||
channel_id: ${{ env.SLACK_CHANNEL_ID }} | ||
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | ||
ref: ${{ github.sha }} | ||
message: "Accessibility tests completed. Status: ${{ needs.accessibility-tests.result }}" |
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
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,31 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
|
||
/** | ||
* Clean up /a11y-report/ directory before running tests. | ||
*/ | ||
function cleanA11yReportDir() { | ||
const dir = 'a11y-report/'; | ||
if (fs.existsSync(dir)) { | ||
fs.rmdirSync(dir, { | ||
recursive: true | ||
}); | ||
} | ||
|
||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir); | ||
} | ||
} | ||
|
||
function globalSetup() { | ||
cleanA11yReportDir(); | ||
} | ||
|
||
module.exports = globalSetup; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.