diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index b86002f3e2..4b6e1a805f 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -21,11 +21,22 @@ jobs: playwright-tests: timeout-minutes: 60 runs-on: ubuntu-latest + # Ships the browsers and the system libraries they need, which is the + # `playwright install --with-deps` step this job used to run. The tag + # has to match the `playwright-core` version resolved by the lockfile, + # or Playwright downloads a second set of browsers at runtime. + container: + image: mcr.microsoft.com/playwright:v1.62.1-noble + env: + # The steps run as root while the runner's own /github/home belongs + # to the image's pwuser, and Firefox refuses to launch when $HOME is + # owned by somebody else + HOME: /root strategy: fail-fast: false matrix: - shardIndex: [1, 2] - shardTotal: [2] + shardIndex: [1, 2, 3, 4] + shardTotal: [4] outputs: node-version: ${{ steps.versions.outputs.node-version }} package-manager-version: ${{ steps.versions.outputs.package-manager-version }} @@ -50,9 +61,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Install Playwright browsers - run: npx playwright install --with-deps - - name: Run Playwright tests run: npm run test:component -- --shard='${{ matrix.shardIndex }}/${{ matrix.shardTotal }}' diff --git a/playwright.config.ts b/playwright.config.ts index c8c0253707..112ff17e6d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -44,8 +44,11 @@ export default defineConfig({ forbidOnly: !!process.env.CI, /* Retry on CI only */ retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : undefined, + /* Two of the runner's four cores on CI, which is where the suite stops + scaling: measured over the whole suite, one worker takes 6m19, two + take 4m49 and four take 4m22, and four workers is also where a + second test starts flaking. */ + workers: process.env.CI ? 2 : undefined, // On CI we are using the github annotations + blob which will be merged by workflow to a downloadable HTML report (like the one we receive locally) reporter: process.env.CI ? 'blob' : 'html',