fusiontest 0.2.22__tar.gz → 0.2.23__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.
- {fusiontest-0.2.22 → fusiontest-0.2.23}/PKG-INFO +1 -1
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/__init__.py +52 -6
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/sites/shop/index.html +53 -12
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/suites/shop-bugs.yaml +22 -2
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/suites/shop.yaml +1 -1
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/cli.py +10 -5
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/PKG-INFO +1 -1
- {fusiontest-0.2.22 → fusiontest-0.2.23}/pyproject.toml +1 -1
- {fusiontest-0.2.22 → fusiontest-0.2.23}/README.md +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/sites/shop/bugs.js +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/sites/shop/help.html +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/bench/suites/todomvc.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/action_model.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/app_errors.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/goal_verifier.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/netguard.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/promise_checker.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/replay.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/runner.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/screen_parser.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/secrets.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/shared_traces.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/core/tokens.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/fusiontest_dashboard.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/github.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/hacker_news.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/httpbin.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/todomvc.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/demos/wikipedia.yaml +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/desktop/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/desktop/macos_adapter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/desktop/playwright_adapter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/desktop/windows_adapter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/discovery/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/discovery/goal_generator.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/guardrails/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/guardrails/engine.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/mobile/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/mobile/android_adapter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/mobile/ios_adapter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/reporting/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/reporting/reporter.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/training/__init__.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/training/data_collector.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/training/dataset_builder.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest/training/trainer.py +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/SOURCES.txt +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/dependency_links.txt +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/entry_points.txt +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/not-zip-safe +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/requires.txt +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/fusiontest.egg-info/top_level.txt +0 -0
- {fusiontest-0.2.22 → fusiontest-0.2.23}/setup.cfg +0 -0
|
@@ -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]:
|
|
@@ -160,7 +172,17 @@ def _load_bug_suite(data: dict, source: str) -> BugSuite:
|
|
|
160
172
|
unplanted = set(bugs) - {b for v in variants for b in v.bugs}
|
|
161
173
|
if unplanted:
|
|
162
174
|
raise bad(f"bugs never planted in a variant: {sorted(unplanted)}")
|
|
163
|
-
|
|
175
|
+
decoys = []
|
|
176
|
+
bug_keywords = {k for b in bugs.values() for k in b.match}
|
|
177
|
+
for decoy_id, raw in (data.get("decoys") or {}).items():
|
|
178
|
+
match = [str(k).lower() for k in (raw or {}).get("match") or []]
|
|
179
|
+
if not match:
|
|
180
|
+
raise bad(f"decoy {decoy_id!r} needs match keywords")
|
|
181
|
+
shared = bug_keywords & set(match)
|
|
182
|
+
if shared:
|
|
183
|
+
raise bad(f"decoy {decoy_id!r} shares match keywords with a bug: {sorted(shared)}")
|
|
184
|
+
decoys.append(Decoy(id=str(decoy_id), description=str(raw.get("description", "")), match=match))
|
|
185
|
+
return BugSuite(name=name, tasks=tasks, bugs=bugs, variants=variants, decoys=decoys,
|
|
164
186
|
version=int(data.get("version", 1)), description=str(data.get("description", "")),
|
|
165
187
|
platform=str(data.get("platform", "playwright")), site=str(data["site"]))
|
|
166
188
|
|
|
@@ -349,13 +371,32 @@ def summarize(runs: list[SuiteRun]) -> Summary:
|
|
|
349
371
|
|
|
350
372
|
def match_report(report: str, planted: list[PlantedBug]) -> str | None:
|
|
351
373
|
"""The planted bug a report is about: the one whose keywords it mentions most."""
|
|
374
|
+
return _best_match(report, planted)[0]
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def classify_report(report: str, planted: list[PlantedBug],
|
|
378
|
+
decoys: list[Decoy]) -> tuple[str | None, str | None]:
|
|
379
|
+
"""(planted bug id, decoy id) for a report; at most one is set.
|
|
380
|
+
|
|
381
|
+
A report that mentions a decoy at least as much as any planted bug is
|
|
382
|
+
about the decoy: ties go against the bug finder, so precision isn't
|
|
383
|
+
flattered by an ambiguous report.
|
|
384
|
+
"""
|
|
385
|
+
bug, bug_hits = _best_match(report, planted)
|
|
386
|
+
decoy, decoy_hits = _best_match(report, decoys)
|
|
387
|
+
if decoy is not None and decoy_hits >= bug_hits:
|
|
388
|
+
return None, decoy
|
|
389
|
+
return bug, None
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
def _best_match(report: str, candidates: list) -> tuple[str | None, int]:
|
|
352
393
|
text = report.lower()
|
|
353
394
|
best, best_hits = None, 0
|
|
354
|
-
for
|
|
355
|
-
hits = sum(keyword in text for keyword in
|
|
395
|
+
for candidate in candidates:
|
|
396
|
+
hits = sum(keyword in text for keyword in candidate.match)
|
|
356
397
|
if hits > best_hits:
|
|
357
|
-
best, best_hits =
|
|
358
|
-
return best
|
|
398
|
+
best, best_hits = candidate.id, hits
|
|
399
|
+
return best, best_hits
|
|
359
400
|
|
|
360
401
|
|
|
361
402
|
@dataclass
|
|
@@ -365,6 +406,7 @@ class VariantResult:
|
|
|
365
406
|
outcome: str = "run" # run | error | not_run
|
|
366
407
|
reports: list[str] = field(default_factory=list) # bugs FusionTest reported
|
|
367
408
|
matches: list[str | None] = field(default_factory=list) # planted id per report, or None
|
|
409
|
+
decoy_trips: list[str] = field(default_factory=list) # decoys that false reports were about
|
|
368
410
|
tasks_passed: int = 0
|
|
369
411
|
tasks: int = 0
|
|
370
412
|
failed_tasks: list[str] = field(default_factory=list) # "task — why", for diagnosis
|
|
@@ -385,10 +427,12 @@ def score_variant(suite: BugSuite, variant: Variant, run: RunResult) -> VariantR
|
|
|
385
427
|
planted = [suite.bugs[b] for b in variant.bugs]
|
|
386
428
|
reports = [str(r) for r in run.bugs_detected]
|
|
387
429
|
evaluated = run.steps and not run.errored
|
|
430
|
+
classified = [classify_report(r, planted, suite.decoys) for r in reports]
|
|
388
431
|
return VariantResult(
|
|
389
432
|
variant=variant.name, planted=list(variant.bugs),
|
|
390
433
|
outcome="run" if evaluated else "error",
|
|
391
|
-
reports=reports, matches=[
|
|
434
|
+
reports=reports, matches=[bug for bug, _ in classified],
|
|
435
|
+
decoy_trips=[decoy for _, decoy in classified if decoy],
|
|
392
436
|
tasks_passed=sum(s.success for s in run.steps), tasks=len(suite.tasks),
|
|
393
437
|
failed_tasks=[f"{s.goal} — {s.error}" for s in run.steps if not s.success],
|
|
394
438
|
seconds=round(sum(s.duration_seconds for s in run.steps), 2),
|
|
@@ -432,6 +476,7 @@ class BugSummary:
|
|
|
432
476
|
true_reports: int
|
|
433
477
|
false_reports: int
|
|
434
478
|
false_on_clean: int # reports on variants with nothing planted
|
|
479
|
+
decoy_trips: int = 0 # false reports about decoys
|
|
435
480
|
|
|
436
481
|
@property
|
|
437
482
|
def precision(self) -> float | None:
|
|
@@ -458,6 +503,7 @@ def summarize_bugs(runs: list[BugSuiteRun]) -> BugSummary:
|
|
|
458
503
|
planted=sum(len(v.planted) for v in evaluated), found=sum(len(v.found) for v in evaluated),
|
|
459
504
|
reports=reports, true_reports=reports - false_reports, false_reports=false_reports,
|
|
460
505
|
false_on_clean=sum(len(v.reports) for v in evaluated if not v.planted),
|
|
506
|
+
decoy_trips=sum(len(v.decoy_trips) for v in evaluated),
|
|
461
507
|
)
|
|
462
508
|
|
|
463
509
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
225
|
-
if (!
|
|
226
|
-
|
|
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
|
|
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 —
|
|
248
|
-
|
|
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
|
|
@@ -12,9 +12,14 @@
|
|
|
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
14
|
# the defect, and keep the bugs in one variant from sharing keywords.
|
|
15
|
+
#
|
|
16
|
+
# Decoys are always on, in every variant: shop behaviour that looks like a bug
|
|
17
|
+
# but is correct and explained on screen. A report that mentions a decoy's
|
|
18
|
+
# keywords at least as much as any planted bug's is a false report, counted
|
|
19
|
+
# as a decoy trip, so we can see which decoys fool the bug finder.
|
|
15
20
|
name: shop-bugs
|
|
16
21
|
kind: bugs
|
|
17
|
-
version:
|
|
22
|
+
version: 2 # v2: decoys and the tasks that reach them
|
|
18
23
|
description: Bug finding on Acme Shop variants with planted defects (ADR-009)
|
|
19
24
|
platform: playwright
|
|
20
25
|
site: shop
|
|
@@ -22,7 +27,8 @@ site: shop
|
|
|
22
27
|
tasks:
|
|
23
28
|
- "Sign in with email demo@acme.test and password hunter2"
|
|
24
29
|
- "Add Blue Mug, Green Tea and Notebook to the cart"
|
|
25
|
-
- "
|
|
30
|
+
- "Add another Blue Mug to the cart"
|
|
31
|
+
- "Open the cart and apply the coupon codes SPRING24, FREESHIP and SAVE10, one at a time"
|
|
26
32
|
- "Remove Notebook from the cart"
|
|
27
33
|
- "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
34
|
- "Open the Help page" # last: a 404 page has no way back into the shop
|
|
@@ -57,6 +63,20 @@ bugs:
|
|
|
57
63
|
description: "The Help link returns 404"
|
|
58
64
|
match: [help, "404", not found]
|
|
59
65
|
|
|
66
|
+
decoys:
|
|
67
|
+
limit-per-order:
|
|
68
|
+
description: "A second Blue Mug isn't added: the product row says 'Limit 1 per order'"
|
|
69
|
+
match: [limit, per order]
|
|
70
|
+
expired-coupon:
|
|
71
|
+
description: "SPRING24 is refused with 'Coupon SPRING24 expired on 31 May'"
|
|
72
|
+
match: [spring24, expired]
|
|
73
|
+
freeship-coupon:
|
|
74
|
+
description: "FREESHIP leaves the cart total unchanged; it makes Express shipping free at checkout and says so"
|
|
75
|
+
match: [freeship, free shipping, free express]
|
|
76
|
+
service-fee:
|
|
77
|
+
description: "The order total is $1.50 more than the cart total: 'A $1.50 service fee is added at checkout'"
|
|
78
|
+
match: [service fee, fee, "$1.50"]
|
|
79
|
+
|
|
60
80
|
# Bugs in one variant don't interfere with each other's tasks. `clean` has no
|
|
61
81
|
# bugs: anything reported there is a false bug.
|
|
62
82
|
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:
|
|
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", "
|
|
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.
|
|
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.
|
|
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, ""])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|