r/Playwright • • 25m ago

Help needed beginners question

1 Upvotes

Hey everyone,

I started learning Playwright a few days ago, mostly for fun. I ran some tests at work in our TEST environment and everything worked great, and I got to try out a lot of the cool stuff I'd learned.

Today I tried to replicate the same thing in PROD. The login went smoothly, but right after signing in a blank page appears saying "Working", and then the Playwright session just closes.

Any idea why this is happening? Or a way to fix it?

I'm not a tech guy, just someone wanting to learn a little bit.


r/Playwright • • 4h ago

I built mustfail, an open-source CLI that finds Playwright tests that stay green when the app is broken

0 Upvotes

mustfail, a free, open-source CLI that finds Playwright tests that pass when the app is broken.

You run `npx mustfail run` in your project. It reruns your suite several times: once with every API call failing, then with the values your assertions read changed, lists emptied, and the test's own saves failed. It grades each test by what it noticed. A test that stays green with the whole API down is decorative. A test that stays green when its own data is wrong is weak. You don't change your tests or your config, and it writes an HTML report. It needs Node 20+ and Playwright 1.50+.

I ran it on Strapi's open-source e2e suite. The test that deletes the Author role checks:

await expect(page.getByRole('row', { name: 'Author', exact: true })).not.toBeVisible();

I made `POST /admin/roles/batch-delete` return 500 with `page.route`. The role stayed in the table and the test stayed green. Playwright names a row after the text of all its cells, so no row is named exactly "Author", and `not.toBeVisible()` on a locator that matches nothing passes every time. Checking `getByRole('gridcell', ...)` instead fixes it. I filed it with a second test it found, a homepage widget test that never reloads to check the save: https://github.com/strapi/strapi/issues/28805

Across the 189 admin and content-manager tests I ran, 86 failed an assertion when their data was wrong.

It's an alpha. It reruns your tests several times (a full run takes 3 to 4 times your suite's runtime), so point it at a local or disposable environment, since it repeats your tests' writes.

I'd like to hear where a grade is wrong on your suite. Reply here, or open an issue with the test and the reason mustfail gave.

https://github.com/ashwink-tech/mustfail


r/Playwright • • 1d ago

Piwi: Our demo video is a Playwright test that runs every night, and films itself

Thumbnail youtu.be
7 Upvotes

I maintain Piwi, a free, self-hosted dashboard for Playwright results (a reporter, a dashboard, a VS Code extension and a browser extension). A video of all of them together is out of date at every release, so I didn't want to edit by hand each time.

Instead, one Playwright script plays a story on the real tools: a red CI run, debugging it in VS Code, picking the right locator on the live page, recording a missing step, then watching the fix run on three CI workers. Each step ends with a check of what it left behind (the file on disk, the dashboard's API, the editor's DOM). Played without a camera, it's the only test that drives all the tools together, and it runs nightly.

A few things that may be useful beyond this project:

  • Playwright drives Chromium, the test's own browser and VS Code (Electron) with trusted input, and every click and key is logged with its box on the screen.
  • There's no waitForTimeout in it: each step waits on a state (a line on disk, a row in an API, a CodeLens).
  • Filming is the same run on a 4K Xvfb screen recorded by ffmpeg. The edit is a web page that renders each frame from the recording and the gesture log (camera, cursor, subtitles), so the motion is unit-tested like any other code.
  • Running nightly, it has caught four product bugs that no other test saw; watching the film caught a fifth (the page's own CSS leaking into the picker's panels).

How it's made: https://piwitests.dev/blog/the-demo-video-is-a-test

The video: https://youtu.be/ugsqKraU1KY

The script: https://github.com/PiwiTests/piwi/tree/main/apps/showcase


r/Playwright • • 1d ago

Migrating from UiPath to Playwright - anyone done this?

3 Upvotes

We’re in the process of migrating some complex UiPath automations to Playwright. Has anyone here done a similar migration? Curious about the challenges you faced, things you wish you’d known beforehand, and whether it was worth it in the long run.


r/Playwright • • 3d ago

Playwright MCP vs AI Browser Agents: Which Is Better for Repetitive Tasks?

5 Upvotes

I think I've been overcomplicating browser automation a bit lol. Why bother with scripts when an AI agent can just figure out where to click? Sounds great until it's figuring out the same buttons and forms every single time.

So I've been looking into letting AI handle a task once, then turning the successful steps into a reusable Playwright workflow. Came across oya browser while researching this, and the approach caught my attention. Seems like a reasonable middle ground between AI-driven browsing and manually writing scripts.

Of course, websites change, sessions expire, and workflows still need maintenance. But having an agent start from scratch every time feels like unnecessary overhead for repetitive tasks.

How are you guys handling this with MCP browser automation? Do you let agents figure things out each time, or reuse Playwright workflows once they're working?


r/Playwright • • 3d ago

I built MailGate: a self-hosted, receive-only OTP and magic-link inbox on Cloudflare Workers and D1 with Playwright SDK and MCP server

Post image
6 Upvotes

I built MailGate, a self-hosted, receive-only email inbox for verification codes and magic sign-in links running on Cloudflare Email Routing, Workers, and D1. It fits the free tier with no VPS or SMTP server to maintain.

I made it because I got tired of paying for hosted QA inbox services or keeping Mailhog running just to read OTP codes during Playwright authentication tests and Claude Code sessions.

What it includes:

  • Strict recipient allowlist at SMTP ingest and optional PBKDF2-SHA256 inbox passwords
  • Automatic OTP code and magic-link extraction that ignores calendar years in receipts
  • Defense-in-depth HTML sanitization rendered inside a sandboxed iframe with a strict CSP
  • Daily Cron Trigger auto-cleanup with configurable retention TTL
  • Zero-dependency TypeScript/JS SDK and Playwright fixture via mailgate-sdk/playwright
  • Built-in stdio MCP server via npx -y mailgate-sdk mcp, listed on the Official MCP Registry and rated B on Glama

GitHub (MIT): https://github.com/Dicka18/mailgate npm: https://www.npmjs.com/package/mailgate-sdk

Happy to answer any questions about running receive-only email on Cloudflare Workers and D1, or hear what features to add next.


r/Playwright • • 4d ago

Any Claude Code & Playwright for Automated Tests on a B2B + Skills Question

0 Upvotes

Hi all!

Wanted to see if anyone has been using Claude Code and Playwright for automated testing in a B2B site? If so, I understand those tend to be more complex to do automated tests for given their multi-tenant and role-based permissions, as well as multi-step workflows. Any suggestions, ideas, things to watch out for our plan for completely different than a B2C?

I've also noticed some Playwright skills out there that have been developed. The site below does a nice job listing a bunch with details. Has anyone used or heard about any of them?

Playwright Skills & Plugins for AI Coding Agents https://currents.dev/posts/best-playwright-skills-and-plugins-for-ai-coding-agents

Thanks!


r/Playwright • • 4d ago

forcing closed shadow roots open worked until the vendor updated

13 Upvotes

the approve button in our ap vendor's portal sits inside a closed shadow root. for months the bot only worked because of an init script that patches attachShadow to force mode open. hacky, but it held until the vendor's last update

with the patch on, the invoice widget throws on load and renders blank. with it off the widget renders but element.shadowRoot is null and locators walk straight past the button

before anyone says frame locators, those already handle the iframe bits fine. the button lives on the main page, in that one closed root

i'd rather not fight their frontend every release. anyone reaching elements in closed roots without monkeypatching the page?


r/Playwright • • 5d ago

Has an AI agent ever told you a test step passed when it didn't?

5 Upvotes

I work in QA at ThinkSys, so I see this across a few client teams. The failure mode that worries me most with agentic testing isn't the agent failing. it's the agent saying it succeeded.

With normal Playwright tests, failures are loud. an element isn't found and the test stops. with agents, we've seen runs where the agent reports a step as done when it actually landed somewhere else. one got stuck looping on a login page because it didn't recognise a 2FA prompt, and still reported progress.

Those failures are much harder to trace, because there's no line of code that broke. you have to read through what the agent thought it was doing.

The only thing that's helped so far is checking results outside the agent, like querying the API or database to confirm the step actually happened instead of trusting the agent's report.

How are others catching this? Is there a good way to verify agent runs without checking every step by hand?


r/Playwright • • 5d ago

Reviewing AI-generated tests: the 5 drifts to check before anything merges

11 Upvotes

AI-written tests fail in predictable ways. They usually pass, and that's the problem: a passing test that checks the wrong thing is worse than no test. These are the five drifts worth checking every time:

1. Selector drift

The agent picks whatever locator works right now: XPath, deep CSS chains, nth-child, auto-generated class names. Those break on the next UI change.

Check: locators should be based on role, label, text or test ID, matching your project's strategy.

2. Data drift

Hard-coded emails, IDs and dates invented on the spot, instead of your project's data factories or fixtures. Tests then collide or depend on state that won't exist in CI.

Check: test data comes from your helpers, not literals.

3. Import drift

The agent imports test utilities directly, bypasses your custom fixtures, or pulls in a new library to solve something you already have a helper for.

Check: imports match the patterns used in the rest of the suite.

4. Assertion drift

The most dangerous one. Assertions that can't fail (checking that an element exists that always exists), asserting on implementation details, or replacing real checks with arbitrary waits.

Check: every assertion would fail if the feature broke.

5. Structure drift

Each generated file looks slightly different: logic in tests instead of page objects, duplicated setup, inconsistent naming. Individually harmless, collectively unmaintainable.

Check: the file looks like the best existing test in your suite.

The bigger fix

Reviewing for drift catches problems. Preventing them works better: give the agent a scaffold where the rules already live, and block the worst patterns automatically before a file is even written.

Which drift do you see most in AI-generated tests?


r/Playwright • • 6d 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 • • 6d ago

Check API/steps performance regression - Playwright

4 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 • • 7d ago

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

0 Upvotes

r/Playwright • • 7d 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 • • 8d ago

Disposable Inboxes as an API for Automation & QA

3 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 • • 9d ago

AI UI Test Automation Project - Prototype

3 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 • • 9d 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 • • 10d 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 • • 10d 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 • • 10d ago

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

3 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 • • 11d 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 • • 11d 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 • • 11d ago

GitHub Actions browser and device testing

6 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 • • 11d 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.