diff --git a/.github/workflows/browser-test.yml b/.github/workflows/browser-test.yml index 24717f28ae..76c7545c1b 100644 --- a/.github/workflows/browser-test.yml +++ b/.github/workflows/browser-test.yml @@ -17,7 +17,7 @@ concurrency: jobs: browser-tests: - timeout-minutes: 30 + timeout-minutes: 120 runs-on: ubuntu-latest # This Chrome nightly image can no longer install browsers in Github CI for # lack of some system dependencies: @@ -33,8 +33,6 @@ jobs: # env: # HOME: /root # Firefox complains otherwise steps: - - name: Put unstable chrome where playwright would look for it - run: mv /opt/google/chrome /opt/google/chrome-unstable - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -50,9 +48,51 @@ jobs: - name: Install browser test dependencies working-directory: browser-test run: npm ci --ignore-scripts + # Cache Playwright's browser binaries between runs. The cache key + # is keyed on `browser-test/package-lock.json`, which moves when + # the resolved `@playwright/test` version changes, so a Playwright + # version bump invalidates the cache on the commit that lands it. + # + # The install step below runs unconditionally rather than guarded + # by `cache-hit`: `--with-deps` also installs apt system packages, + # which the cache does not cover, and the browser-binary download + # itself is a no-op on cache hit. Keeping the step unconditional + # avoids a second always-run apt step and keeps the workflow + # readable. + - name: Cache Playwright browsers + id: playwright-cache + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ hashFiles('browser-test/package-lock.json') }} + restore-keys: | + playwright-${{ runner.os }}- + # Wrap the install in a retry: the recurring failure mode is a + # timeout downloading Chromium from the Playwright CDN shortly + # after a Chromium version bump, before the CDN has seeded the + # new binary widely. Three attempts with a 30-minute per-attempt + # ceiling: the observed failure mode is an attempt still making + # progress (slow CDN download or apt step) when the prior + # 15-minute ceiling killed it mid-progress and the retry started + # from scratch. The bump to 30 minutes gives one attempt enough + # headroom to complete; the 3-attempt safety net is retained for + # genuine transient failures. Worst case 3 x 30 = 90 minutes fits + # inside the job's 120-minute `timeout-minutes`, leaving headroom + # for setup, build, and the tests themselves. The bumped ceiling + # is provisional: once a real install time is observed, both the + # per-attempt and outer ceilings should come back down. - name: Install Playwright Browsers - working-directory: browser-test - run: npx playwright install --with-deps + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + env: + # Surface the hanging step in the install path. The Chrome-for- + # Testing migration in Playwright >= 1.50 introduced a silent + # post-download hang on this CI; pw:install logs the probe and + # extract steps so the next run shows where the time is going. + DEBUG: pw:install + with: + timeout_minutes: 30 + max_attempts: 3 + command: cd browser-test && npx playwright install --with-deps - name: Run Playwright tests working-directory: browser-test run: npx playwright test diff --git a/browser-test/package-lock.json b/browser-test/package-lock.json index 0e0fb29c54..4b6393802c 100644 --- a/browser-test/package-lock.json +++ b/browser-test/package-lock.json @@ -8,18 +8,18 @@ "name": "browser-test", "license": "Apache-2.0", "devDependencies": { - "@playwright/test": "^1.49.1", + "@playwright/test": "1.58.2", "@types/node": "^20.11.16" } }, "node_modules/@playwright/test": { - "version": "1.49.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", - "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.58.2.tgz", + "integrity": "sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.49.1" + "playwright": "1.58.2" }, "bin": { "playwright": "cli.js" @@ -53,13 +53,13 @@ } }, "node_modules/playwright": { - "version": "1.49.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", - "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.58.2.tgz", + "integrity": "sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.49.1" + "playwright-core": "1.58.2" }, "bin": { "playwright": "cli.js" @@ -72,9 +72,9 @@ } }, "node_modules/playwright-core": { - "version": "1.49.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", - "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.58.2.tgz", + "integrity": "sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/browser-test/package.json b/browser-test/package.json index acecdfe6a5..379af8d679 100644 --- a/browser-test/package.json +++ b/browser-test/package.json @@ -7,7 +7,7 @@ "test": "playwright test" }, "devDependencies": { - "@playwright/test": "^1.49.1", + "@playwright/test": "1.58.2", "@types/node": "^20.11.16" }, "eslintConfig": {