@ia-qa/qa-discovery 0.11.1 → 0.12.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 +19 -3
- package/ROADMAP.md +11 -0
- package/TUTORIAL.md +69 -0
- package/dist/ai/model.js +4 -3
- package/dist/ai/model.js.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +28 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/scenarios.d.ts +1 -0
- package/dist/cli/scenarios.js +142 -0
- package/dist/cli/scenarios.js.map +1 -0
- package/dist/cli-ai/index.js +4 -2
- package/dist/cli-ai/index.js.map +1 -1
- package/dist/mcp/server.d.ts +61 -0
- package/dist/mcp/server.js +48 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/scenarios/emit.d.ts +17 -0
- package/dist/scenarios/emit.js +62 -0
- package/dist/scenarios/emit.js.map +1 -0
- package/dist/scenarios/gherkin.d.ts +29 -0
- package/dist/scenarios/gherkin.js +111 -0
- package/dist/scenarios/gherkin.js.map +1 -0
- package/dist/scenarios/live.d.ts +50 -0
- package/dist/scenarios/live.js +479 -0
- package/dist/scenarios/live.js.map +1 -0
- package/dist/scenarios/run.d.ts +47 -0
- package/dist/scenarios/run.js +177 -0
- package/dist/scenarios/run.js.map +1 -0
- package/dist/scenarios/steps.d.ts +108 -0
- package/dist/scenarios/steps.js +143 -0
- package/dist/scenarios/steps.js.map +1 -0
- package/package.json +2 -2
- package/skills/ia-qa-discover/SKILL.md +7 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Browser, Locator, Page } from 'playwright';
|
|
2
|
+
import type { GherkinScenario } from './gherkin';
|
|
3
|
+
import { type PlanStep, type Target } from './steps';
|
|
4
|
+
/**
|
|
5
|
+
* Bind a validated scenario to the live page, run it, and prove the test it becomes.
|
|
6
|
+
*
|
|
7
|
+
* **Binding uses Playwright's own engine, never a re-implementation.** A step is bound when
|
|
8
|
+
* `getByRole` (or `getByLabel`, `getByText`) counts exactly one element on the page as it
|
|
9
|
+
* stands at that step. Nothing is guessed: no match is a step for a person, several matches
|
|
10
|
+
* are named and left for a person too. The element is observed, so the locator exists.
|
|
11
|
+
*
|
|
12
|
+
* **"Proven" means two things, and the second is the one generators skip.** The plan passes
|
|
13
|
+
* twice in fresh browsers, and each assertion fails when the thing it checks is altered on
|
|
14
|
+
* the page. A test that stays green while its target says something else checks nothing;
|
|
15
|
+
* it is reported as blind, not counted as a test.
|
|
16
|
+
*/
|
|
17
|
+
export type ScenarioStatus = 'proven' | 'blind' | 'unverified' | 'flaky' | 'failing' | 'needs-input' | 'not-run';
|
|
18
|
+
export interface BoundStep {
|
|
19
|
+
line: number;
|
|
20
|
+
text: string;
|
|
21
|
+
plan: PlanStep;
|
|
22
|
+
}
|
|
23
|
+
export interface ScenarioResult {
|
|
24
|
+
name: string;
|
|
25
|
+
line: number;
|
|
26
|
+
status: ScenarioStatus;
|
|
27
|
+
/** One sentence naming what happened, written for the person who wrote the scenario. */
|
|
28
|
+
reason?: string;
|
|
29
|
+
/** The step the reason is about. */
|
|
30
|
+
step?: {
|
|
31
|
+
line: number;
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
/** For an ambiguous step, what the page offered; for a missing one, what it does show. */
|
|
35
|
+
candidates?: string[];
|
|
36
|
+
steps?: BoundStep[];
|
|
37
|
+
/** Further problems found in the same scenario, so one run names all of them. */
|
|
38
|
+
also?: string[];
|
|
39
|
+
/** Assertions that stayed green while their target was altered. */
|
|
40
|
+
blind?: Array<{
|
|
41
|
+
line: number;
|
|
42
|
+
text: string;
|
|
43
|
+
why: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export declare const MUTATION_MARK = "ia-qa mutation";
|
|
47
|
+
export declare function locate(page: Page, t: Target): Locator;
|
|
48
|
+
/** Run one bound step exactly as the written test would, with Playwright's default timeouts. */
|
|
49
|
+
export declare function execute(page: Page, step: PlanStep, timeout?: number): Promise<void>;
|
|
50
|
+
export declare function proveScenario(browser: Browser, scenario: GherkinScenario, baseUrl: string | undefined, session?: string): Promise<ScenarioResult>;
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MUTATION_MARK = void 0;
|
|
4
|
+
exports.locate = locate;
|
|
5
|
+
exports.execute = execute;
|
|
6
|
+
exports.proveScenario = proveScenario;
|
|
7
|
+
const steps_1 = require("./steps");
|
|
8
|
+
const TIMEOUT = 5000;
|
|
9
|
+
const MUTATION_TIMEOUT = 2000;
|
|
10
|
+
const POLL = 150;
|
|
11
|
+
exports.MUTATION_MARK = 'ia-qa mutation';
|
|
12
|
+
const CLICK_ROLES = ['button', 'link', 'tab', 'menuitem', 'checkbox', 'radio', 'option', 'switch'];
|
|
13
|
+
class StepProblem extends Error {
|
|
14
|
+
status;
|
|
15
|
+
candidates;
|
|
16
|
+
constructor(status, message, candidates) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.status = status;
|
|
19
|
+
this.candidates = candidates;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
23
|
+
async function poll(fn, timeout = TIMEOUT) {
|
|
24
|
+
const end = Date.now() + timeout;
|
|
25
|
+
for (;;) {
|
|
26
|
+
const v = await fn();
|
|
27
|
+
if (v !== undefined)
|
|
28
|
+
return v;
|
|
29
|
+
if (Date.now() >= end)
|
|
30
|
+
return undefined;
|
|
31
|
+
await sleep(POLL);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wait until the page stops changing after an action.
|
|
36
|
+
*
|
|
37
|
+
* Binding reads the page, so it must read the page the action produced. Measured on Sandbox
|
|
38
|
+
* Bazaar: right after a click on a product card, the home page was sometimes still rendered,
|
|
39
|
+
* and "42.00 EUR" was bound to the card's price instead of the product page's — two runs over
|
|
40
|
+
* an unchanged app wrote two different files. A written test does not need this (Playwright
|
|
41
|
+
* retries its assertions); the binding does, because it keeps the first answer it gets.
|
|
42
|
+
*/
|
|
43
|
+
async function settleDom(page) {
|
|
44
|
+
await page.waitForLoadState('load').catch(() => undefined);
|
|
45
|
+
await page
|
|
46
|
+
.evaluate(([quiet, max]) => new Promise((resolve) => {
|
|
47
|
+
let timer = setTimeout(done, quiet);
|
|
48
|
+
const stop = setTimeout(done, max);
|
|
49
|
+
const observer = new MutationObserver(() => {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
timer = setTimeout(done, quiet);
|
|
52
|
+
});
|
|
53
|
+
observer.observe(document, { subtree: true, childList: true, characterData: true, attributes: true });
|
|
54
|
+
function done() {
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
clearTimeout(stop);
|
|
58
|
+
resolve();
|
|
59
|
+
}
|
|
60
|
+
}), [300, 3000])
|
|
61
|
+
.catch(() => undefined);
|
|
62
|
+
}
|
|
63
|
+
function locate(page, t) {
|
|
64
|
+
switch (t.by) {
|
|
65
|
+
case 'role':
|
|
66
|
+
return page.getByRole(t.role, { name: t.name, exact: t.exact });
|
|
67
|
+
case 'label':
|
|
68
|
+
return page.getByLabel(t.text, { exact: t.exact });
|
|
69
|
+
case 'placeholder':
|
|
70
|
+
return page.getByPlaceholder(t.text, { exact: t.exact });
|
|
71
|
+
case 'testid':
|
|
72
|
+
return page.getByTestId(t.id);
|
|
73
|
+
case 'text':
|
|
74
|
+
return page.getByText(t.text, { exact: t.exact });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function names(loc, limit = 6) {
|
|
78
|
+
return loc.evaluateAll((els, n) => els.slice(0, n).map((e) => (e.getAttribute('aria-label') || e.innerText || e.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 80)), limit);
|
|
79
|
+
}
|
|
80
|
+
/** What the page offers to click, so a step that matched nothing comes back with the real names. */
|
|
81
|
+
async function clickable(page) {
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const role of ['button', 'link']) {
|
|
84
|
+
for (const n of await names(page.getByRole(role), 12))
|
|
85
|
+
if (n && !out.includes(n))
|
|
86
|
+
out.push(`${role} "${n}"`);
|
|
87
|
+
}
|
|
88
|
+
return out.slice(0, 12);
|
|
89
|
+
}
|
|
90
|
+
/** The one element of these roles named `name`, exact names first. Several is a refusal, never a pick. */
|
|
91
|
+
async function pickByRole(page, roles, name) {
|
|
92
|
+
for (const exact of [true, false]) {
|
|
93
|
+
const hits = [];
|
|
94
|
+
for (const role of roles) {
|
|
95
|
+
const count = await locate(page, { by: 'role', role, name, exact }).count();
|
|
96
|
+
if (count > 0)
|
|
97
|
+
hits.push({ role, count });
|
|
98
|
+
}
|
|
99
|
+
const total = hits.reduce((n, h) => n + h.count, 0);
|
|
100
|
+
if (total === 1)
|
|
101
|
+
return { target: { by: 'role', role: hits[0].role, name, exact } };
|
|
102
|
+
if (total > 1) {
|
|
103
|
+
const listed = [];
|
|
104
|
+
for (const h of hits)
|
|
105
|
+
for (const n of await names(locate(page, { by: 'role', role: h.role, name, exact })))
|
|
106
|
+
listed.push(`${h.role} "${n}"`);
|
|
107
|
+
return { ambiguous: listed };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
/** The first of these targets that counts exactly one element. */
|
|
113
|
+
async function pickFirst(page, targets) {
|
|
114
|
+
let ambiguous = null;
|
|
115
|
+
for (const t of targets) {
|
|
116
|
+
const count = await locate(page, t).count();
|
|
117
|
+
if (count === 1)
|
|
118
|
+
return { target: t };
|
|
119
|
+
if (count > 1 && !ambiguous)
|
|
120
|
+
ambiguous = await names(locate(page, t));
|
|
121
|
+
}
|
|
122
|
+
return ambiguous ? { ambiguous } : undefined;
|
|
123
|
+
}
|
|
124
|
+
const both = (make) => [make(true), make(false)];
|
|
125
|
+
async function settle(page, pick, what, missing) {
|
|
126
|
+
const found = await poll(pick);
|
|
127
|
+
if (!found) {
|
|
128
|
+
throw new StepProblem('needs-input', `nothing on the page answers to ${what}`, await missing());
|
|
129
|
+
}
|
|
130
|
+
if ('ambiguous' in found) {
|
|
131
|
+
throw new StepProblem('needs-input', `several elements answer to ${what} — name the one you mean more precisely`, found.ambiguous);
|
|
132
|
+
}
|
|
133
|
+
return found.target;
|
|
134
|
+
}
|
|
135
|
+
/** The best locator for an element showing `text`: by role when it has one, by test id, by text last. */
|
|
136
|
+
async function seeTarget(page, text) {
|
|
137
|
+
const found = await poll(() => pickFirst(page, both((exact) => ({ by: 'text', text, exact }))));
|
|
138
|
+
if (!found)
|
|
139
|
+
throw new StepProblem('failing', `"${text}" is not on the page`);
|
|
140
|
+
if ('ambiguous' in found) {
|
|
141
|
+
throw new StepProblem('needs-input', `"${text}" appears in several places — say which one the scenario means`, found.ambiguous);
|
|
142
|
+
}
|
|
143
|
+
const byText = found.target;
|
|
144
|
+
const info = await locate(page, byText).evaluate((el) => {
|
|
145
|
+
const tag = el.tagName.toLowerCase();
|
|
146
|
+
const role = el.getAttribute('role') ||
|
|
147
|
+
(tag === 'a' && el.hasAttribute('href') ? 'link' : tag === 'button' ? 'button' : /^h[1-6]$/.test(tag) ? 'heading' : null);
|
|
148
|
+
let testid = null;
|
|
149
|
+
let node = el;
|
|
150
|
+
for (let i = 0; i < 4 && node; i++, node = node.parentElement) {
|
|
151
|
+
const v = node.getAttribute('data-testid');
|
|
152
|
+
if (v) {
|
|
153
|
+
testid = v;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return { role, own: (el.textContent || '').replace(/\s+/g, ' ').trim(), testid };
|
|
158
|
+
});
|
|
159
|
+
if (info.role) {
|
|
160
|
+
const t = { by: 'role', role: info.role, name: text, exact: info.own === text };
|
|
161
|
+
if ((await locate(page, t).count()) === 1)
|
|
162
|
+
return { target: t };
|
|
163
|
+
}
|
|
164
|
+
if (info.testid && (await page.getByTestId(info.testid).count()) === 1) {
|
|
165
|
+
return { target: { by: 'testid', id: info.testid }, text };
|
|
166
|
+
}
|
|
167
|
+
return { target: byText };
|
|
168
|
+
}
|
|
169
|
+
async function bind(page, intent, baseUrl) {
|
|
170
|
+
switch (intent.kind) {
|
|
171
|
+
case 'open':
|
|
172
|
+
return { do: 'goto', url: absolute(intent.url, baseUrl) };
|
|
173
|
+
case 'click':
|
|
174
|
+
return {
|
|
175
|
+
do: 'click',
|
|
176
|
+
target: await settle(page, () => pickByRole(page, intent.role ? [intent.role] : CLICK_ROLES, intent.name), `${intent.role ?? 'a button or link'} named "${intent.name}"`, () => clickable(page)),
|
|
177
|
+
};
|
|
178
|
+
case 'fill':
|
|
179
|
+
return {
|
|
180
|
+
do: 'fill',
|
|
181
|
+
value: intent.value,
|
|
182
|
+
target: await settle(page, () => pickFirst(page, [
|
|
183
|
+
...both((exact) => ({ by: 'label', text: intent.label, exact })),
|
|
184
|
+
...both((exact) => ({ by: 'placeholder', text: intent.label, exact })),
|
|
185
|
+
...['textbox', 'searchbox', 'combobox', 'spinbutton'].flatMap((role) => both((exact) => ({ by: 'role', role, name: intent.label, exact }))),
|
|
186
|
+
]), `a field labelled "${intent.label}"`, async () => names(page.getByRole('textbox'))),
|
|
187
|
+
};
|
|
188
|
+
case 'choose':
|
|
189
|
+
return {
|
|
190
|
+
do: 'check',
|
|
191
|
+
on: true,
|
|
192
|
+
target: await settle(page, () => pickFirst(page, both((exact) => ({ by: 'role', role: 'radio', name: intent.name, exact }))), `an option named "${intent.name}"`, async () => names(page.getByRole('radio'))),
|
|
193
|
+
};
|
|
194
|
+
case 'check':
|
|
195
|
+
return {
|
|
196
|
+
do: 'check',
|
|
197
|
+
on: intent.on,
|
|
198
|
+
target: await settle(page, () => pickFirst(page, [
|
|
199
|
+
...both((exact) => ({ by: 'role', role: 'checkbox', name: intent.name, exact })),
|
|
200
|
+
...both((exact) => ({ by: 'label', text: intent.name, exact })),
|
|
201
|
+
]), `a checkbox named "${intent.name}"`, async () => names(page.getByRole('checkbox'))),
|
|
202
|
+
};
|
|
203
|
+
case 'select':
|
|
204
|
+
return {
|
|
205
|
+
do: 'select',
|
|
206
|
+
option: intent.option,
|
|
207
|
+
target: await settle(page, () => pickFirst(page, [
|
|
208
|
+
...both((exact) => ({ by: 'label', text: intent.label, exact })),
|
|
209
|
+
...both((exact) => ({ by: 'role', role: 'combobox', name: intent.label, exact })),
|
|
210
|
+
]), `a list labelled "${intent.label}"`, async () => names(page.getByRole('combobox'))),
|
|
211
|
+
};
|
|
212
|
+
case 'see': {
|
|
213
|
+
const { target, text } = await seeTarget(page, intent.text);
|
|
214
|
+
return { do: 'expectVisible', target, ...(text !== undefined ? { text } : {}) };
|
|
215
|
+
}
|
|
216
|
+
case 'notSee':
|
|
217
|
+
return { do: 'expectAbsent', text: intent.text };
|
|
218
|
+
case 'url':
|
|
219
|
+
return { do: 'expectUrl', contains: intent.contains };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function absolute(url, baseUrl) {
|
|
223
|
+
if (/^https?:\/\//i.test(url))
|
|
224
|
+
return url;
|
|
225
|
+
if (!baseUrl) {
|
|
226
|
+
throw new StepProblem('needs-input', `"${url}" is a path and no base URL is known — pass --base-url, or run \`ia-qa-discover scan <url> --save\` once`);
|
|
227
|
+
}
|
|
228
|
+
return new URL(url, baseUrl).toString();
|
|
229
|
+
}
|
|
230
|
+
/** Run one bound step exactly as the written test would, with Playwright's default timeouts. */
|
|
231
|
+
async function execute(page, step, timeout = TIMEOUT) {
|
|
232
|
+
switch (step.do) {
|
|
233
|
+
case 'goto':
|
|
234
|
+
await page.goto(step.url, { waitUntil: 'load' });
|
|
235
|
+
return;
|
|
236
|
+
case 'click':
|
|
237
|
+
await locate(page, step.target).click({ timeout });
|
|
238
|
+
return;
|
|
239
|
+
case 'fill':
|
|
240
|
+
await locate(page, step.target).fill(step.value, { timeout });
|
|
241
|
+
return;
|
|
242
|
+
case 'check':
|
|
243
|
+
if (step.on)
|
|
244
|
+
await locate(page, step.target).check({ timeout });
|
|
245
|
+
else
|
|
246
|
+
await locate(page, step.target).uncheck({ timeout });
|
|
247
|
+
return;
|
|
248
|
+
case 'select':
|
|
249
|
+
await locate(page, step.target).selectOption({ label: step.option }, { timeout });
|
|
250
|
+
return;
|
|
251
|
+
case 'expectVisible': {
|
|
252
|
+
const loc = locate(page, step.target);
|
|
253
|
+
const ok = await poll(async () => {
|
|
254
|
+
if ((await loc.count()) !== 1)
|
|
255
|
+
return undefined;
|
|
256
|
+
if (step.target.by === 'testid' && step.text !== undefined) {
|
|
257
|
+
return ((await loc.textContent()) ?? '').includes(step.text) ? true : undefined;
|
|
258
|
+
}
|
|
259
|
+
return (await loc.isVisible()) ? true : undefined;
|
|
260
|
+
}, timeout);
|
|
261
|
+
if (!ok)
|
|
262
|
+
throw new Error(`expected ${describe(step)} to be visible`);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
case 'expectAbsent': {
|
|
266
|
+
const ok = await poll(async () => ((await page.getByText(step.text).count()) === 0 ? true : undefined), timeout);
|
|
267
|
+
if (!ok)
|
|
268
|
+
throw new Error(`expected "${step.text}" not to be on the page`);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
case 'expectUrl': {
|
|
272
|
+
const ok = await poll(async () => (page.url().includes(step.contains) ? true : undefined), timeout);
|
|
273
|
+
if (!ok)
|
|
274
|
+
throw new Error(`expected the URL to contain "${step.contains}", it is ${page.url()}`);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function describe(step) {
|
|
280
|
+
if (step.do !== 'expectVisible')
|
|
281
|
+
return step.do;
|
|
282
|
+
const t = step.target;
|
|
283
|
+
return t.by === 'role' ? `${t.role} "${t.name}"` : t.by === 'testid' ? `[data-testid="${t.id}"] containing "${step.text}"` : `"${'text' in t ? t.text : ''}"`;
|
|
284
|
+
}
|
|
285
|
+
/** Alter, on the page, exactly what an assertion checks — so a test that still passes is shown to check nothing. */
|
|
286
|
+
async function mutate(page, step) {
|
|
287
|
+
if (step.do === 'expectVisible') {
|
|
288
|
+
await locate(page, step.target).evaluateAll((els, mark) => {
|
|
289
|
+
for (const el of els) {
|
|
290
|
+
if (el.hasAttribute('aria-label'))
|
|
291
|
+
el.setAttribute('aria-label', mark);
|
|
292
|
+
el.querySelectorAll('img[alt]').forEach((img) => img.setAttribute('alt', mark));
|
|
293
|
+
const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
|
|
294
|
+
const nodes = [];
|
|
295
|
+
while (walker.nextNode())
|
|
296
|
+
nodes.push(walker.currentNode);
|
|
297
|
+
nodes.forEach((n, i) => (n.data = i === 0 ? mark : ''));
|
|
298
|
+
if (nodes.length === 0)
|
|
299
|
+
el.appendChild(document.createTextNode(mark));
|
|
300
|
+
}
|
|
301
|
+
}, exports.MUTATION_MARK);
|
|
302
|
+
}
|
|
303
|
+
else if (step.do === 'expectAbsent') {
|
|
304
|
+
await page.evaluate((text) => {
|
|
305
|
+
const div = document.createElement('div');
|
|
306
|
+
div.textContent = text;
|
|
307
|
+
document.body.appendChild(div);
|
|
308
|
+
}, step.text);
|
|
309
|
+
}
|
|
310
|
+
else if (step.do === 'expectUrl') {
|
|
311
|
+
await page.evaluate(() => history.replaceState(history.state, '', '/ia-qa-mutation'));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async function mutationHeld(page, step) {
|
|
315
|
+
if (step.do === 'expectVisible')
|
|
316
|
+
return page.evaluate((mark) => (document.body.textContent || '').includes(mark), exports.MUTATION_MARK);
|
|
317
|
+
if (step.do === 'expectUrl')
|
|
318
|
+
return page.url().includes('/ia-qa-mutation');
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
async function inFreshPage(browser, fn, session) {
|
|
322
|
+
const context = await browser.newContext(session ? { storageState: session } : {});
|
|
323
|
+
try {
|
|
324
|
+
return await fn(await context.newPage());
|
|
325
|
+
}
|
|
326
|
+
finally {
|
|
327
|
+
await context.close().catch(() => undefined);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function firstLine(err) {
|
|
331
|
+
return (err instanceof Error ? err.message : String(err)).split('\n')[0];
|
|
332
|
+
}
|
|
333
|
+
async function proveScenario(browser, scenario, baseUrl, session) {
|
|
334
|
+
const base = { name: scenario.name, line: scenario.line };
|
|
335
|
+
if (scenario.refused)
|
|
336
|
+
return { ...base, status: 'not-run', reason: scenario.refused };
|
|
337
|
+
if (scenario.steps.length === 0)
|
|
338
|
+
return { ...base, status: 'needs-input', reason: 'this scenario has no steps' };
|
|
339
|
+
const intents = [];
|
|
340
|
+
let unreadable = null;
|
|
341
|
+
for (const step of scenario.steps) {
|
|
342
|
+
const intent = (0, steps_1.parseStep)(step.text);
|
|
343
|
+
if (!intent) {
|
|
344
|
+
unreadable = step;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
intents.push({ step, intent });
|
|
348
|
+
}
|
|
349
|
+
const vocabularyReason = `this step is not in the vocabulary, so nothing on the page can be checked for it — write it as one of: ${steps_1.VOCABULARY.join(' · ')}`;
|
|
350
|
+
if (intents.length === 0 && unreadable) {
|
|
351
|
+
return { ...base, status: 'needs-input', step: { line: unreadable.line, text: unreadable.text }, reason: vocabularyReason };
|
|
352
|
+
}
|
|
353
|
+
if (intents[0].intent.kind !== 'open') {
|
|
354
|
+
return {
|
|
355
|
+
...base,
|
|
356
|
+
status: 'needs-input',
|
|
357
|
+
step: { line: intents[0].step.line, text: intents[0].step.text },
|
|
358
|
+
reason: 'the first step must open a page (I open "<url>"), or nothing says where the test starts',
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
// Run 1 binds each step on the page as that step finds it, and runs it.
|
|
362
|
+
const bound = [];
|
|
363
|
+
const binding = await inFreshPage(browser, async (page) => {
|
|
364
|
+
for (const { step, intent } of intents) {
|
|
365
|
+
let plan;
|
|
366
|
+
try {
|
|
367
|
+
plan = await bind(page, intent, baseUrl);
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
if (err instanceof StepProblem)
|
|
371
|
+
return { problem: err, step };
|
|
372
|
+
return { problem: new StepProblem('failing', firstLine(err)), step };
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
await execute(page, plan);
|
|
376
|
+
}
|
|
377
|
+
catch (err) {
|
|
378
|
+
return { problem: new StepProblem('failing', firstLine(err)), step };
|
|
379
|
+
}
|
|
380
|
+
if (!(0, steps_1.isAssertion)(plan))
|
|
381
|
+
await settleDom(page);
|
|
382
|
+
bound.push({ line: step.line, text: step.text, plan });
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}, session);
|
|
386
|
+
// A later step that cannot be read does not hide an earlier one the page cannot answer: the
|
|
387
|
+
// readable part runs first, so the person learns about both in one pass.
|
|
388
|
+
const later = unreadable ? [`step ${unreadable.line} "${unreadable.text}" is not in the vocabulary either`] : [];
|
|
389
|
+
if (binding) {
|
|
390
|
+
return {
|
|
391
|
+
...base,
|
|
392
|
+
status: binding.problem.status,
|
|
393
|
+
reason: binding.problem.message,
|
|
394
|
+
step: { line: binding.step.line, text: binding.step.text },
|
|
395
|
+
...(binding.problem.candidates?.length ? { candidates: binding.problem.candidates } : {}),
|
|
396
|
+
...(later.length ? { also: later } : {}),
|
|
397
|
+
steps: bound,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
if (unreadable) {
|
|
401
|
+
return { ...base, status: 'needs-input', step: { line: unreadable.line, text: unreadable.text }, reason: vocabularyReason, steps: bound };
|
|
402
|
+
}
|
|
403
|
+
// Runs 2 and 3 replay the bound plan only, in fresh browsers: what the written test will do.
|
|
404
|
+
const replays = [];
|
|
405
|
+
for (let i = 0; i < 2; i++) {
|
|
406
|
+
replays.push(await inFreshPage(browser, async (page) => {
|
|
407
|
+
for (const s of bound) {
|
|
408
|
+
try {
|
|
409
|
+
await execute(page, s.plan);
|
|
410
|
+
}
|
|
411
|
+
catch (err) {
|
|
412
|
+
return `line ${s.line} "${s.text}": ${firstLine(err)}`;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return null;
|
|
416
|
+
}, session));
|
|
417
|
+
}
|
|
418
|
+
const failedReplay = replays.find((r) => r !== null);
|
|
419
|
+
if (failedReplay) {
|
|
420
|
+
return { ...base, status: 'flaky', reason: `it passed once, then failed on a replay — ${failedReplay}`, steps: bound };
|
|
421
|
+
}
|
|
422
|
+
const assertions = bound.filter((s) => (0, steps_1.isAssertion)(s.plan));
|
|
423
|
+
if (assertions.length === 0) {
|
|
424
|
+
return {
|
|
425
|
+
...base,
|
|
426
|
+
status: 'blind',
|
|
427
|
+
reason: 'it has no Then step, so it can only fail if a click does — add what the page should show',
|
|
428
|
+
steps: bound,
|
|
429
|
+
blind: [],
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const blind = [];
|
|
433
|
+
let unverified = false;
|
|
434
|
+
for (const target of assertions) {
|
|
435
|
+
const verdict = await inFreshPage(browser, async (page) => {
|
|
436
|
+
for (const s of bound) {
|
|
437
|
+
if (s === target)
|
|
438
|
+
break;
|
|
439
|
+
await execute(page, s.plan);
|
|
440
|
+
}
|
|
441
|
+
// The check must hold first, on the page the steps produced: altering a page that has not
|
|
442
|
+
// rendered its target yet alters nothing, and the check then passes for the wrong reason.
|
|
443
|
+
await settleDom(page);
|
|
444
|
+
await execute(page, target.plan);
|
|
445
|
+
await mutate(page, target.plan);
|
|
446
|
+
try {
|
|
447
|
+
await execute(page, target.plan, MUTATION_TIMEOUT);
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
return 'caught';
|
|
451
|
+
}
|
|
452
|
+
return (await mutationHeld(page, target.plan)) ? 'blind' : 'unverified';
|
|
453
|
+
}, session).catch((err) => `error: ${firstLine(err)}`);
|
|
454
|
+
if (verdict === 'caught')
|
|
455
|
+
continue;
|
|
456
|
+
if (verdict === 'unverified')
|
|
457
|
+
unverified = true;
|
|
458
|
+
blind.push({
|
|
459
|
+
line: target.line,
|
|
460
|
+
text: target.text,
|
|
461
|
+
why: verdict === 'blind'
|
|
462
|
+
? 'it stayed green while what it checks was altered on the page'
|
|
463
|
+
: verdict === 'unverified'
|
|
464
|
+
? 'the page undid the alteration before the check ran, so this could not be proven either way'
|
|
465
|
+
: `the alteration could not be run (${verdict})`,
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
if (blind.length === 0)
|
|
469
|
+
return { ...base, status: 'proven', steps: bound };
|
|
470
|
+
const reallyBlind = blind.some((b) => b.why.startsWith('it stayed green'));
|
|
471
|
+
return {
|
|
472
|
+
...base,
|
|
473
|
+
status: reallyBlind ? 'blind' : unverified ? 'unverified' : 'blind',
|
|
474
|
+
reason: reallyBlind ? 'at least one check stays green when its target changes' : 'at least one check could not be proven to fail',
|
|
475
|
+
steps: bound,
|
|
476
|
+
blind,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
//# sourceMappingURL=live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../src/scenarios/live.ts"],"names":[],"mappings":";;;AA0GA,wBAaC;AA6LD,0BAyCC;AAoDD,sCA8IC;AA7hBD,mCAAsG;AAyCtG,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,IAAI,GAAG,GAAG,CAAC;AACJ,QAAA,aAAa,GAAG,gBAAgB,CAAC;AAE9C,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEnG,MAAM,WAAY,SAAQ,KAAK;IAElB;IAEA;IAHX,YACW,MAAiC,EAC1C,OAAe,EACN,UAAqB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,WAAM,GAAN,MAAM,CAA2B;QAEjC,eAAU,GAAV,UAAU,CAAW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BAChE,CAAC,CAAC,OAAO,KAAK,YAAY;oBACxB,CAAC,CAAC,4FAA4F;oBAC9F,CAAC,CAAC,oCAAoC,OAAO,GAAG;SACvD,CAAC,CAAC;IACL,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC3E,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC3E,OAAO;QACL,GAAG,IAAI;QACP,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO;QACnE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC,gDAAgD;QACjI,KAAK,EAAE,KAAK;QACZ,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type SessionChoice } from '../config';
|
|
2
|
+
import { type ScenarioResult, type ScenarioStatus } from './live';
|
|
3
|
+
/**
|
|
4
|
+
* The one door for `scenarios`: the CLI, the MCP tool and pal all come through here, so a
|
|
5
|
+
* person and an agent get the same columns from the same run.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCENARIO_SCHEMA = "qa-discovery-scenarios@1";
|
|
8
|
+
export declare const STATUS_ORDER: ScenarioStatus[];
|
|
9
|
+
export interface FeatureReport {
|
|
10
|
+
file: string;
|
|
11
|
+
feature: string;
|
|
12
|
+
results: ScenarioResult[];
|
|
13
|
+
spec?: {
|
|
14
|
+
file: string;
|
|
15
|
+
state: 'written' | 'unchanged' | 'kept';
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ScenarioRun {
|
|
19
|
+
schema: typeof SCENARIO_SCHEMA;
|
|
20
|
+
ran: boolean;
|
|
21
|
+
/** Set when nothing ran: why, and what to write. */
|
|
22
|
+
reason?: string;
|
|
23
|
+
help?: string[];
|
|
24
|
+
baseUrl: string | null;
|
|
25
|
+
session: string | null;
|
|
26
|
+
sessionSource: SessionChoice['source'] | null;
|
|
27
|
+
outDir: string;
|
|
28
|
+
totals: Partial<Record<ScenarioStatus, number>>;
|
|
29
|
+
features: FeatureReport[];
|
|
30
|
+
}
|
|
31
|
+
export declare const EXAMPLE_SCENARIO: string[];
|
|
32
|
+
export declare function featureFiles(target: string): string[];
|
|
33
|
+
export interface ScenarioOptions {
|
|
34
|
+
source: string;
|
|
35
|
+
outDir: string;
|
|
36
|
+
baseUrl?: string;
|
|
37
|
+
session?: string;
|
|
38
|
+
force?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Refuse a scenario that opens a page on another origin than the base URL. Set by the MCP
|
|
41
|
+
* door: a feature file an agent wrote can be steered by third-party content toward an
|
|
42
|
+
* endpoint reachable only from this machine — the reason `scan_app` has the same rule.
|
|
43
|
+
*/
|
|
44
|
+
sameOriginOnly?: boolean;
|
|
45
|
+
onProgress?: (line: string) => void;
|
|
46
|
+
}
|
|
47
|
+
export declare function runScenarioSuite(options: ScenarioOptions): Promise<ScenarioRun>;
|