r/Playwright • u/meseser • 7d ago
Check API/steps performance regression - Playwright
Hi all,
QA engineer here. Our e2e/api suites hit the backend thousands of times a day, but nobody looked at how long those requests took. A slow endpoint only got noticed once users complained. So I built playwright-performance-regression (MIT, free).
What it does:
- Measures the backend requests your browser makes (and `request` calls in API tests) while your existing tests run. No new tests to write.
- Groups them into endpoint keys like `GET /api/orders/:id` and computes median, p95, p99 and error rate. It can also time your `test.step` blocks.
- Derives thresholds into JSON files that you review and commit like code.
- Fails the run when an endpoint gets slower or starts erroring, with a console summary, a self-contained HTML report and `junit.xml` for CI.
Zero maintenance, by design:
- Setup takes minutes: one command, a guided setup, done. No new tests, no page objects, no instrumentation.
- Coverage grows on its own: every new e2e test that hits a new endpoint gets measured automatically. The more you test, the more performance coverage you get, with zero extra work.
- Your normal `npx playwright test` runs stay untouched. Measuring is a separate run you switch on with an env variable: `PW_PERF_MODE=test npm run e2e`.
Setup:
npm init playwright-performance-regressionA guided setup asks a few questions and shows a diff of every change before writing it. It never touches `package.json`. Then you generate thresholds once on CI, commit them, and forget about it.
Statistics:
Timings are noisy, so the run repeats your suite a few times (passes) and the thresholds are derived from those samples. I validated this on a benchmark before building the tool. CI recipes are included for GitHub Actions, GitLab, Jenkins and Azure.
- Live demo report: https://meser6.github.io/playwright-performance-regression/
- GitHub: https://github.com/Meser6/playwright-performance-regression
It's 1.0.0, so I'd really appreciate feedback: does it work on your setup, what's confusing, what's missing?

2
u/Status_Ad8999 7d ago
Grouping dynamic URLs into route templates like
GET /api/orders/:idautomatically is the trickiest part of passive network timing. How are you handling numeric vs UUID/ULID path segments so high-cardinality IDs do not explode the baseline JSON file? Also worth separating cold first-hit calls after container spin-up in CI from warm samples, since the first request often skews p95 on small sample counts.2
u/Alternative-Ruin275 5d ago
One more baseline check I'd want: do you report latency for successful responses separately from failed responses? If an endpoint starts returning fast 401s or 500s, its aggregate median can improve while the application gets worse. The error-rate gate helps, but showing both distributions would make that failure easier to understand. I'd also put sample count, worker count and the measured endpoint mix beside each comparison. Repeating a suite after a fixture or concurrency change isn't necessarily the same workload. A tiny example report with a fast-failure regression would make it easier to assess how the latency and error gates interact.
1
u/Xiao20 7d ago
It's interesting that Claude chose a very similar UI design to a Triathlon app I had it build.