Skip to content

Migrate UI integration tests from Puppeteer to Playwright - #9735

Merged
gmierz merged 5 commits into
masterfrom
playwright-migration
Aug 19, 2026
Merged

Migrate UI integration tests from Puppeteer to Playwright#9735
gmierz merged 5 commits into
masterfrom
playwright-migration

Conversation

@camd

@camd camd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces the jest-puppeteer + Polly.js integration test setup with Playwright (@playwright/test), and adds new integration coverage for the Jobs view.

Migration

  • playwright.config.js: new root config. Runs specs in tests/ui/integration/**/*.spec.js in Firefox (the preferred browser for this project) and starts BROWSER=none pnpm start on port 5000 automatically (or reuses an already-running dev server), matching the previous jest-puppeteer behavior. pnpm test:integration now runs playwright test.
  • Logviewer suitelogviewer.spec.js: keeps the fetch-mocking approach (page.addInitScript replaces evaluateOnNewDocument), converted to locators and web-first assertions. Selectors/labels updated to the current toolbar UI (.classic-log-toolbar-label replaced the old copy-highlight bar, which the old suite still referenced).
  • Graphs view suitegraphs_view.spec.js: Polly is dropped entirely. The existing Polly recordings are already HAR files, so they are replayed directly with page.routeFromHAR; unmatched requests fall through to the dev-server proxy (equivalent to Polly's recordIfMissing passthrough). The performance/summary responses are served by signature param through a custom route because the app added a replicates query param after the recordings were captured, so exact-URL HAR matching can no longer hit them.
  • Removed: puppeteer, jest-puppeteer, jest-environment-puppeteer, all @pollyjs/* packages, setup-polly-jest, jest.integration.config.js, jest-puppeteer.config.js, and the integration test-setup.js. Also updated docs/testing.md, biome.json (removed the puppeteer globals), and .gitignore (Playwright artifacts).

New Jobs view tests

tests/ui/integration/job-view/jobs_view.spec.js covers the basic Jobs view workflows end to end:

  • rendering the push list with job buttons
  • selecting a job: selected-job styling, selectedTaskRun URL param, and the details panel opening with the job's details
  • narrowing the displayed jobs with the quick filter (searchStr URL param)

API responses are served via page.route from the same JSON fixtures the Jest unit tests use (tests/ui/mock/), so the tests are deterministic and backend-independent.

Firefox notes

Granting clipboard permissions is a Chromium-only Playwright API and throws on Firefox, so the logviewer copy test only grants them when running in Chromium; Playwright's Firefox (a Playwright custom, patched version of Firefox) permits the clipboard write in tests without an explicit grant.

By this, I mean: Copy / Paste won't work for Playwright with the "normal" headless Firefox. But Playwright has their own "patched" version that makes it work. So it's seamless, and a non-issue. Just calling out the distinction.

Test plan

  • pnpm test:integration — 19 tests pass (~5s)
  • pnpm test — 1034 unit tests pass
  • pnpm lint / pnpm markdownlint — clean (no new diagnostics)

Running locally

pnpm install
npx playwright install firefox  # one-time browser download
pnpm test:integration

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.57%. Comparing base (a0c7d98) to head (c7cc2a8).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #9735    +/-   ##
========================================
  Coverage   83.57%   83.57%            
========================================
  Files         640      640            
  Lines       38698    38698            
  Branches     3421     3493    +72     
========================================
  Hits        32342    32342            
+ Misses       6209     5966   -243     
- Partials      147      390   +243     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@camd camd self-assigned this Jul 31, 2026
@camd
camd requested a review from gmierz July 31, 2026 17:10
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for treeherder ready!

Name Link
🔨 Latest commit c7cc2a8
🔍 Latest deploy log https://app.netlify.com/projects/treeherder/deploys/6a8469bfc30c6300082da3c2
😎 Deploy Preview https://deploy-preview-9735--treeherder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@camd
camd marked this pull request as ready for review July 31, 2026 17:20
@camd camd added the front-end label Jul 31, 2026
@camd
camd force-pushed the playwright-migration branch from 97eaf06 to 1024bc4 Compare July 31, 2026 17:51
Comment thread docs/testing.md
### Running the Playwright integration tests

Integration tests are useful when testing higher level components that would be hard to set up with fetch mock.
They are run with [Playwright] (see `playwright.config.js`) in Firefox, which starts the dev server

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a small note somewhere in these docs to specify that the firefox being used is a custom built one from playwright?

@camd
camd force-pushed the playwright-migration branch 2 times, most recently from 332fea9 to 8721dda Compare August 12, 2026 16:22
@camd
camd force-pushed the playwright-migration branch from 8721dda to bc83686 Compare August 16, 2026 03:29
camd and others added 5 commits August 18, 2026 07:12
Replace the jest-puppeteer + Polly.js integration test setup with
@playwright/test:

- Add playwright.config.js; the config starts (or reuses) the dev server
  on port 5000, matching the previous jest-puppeteer behavior.
- Convert the logviewer suite to a Playwright spec, keeping the
  fetch-mocking approach via page.addInitScript. Selectors and labels
  are updated to the current toolbar UI (classic-log-toolbar-label
  replaced the old copy-highlight bar).
- Convert the graphs view suite to a Playwright spec. The existing
  Polly HAR recordings are replayed with page.routeFromHAR; the
  performance/summary responses are served by signature because the
  query params have changed since the HAR was recorded.
- Remove puppeteer, jest-puppeteer, jest-environment-puppeteer, the
  @pollyjs packages and setup-polly-jest, along with
  jest.integration.config.js and jest-puppeteer.config.js.
- Update docs/testing.md and biome.json accordingly.
Cover the basic Jobs view workflows end to end: rendering the push
list, selecting a job and verifying the details panel opens with the
job's details and the selectedTaskRun URL param, and narrowing the
displayed jobs with the quick filter.

API responses are served from the JSON fixtures in tests/ui/mock/ via
page.route, so the tests run deterministically without a backend.
Firefox is the preferred browser for this project. Switch the Playwright
project from Chromium to Firefox and update docs/testing.md accordingly.

Granting clipboard permissions is a Chromium-only API that throws on
Firefox, so the logviewer copy test now only grants them when running
in Chromium; Playwright's Firefox permits the clipboard write in tests
without an explicit grant.
The rebase onto origin/master conflicted in pnpm-lock.yaml. Took the
target branch's version as a starting point and regenerated the
lockfile with `pnpm install --no-frozen-lockfile` to ensure it is
consistent with package.json (playwright/puppeteer/polly changes from
this branch plus master's zustand 5.0.15 bump).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a javascript-integration-tests job that installs and caches the
Playwright Firefox build, runs pnpm test:integration (Playwright's
webServer starts the dev server itself), and uploads the JUnit results
plus the HTML report/traces as artifacts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@camd
camd force-pushed the playwright-migration branch from bc83686 to c7cc2a8 Compare August 18, 2026 14:18

@gmierz gmierz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ thanks for making this change!

@gmierz
gmierz merged commit bf67753 into master Aug 19, 2026
13 checks passed
@gmierz
gmierz deleted the playwright-migration branch August 19, 2026 12:48
gopar pushed a commit to gopar/treeherder that referenced this pull request Aug 24, 2026
* Migrate UI integration tests from Puppeteer to Playwright

Replace the jest-puppeteer + Polly.js integration test setup with
@playwright/test:

- Add playwright.config.js; the config starts (or reuses) the dev server
  on port 5000, matching the previous jest-puppeteer behavior.
- Convert the logviewer suite to a Playwright spec, keeping the
  fetch-mocking approach via page.addInitScript. Selectors and labels
  are updated to the current toolbar UI (classic-log-toolbar-label
  replaced the old copy-highlight bar).
- Convert the graphs view suite to a Playwright spec. The existing
  Polly HAR recordings are replayed with page.routeFromHAR; the
  performance/summary responses are served by signature because the
  query params have changed since the HAR was recorded.
- Remove puppeteer, jest-puppeteer, jest-environment-puppeteer, the
  @pollyjs packages and setup-polly-jest, along with
  jest.integration.config.js and jest-puppeteer.config.js.
- Update docs/testing.md and biome.json accordingly.

* Add Playwright integration tests for the Jobs view

Cover the basic Jobs view workflows end to end: rendering the push
list, selecting a job and verifying the details panel opens with the
job's details and the selectedTaskRun URL param, and narrowing the
displayed jobs with the quick filter.

API responses are served from the JSON fixtures in tests/ui/mock/ via
page.route, so the tests run deterministically without a backend.

* Run Playwright integration tests in Firefox by default

Firefox is the preferred browser for this project. Switch the Playwright
project from Chromium to Firefox and update docs/testing.md accordingly.

Granting clipboard permissions is a Chromium-only API that throws on
Firefox, so the logviewer copy test now only grants them when running
in Chromium; Playwright's Firefox permits the clipboard write in tests
without an explicit grant.

* fix: regenerate pnpm-lock.yaml after rebase conflict resolution

The rebase onto origin/master conflicted in pnpm-lock.yaml. Took the
target branch's version as a starting point and regenerated the
lockfile with `pnpm install --no-frozen-lockfile` to ensure it is
consistent with package.json (playwright/puppeteer/polly changes from
this branch plus master's zustand 5.0.15 bump).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Run Playwright integration tests in CircleCI

Adds a javascript-integration-tests job that installs and caches the
Playwright Firefox build, runs pnpm test:integration (Playwright's
webServer starts the dev server itself), and uploads the JUnit results
plus the HTML report/traces as artifacts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants