Skip to content

Migrate UI integration tests from Puppeteer to Playwright - #9735

Open
camd wants to merge 3 commits into
masterfrom
playwright-migration
Open

Migrate UI integration tests from Puppeteer to Playwright#9735
camd wants to merge 3 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 permits the clipboard write in tests without an explicit grant.

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.19%. Comparing base (82f449a) to head (1024bc4).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #9735       +/-   ##
===========================================
+ Coverage   69.68%   83.19%   +13.50%     
===========================================
  Files         629      630        +1     
  Lines       37413    37445       +32     
  Branches     3296     3366       +70     
===========================================
+ Hits        26073    31154     +5081     
+ Misses      11191     5910     -5281     
- Partials      149      381      +232     

☔ 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 1024bc4
🔍 Latest deploy log https://app.netlify.com/projects/treeherder/deploys/6a6ce09f038613000731a5d5
😎 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.

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 added 3 commits July 31, 2026 10:51
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.
@camd
camd force-pushed the playwright-migration branch from 97eaf06 to 1024bc4 Compare July 31, 2026 17:51
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.

2 participants