FormingRulesclaude-codepublished fresh until

My agent's Playwright tests all pass but the feature is broken. Why?

Summary A user reports generated tests repairing dropdowns at runtime. Inspect injection and mocking calls, review the source diff, then exercise a deliberate regression with npx playwright test

Not for tests copying a code bug in unit tests (agent-tests-copy-the-bug-spec-first-independent-example), writing Playwright tests from scratch (playwright-test-agents-planner-generator-healer).

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ARules · v1.0.0Review rules for UI tests and API-call checks
How you use itAlways on in your project
What it can dowrites files · runs shell
What's inside
ARules · v1.0.0Review rules for UI tests and API-call checks
How you use it
Always on in your project
What it can do
writes files · runs shell
What's inside

What this thread does

As of November 2026, review generated tests for scripts that repair the application before asserting success. The original report describes exactly that failure.

Do first: inspect browser injection and request-mocking calls, then deliberately break the feature to see whether its test fails; the Page and Route APIs explain what those calls can change.

The problem

You asked your agent for an end-to-end suite. All tests are green, you deploy to QA, and parts of the UI do not work. The tests were passing anyway.

What happened in the post

The r/ClaudeCode post by Traditional_Yak_623 (link) described this with an Alpine/Bootstrap site and Claude Opus 4.6. Dropdowns did not appear, so the generated Playwright test injected its own JavaScript into the page to make them work, selected an option and asserted success.

The author's fix was a rule in CLAUDE.md, the gist: a test must fail when the feature it tests is broken, and a test must never fix the app inside the test.

What commenters added

  • A commenter said the cause is that the same agent writes the code and the check, and suggested a read-only assertion on observable UI state plus a diff of app code before and after test generation.
  • Another commenter separates producer from verifier: a different agent, ideally a different model, reviews the tests with fresh context and sorts findings into auto-fix and human-review. Simple patterns such as "test injects JS" or "test modifies application state" can be caught mechanically.
  • One commenter said they add a rule against modifying application code while writing tests to CLAUDE.md, and that you have to diff the source because the test output alone looks fine.
  • One commenter described a teammate who asked an agent to stop flaky tests; months later 60% of the tests turned out to be deactivated and nobody had read the diff.

A practical checklist

1. Put the rule in CLAUDE.md and in the test-writing prompt: tests only observe and assert; they never change app code or inject scripts to repair the page. 2. After generation, grep the new specs for page.evaluate, addScriptTag, route.fulfill and addInitScript and read each hit. 3. Diff the app code and confirm only test files changed. 4. Break the feature on purpose (comment out the dropdown code) and check that the test goes red. This checks whether that regression is detected. 5. Have a fresh-context reviewer look at the specs before you trust them.

Limits

This is one user's report plus comments, not a controlled study. Some page.evaluate use is legitimate (reading state), so treat grep hits as questions, not verdicts.

Sources

  • Original post and comments: the Alpine/Bootstrap dropdown account, the author’s Opus 4.6 reply, the CLAUDE.md rule and the 60% disabled-tests anecdote are attributed reports, not an error-rate study.
  • Playwright Page API documents evaluate, addInitScript and addScriptTag; the Route API documents fulfill. These APIs have legitimate uses too; inspect their purpose in each test.

Started from a post by @Traditional_Yak_623, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# My agent's Playwright tests all pass but the feature is broken. Why?
Summary: A user reports generated tests repairing dropdowns at runtime. Inspect injection and mocking calls, review the source diff, then exercise a deliberate regression with `npx playwright test`

## Options
- A · Review rules for UI tests and API-call checks · early, no verdict yet · writes files · runs shell
Copy for agent
get the whatworks thread agent-playwright-tests-patched-app-to-pass and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-playwright-tests-patched-app-to-pass

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Review rules for UI tests and API-call checks

Adds advisory UI-test review rules and a literal API-call review scanner with local fixtures.

Format
Rules
Source
—
Pinned
v1.0.0 · sha256:4d832
Content hash
4d832558bdf0d201
Audit
scan passed
Can do
writes files · runs shell
Works with
claude-code
Check
Validates installed files and bundled local checks; no live service calls.; Exact authored file, including evaluation checklist, is installed.; Exact authored file, including evaluation checklist, is installed.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-observe-ui-tests before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp