r/Playwright • u/meseser • 8h 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?
