Classify a failing or flaky end-to-end test before touching it, as a real product bug, a changed UI path, a changed requirement, an environment problem, a flaky test, or a wrong test, and apply the fix that matches. Repairs how a test reaches its target, never what it checks. Use when an E2E, UI, browser, Playwright, Cypress or Kane CLI test fails, fails intermittently, passes only on retry, or when asked to fix a red build or flaky test.
Ships in kane-testing-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The fastest way to lose trust in a test suite is to "fix" a failing test by weakening what it checks. This skill forbids that. A test has two parts:
Collect before deciding:
main if cheap). If the test covers a feature that does not exist on the base branch yet, say so and skip this check.Where to find these:
unzip -l <pack>.evidence lists it; the failed step has steps/<n>-<id>/screenshot.png, annotated.png and failure.yaml; logs are in tests/<id>/logs/ (*-console.ndjson, *-network.har). For a saved test, also read output-<name>/Result.md.npx playwright show-trace <trace.zip>) or the HTML report; screenshots in test-results/.cypress/screenshots/, cypress/videos/, and the run log.Pick exactly one. If two fit, pick the one higher in the list.
| Class | Signs | What to do |
|---|---|---|
| Environment | Did not start, auth error, app not reachable, missing env var or secret, Chrome missing. Kane CLI exit 2; timeouts exit 3. | Fix setup. Do not edit the test. |
| Product bug | The path worked; the outcome is wrong. Wrong total, wrong message, missing record, 500 from the API. Also fails on a clean rerun. | Report it as a bug with the evidence. Do not edit the test. If the PR caused it, fix the code. |
| Requirement changed | The app behaves as the new ticket says, and the criterion reflects the old behaviour. | Stop and ask the human to approve a new criterion. With Kane CLI assurance, kane-cli maintain reconcile walks the suite through a requirement change. |
| Path changed | The outcome is reachable; the test cannot find its way. Renamed button, moved menu, new step in the flow, new id. | Repair the path only (Step 3). Assertions stay byte-for-byte the same. |
| Flaky | Same commit, mixed outcomes across reruns. Timing, shared test data, test order, animations, third-party scripts. | Fix the cause (Step 4). Never add sleeps, retries or longer timeouts as the fix. |
| Wrong test | The test never checked the criterion correctly (wrong expected value copied, asserts the trigger not the outcome). Fails on base branch too, and the app is right. | Fix the test to match the approved criterion, and say so plainly in the PR. |
A test that only passes with retries is Flaky, not passing.
When the fix is in the product code (a product bug the PR caused), leave the test as it is, rerun the failed test, then run the rest of its file or suite once to check nothing else moved. Report every run, the failing ones included.
Before changing anything, read references/never-do.md: the list of edits that would turn a real failure into a false pass.
getByRole with a name, getByLabel, getByText) that matches what the element is, not where it sits. Keep the same expect lines.After repairing, rerun 3 times. All three must pass.
| Cause | Fix |
|---|---|
| Asserting before the UI settled | Use a waiting assertion on the final state (await expect(...).toHaveText(...); Kane: end the step on a verify of the end state). |
| Shared or reused data | Unique data per run (timestamp suffix, factory helper; Kane: {{smart.random_email}}). |
| Test order dependence | Each test sets up its own state. |
| Optional popups | Guarded, optional step; never an assertion. |
| Third-party widget latency | Stub it if the criterion is not about it; otherwise assert on our side of the integration. |
If you cannot find the cause, quarantine is a human decision. Say "I could not find the cause; here are the 3 run outcomes and evidence" and stop.
**Failing test:** tests/e2e/promo.spec.ts › "expired promo code shows an error"
**Class:** Product bug
**Evidence:** step 4 screenshot shows total $37.80 (expected $42.00); `POST /api/cart/promo` returned 200 for an expired code. Fails 3/3 on this branch, passes 3/3 on main.
**Action:** Reported, test unchanged. Likely cause: `isExpired()` compares dates in local time (src/promo.ts:41).
Hand the result to kane-pr-evidence so the PR shows it.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/kane-pr-evidenceWrite the testing section of a pull request description so a reviewer can see, in under a minute, what was verified, against which acceptance criteria, what passed or failed, and where the evidence is. Use when opening or updating a PR, or when asked "what did you test?", and only when the change has user-facing behaviour or tests were run in this session; skip docs-only, dependency-only and config-only PRs. Reuses results from kane-run; never claims a check that did not run./kane-runRun end-to-end checks and report a verdict only from real evidence. Uses Kane CLI (kane-cli) when it is installed and signed in, and otherwise falls back to the repo's own test runner (Playwright, Cypress, npm/pnpm scripts, pytest). Never reports a pass without a process exit code and a result artifact. Use when asked to run, verify or check tests or a change in a real browser, after writing tests with kane-write-e2e, or before saying a user-facing change is done./kane-test-intentBefore writing end-to-end or user-flow tests, turn a ticket, issue, bug report or PR diff into 3-7 acceptance criteria a user could observe, and get them approved. Use when asked to test a user-facing feature or fix, plan what to verify in a PR, or before saying a user-facing change is done. Not for unit tests of a single function, refactors with no behaviour change, or docs/config-only changes. Does not run anything./kane-write-e2eWrite end-to-end tests from approved acceptance criteria, in whatever the repo already uses. If the repo has Playwright, Cypress or another E2E framework, write idiomatic tests there with resilient, user-facing locators and assertions on outcomes. If Kane CLI is installed, express the checks as plain-English Kane objectives or designed _test.md tests instead of hand-written scripts. Use after kane-test-intent, or when asked to add, write or generate E2E, UI, browser or end-to-end tests for a change./kane-testing-skills:kane-failure-triagefrom kane-testing-skills
npx claudepluginhub lambdatest/kane-testing-skills --plugin kane-testing-skills