r/Playwright • • 7h ago

In the last 3 months, did any of your browser (UI/E2E) test fail on just one browser or device? Pick the one it failed on most.

0 Upvotes

r/Playwright • • 8h ago

Check API/steps performance regression - Playwright

2 Upvotes

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-regression

A 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?


r/Playwright • • 1d ago

Running Playwright tests as production monitors, need best solution

8 Upvotes

Thinking about taking maybe 3-5 of our actually important Playwright flows and running them against prod as synthetic checks but I'm realizing a failed test and a failed monitor are VERY different problems lol.

CI test fails -> someone at it while they're already working on the build

Prod monitor fails -> somebody might get woken up at 2am

so the tolerance for bullshit has to be way lower.

Was prod actually broken?

Did the synthetic account expire?

Did auth randomly die?

Did test data get messed up?

Was it literally one weird browser run?

Kane CLI is interesting to me more as the browser-verification piece here

run the real flow, get an actual result/evidence back, then let the monitoring stack handle retries / alerts / whatever

I definitely wouldn't want the testing tool itself deciding when somebody gets paged for people doing browser synthetics in prod:

which Playwright flows actually make good monitors?

And which ones should stay safely inside regression?


r/Playwright • • 1d ago

Are you guys actually trusting GitHub Copilot or Claude Code for test automation yet?

14 Upvotes

can copilot or claude code actually be trusted for test cases yet? saw rahul shetty academy has an ai agents course for qa. whats your experience?


r/Playwright • • 1d ago

Which browsers do your automated browser (UI/E2E) tests run on today? Pick the widest that applies.

0 Upvotes

r/Playwright • • 1d ago

How do your automated browser (UI/E2E) tests cover phones today? Pick the closest to a real phone that you use.

2 Upvotes

r/Playwright • • 2d ago

Disposable Inboxes as an API for Automation & QA

2 Upvotes

One interesting way to use disposable email inboxes is in automated testing and QA for playwright.

Instead of switching to a mailbox every time your application sends a verification email, OTP, password reset link, or notification, your automation can:

  • Create a disposable inbox through an API.
  • Trigger the actual application workflow.
  • Fetch incoming emails using email APIs.
  • Extract OTPs, verification links, or relevant content.
  • Validate the response and let the automation continue.

This makes it possible to test complete, real-world user flows without manual mailbox interaction.

I've been exploring this approach while building Mail My Agents, and I think disposable inbox APIs have some interesting applications beyond temporary email.

Curious how others are handling email verification in automated QA pipelines.


r/Playwright • • 2d ago

AI UI Test Automation Project - Prototype

2 Upvotes

I built a prototype that generates and executes Playwright UI tests from plain English. Looking for feedback from experienced automation engineers. More functionality to come.

Feedback would be very much appreciated!

GitHub: https://github.com/leonard01/ai-ui-testing-agent


r/Playwright • • 3d ago

I have an Automation challenge site.

Thumbnail daw-postal-service.lovable.app
0 Upvotes

Basic: Click Update four times.

Intermediate :
Verify the address remains "1313 Mockingbird Lane" after each Update.

Advanced:
If the page does not populate, recover by refreshing the browser without an explicit line of code.

Good luck!🍀


r/Playwright • • 3d ago

AI based web automation. Not just AI wrapper or generating code for selenium or playwright.

0 Upvotes

Please don't consider this as a low quality post.

I need go save my job.

Ours is fat client GUI. Which can potentially be converted to web based.

Now selenium or playwright are the potential framework which can be used for testing.

But AI is the buzz word...left and Right client needs AI.

Now apart from generating code for selenium or playwright can someone guide me...to cover the entire execution of testcase in playwright or selenium using A but for deterministic testing I...something like browser base.

I request your guidance.


r/Playwright • • 4d ago

Heads up: Playwright 1.65 can break page objects that build locators in class fields

7 Upvotes

If you upgraded to 1.65 and got this:

TypeError: Cannot read properties of undefined (reading 'getByLabel')

check for this pattern:

readonly email = this.page.getByLabel('Email');
constructor(private readonly page: Page) {}

1.65 now follows useDefineForClassFields from your tsconfig, same as tsc. It's on by default when target is ES2022+ or not set. Class fields now run before the constructor assigns page, so this.page is undefined.

Fixes:

  1. Build the locators inside the constructor (works with any tsconfig)
  2. Use getters: get email() { return this.page.getByLabel('Email'); }
  3. Set "useDefineForClassFields": false as a temporary unblock

If it only fails in CI, check the Playwright version in the log. A ^1.64 range can pull 1.65 on a fresh install.

Release notes: https://github.com/microsoft/playwright/releases/tag/v1.65.0

Anyone hit anything else with 1.65?


r/Playwright • • 4d ago

How do you keep headed Chrome from throttling background tabs over connectOverCDP without calling bringToFront()?

2 Upvotes

We run a few Playwright tasks against an already-open headed Chrome instance via chromium.connectOverCDP while working in another tab. Because the automation tabs stay in the background, Chrome throttles their requestAnimationFrame loop and background timers. On heavier SPAs, modals and virtualized lists never finish mounting in the DOM until someone clicks the tab.

Calling page.bringToFront() unfreezes the page, except it steals window and keyboard focus every time a task runs. Passing --disable-background-timer-throttling and --disable-renderer-backgrounding works if you launch Chrome from scratch, though you cannot always restart the user's running browser just to add flags.

The cleanest workaround we found per page is opening a CDP session right after creating the background tab and sending Emulation.setFocusEmulationEnabled({ enabled: true }) followed by Page.setWebLifecycleState({ state: 'active' }).

That keeps the SPA rendering in the background while focus stays on whatever tab you are actually typing in. Has anyone run into side effects with setWebLifecycleState('active') across navigations, or found a cleaner way to keep background tabs awake over CDP?


r/Playwright • • 4d ago

Built a zero-dependency Playwright reporter focused on fast CI failure triage, local re-runs, and AI-ready error summaries

1 Upvotes

Hey everyone,

Every time a Playwright CI pipeline fails, I got tired of scrolling through hundreds of terminal log lines or downloading and unzipping the full HTML report just to see which tests broke and how to re-run them locally.

So I built a small open-source custom reporter called `playwright-summary-reporter` to run alongside the built-in HTML reporter.

To be upfront: if you want rich interactive reports or heavy charting, Playwright's HTML Report, Trace Viewer, Monocart, or Allure are much better suited for that. This reporter focuses specifically on what happens the moment CI turns red:

- **Actionable Summary in `GITHUB_STEP_SUMMARY`:** Writes pass/fail/flaky/skipped counts, pass rate, duration, per-browser breakdown (Chromium, Firefox, WebKit), flaky retries, and slowest tests with 1 line in `playwright.config.ts`.

- **1-Click Local Re-run:** Generates the exact `npx playwright test <file:line>` command for only the failed tests.

- **Error Classification:** Categorizes failures into `Runtime`, `Timeout`, `Assertion`, and `Locator`.

- **AI-Ready Debugging Prompt:** Adds a collapsible, ANSI-stripped error summary formatted for Copilot, Claude, or Cursor (no API keys or external services).

It has zero runtime dependencies (~17 KB packed) and is written in TypeScript.

Install:

`npm install -D playwright-summary-reporter`

Config:

`reporter: [['list'], ['html'], ['playwright-summary-reporter']]`

- npm: https://www.npmjs.com/package/playwright-summary-reporter

- GitHub: https://github.com/salekinnewaz/playwright-summary-reporter

Curious how others handle fast CI failure triage in Playwright — and if you were to use something like this, would sharded run merging or native Azure DevOps support be more useful next?


r/Playwright • • 5d ago

Playwright + PrimeNG Autofocus Causing fill() to Target the Wrong Field

2 Upvotes

Hello everyone,

I'm facing an issue while writing Playwright tests for an Angular application that uses PrimeNG components.

Context

I have a page containing a button that opens a modal dialog.

When the modal opens, PrimeNG automatically moves the focus from the underlying page to the first focusable element inside the modal (autofocus behavior).

In my Playwright test, I then try to fill a field like this:

await parent.getByRole('combobox', options).fill(valeur)

Problem

Sometimes, just before Playwright performs the fill(), the PrimeNG autofocus logic moves the focus to another input.

As a result, the text ends up being entered into the wrong field and the test becomes flaky.

Possible Workaround

I was considering bypassing the focus-related behavior by dispatching input events manually (e.g. using dispatchEvent or directly setting the value).

However, some of the affected fields are PrimeNG AutoComplete components. Normally, when typing into these fields, a suggestion panel appears and performs filtering/autocompletion.

My concern is that manually dispatching events could bypass part of the component's behavior and prevent the suggestions panel from appearing correctly.

If you have any idea, it would be very helpful.

Thanks a lot


r/Playwright • • 5d ago

GitHub Actions browser and device testing

5 Upvotes

Hi,

I've got a suite of Playwright tests that run against multiple browsers and mobile viewports.

playwright.config.ts:

projects: [
  {
    name: 'chromium',
    use: { ...devices['Desktop Chrome'] },
  },
  {
    name: 'firefox',
    use: { ...devices['Desktop Firefox'] },
  },
  {
    name: 'webkit',
    use: { ...devices['Desktop Safari'] },
  },

  /* Test against mobile viewports. */
  {
    name: 'Mobile Chrome',
    use: { ...devices['Pixel 5'] },
  },
  {
    name: 'Mobile Safari',
    use: { ...devices['iPhone 12'] },
  },

  /* Test against branded browsers. */
  {
    name: 'Microsoft Edge',
    use: { ...devices['Desktop Edge'], channel: 'msedge' },
  },
  {
    name: 'Google Chrome',
    use: { ...devices['Desktop Chrome'], channel: 'chrome' },
  },
],playwright.config.ts:projects: [
  {
    name: 'chromium',
    use: { ...devices['Desktop Chrome'] },
  },
  {
    name: 'firefox',
    use: { ...devices['Desktop Firefox'] },
  },
  {
    name: 'webkit',
    use: { ...devices['Desktop Safari'] },
  },

  /* Test against mobile viewports. */
  {
    name: 'Mobile Chrome',
    use: { ...devices['Pixel 5'] },
  },
  {
    name: 'Mobile Safari',
    use: { ...devices['iPhone 12'] },
  },

  /* Test against branded browsers. */
  {
    name: 'Microsoft Edge',
    use: { ...devices['Desktop Edge'], channel: 'msedge' },
  },
  {
    name: 'Google Chrome',
    use: { ...devices['Desktop Chrome'], channel: 'chrome' },
  },
],

Locally, Playwright runs the tests against all the configured browsers and device viewports.

However, in my GitHub Actions workflow, I'm using a matrix strategy to run tests across multiple browsers:

strategy:
  fail-fast: false
  matrix:
    browser: [chromium, firefox, webkit]

This currently means GitHub Actions runs the tests against Chromium, Firefox and WebKit.

My question is: What's the best approach to running the full suite against all these projects in GitHub Actions, including mobile viewports and branded browsers such as Microsoft Edge and Google Chrome?

Do I need to configure additional matrix entries for mobile devices and Edge, as I assumed this would have covered the mobile browsers etc.


r/Playwright • • 5d ago

What makes a test fail without a bug?

0 Upvotes

A test only reports that something did not happen. The cause can sit in four places that have nothing to do with your code:

  • the page was slow and the test ran out of time;
  • the host could not be reached, for example because the name did not resolve;
  • the site defended itself with a 403, a 429, a CAPTCHA or a bot challenge, so the request never reached your product;
  • the browser or the process died.

When every one of these reads as a plain red, the team files them as bugs, or learns to rerun reds instead of reading them. Either way the real defect hides in the noise.


r/Playwright • • 5d ago

How does Nexus StudioQA tell a false failure from a bug?

0 Upvotes

When a test fails, the engine reads the error message and the network log of the run and tests them against groups of patterns in a fixed order. The first group that matches decides the verdict. The order is CONFIG_ERROR, then CRASHED, BLOCKED, UNREACHABLE and TIMEOUT, and only then BREACHED_FLAKY or BREACHED. So BREACHED, the verdict that means a bug report, is left for a failure that no environment or harness pattern explains. The patterns cover both Playwright and Selenium WebDriver wording.


r/Playwright • • 5d ago

Patchright vs playwright-extra stealth + Chromium major version UA drift on Windows

2 Upvotes

Running into two interesting edge cases across local Windows Playwright setups and wanted to compare notes with folks running larger suites:

1. Mixing patchright with playwright-extra-plugin-stealth From what I've observed, patchright patches the CDP/driver layer directly (avoiding the Runtime.enable leak and automation flags), whereas playwright-extra injects runtime JS evasions on top of standard Playwright. Whenever someone tries to stack both together, the JS overrides actually re-introduce detectable hooks that patchright cleanly removes—so keeping them mutually exclusive (patchright standalone vs playwright-extra with user-agent-override and navigator.languages deleted) behaves much more predictably.

2. Bundled Chromium vs installed Chrome major-version UA mismatch On Windows dev boxes where installed Chrome is significantly ahead of Playwright's bundled Chromium (or vice versa), building a UA string dynamically from browser.version() and normalizing desktop UA to <major>.0.0.0 prevents mismatching full build numbers—and explicitly inspecting page.url() for chrome-error:// after redirects avoids mistaking a broken final hop for the initial HTTP 200 status.

For anyone maintaining multi-engine Playwright runners in production:

  • Have you settled purely on patchright / channel: 'chrome', or are you still keeping playwright-extra around for Firefox/WebKit compatibility?
  • Any cleaner way to catch redirect chains that die on a chrome-error:// hop when response.status() on the first request was 200/302?

r/Playwright • • 6d ago

How do you prevent Playwright tests from interfering with shared resources?

Thumbnail endform.dev
7 Upvotes

We kept running into cases where tests that touched the same resource would interfere with each other when run in parallel. The usual options were serial mode or reducing workers, but both slow down tests that could otherwise run safely alongside each other.

Playwright 1.63 added named test locks, which help with this. You can mark tests that share a resource with the same lock, and Playwright prevents them from running at the same time while unrelated tests keep running in parallel.

The article covers how locks work, where they help, and where they still fall short. For example, a lock allows only one test at a time, even if the resource can handle several. They also coordinate tests only within a single Playwright run, so separate CI jobs can still collide in the same staging environment or over shared test data.

Do give this a read, and any feedback is appreciated. Do you isolate test data wherever possible, use serial mode, or rely on locks?


r/Playwright • • 6d ago

How are you handling sessionStorage in storageState when sharing auth across workers?

1 Upvotes

We have a couple internal apps that keep part of their auth and tenant state in sessionStorage instead of cookies or localStorage. Since context.storageState() only dumps cookies and localStorage, spinning up parallel workers from a saved auth.json still drops us back on the org picker screen.

Right now in global setup we run page.evaluate(() => JSON.stringify(sessionStorage)), save that to a separate json file, and inject it back in a test fixture with context.addInitScript before page.goto. It works, though it feels a bit duct-taped when tests hop across two subdomains.

Has anyone found a cleaner way to persist sessionStorage across worker contexts in 1.50+, or is addInitScript still the standard workaround?


r/Playwright • • 6d ago

heads up for 1.65, if your page objects set locators as class fields they might break on upgrade

11 Upvotes

The 1.65 notes have a breaking change that I think a lot of POM setups are going to hit.

TypeScript class fields now follow useDefineForClassFields from your tsconfig, same as tsc does. It’s on for ES2022+ targets, and also when you don’t set a target at all. The catch is that field initializers now run before constructor parameter properties get assigned. So this pattern blows up with a “cannot read properties of undefined” error:

class LoginPage {
  readonly submit = this.page.getByRole('button', { name: 'Submit' });
  constructor(private readonly page: Page) {}
}

Two fixes per the notes. Move the locator assignments into the constructor, or set useDefineForClassFields to false in your tsconfig.

Couple other things worth knowing before you bump. Actions like click and fill now wait for an element to not be inert, so anything that clicks into an inert section will time out instead of going through. And they’ve stopped testing on Node 20, so 22 or newer.

Curious how many people write page objects this way. I feel like it was in half the tutorials I learned from


r/Playwright • • 6d ago

Beginner SDET here: is it a bad idea to let AI/agents write all my Playwright tests? Felt like commanding my Troop through a Letter.

17 Upvotes

Hey everyone,

I’m learning Playwright and practicing a lot to get into automation testing. AI can generate a full test file under a minute, and it usually runs fine. But I’m worried about a few things:

  • If AI writes everything, am I actually learning?
  • Passing tests don’t always mean good quality (weak assertions, only happy paths)
  • AI doesn’t know which flows are high-risk for the product

I don’t want to ignore AI either, so how do you handle it?

  1. Would you learn manual test writing first, or use AI from day one?
  2. How much of your team’s test code is AI-generated vs. hand-written?
  3. How do you review AI-written tests for weak or flaky ones?

Would love to hear from people working on real projects. Thanks! 🙏


r/Playwright • • 7d ago

I just learned Playwright can set baseURL from a dynamic webServer port

6 Upvotes

I used to configure Playwright's baseURL using a PORT env var with some default value:

const port = process.env.PORT || '3000';
const baseURL = `http://localhost:${port}`;

export default defineConfig({
  use: {
    baseURL,
  },
  webServer: {
    command: `npm run dev -- --port ${port}`,
    url: baseURL,
  },
});

This works fine until multiple instances of the app try to run tests on the same machine and get port conflict. With 5 parallel agent sessions this becomes much more likely!

I could use something like get-port-cli to find an available port before starting Playwright:

PORT=$(npx get-port) npx playwright test

But that's not a universal solution. I still need to handle launching tests from the Playwright VS Code extension and other entry points.

Today I discovered that since Playwright 1.57, there's a simpler way to handle this.

The webServer option has a wait field that can wait for specific output and capture values from it. For example, when Vite server starts on some available port, it prints:

VITE ready in 200 ms

➜  Local:   http://localhost:5174/

Playwright can extract the actual URL from that output using a regex:

export default defineConfig({
  webServer: {
    command: 'npm run dev',
    wait: {
      stdout: /Local:\s+(?<APP_URL>https?:\/\/[^\s]+)/,
    },
  },
});

The key part is (?<APP_URL>...) — a named capture group. Playwright automatically assigns the captured value to process.env.APP_URL. You can use any name you like.

The final piece is to set baseURL using a fixture function, instead of config use section, since the config is evaluated before server starts. For example:

// fixtures.ts
import { test as base, expect } from '@playwright/test';

export const test = base.extend({
  baseURL: async ({}, use) => use(process.env.APP_URL),
});

Then tests can use relative URLs as usual:

import { test } from './fixtures';

test('homepage', async ({ page }) => {
  await page.goto('/'); // -> opens http://localhost:5174/
});

No need to coordinate ports between parallel Playwright processes. Each can start its own server and use the URL that server reports.

A couple of details:

  • Don't set webServer.url alongside wait.stdout here, since either readiness condition can finish first.
  • Playwright 1.57–1.60 may need env: { NO_COLOR: '1', FORCE_COLOR: '0' } to avoid ANSI color codes interfering with regex matching. This was fixed in 1.61.

I switched all my configs to this approach.


r/Playwright • • 7d ago

Last week I asked r/Playwright whether teams allow retries in CI.

0 Upvotes

The answers split into two camps, and both had a point.

Camp 1: no retries at all.
If a sandbox is flaky you shouldn't depend on it. CI should be deterministic, anything flaky gets quarantined, and the team owns it. Fair question from that side: if a retry hid a real bug, how would you even know?

Camp 2: retry the infrastructure, not the test.
- Only retry on 502/503/504, at the request or fixture level, not the whole test
- A health-check fixture before the suite, so a cold environment fails fast with one clear message instead of 40 red tests
- Test-level retries at 0 or 1 at most
- "Passed on retry" is reported as flaky, never as green

A few habits both camps agreed on:
- Quarantine with an expiry date and a named owner. Without an expiry it's just a slow delete.
- Split new flakiness (yours, fix it now) from old flakiness (quarantine and hand it to the owner)
- Blanket retries double CI time on real failures and hide framework problems too

One thing that surprised people: the default Playwright config only turns retries on in CI (`retries: process.env.CI ? 2 : 0`). So a test can fail 1 run in 3 locally and look green in CI forever.

Which camp is your team in? And if you retry, how do you stop "passed on retry" from quietly becoming normal?