tripwire-e2e 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -169
- package/operators/_util.js +14 -1
- package/operators/dead-control.js +23 -23
- package/operators/hide-control.js +3 -3
- package/operators/index.js +81 -77
- package/operators/label-swap.js +1 -1
- package/operators/missing-row-action.js +24 -24
- package/operators/rendered-item-drop.js +31 -0
- package/operators/rendered-item-dup.js +20 -0
- package/operators/rendered-number-drift.js +24 -0
- package/package.json +1 -1
- package/src/agent.js +1 -1
- package/src/browser/mutate.js +156 -113
- package/src/browser/recorder.js +102 -80
- package/src/cli.js +41 -37
- package/src/commands/check.js +24 -7
- package/src/commands/coverage.js +110 -0
- package/src/commands/doctor.js +28 -0
- package/src/commands/fix.js +13 -4
- package/src/commands/run.js +370 -310
- package/src/commands/sabotage.js +85 -74
- package/src/kane.js +158 -150
- package/src/mutant.js +26 -26
- package/src/orphans.js +40 -0
- package/src/profile.js +13 -1
- package/src/proxy.js +292 -289
- package/src/report.js +183 -182
package/README.md
CHANGED
|
@@ -1,169 +1,201 @@
|
|
|
1
|
-
# Tripwire
|
|
2
|
-
|
|
3
|
-
**Break the app on purpose to find out whether a green Kane suite means anything.**
|
|
4
|
-
|
|
5
|
-
Coding agents write the app and its tests, and they are very good at writing tests that pass.
|
|
6
|
-
A passing end-to-end test only matters if it would have failed when the app was broken, and
|
|
7
|
-
nobody checks that. Tripwire does.
|
|
8
|
-
|
|
9
|
-
A proxy sits between the browser and your app and breaks it in one small, realistic way at a time:
|
|
10
|
-
a wrong total, a failed save reported as success, a missing button, another user's order in your
|
|
11
|
-
list. It never touches your code. [Kane CLI](https://github.com/LambdaTest/kane-cli) replays your
|
|
12
|
-
suite against each broken version with healing off. Every bug the suite walks past goes to your
|
|
13
|
-
coding agent, which adds one plain-English assertion, and Kane proves it: the strengthened test
|
|
14
|
-
**passes on the real app and fails on the broken one**.
|
|
15
|
-
|
|
16
|
-

|
|
17
|
-
|
|
18
|
-
## Results
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
|
139
|
-
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
# Tripwire
|
|
2
|
+
|
|
3
|
+
**Break the app on purpose to find out whether a green Kane suite means anything.**
|
|
4
|
+
|
|
5
|
+
Coding agents write the app and its tests, and they are very good at writing tests that pass.
|
|
6
|
+
A passing end-to-end test only matters if it would have failed when the app was broken, and
|
|
7
|
+
nobody checks that. Tripwire does.
|
|
8
|
+
|
|
9
|
+
A proxy sits between the browser and your app and breaks it in one small, realistic way at a time:
|
|
10
|
+
a wrong total, a failed save reported as success, a missing button, another user's order in your
|
|
11
|
+
list. It never touches your code. [Kane CLI](https://github.com/LambdaTest/kane-cli) replays your
|
|
12
|
+
suite against each broken version with healing off. Every bug the suite walks past goes to your
|
|
13
|
+
coding agent, which adds one plain-English assertion, and Kane proves it: the strengthened test
|
|
14
|
+
**passes on the real app and fails on the broken one**.
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
## Results
|
|
19
|
+
|
|
20
|
+
Two apps, each with a suite written by a fresh Claude Code session that was never told about
|
|
21
|
+
Tripwire (Kane CLI 0.10.5, 18 to 20 Nov 2026). Every fix below was proven by two Kane runs: the
|
|
22
|
+
strengthened test passes on the real app and fails with the bug armed.
|
|
23
|
+
|
|
24
|
+
**Demo shop** (`demo/shop`, 6 tests, JSON API)
|
|
25
|
+
|
|
26
|
+
| Run | Mutants | Score | Killed | Survived | Masked by heal | Not reached |
|
|
27
|
+
|---|---|---|---|---|---|---|
|
|
28
|
+
| First-draft suite | 40 | **78.4%** | 29 | 7 | 1 | 3 |
|
|
29
|
+
| After `tripwire fix` (5 proven fixes) | 40 | **91.9%** | 34 | 2 | 1 | 3 |
|
|
30
|
+
| Fresh measured re-run of the strengthened suite, harder set (adds 8 saboteur bugs and the in-page operators) | 50 | **78.7%** | 37 | 10 | 0 | 3 |
|
|
31
|
+
| After 3 more proven fixes | 50 | **85.1%** | 40 | 7 | 0 | 3 |
|
|
32
|
+
|
|
33
|
+
5 of the 7 remaining survivors are flagged *suspected equivalent*: the bug fired but no page ever
|
|
34
|
+
showed anything different (mostly saboteur bugs placed in write responses that the shop ignores
|
|
35
|
+
because it re-reads the data). They stay in the score: only a person can exclude a mutant.
|
|
36
|
+
|
|
37
|
+
**TodoMVC** (`demo/third-party`, the unmodified JavaScript ES5 example, 6 tests, no backend)
|
|
38
|
+
|
|
39
|
+
| Run | Mutants | Score | Killed | Survived | Masked by heal |
|
|
40
|
+
|---|---|---|---|---|---|
|
|
41
|
+
| First-draft suite | 18 | **77.8%** | 14 | 2 | 2 |
|
|
42
|
+
| After `tripwire fix` (4 proven fixes, including both masked bugs) | 18 | **100%** | 18 | 0 | 0 |
|
|
43
|
+
| Incremental re-check of the strengthened suite (`--since`, corrected operators) | 17 | **94.1%** | 16 | 1 | 0 |
|
|
44
|
+
| After 1 more proven fix | 17 | **100%** | 17 | 0 | 0 |
|
|
45
|
+
|
|
46
|
+
**What the runs found**
|
|
47
|
+
|
|
48
|
+
- **Another customer's order (#91002) in "My orders"**, and a product price 10% too high, both green
|
|
49
|
+
in the first-draft shop suite. Both now caught by one appended step each.
|
|
50
|
+
- **Default healing passed a bug Kane's own triage had just diagnosed.** With a TodoMVC row hidden,
|
|
51
|
+
strict replay failed and Kane's triage said "application issue, major: the page says 3 items left
|
|
52
|
+
but shows only 'Walk the dog' and 'Read a book'". With healing on, Kane re-authored the check,
|
|
53
|
+
read the hidden row from the DOM, and passed. For masked bugs the agent learned to write checks
|
|
54
|
+
that forbid re-entering data, and those failed on the broken app even with healing on.
|
|
55
|
+
- **A replayed "exactly three items" check passed with four rows on screen** (screenshot in the
|
|
56
|
+
report). The appended fix pins the row to directly above the footer.
|
|
57
|
+
- **Coverage, with a third state.** Of the shop's 21 acceptance criteria: 7 proven and guarded,
|
|
58
|
+
4 *proven but unguarded* (tests check them, a bug that broke them got past), 3 untouched by any
|
|
59
|
+
mutant, 7 owed (no test checks them).
|
|
60
|
+
|
|
61
|
+
Reports: [shop](https://da-b0s.github.io/tripwire/) · [TodoMVC](https://da-b0s.github.io/tripwire/todomvc/)
|
|
62
|
+
(each survivor with a screenshot of the broken page the suite passed on, Kane's triage of every
|
|
63
|
+
failure, every fix and lesson). Full measurements and findings: [NOTES.md](https://github.com/da-b0s/tripwire/blob/main/NOTES.md).
|
|
64
|
+
|
|
65
|
+
**Cost:** a passing replay ≈ 0.7 credits per test; a failing one ≈ 5 (Kane investigates it); a heal
|
|
66
|
+
check 15 to 35; each proven fix ≈ 25.
|
|
67
|
+
|
|
68
|
+
## Quickstart
|
|
69
|
+
|
|
70
|
+
You need Node 18+, Chrome, and a [TestMu AI](https://www.testmuai.com) account (free credits).
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install -g @testmuai/kane-cli tripwire-e2e
|
|
74
|
+
kane-cli login
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Point your `*_test.md` files at the proxy (`url: http://localhost:8080` in the frontmatter), start
|
|
78
|
+
your app, then:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
tripwire run # baseline, generate mutants, replay, score, report
|
|
82
|
+
tripwire fix # hand each survivor to your agent; Kane proves every new assertion
|
|
83
|
+
tripwire check # exit 1 below the threshold (for hooks and CI)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
More: `tripwire sabotage` (your agent proposes domain bugs from your acceptance criteria),
|
|
87
|
+
`tripwire coverage` (criteria as owed / proven and guarded / proven but unguarded),
|
|
88
|
+
`tripwire run --since <ref>` (only mutants whose tests changed), `tripwire doctor` (checks
|
|
89
|
+
kane-cli, the login, and leftover Kane browsers that can change a shared app's state).
|
|
90
|
+
|
|
91
|
+
Try it on the bundled demo shop (its Kane suite and recordings are committed):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/da-b0s/tripwire && cd tripwire && npm install
|
|
95
|
+
npm run shop # terminal 1: the app, on :3000
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd demo/shop && npx tripwire run # terminal 2: starts the proxy on :8080 itself
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Without spending any credits you can inspect the committed results: `npx tripwire check`,
|
|
103
|
+
`npx tripwire list`, `npx tripwire run --dry-run` and `npx tripwire report` all work offline.
|
|
104
|
+
|
|
105
|
+
Long runs are safe to interrupt: `tripwire run --resume` continues from the last finished mutant,
|
|
106
|
+
`--retry-errors` re-runs only mutants that hit a Kane service error, and `--redo <id>` re-runs
|
|
107
|
+
named mutants. Kane service hiccups before a run starts are waited out automatically.
|
|
108
|
+
|
|
109
|
+
## What a score means
|
|
110
|
+
|
|
111
|
+
| Status | Meaning | Counted |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| **killed** | at least one test failed while the bug was live | yes |
|
|
114
|
+
| **survived** | the bug fired and every test still passed | yes, against you |
|
|
115
|
+
| **masked** | strict replay caught it, but with Kane's default healing the test re-authored itself and passed on the broken app | yes, against you |
|
|
116
|
+
| **not reached** | the bug never fired in any test (e.g. no test submits invalid input) | no, listed separately |
|
|
117
|
+
|
|
118
|
+
Score = killed ÷ (killed + survived + masked). Kane errors and timeouts are retried and never
|
|
119
|
+
counted. A survivor whose pages never showed anything different from the clean run is flagged as a
|
|
120
|
+
*suspected equivalent*; it is excluded only when a person adds it to `.tripwire/equivalents.json`
|
|
121
|
+
with a reason, and every exclusion is listed in the report. A gate can set flagged ones aside
|
|
122
|
+
without changing the score: `tripwire check --allow-suspected-equivalents` (this repo's CI does).
|
|
123
|
+
|
|
124
|
+
## The operators
|
|
125
|
+
|
|
126
|
+
Generated from the traffic and the pages your suite actually produced, so every mutant is
|
|
127
|
+
relevant to at least one test. Data mutants only change values that were on screen; interface
|
|
128
|
+
mutants target controls by their visible text, or by tag and class with their row for icon buttons
|
|
129
|
+
and checkboxes. Links to other sites are never mutated.
|
|
130
|
+
|
|
131
|
+
| Family | Operator | What breaks |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| data | number-drift | a price, total or count is off by one unit or 10% |
|
|
134
|
+
| data | item-drop / item-dup | a list loses or repeats an element |
|
|
135
|
+
| data | field-swap | two displayed fields of a record are exchanged |
|
|
136
|
+
| data | stale-read | a read after a write returns the old data |
|
|
137
|
+
| data | wrong-owner | another user's record appears in a list |
|
|
138
|
+
| data | rendered-number-drift | a number shown on the page is off by one, changed in the page (no JSON needed) |
|
|
139
|
+
| data | rendered-item-drop / -dup | a list row disappears or shows twice, changed in the page |
|
|
140
|
+
| behaviour | silent-fail | a write returns 500 and is dropped |
|
|
141
|
+
| behaviour | fake-success | a write answers with its usual success body but is never saved |
|
|
142
|
+
| behaviour | double-apply | a POST is applied twice |
|
|
143
|
+
| behaviour | validation-off | a 400/422 becomes 200 |
|
|
144
|
+
| behaviour | auth-drop | one request mid-flow returns 401 |
|
|
145
|
+
| interface | hide-control | a control the tests see but never use disappears |
|
|
146
|
+
| interface | dead-control | a control the tests click does nothing |
|
|
147
|
+
| interface | label-swap | two button labels are exchanged |
|
|
148
|
+
| interface | text-change | a heading or status shows the wrong words |
|
|
149
|
+
| interface | wrong-link | a link points to a different page |
|
|
150
|
+
| interface | missing-row-action | the first row loses its edit/delete/cancel action |
|
|
151
|
+
| saboteur | agent-proposed | domain rules broken on purpose, proposed by your agent (`tripwire sabotage`) |
|
|
152
|
+
|
|
153
|
+
## Use it in your agent
|
|
154
|
+
|
|
155
|
+
- **Claude Code Stop hook**: [hooks/stop-hook.mjs](https://github.com/da-b0s/tripwire/blob/main/hooks/stop-hook.mjs) blocks "done" while tests
|
|
156
|
+
changed since the last run or the score is below the threshold, and names the bugs that got past.
|
|
157
|
+
Merge [hooks/claude-settings.json](https://github.com/da-b0s/tripwire/blob/main/hooks/claude-settings.json) into `.claude/settings.json`.
|
|
158
|
+
- **Any agent**: copy [hooks/AGENTS.md](https://github.com/da-b0s/tripwire/blob/main/hooks/AGENTS.md).
|
|
159
|
+
- **CI**: [hooks/tripwire.yml](https://github.com/da-b0s/tripwire/blob/main/hooks/tripwire.yml) runs incrementally (`--since`) on pull requests.
|
|
160
|
+
- **Memory**: `.tripwire/lessons.md` records each bug with the exact step that was proven to catch
|
|
161
|
+
it; the agent reads it before writing new tests (seen live in the hook session above).
|
|
162
|
+
|
|
163
|
+
## What Kane does here
|
|
164
|
+
|
|
165
|
+
| Kane feature | Role in Tripwire |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `_test.md` replay | the suite runs once per mutant without re-authoring |
|
|
168
|
+
| `--no-adaptive-heal` and heal events | strict verdicts; then a healing-on rerun detects masked bugs |
|
|
169
|
+
| Policies and `evidence verdict` | an inverted policy (`failed + broken >= 1`) judges every mutant run; a clean policy gates the baseline |
|
|
170
|
+
| `metrics.tests_without_checks` | assertion-free tests are reported first |
|
|
171
|
+
| Evidence packs | screenshots of the broken page for the report and for the agent |
|
|
172
|
+
| NDJSON events, exit codes, failure triage | machine-readable verdicts; Kane's own triage is shown next to each planted bug |
|
|
173
|
+
| Official skill | the test-writing agent uses TestMu's skill; Tripwire checks the result |
|
|
174
|
+
|
|
175
|
+
## Limits
|
|
176
|
+
|
|
177
|
+
- Tripwire mutates traffic and the rendered page, not source code. It measures whether the suite
|
|
178
|
+
notices breakage a user would see. It does not replace unit-level mutation testing.
|
|
179
|
+
- JSON operators need a JSON API; the in-page operators and interface operators work on any page.
|
|
180
|
+
Websockets and static assets pass through untouched.
|
|
181
|
+
- Kane's checks are AI-judged and not perfectly repeatable: the same mutant was caught by a test in
|
|
182
|
+
one run and survived it in another, and one check failed with `analyzer_failed` and passed on the
|
|
183
|
+
next replay. Treat a single kill or survival as strong evidence, not proof.
|
|
184
|
+
- Equivalence is flagged by comparing page text, so it cannot see effects that never reach the
|
|
185
|
+
page, and older baselines cannot see duplicated rows (duplicating mutants are never flagged then).
|
|
186
|
+
- A Kane replay re-evaluates its AI checks, so it is cheap but not free. See [NOTES.md](https://github.com/da-b0s/tripwire/blob/main/NOTES.md).
|
|
187
|
+
- Only run it against apps you own or run locally.
|
|
188
|
+
|
|
189
|
+
## For judges
|
|
190
|
+
|
|
191
|
+
- Everything runs locally against the two demos; you only need a Kane login.
|
|
192
|
+
- Both suites were written by separate Claude Code sessions in clean folders that never saw
|
|
193
|
+
Tripwire; transcripts are in `demo/*/agent-session.jsonl`, prompts and what happened in
|
|
194
|
+
`demo/*/WRITE_TESTS_PROMPT.md`.
|
|
195
|
+
- `demo/shop/stop-hook-session.jsonl` is a real Claude Code session blocked by the Stop hook.
|
|
196
|
+
- If you cannot run it: the committed reports, ledgers, fixes, lessons and screenshots in
|
|
197
|
+
`demo/*/.tripwire/` are the record of every run.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MIT
|
package/operators/_util.js
CHANGED
|
@@ -94,9 +94,22 @@ export function controls(profile) {
|
|
|
94
94
|
}
|
|
95
95
|
for (const c of t.clicks) { const k = keyOf(c); if (by.has(k)) by.get(k).clicked = true; }
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
// Links to other sites (author credits, social links) are not part of the app under test.
|
|
98
|
+
return [...by.values()].filter((c) => !(c.role === 'link' && isExternal(c.href))).map((c) => ({ ...c, tests: [...c.tests], pages: [...c.pages] }));
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
export const isExternal = (href) => /^(https?:)?\/\//i.test(href || '') && !/^(https?:)?\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d+)?(\/|$)/i.test(href);
|
|
102
|
+
|
|
103
|
+
// How a control reads in a sentence. "[button.destroy]" (no visible text) becomes
|
|
104
|
+
// 'the "destroy" button on the "Buy milk" row'; a labelled one becomes 'the "Save" button'.
|
|
105
|
+
export function labelOf(c) {
|
|
106
|
+
const anon = /^\[([a-z0-9-]+)(?:\.([\w-]+))?\]$/i.exec(c.text || '');
|
|
107
|
+
const kind = c.role === 'link' ? 'link' : c.role === 'checkbox' ? 'checkbox' : c.role === 'heading' ? 'heading' : 'button';
|
|
108
|
+
const name = anon ? `the unlabelled "${anon[2] || anon[1]}" ${kind}` : `the "${c.text}" ${kind}`;
|
|
109
|
+
return c.row && c.inRow && c.row !== c.text ? `${name} on the "${c.row}" row` : name;
|
|
110
|
+
}
|
|
111
|
+
export const sentence = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
112
|
+
|
|
100
113
|
// The target a DOM mutant uses to find a control again in the page.
|
|
101
114
|
export const targetOf = (c) => (c.pattern ? { role: c.role, text: c.text, pattern: c.pattern } : { role: c.role, text: c.text });
|
|
102
115
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// Interface: a control the test clicks no longer does anything. If the test passes anyway,
|
|
2
|
-
// it never checked the effect of the click.
|
|
3
|
-
import { controls, mutant } from './_util.js';
|
|
4
|
-
import { domMutant } from './hide-control.js';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
name: 'dead-control',
|
|
8
|
-
family: 'interface',
|
|
9
|
-
summary: 'The click handler of a control is disabled by an injected script.',
|
|
10
|
-
generate(profile) {
|
|
11
|
-
return controls(profile)
|
|
12
|
-
.filter((c) => c.role === 'button' && c.clicked)
|
|
13
|
-
.map((c) => mutant({
|
|
14
|
-
id: `dead-control:
|
|
15
|
-
family: 'interface', operator: 'dead-control',
|
|
16
|
-
match: { document: true },
|
|
17
|
-
action: domMutant('dead', c),
|
|
18
|
-
touches_tests: c.tests,
|
|
19
|
-
describe:
|
|
20
|
-
expect: `The test checks what "${c.text}" is supposed to change`
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
1
|
+
// Interface: a control the test clicks no longer does anything. If the test passes anyway,
|
|
2
|
+
// it never checked the effect of the click.
|
|
3
|
+
import { controls, mutant, labelOf } from './_util.js';
|
|
4
|
+
import { domMutant } from './hide-control.js';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'dead-control',
|
|
8
|
+
family: 'interface',
|
|
9
|
+
summary: 'The click handler of a control is disabled by an injected script.',
|
|
10
|
+
generate(profile) {
|
|
11
|
+
return controls(profile)
|
|
12
|
+
.filter((c) => (c.role === 'button' || c.role === 'checkbox') && c.clicked)
|
|
13
|
+
.map((c) => mutant({
|
|
14
|
+
id: `dead-control:${c.role}:"${c.text}"`,
|
|
15
|
+
family: 'interface', operator: 'dead-control',
|
|
16
|
+
match: { document: true },
|
|
17
|
+
action: domMutant('dead', c),
|
|
18
|
+
touches_tests: c.tests,
|
|
19
|
+
describe: `${c.role === 'checkbox' ? 'Ticking' : 'Clicking'} ${labelOf(c)} does nothing`,
|
|
20
|
+
expect: `The test checks what "${c.text}" is supposed to change`
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Interface: a button or link the tests saw but never clicked disappears.
|
|
2
2
|
// Catches suites that never look at controls they do not use.
|
|
3
|
-
import { controls, mutant, targetOf } from './_util.js';
|
|
3
|
+
import { controls, mutant, targetOf, labelOf, sentence } from './_util.js';
|
|
4
4
|
|
|
5
5
|
const domMutant = (op, c, extra = {}) => ({ type: 'dom', dom: { op, target: targetOf(c), ...extra } });
|
|
6
6
|
|
|
@@ -21,8 +21,8 @@ export default {
|
|
|
21
21
|
match: { document: true },
|
|
22
22
|
action: domMutant('hide', c),
|
|
23
23
|
touches_tests: c.tests,
|
|
24
|
-
describe:
|
|
25
|
-
expect: `The test checks that
|
|
24
|
+
describe: `${sentence(labelOf(c))} is missing`,
|
|
25
|
+
expect: `The test checks that ${labelOf(c)} is offered`
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
28
|
};
|