Can you trust AI-written Playwright tests? How to review what agents change
By TurnSignal · September 27, 2026 · 5 min read
In short
- A test is only useful if it fails when the feature breaks. AI-written and AI-fixed tests can pass while checking less than before.
- Review the change, not just the green check: weakened or removed assertions, changed expected values, skipped tests, added waits and timeouts, and new tests that assert nothing.
- Playwright’s own healer agent can return a passing test, or a skipped test when it believes the functionality is broken. Both deserve a human look.
- You can automate the first pass:
npx turnsignal governanceclassifies every test change in a pull request and posts one comment, with nothing uploaded.
Why AI-written tests need a different review
More and more Playwright tests are written by coding agents such as Claude Code, Cursor and Copilot, and Playwright itself ships three test agents: a planner that explores the app and writes a Markdown test plan, a generator that turns the plan into test files, and a healer that runs failing tests and repairs them.
That speed changes where the risk is. When a person fixes a failing test, a reviewer usually knows why it failed. When an agent fixes twenty tests in one pull request, the diff is long, every test is green, and the easiest way to make a failing test pass is to make it check less. Nobody needs bad intent for this to happen: the agent is asked to make the test pass, and it does.
What the Playwright healer does
According to Playwright's documentation, when a test fails the healer replays the failing steps, inspects the current UI to find equivalent elements or flows, suggests a patch (for example a locator update, a wait adjustment or a data fix), and re-runs the test until it passes or its guardrails stop the loop. Its output is a passing test, or a skipped test if it believes the functionality itself is broken.
Most of those patches are exactly right: a button was renamed, a locator changed. But "a wait adjustment" and "the functionality is broken, so skip it" are also the two most common ways a real bug slips through. The review question is always the same: does this test still fail when the feature breaks?
Changes that weaken a test
These are the patterns worth stopping on in any AI-authored test diff, from most to least serious:
- The test is disabled or deleted:
test.skip(),test.fixme(), or the test removed. The suite gets greener and the feature is no longer tested. - An assertion is weakened:
toHaveText('Order #1042 confirmed')becomestoBeVisible();expectbecomesexpect.soft; an assertion is removed or negated. The test now passes whatever the page says. - The expected value changed:
toHaveText('$42.00')becomestoHaveText('$44.10'). Sometimes the product really changed. Sometimes the test was updated to match a bug. Check whether application code changed in the same pull request. - A wait, timeout or force was added:
page.waitForTimeout(), a longertimeout,test.slow()orclick({ force: true }). These can hide a real slowdown or a real overlay covering the button. - A snapshot baseline was updated: a new screenshot baseline accepts whatever the page looks like today.
- A new test asserts nothing, or does not await its assertion: it passes as long as the page loads.
And the changes that are usually safe: only a locator changed, or the test was renamed and its steps and assertions are the same.
A review checklist for AI-authored test changes
- For every changed test, compare its assertions before and after. Fewer, softer or negated assertions need a reason in the pull request.
- If an expected value changed, find the application change that explains it. No application change is a red flag.
- Treat new skips and fixmes like a deleted test: who owns it and when does it come back?
- Question every new fixed wait and longer timeout; ask what the test is waiting for and use a web-first assertion instead.
- For new tests, check that each one ends with a meaningful assertion about the result the user cares about.
- Know who made the change: a person, an agent, a bot, or a person with an AI assistant (
Co-authored-bytrailers).
Automating the first pass in CI
Reading every assertion in a long AI-generated diff is exactly the work people skip. npx turnsignal governance (in the free turnsignal npm package, 0.6.0+) does the first pass in your pull request job. It compares every changed test with the base branch and sorts each change into Needs review (assertion weakened, expected value changed, test disabled or deleted), Worth a look (sleep, longer timeout, force: true or test.slow() added; snapshot updated), Information (new tests, with static checks such as "no assertion") or Safe (locator-only change or rename).
Each change says who made it when git knows: a person, an agent, a bot, or AI-assisted. It runs with git on your CI machine, needs no TurnSignal account or token, and uploads nothing. On GitHub it posts one sticky comment on the pull request:
test-changes:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needs the base branch history
- run: npx -y turnsignal governance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
By default the job only reports and always passes. When you trust its judgement on your codebase, add --strict to make it a required check that fails when a change needs review. On other CI, or on your laptop, npx turnsignal governance --base origin/main prints the same report. For tests that already exist, npx turnsignal analyze flags weak patterns such as tests without assertions, un-awaited assertions and hard waits, also locally.
The bigger picture
Agents will keep writing more of the suite. The teams that benefit are the ones that keep an independent check on what those tests actually verify, and a history of how each test behaves in CI over time. TurnSignal is built for both: a verdict on every run, flaky tests with evidence, and a review of every test an agent changes. See the docs for setup.
Questions people ask
Are AI-generated Playwright tests reliable?
They can be as good as hand-written ones, but they need the same review, especially when an agent changes an existing test to make it pass. Check that assertions did not get weaker and that skips have an owner.
What does the Playwright healer agent do?
It replays a failing test, inspects the current UI, suggests a patch such as a locator update, a wait adjustment or a data fix, and re-runs the test until it passes or its guardrails stop it. It can also return a skipped test if it believes the functionality is broken.
Does turnsignal governance send my code anywhere?
No. It runs with git in your CI job, needs no token, and uploads nothing. On GitHub it posts a comment on the pull request using the job’s GITHUB_TOKEN.
Sources
- Playwright docs: Test agents (planner, generator, healer)
- Playwright docs: Assertions
- Playwright docs: Annotations (skip, fixme, slow)
- turnsignal on npm (governance and analyze)
Playwright details were checked against Playwright 1.63 and its documentation on September 27, 2026.
Try TurnSignal on your next run
Add one reporter line next to your existing reporters. Free to start, no credit card, no repository access.