An open source design system that's fully customizable and agent ready
TypeScript
ci(a11y): run the release spec-test contracts on four workers (#7415)
Cindy Zhang30b6e1bb73b8
diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjsindex 25da934aab..c4e7b83df3 100644--- a/.github/scripts/release-check-workflow.test.mjs+++ b/.github/scripts/release-check-workflow.test.mjs@@ -683,6 +683,10 @@ describe('full release scope without PR metadata or maintenance writes', () => {expect(step('a11y-contracts', 'Run accessibility spec-test contracts').run,).toBe('pnpm test:a11y-contract');+ expect(+ step('a11y-contracts', 'Run accessibility spec-test contracts').env+ .A11Y_CONTRACT_WORKERS,+ ).toBe(4);expect(step('a11y-contracts', 'Run accessibility spec-test contracts')['continue-on-error'diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 00afd017d6..90e91efe1b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -1968,6 +1968,7 @@ jobs:if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check'env:ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}+ A11Y_CONTRACT_WORKERS: 4run: pnpm test:a11y-contract- name: Upload pressed-state pixel evidencediff --git a/playwright.config.ts b/playwright.config.tsindex a3d1d9ea67..97ee1eb7e9 100644--- a/playwright.config.ts+++ b/playwright.config.ts@@ -34,6 +34,22 @@ import {defineConfig, devices} from '@playwright/test';// definition, so `forbidOnly` and the reporter choice cannot disagree.const isCI = (process.env.CI ?? '') !== '';+/**+ * Worker count for the contract run: `A11Y_CONTRACT_WORKERS`, default 1 when+ * unset or empty. Only a positive integer is accepted: Playwright would treat+ * a `NaN` count as zero workers and exit green without running a test.+ */+function contractWorkers(): number {+ const raw = process.env.A11Y_CONTRACT_WORKERS;+ const workers = raw ? Number(raw) : 1;+ if (!Number.isInteger(workers) || workers < 1) {+ throw new Error(+ `A11Y_CONTRACT_WORKERS must be a positive integer, got "${raw}"`,+ );+ }+ return workers;+}+export default defineConfig({testDir: '.',testMatch: [@@ -43,9 +59,12 @@ export default defineConfig({'packages/*/src/**/*.a11y.chromium.spec.ts','packages/*/src/**/*.a11y.browser.spec.ts',],- // The contract mounts, focuses, and types into one page at a time; parallel- // workers would race over real keyboard focus.- workers: 1,+ // The contract mounts, focuses, and types into one page at a time, so a spec+ // file's tests run in order on one worker (`fullyParallel: false`). Workers+ // are separate processes, each with its own browser, so they share no+ // keyboard focus: more than one only spreads whole files across them. One+ // by default; the release job sets A11Y_CONTRACT_WORKERS.+ workers: contractWorkers(),fullyParallel: false,forbidOnly: isCI,reporter: isCI ? [['list'], ['github']] : [['list']],