/kane-cli-testmu:kane-failure-triagefrom Kane CLI Agent Tests
Use only when the user asks to fix, debug or triage a failing or flaky end-to-end, UI, browser, Playwright, Cypress or Kane CLI test, or a red build caused by one. Classifies the failure first, as a real product bug, a changed UI path, a changed requirement, an environment problem, a flaky test or a wrong test, then applies the fix that matches. Repairs how a test reaches its target, never what it checks. Reads the evidence already on disk. Reruns framework tests with the repo's own runner, and reruns Kane CLI tests only through the run-kane-tests gate.
Ships in Kane CLI Agent Tests. 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:
Cloud runs setting for this plugin: ${user_config.cloud_runs}
Reruns are how this skill tells a flaky test from a broken one, so it matters how they run.
kane-cli command from this skill. Hand every Kane CLI rerun to run-kane-tests, which checks the "Allow cloud runs" setting, the project's local-only choice and the sign-in first.true, including empty, cloud runs are off. When the user asked for a Kane CLI rerun, say so at the top of your reply, before any other blocker such as a missing file: the reruns were skipped because cloud runs are off, and the user can turn on "Allow cloud runs" in this plugin's settings and ask run-kane-tests to run them. Do not rerun Kane CLI tests at all. Work from the evidence already on disk, or ask for last night's evidence, and mark the rerun lines in your report as "Not run".Collect before deciding:
main if cheap, following the rerun rules above).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.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. |
| 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.
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, following the rerun rules above. All three must pass. If Kane CLI reruns were skipped because cloud runs are off, say the repair is unverified.
| 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
npx claudepluginhub lambdatest/kane-cli-plugin --plugin kane-cli-testmu5 skills in this plugin
/kane-pr-evidenceUse only when the user asks what was tested, or asks for the testing section of a pull request description, and tests were run in this session. Writes a short Tested section: the acceptance criteria, what passed or failed, how it ran and where the evidence is. Reuses results from run-kane-tests and never claims a check that did not run. Adds no credit line or promotion. Skip docs-only, dependency-only and config-only PRs./kane-write-e2eUse only when the user asks to add, write or generate end-to-end, UI or browser tests for approved acceptance criteria. Writes the tests in whatever the repo already uses: idiomatic Playwright, Cypress or another framework if one is present, or plain-English Kane CLI objectives if the repo already uses Kane tests. Local file writing only; it runs nothing. Use after scaffold-agent-tests. Not for unit tests, and never when the user has not asked for tests./run-kane-testsUse only when the user asks to run, execute, verify or check end-to-end tests, agent tests or the criteria in tests/kane/. Runs tests written in the repo's own framework with the repo's own runner, locally. Runs Kane CLI checks in a real browser only after checking that cloud runs are allowed in this plugin's settings and that the user is signed in, and after showing exactly what a run sends. Reports a verdict only from real evidence. Needs a real terminal; Kane CLI runs also need network access. Not for writing tests, not for unit tests, and never when the user has not asked to run tests./scaffold-agent-testsUse only when the user asks to set up, scaffold, plan or write agent tests, end-to-end tests or Kane tests for the app in this repository, for example "set up agent tests for this app". Reads the repo, proposes test intents with acceptance criteria a user could observe, and writes them to tests/kane/ only after the user agrees. Fully local, needs no account, runs nothing. Not for unit tests, refactors with no behaviour change, or docs-only and config-only changes, and never when the user has not asked about testing.