fusiontest 0.2.22__tar.gz → 0.2.24__tar.gz

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.
Files changed (56) hide show
  1. {fusiontest-0.2.22 → fusiontest-0.2.24}/PKG-INFO +1 -1
  2. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/__init__.py +62 -6
  3. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/sites/shop/index.html +53 -12
  4. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/suites/shop-bugs.yaml +26 -4
  5. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/suites/shop.yaml +1 -1
  6. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/cli.py +10 -5
  7. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/PKG-INFO +1 -1
  8. {fusiontest-0.2.22 → fusiontest-0.2.24}/pyproject.toml +1 -1
  9. {fusiontest-0.2.22 → fusiontest-0.2.24}/README.md +0 -0
  10. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/__init__.py +0 -0
  11. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/sites/shop/bugs.js +0 -0
  12. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/sites/shop/help.html +0 -0
  13. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/bench/suites/todomvc.yaml +0 -0
  14. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/__init__.py +0 -0
  15. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/action_model.py +0 -0
  16. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/app_errors.py +0 -0
  17. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/goal_verifier.py +0 -0
  18. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/netguard.py +0 -0
  19. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/promise_checker.py +0 -0
  20. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/replay.py +0 -0
  21. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/runner.py +0 -0
  22. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/screen_parser.py +0 -0
  23. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/secrets.py +0 -0
  24. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/shared_traces.py +0 -0
  25. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/core/tokens.py +0 -0
  26. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/__init__.py +0 -0
  27. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/fusiontest_dashboard.yaml +0 -0
  28. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/github.yaml +0 -0
  29. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/hacker_news.yaml +0 -0
  30. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/httpbin.yaml +0 -0
  31. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/todomvc.yaml +0 -0
  32. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/demos/wikipedia.yaml +0 -0
  33. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/desktop/__init__.py +0 -0
  34. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/desktop/macos_adapter.py +0 -0
  35. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/desktop/playwright_adapter.py +0 -0
  36. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/desktop/windows_adapter.py +0 -0
  37. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/discovery/__init__.py +0 -0
  38. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/discovery/goal_generator.py +0 -0
  39. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/guardrails/__init__.py +0 -0
  40. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/guardrails/engine.py +0 -0
  41. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/mobile/__init__.py +0 -0
  42. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/mobile/android_adapter.py +0 -0
  43. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/mobile/ios_adapter.py +0 -0
  44. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/reporting/__init__.py +0 -0
  45. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/reporting/reporter.py +0 -0
  46. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/training/__init__.py +0 -0
  47. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/training/data_collector.py +0 -0
  48. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/training/dataset_builder.py +0 -0
  49. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest/training/trainer.py +0 -0
  50. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/SOURCES.txt +0 -0
  51. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/dependency_links.txt +0 -0
  52. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/entry_points.txt +0 -0
  53. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/not-zip-safe +0 -0
  54. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/requires.txt +0 -0
  55. {fusiontest-0.2.22 → fusiontest-0.2.24}/fusiontest.egg-info/top_level.txt +0 -0
  56. {fusiontest-0.2.22 → fusiontest-0.2.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
5
5
  Author-email: FusionLeap <hello@fusionleap.io>
6
6
  License: MIT
@@ -22,6 +22,10 @@ what was planted:
22
22
  precision reports that match a planted bug ÷ all reports
23
23
  recall planted bugs found ÷ planted bugs
24
24
  false bugs reports on clean variants — must stay at zero
25
+
26
+ Bug suites can also list decoys: behaviour that looks broken but is correct
27
+ and explained on screen. A report about a decoy is a false report, counted as
28
+ a decoy trip.
25
29
  """
26
30
 
27
31
  from __future__ import annotations
@@ -71,6 +75,13 @@ class PlantedBug:
71
75
  match: list[str] # keywords; a report mentioning them is about this bug
72
76
 
73
77
 
78
+ @dataclass
79
+ class Decoy:
80
+ id: str
81
+ description: str
82
+ match: list[str]
83
+
84
+
74
85
  @dataclass
75
86
  class Variant:
76
87
  name: str
@@ -88,6 +99,7 @@ class BugSuite:
88
99
  platform: str = "playwright"
89
100
  site: str = ""
90
101
  kind: str = "bugs"
102
+ decoys: list[Decoy] = field(default_factory=list)
91
103
 
92
104
 
93
105
  def builtin_suites() -> list[str]:
@@ -142,6 +154,8 @@ def _load_bug_suite(data: dict, source: str) -> BugSuite:
142
154
  match = [str(k).lower() for k in (raw or {}).get("match") or []]
143
155
  if kind not in BUG_KINDS or not match:
144
156
  raise bad(f"bug {bug_id!r} needs a kind ({' | '.join(BUG_KINDS)}) and match keywords")
157
+ if _nested_keywords(match):
158
+ raise bad(f"bug {bug_id!r}: a keyword contains another {_nested_keywords(match)}")
145
159
  bugs[str(bug_id)] = PlantedBug(id=str(bug_id), kind=kind,
146
160
  description=str(raw.get("description", "")), match=match)
147
161
  variants = []
@@ -160,11 +174,29 @@ def _load_bug_suite(data: dict, source: str) -> BugSuite:
160
174
  unplanted = set(bugs) - {b for v in variants for b in v.bugs}
161
175
  if unplanted:
162
176
  raise bad(f"bugs never planted in a variant: {sorted(unplanted)}")
163
- return BugSuite(name=name, tasks=tasks, bugs=bugs, variants=variants,
177
+ decoys = []
178
+ bug_keywords = {k for b in bugs.values() for k in b.match}
179
+ for decoy_id, raw in (data.get("decoys") or {}).items():
180
+ match = [str(k).lower() for k in (raw or {}).get("match") or []]
181
+ if not match:
182
+ raise bad(f"decoy {decoy_id!r} needs match keywords")
183
+ if _nested_keywords(match):
184
+ raise bad(f"decoy {decoy_id!r}: a keyword contains another {_nested_keywords(match)}")
185
+ shared = bug_keywords & set(match)
186
+ if shared:
187
+ raise bad(f"decoy {decoy_id!r} shares match keywords with a bug: {sorted(shared)}")
188
+ decoys.append(Decoy(id=str(decoy_id), description=str(raw.get("description", "")), match=match))
189
+ return BugSuite(name=name, tasks=tasks, bugs=bugs, variants=variants, decoys=decoys,
164
190
  version=int(data.get("version", 1)), description=str(data.get("description", "")),
165
191
  platform=str(data.get("platform", "playwright")), site=str(data["site"]))
166
192
 
167
193
 
194
+ def _nested_keywords(match: list[str]) -> list[tuple[str, str]]:
195
+ """Pairs (inner, outer) where one keyword contains another: a single mention
196
+ of the outer one would count as two hits."""
197
+ return [(a, b) for a in match for b in match if a != b and a in b]
198
+
199
+
168
200
  def _shared_keywords(bugs: list[PlantedBug]) -> set[str]:
169
201
  seen: set[str] = set()
170
202
  shared: set[str] = set()
@@ -349,13 +381,32 @@ def summarize(runs: list[SuiteRun]) -> Summary:
349
381
 
350
382
  def match_report(report: str, planted: list[PlantedBug]) -> str | None:
351
383
  """The planted bug a report is about: the one whose keywords it mentions most."""
384
+ return _best_match(report, planted)[0]
385
+
386
+
387
+ def classify_report(report: str, planted: list[PlantedBug],
388
+ decoys: list[Decoy]) -> tuple[str | None, str | None]:
389
+ """(planted bug id, decoy id) for a report; at most one is set.
390
+
391
+ A report that mentions a decoy at least as much as any planted bug is
392
+ about the decoy: ties go against the bug finder, so precision isn't
393
+ flattered by an ambiguous report.
394
+ """
395
+ bug, bug_hits = _best_match(report, planted)
396
+ decoy, decoy_hits = _best_match(report, decoys)
397
+ if decoy is not None and decoy_hits >= bug_hits:
398
+ return None, decoy
399
+ return bug, None
400
+
401
+
402
+ def _best_match(report: str, candidates: list) -> tuple[str | None, int]:
352
403
  text = report.lower()
353
404
  best, best_hits = None, 0
354
- for bug in planted:
355
- hits = sum(keyword in text for keyword in bug.match)
405
+ for candidate in candidates:
406
+ hits = sum(keyword in text for keyword in candidate.match)
356
407
  if hits > best_hits:
357
- best, best_hits = bug.id, hits
358
- return best
408
+ best, best_hits = candidate.id, hits
409
+ return best, best_hits
359
410
 
360
411
 
361
412
  @dataclass
@@ -365,6 +416,7 @@ class VariantResult:
365
416
  outcome: str = "run" # run | error | not_run
366
417
  reports: list[str] = field(default_factory=list) # bugs FusionTest reported
367
418
  matches: list[str | None] = field(default_factory=list) # planted id per report, or None
419
+ decoy_trips: list[str] = field(default_factory=list) # decoys that false reports were about
368
420
  tasks_passed: int = 0
369
421
  tasks: int = 0
370
422
  failed_tasks: list[str] = field(default_factory=list) # "task — why", for diagnosis
@@ -385,10 +437,12 @@ def score_variant(suite: BugSuite, variant: Variant, run: RunResult) -> VariantR
385
437
  planted = [suite.bugs[b] for b in variant.bugs]
386
438
  reports = [str(r) for r in run.bugs_detected]
387
439
  evaluated = run.steps and not run.errored
440
+ classified = [classify_report(r, planted, suite.decoys) for r in reports]
388
441
  return VariantResult(
389
442
  variant=variant.name, planted=list(variant.bugs),
390
443
  outcome="run" if evaluated else "error",
391
- reports=reports, matches=[match_report(r, planted) for r in reports],
444
+ reports=reports, matches=[bug for bug, _ in classified],
445
+ decoy_trips=[decoy for _, decoy in classified if decoy],
392
446
  tasks_passed=sum(s.success for s in run.steps), tasks=len(suite.tasks),
393
447
  failed_tasks=[f"{s.goal} — {s.error}" for s in run.steps if not s.success],
394
448
  seconds=round(sum(s.duration_seconds for s in run.steps), 2),
@@ -432,6 +486,7 @@ class BugSummary:
432
486
  true_reports: int
433
487
  false_reports: int
434
488
  false_on_clean: int # reports on variants with nothing planted
489
+ decoy_trips: int = 0 # false reports about decoys
435
490
 
436
491
  @property
437
492
  def precision(self) -> float | None:
@@ -458,6 +513,7 @@ def summarize_bugs(runs: list[BugSuiteRun]) -> BugSummary:
458
513
  planted=sum(len(v.planted) for v in evaluated), found=sum(len(v.found) for v in evaluated),
459
514
  reports=reports, true_reports=reports - false_reports, false_reports=false_reports,
460
515
  false_on_clean=sum(len(v.reports) for v in evaluated if not v.planted),
516
+ decoy_trips=sum(len(v.decoy_trips) for v in evaluated),
461
517
  )
462
518
 
463
519
 
@@ -12,6 +12,9 @@
12
12
  all off unless the benchmark server turns them on for a variant, by serving
13
13
  bugs.js with their ids (see PLANTED below). Some are server-side: a 500 from
14
14
  api/order and a 404 for help.html.
15
+ And it has decoys, always on: behaviour that looks broken at a glance but is
16
+ correct and explained on screen (see DECOYS below). A bug finder that
17
+ reports them is producing false bugs.
15
18
  Keep it stable: suites assert on its exact text. Change it only together
16
19
  with the suites, and note the change in the suite version.
17
20
  -->
@@ -60,6 +63,7 @@
60
63
  <h1>Products</h1>
61
64
  <div class="field"><label for="search">Search products</label><input id="search" type="search"></div>
62
65
  <p id="search-status"></p>
66
+ <p id="product-status" role="status"></p>
63
67
  <ul class="products" id="product-list"></ul>
64
68
  </section>
65
69
 
@@ -69,12 +73,14 @@
69
73
  <ul id="cart-list"></ul>
70
74
  <p id="cart-empty" hidden>Your cart is empty</p>
71
75
  <p id="cart-discount"></p>
76
+ <p id="cart-shipping"></p>
72
77
  <p id="cart-total"></p>
73
78
  <form id="coupon-form" novalidate>
74
79
  <div class="field"><label for="coupon">Coupon code</label><input id="coupon" autocomplete="off"></div>
75
80
  <button type="submit">Apply coupon</button>
76
81
  </form>
77
82
  <p id="coupon-status" role="status"></p>
83
+ <p id="fee-note"></p>
78
84
  <a href="#/checkout" id="checkout-link">Checkout</a>
79
85
  </section>
80
86
 
@@ -91,7 +97,7 @@
91
97
  <div class="field"><label for="shipping">Shipping method</label>
92
98
  <select id="shipping">
93
99
  <option value="standard">Standard shipping (free)</option>
94
- <option value="express">Express shipping ($9.00)</option>
100
+ <option value="express" id="express-option">Express shipping ($9.00)</option>
95
101
  </select></div>
96
102
  <div class="field"><label><input type="checkbox" id="terms"> I accept the terms and conditions</label>
97
103
  <span class="error" id="terms-error" hidden>You must accept the terms</span></div>
@@ -117,13 +123,23 @@
117
123
  // checkout-500 (server) api/order returns 500 and the page silently does nothing
118
124
  // dead-link (server) help.html returns 404
119
125
  const PLANTED = new Set(window.PLANTED_BUGS || []);
126
+ // Decoys (ADR-009), always on. Each looks like a bug but is the shop working
127
+ // as designed, with the reason on screen:
128
+ // limit-per-order a second Blue Mug isn't added: "Limit 1 per order"
129
+ // expired-coupon SPRING24 is refused: "Coupon SPRING24 expired on 31 May"
130
+ // freeship-coupon FREESHIP leaves the cart total unchanged: it makes
131
+ // Express shipping free at checkout, and says so
132
+ // service-fee the order total is $1.50 more than the cart total:
133
+ // "A $1.50 service fee is added at checkout"
134
+ const SERVICE_FEE = 1.50;
120
135
  const PRODUCTS = [
121
- { id: "mug", name: "Blue Mug", price: 12.00 },
136
+ { id: "mug", name: "Blue Mug", price: 12.00, limit: 1 },
122
137
  { id: "tea", name: "Green Tea", price: 15.00 },
123
138
  { id: "notebook", name: "Notebook", price: 8.50 },
124
139
  ];
125
- const COUPONS = { SAVE10: 0.10 };
126
- const state = { signedIn: false, cart: {}, filter: "", order: null, coupon: null };
140
+ const COUPONS = { SAVE10: { percent: 0.10 }, FREESHIP: { freeShipping: true },
141
+ SPRING24: { expired: "31 May" } };
142
+ const state = { signedIn: false, cart: {}, filter: "", order: null, coupon: null, freeShipping: false };
127
143
  const $ = (id) => document.getElementById(id);
128
144
  const money = (n) => "$" + n.toFixed(2);
129
145
  const cartCount = () => Object.values(state.cart).reduce((a, b) => a + b, 0);
@@ -133,7 +149,7 @@
133
149
  if (PLANTED.has("total-wrong") && lines.length > 1) lines.pop();
134
150
  return lines.reduce((a, b) => a + b, 0);
135
151
  };
136
- const discount = () => state.coupon ? Math.round(subtotal() * COUPONS[state.coupon] * 100) / 100 : 0;
152
+ const discount = () => state.coupon ? Math.round(subtotal() * COUPONS[state.coupon].percent * 100) / 100 : 0;
137
153
  const cartTotal = () => subtotal() - discount();
138
154
 
139
155
  function renderProducts() {
@@ -142,12 +158,18 @@
142
158
  const shown = PRODUCTS.filter(p => p.name.toLowerCase().includes(state.filter));
143
159
  for (const p of shown) {
144
160
  const li = document.createElement("li");
145
- li.innerHTML = `<h3>${p.name}</h3><span>${money(p.price)}</span><button type="button">Add to cart</button>`;
161
+ const limit = p.limit ? `<span>Limit ${p.limit} per order</span>` : "";
162
+ li.innerHTML = `<h3>${p.name}</h3>${limit}<span>${money(p.price)}</span><button type="button">Add to cart</button>`;
146
163
  li.querySelector("button").addEventListener("click", () => {
147
164
  if (PLANTED.has("js-exception") && p.id === "notebook") {
148
165
  const stock = undefined;
149
166
  stock.reserved += 1; // TypeError, uncaught
150
167
  }
168
+ if (p.limit && (state.cart[p.id] || 0) >= p.limit) {
169
+ $("product-status").textContent = `${p.name} is limited to ${p.limit} per order`;
170
+ return;
171
+ }
172
+ $("product-status").textContent = "";
151
173
  state.cart[p.id] = (state.cart[p.id] || 0) + 1;
152
174
  renderNav();
153
175
  });
@@ -177,7 +199,12 @@
177
199
  $("coupon-form").hidden = cartCount() === 0;
178
200
  $("cart-discount").textContent = cartCount() && state.coupon
179
201
  ? `Discount (${state.coupon}): -${money(discount())}` : "";
202
+ $("cart-shipping").textContent = cartCount() && state.freeShipping
203
+ ? "Free Express shipping (FREESHIP) will be applied at checkout" : "";
180
204
  $("cart-total").textContent = cartCount() ? `Total: ${money(cartTotal())}` : "";
205
+ $("fee-note").textContent = cartCount() ? `A ${money(SERVICE_FEE)} service fee is added at checkout.` : "";
206
+ $("express-option").textContent = state.freeShipping
207
+ ? "Express shipping (free with FREESHIP)" : "Express shipping ($9.00)";
181
208
  }
182
209
 
183
210
  function renderNav() {
@@ -194,6 +221,7 @@
194
221
  const path = location.hash.replace(/^#\//, "") || "login";
195
222
  if (path === "signout") { // "Sign out" link
196
223
  state.signedIn = false; state.cart = {}; state.filter = ""; state.order = null; state.coupon = null;
224
+ state.freeShipping = false;
197
225
  location.replace("#/login");
198
226
  return;
199
227
  }
@@ -221,9 +249,19 @@
221
249
  $("coupon-form").addEventListener("submit", (e) => {
222
250
  e.preventDefault();
223
251
  const code = $("coupon").value.trim().toUpperCase();
224
- if (!COUPONS[code]) { $("coupon-status").textContent = `Coupon ${code || "code"} is not valid`; return; }
225
- if (!PLANTED.has("coupon-noop")) state.coupon = code;
226
- $("coupon-status").textContent = `Coupon ${code} applied: ${COUPONS[code] * 100}% off`;
252
+ const coupon = COUPONS[code];
253
+ if (!coupon) { $("coupon-status").textContent = `Coupon ${code || "code"} is not valid`; return; }
254
+ if (coupon.expired) {
255
+ $("coupon-status").textContent = `Coupon ${code} expired on ${coupon.expired}`;
256
+ return;
257
+ }
258
+ if (coupon.freeShipping) {
259
+ state.freeShipping = true;
260
+ $("coupon-status").textContent = `Coupon ${code} applied: free Express shipping at checkout`;
261
+ } else {
262
+ if (!PLANTED.has("coupon-noop")) state.coupon = code;
263
+ $("coupon-status").textContent = `Coupon ${code} applied: ${coupon.percent * 100}% off`;
264
+ }
227
265
  renderCart();
228
266
  });
229
267
 
@@ -240,12 +278,15 @@
240
278
  valid = valid && $("terms").checked;
241
279
  if (!valid) return;
242
280
  const express = $("shipping").value === "express";
243
- const total = cartTotal() + (express ? 9 : 0);
281
+ const items = cartTotal();
282
+ const shippingCost = express && !state.freeShipping ? 9 : 0;
283
+ const total = items + shippingCost + SERVICE_FEE;
244
284
  const confirm = () => {
245
285
  state.order = { number: "ACME-1001", express, total };
246
286
  $("confirmation-detail").textContent =
247
- `Order ACME-1001 for ${$("name").value.trim()} — ${express ? "Express" : "Standard"} shipping — total ${money(total)}`;
248
- state.cart = {}; state.coupon = null; renderNav();
287
+ `Order ACME-1001 for ${$("name").value.trim()} — ${express ? "Express" : "Standard"} shipping — ` +
288
+ `items ${money(items)} + shipping ${money(shippingCost)} + service fee ${money(SERVICE_FEE)} = total ${money(total)}`;
289
+ state.cart = {}; state.coupon = null; state.freeShipping = false; renderNav();
249
290
  location.hash = "#/confirmation";
250
291
  };
251
292
  // A failed request leaves the page as it is, with no message: that's the
@@ -11,10 +11,17 @@
11
11
  #
12
12
  # A report matches the planted bug whose `match` keywords it mentions most
13
13
  # (case-insensitive); none mentioned means no match. Keep keywords specific to
14
- # the defect, and keep the bugs in one variant from sharing keywords.
14
+ # the defect, and keep the bugs in one variant from sharing keywords. No
15
+ # keyword may contain another in the same list ("fee" in "service fee"): one
16
+ # mention would count twice.
17
+ #
18
+ # Decoys are always on, in every variant: shop behaviour that looks like a bug
19
+ # but is correct and explained on screen. A report that mentions a decoy's
20
+ # keywords at least as much as any planted bug's is a false report, counted
21
+ # as a decoy trip, so we can see which decoys fool the bug finder.
15
22
  name: shop-bugs
16
23
  kind: bugs
17
- version: 1
24
+ version: 3 # v3: match keywords fixed (no keyword inside another); v2: decoys
18
25
  description: Bug finding on Acme Shop variants with planted defects (ADR-009)
19
26
  platform: playwright
20
27
  site: shop
@@ -22,7 +29,8 @@ site: shop
22
29
  tasks:
23
30
  - "Sign in with email demo@acme.test and password hunter2"
24
31
  - "Add Blue Mug, Green Tea and Notebook to the cart"
25
- - "Open the cart and apply the coupon code SAVE10"
32
+ - "Add another Blue Mug to the cart"
33
+ - "Open the cart and apply the coupon codes SPRING24, FREESHIP and SAVE10, one at a time"
26
34
  - "Remove Notebook from the cart"
27
35
  - "Go to checkout, fill in full name Ada Lovelace, email ada@example.test and shipping address 1 Main St, keep Standard shipping, accept the terms and place the order"
28
36
  - "Open the Help page" # last: a 404 page has no way back into the shop
@@ -39,7 +47,7 @@ bugs:
39
47
  total-wrong:
40
48
  kind: inconsistency
41
49
  description: "The cart total leaves out the last line item"
42
- match: [total, sum, subtotal]
50
+ match: [subtotal, "10% of", does not equal, doesn't equal, add up]
43
51
  remove-noop:
44
52
  kind: broken_promise
45
53
  description: "Remove in the cart does nothing"
@@ -57,6 +65,20 @@ bugs:
57
65
  description: "The Help link returns 404"
58
66
  match: [help, "404", not found]
59
67
 
68
+ decoys:
69
+ limit-per-order:
70
+ description: "A second Blue Mug isn't added: the product row says 'Limit 1 per order'"
71
+ match: [limit, per order]
72
+ expired-coupon:
73
+ description: "SPRING24 is refused with 'Coupon SPRING24 expired on 31 May'"
74
+ match: [spring24, expired]
75
+ freeship-coupon:
76
+ description: "FREESHIP leaves the cart total unchanged; it makes Express shipping free at checkout and says so"
77
+ match: [freeship, free shipping, free express]
78
+ service-fee:
79
+ description: "The order total is $1.50 more than the cart total: 'A $1.50 service fee is added at checkout'"
80
+ match: [service fee, "$1.50"]
81
+
60
82
  # Bugs in one variant don't interfere with each other's tasks. `clean` has no
61
83
  # bugs: anything reported there is a false bug.
62
84
  variants:
@@ -2,7 +2,7 @@
2
2
  # Cases run in order and share browser state. `expect: fail` cases are goals
3
3
  # that are NOT satisfied on the page; a model that "passes" them is a false pass.
4
4
  name: shop
5
- version: 2 # v2: Sign out has its own route; Back to the login page no longer signs out
5
+ version: 3 # v3: fixture gained bug-suite decoys (Blue Mug limit, service fee at checkout); cases unchanged
6
6
  description: Login, search, cart, checkout validation and order on the local Acme Shop fixture
7
7
  platform: playwright
8
8
  site: shop # served from fusiontest/bench/sites/shop
@@ -785,6 +785,8 @@ def _print_variants(run) -> None:
785
785
  detail += f", {len(v.reports)} report(s), {v.false_reports} false"
786
786
  if missed:
787
787
  detail += f" · missed {', '.join(missed)}"
788
+ if v.decoy_trips:
789
+ detail += f" · fooled by {', '.join(v.decoy_trips)}"
788
790
  console.print(f" {mark} {v.variant:<10} {detail} "
789
791
  f"[dim](tasks passed {v.tasks_passed}/{v.tasks})[/dim]")
790
792
 
@@ -795,13 +797,15 @@ def _pct(x: float | None) -> str:
795
797
 
796
798
  def _bug_table(bug_summaries, bug_runs) -> Table:
797
799
  table = Table(title="Bug finding", header_style="bold", box=None, pad_edge=False)
798
- for col in ("Suite", "Backend", "Precision", "Recall", "False on clean", "Reports", "Errors", "Cost"):
800
+ for col in ("Suite", "Backend", "Precision", "Recall", "False on clean", "Decoy trips", "Reports",
801
+ "Errors", "Cost"):
799
802
  table.add_column(col, justify="left" if col in ("Suite", "Backend") else "right")
800
803
  for sm in bug_summaries:
801
804
  table.add_row(
802
805
  sm.suite, sm.backend, f"{_pct(sm.precision)} ({sm.true_reports}/{sm.reports})",
803
806
  f"{_pct(sm.recall)} ({sm.found}/{sm.planted})", str(sm.false_on_clean),
804
- str(sm.reports), str(sm.errors), _cost_cell(bug_runs, sm.suite, sm.backend))
807
+ str(sm.decoy_trips), str(sm.reports), str(sm.errors),
808
+ _cost_cell(bug_runs, sm.suite, sm.backend))
805
809
  return table
806
810
 
807
811
 
@@ -811,10 +815,11 @@ def _bench_markdown(summaries, runs, spend_line: str, bug_summaries=(), bug_runs
811
815
  lines += _goal_markdown(summaries, runs)
812
816
  if bug_summaries:
813
817
  lines += ["### Bug finding", "",
814
- "| Suite | Backend | Precision | Recall | False on clean | Reports | Errors | Cost |",
815
- "|---|---|---|---|---|---|---|---|"]
818
+ "| Suite | Backend | Precision | Recall | False on clean | Decoy trips | Reports | Errors | Cost |",
819
+ "|---|---|---|---|---|---|---|---|---|"]
816
820
  lines += [f"| {sm.suite} | {sm.backend} | {_pct(sm.precision)} ({sm.true_reports}/{sm.reports}) | "
817
- f"{_pct(sm.recall)} ({sm.found}/{sm.planted}) | {sm.false_on_clean} | {sm.reports} | "
821
+ f"{_pct(sm.recall)} ({sm.found}/{sm.planted}) | {sm.false_on_clean} | {sm.decoy_trips} | "
822
+ f"{sm.reports} | "
818
823
  f"{sm.errors} | {_cost_cell(bug_runs, sm.suite, sm.backend)} |" for sm in bug_summaries]
819
824
  lines.append("")
820
825
  return "\n".join(lines + [spend_line, ""])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
5
5
  Author-email: FusionLeap <hello@fusionleap.io>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fusiontest"
7
- version = "0.2.22"
7
+ version = "0.2.24"
8
8
  description = "AI-powered UI testing for mobile and desktop — by FusionLeap.io"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes