|
| 1 | +name: Screen reader tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + paths: |
| 5 | + - 'gulpfile.mjs' |
| 6 | + - 'src/**' |
| 7 | + - 'test/test.mjs' |
| 8 | + - 'test/integration/test_utils.mjs' |
| 9 | + - 'test/screenreader/**' |
| 10 | + - 'web/**' |
| 11 | + - '.github/workflows/screenreader_tests.yml' |
| 12 | + branches: |
| 13 | + - master |
| 14 | + pull_request: |
| 15 | + paths: |
| 16 | + - 'gulpfile.mjs' |
| 17 | + - 'src/**' |
| 18 | + - 'test/test.mjs' |
| 19 | + - 'test/integration/test_utils.mjs' |
| 20 | + - 'test/screenreader/**' |
| 21 | + - 'web/**' |
| 22 | + - '.github/workflows/screenreader_tests.yml' |
| 23 | + branches: |
| 24 | + - master |
| 25 | + workflow_dispatch: |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + test: |
| 31 | + name: ${{ matrix.os }} / ${{ matrix.browser }} |
| 32 | + |
| 33 | + # Real screen-reader automation only works on Windows (NVDA) and macOS |
| 34 | + # (VoiceOver), so Linux is intentionally absent from the matrix. |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + node-version: [lts/*] |
| 39 | + os: [windows-latest, macos-latest] |
| 40 | + browser: [firefox, chrome] |
| 41 | + include: |
| 42 | + - browser: firefox |
| 43 | + skip: --noChrome |
| 44 | + - browser: chrome |
| 45 | + skip: --noFirefox |
| 46 | + |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Checkout repository |
| 51 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + persist-credentials: false |
| 55 | + |
| 56 | + - name: Use Node.js ${{ matrix.node-version }} |
| 57 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 58 | + with: |
| 59 | + node-version: ${{ matrix.node-version }} |
| 60 | + cache: 'npm' |
| 61 | + |
| 62 | + - name: Install dependencies |
| 63 | + run: npm ci |
| 64 | + |
| 65 | + # Installs the portable NVDA build (Windows) or grants the |
| 66 | + # accessibility / Apple Events permissions VoiceOver needs (macOS) |
| 67 | + # so guidepup can drive the screen reader. Inlined as an `npx` call |
| 68 | + # rather than `guidepup/setup-action` because Mozilla's repo-level |
| 69 | + # actions allowlist does not include the action. |
| 70 | + - name: Set up screen reader |
| 71 | + run: npx @guidepup/setup |
| 72 | + |
| 73 | + - name: Restore cached PDF files |
| 74 | + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 75 | + with: |
| 76 | + path: test/pdfs/*.pdf |
| 77 | + key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }} |
| 78 | + restore-keys: | |
| 79 | + cached-pdf-files- |
| 80 | + enableCrossOsArchive: true |
| 81 | + |
| 82 | + # Screen-reader automation cannot run headless, so a real display |
| 83 | + # resolution is configured for the headful browser windows. macOS |
| 84 | + # runners already provide one. |
| 85 | + - name: Update resolution (Windows) |
| 86 | + if: ${{ matrix.os == 'windows-latest' }} |
| 87 | + run: Set-DisplayResolution -Width 1920 -Height 1080 -Force |
| 88 | + |
| 89 | + - name: Run screen reader tests |
| 90 | + run: npx gulp screenreadertest ${{ matrix.skip }} |
| 91 | + |
| 92 | + - name: Save cached PDF files |
| 93 | + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 94 | + with: |
| 95 | + path: test/pdfs/*.pdf |
| 96 | + key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }} |
| 97 | + enableCrossOsArchive: true |
0 commit comments