Skip to content

Commit

Permalink
Limit a11y tests in pipeline
Browse files Browse the repository at this point in the history
Similar to e2e tests, execute a11y tests in pipeline only on a single browser (chromium) to reduce time to production.
  • Loading branch information
mpanne committed Jan 21, 2025
1 parent e120213 commit 66cea48
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/check-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ on:
type: boolean
description: "Whether to run integration tests (E2E and A11y). Default is true."
default: true
ciE2eTestsOnly:
ciTestsOnly:
required: false
type: boolean
description: "If enabled e2e tests only ci tests are executed (e.g. testing only on a single browser)."
description: "If enabled only ci tests are executed (e.g. testing e2e and a11y only on a single browser)."
default: false

env:
Expand Down Expand Up @@ -74,12 +74,12 @@ jobs:
run: npx --yes playwright install --with-deps

- name: Run CI E2E tests
if: inputs.shouldRunIntegrationTests && inputs.ciE2eTestsOnly
if: inputs.shouldRunIntegrationTests && inputs.ciTestsOnly
id: e2e
run: npm run test:e2e-ci --workspace ${{ env.WORKSPACE }}

- name: Run E2E tests
if: inputs.shouldRunIntegrationTests && !inputs.ciE2eTestsOnly
if: inputs.shouldRunIntegrationTests && !inputs.ciTestsOnly
id: e2e-ci
run: npm run test:e2e --workspace ${{ env.WORKSPACE }}

Expand All @@ -89,8 +89,13 @@ jobs:
name: playwright-e2e-test-results
path: packages/${{ inputs.package }}/tests/playwright/playwright-report

- name: Run CI A11Y tests
if: inputs.shouldRunIntegrationTests && inputs.ciTestsOnly
id: a11y-ci
run: npm run test:a11y-ci --workspace ${{ env.WORKSPACE }}

- name: Run A11y tests
if: inputs.shouldRunIntegrationTests
if: inputs.shouldRunIntegrationTests && !inputs.ciTestsOnly
id: a11y
run: npm run test:a11y --workspace ${{ env.WORKSPACE }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: ./.github/workflows/check-and-test.yml
with:
package: ${{ inputs.package }}
ciE2eTestsOnly: true
ciTestsOnly: true
secrets: inherit

build-and-push-image:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"test:e2e": "npm run test:e2e --workspaces --if-present",
"test:e2e-ci": "npm run test:e2e-ci --workspaces --if-present",
"test:a11y": "npm run test:a11y --workspaces --if-present",
"test:a11y-ci": "npm run test:a11y-ci --workspaces --if-present",
"tests": "npm run tests --workspaces",
"tests-ci": "npm run tests-ci --workspaces",
"test:generate-coverage": "npm run test:generate-coverage --workspaces --if-present",
"audit:licences": "license-checker --production --excludePrivatePackages --summary",
"format:check": "prettier --check .",
Expand Down
2 changes: 2 additions & 0 deletions packages/dito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"test:e2e": "playwright test tests/e2e --config=tests/playwright.config.ts",
"test:e2e-ci": "playwright test tests/e2e --config=tests/playwright.config.ts --project chromium",
"test:a11y": "playwright test tests/a11y --config=tests/playwright.config.ts",
"test:a11y-ci": "playwright test tests/a11y --config=tests/playwright.config.ts --project chromium",
"test:snapshots": "playwright test tests/snapshots --config=tests/playwright-snapshots.config.ts",
"test:update-snapshots": "playwright test tests/snapshots --config=tests/playwright-snapshots.config.ts --update-snapshots",
"tests": "vitest run && npm run test:e2e && npm run test:a11y",
"tests-ci": "vitest run && npm run test:e2e-ci && npm run test:a11y-ci",
"test:generate-coverage": "jest --coverage",
"typecheck": "tsc"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/tool-finder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"test:e2e": "playwright test tests/playwright/e2e --config=tests/playwright/playwright.config.ts",
"test:e2e-ci": "playwright test tests/playwright/e2e --config=tests/playwright/playwright.config.ts --project chromium",
"test:a11y": "playwright test tests/playwright/a11y --config=tests/playwright/playwright.config.ts",
"test:a11y-ci": "playwright test tests/playwright/a11y --config=tests/playwright/playwright.config.ts --project chromium",
"tests": "vitest run && npm run test:e2e && npm run test:a11y",
"tests-ci": "vitest run && npm run test:e2e-ci && npm run test:a11y-ci",
"typecheck": "tsc"
},
"dependencies": {
Expand Down

0 comments on commit 66cea48

Please sign in to comment.