@ia-qa/qa-discovery 0.11.2 → 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 +18 -3
- package/ROADMAP.md +11 -0
- package/TUTORIAL.md +69 -0
- 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/mcp/server.d.ts +61 -0
- package/dist/mcp/server.js +46 -0
- 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 +1 -1
- package/skills/ia-qa-discover/SKILL.md +7 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.EXAMPLE_SCENARIO = exports.STATUS_ORDER = exports.SCENARIO_SCHEMA = void 0;
|
|
37
|
+
exports.featureFiles = featureFiles;
|
|
38
|
+
exports.runScenarioSuite = runScenarioSuite;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const self_healing_1 = require("@ia-qa/self-healing");
|
|
42
|
+
const config_1 = require("../config");
|
|
43
|
+
const gherkin_1 = require("./gherkin");
|
|
44
|
+
const steps_1 = require("./steps");
|
|
45
|
+
const live_1 = require("./live");
|
|
46
|
+
const emit_1 = require("./emit");
|
|
47
|
+
/**
|
|
48
|
+
* The one door for `scenarios`: the CLI, the MCP tool and pal all come through here, so a
|
|
49
|
+
* person and an agent get the same columns from the same run.
|
|
50
|
+
*/
|
|
51
|
+
exports.SCENARIO_SCHEMA = 'qa-discovery-scenarios@1';
|
|
52
|
+
exports.STATUS_ORDER = ['proven', 'blind', 'unverified', 'flaky', 'failing', 'needs-input', 'not-run'];
|
|
53
|
+
exports.EXAMPLE_SCENARIO = [
|
|
54
|
+
'Write scenarios in Gherkin (English or French keywords), one file per feature, e.g. scenarios/cart.feature:',
|
|
55
|
+
' Feature: Cart',
|
|
56
|
+
' Scenario: Adding a product shows it in the cart',
|
|
57
|
+
' Given I open "/"',
|
|
58
|
+
' When I click "Add to cart"',
|
|
59
|
+
' Then I see "Cart (1)"',
|
|
60
|
+
'A scenario tagged @draft is a proposal: remove the tag once you have read it, and it is run.',
|
|
61
|
+
];
|
|
62
|
+
function featureFiles(target) {
|
|
63
|
+
if (!fs.existsSync(target))
|
|
64
|
+
return [];
|
|
65
|
+
if (fs.statSync(target).isFile())
|
|
66
|
+
return target.endsWith('.feature') ? [target] : [];
|
|
67
|
+
const out = [];
|
|
68
|
+
for (const entry of fs.readdirSync(target, { withFileTypes: true })) {
|
|
69
|
+
if (entry.name === 'node_modules' || entry.name.startsWith('.'))
|
|
70
|
+
continue;
|
|
71
|
+
const full = path.join(target, entry.name);
|
|
72
|
+
if (entry.isDirectory())
|
|
73
|
+
out.push(...featureFiles(full));
|
|
74
|
+
else if (entry.name.endsWith('.feature'))
|
|
75
|
+
out.push(full);
|
|
76
|
+
}
|
|
77
|
+
return out.sort();
|
|
78
|
+
}
|
|
79
|
+
/** The first `open` step that leaves the base URL's origin, if any. */
|
|
80
|
+
function foreignOpen(steps, baseUrl) {
|
|
81
|
+
for (const s of steps) {
|
|
82
|
+
const intent = (0, steps_1.parseStep)(s.text);
|
|
83
|
+
if (intent?.kind !== 'open')
|
|
84
|
+
continue;
|
|
85
|
+
if (!/^https?:\/\//i.test(intent.url))
|
|
86
|
+
continue;
|
|
87
|
+
if (!baseUrl)
|
|
88
|
+
return { line: s.line, url: intent.url };
|
|
89
|
+
try {
|
|
90
|
+
if (new URL(intent.url).origin !== new URL(baseUrl).origin)
|
|
91
|
+
return { line: s.line, url: intent.url };
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return { line: s.line, url: intent.url };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
async function runScenarioSuite(options) {
|
|
100
|
+
const config = (0, config_1.configExists)() ? (0, config_1.loadConfig)() : undefined;
|
|
101
|
+
const baseUrl = options.baseUrl ?? config?.baseUrl;
|
|
102
|
+
// A session the person named and that cannot be read throws here, before a browser starts —
|
|
103
|
+
// never a fall-through to an anonymous run that would bind steps on the login page.
|
|
104
|
+
const session = (0, config_1.resolveSession)(config, options.session);
|
|
105
|
+
const rel = (f) => (path.relative((0, config_1.baseDir)(), f) || f).replace(/\\/g, '/');
|
|
106
|
+
const empty = {
|
|
107
|
+
schema: exports.SCENARIO_SCHEMA,
|
|
108
|
+
baseUrl: baseUrl ?? null,
|
|
109
|
+
session: session ? rel(session.file) : null,
|
|
110
|
+
sessionSource: session?.source ?? null,
|
|
111
|
+
outDir: rel(options.outDir),
|
|
112
|
+
totals: {},
|
|
113
|
+
features: [],
|
|
114
|
+
};
|
|
115
|
+
const files = featureFiles(options.source);
|
|
116
|
+
if (files.length === 0) {
|
|
117
|
+
return { ...empty, ran: false, reason: `No .feature file in ${rel(options.source)}.`, help: exports.EXAMPLE_SCENARIO };
|
|
118
|
+
}
|
|
119
|
+
const features = files.map((f) => (0, gherkin_1.parseFeature)(fs.readFileSync(f, 'utf8'), f));
|
|
120
|
+
const reports = [];
|
|
121
|
+
const { browser } = await (0, self_healing_1.launchBrowser)();
|
|
122
|
+
try {
|
|
123
|
+
for (const feature of features) {
|
|
124
|
+
const file = rel(feature.file);
|
|
125
|
+
const results = [];
|
|
126
|
+
for (const scenario of feature.scenarios) {
|
|
127
|
+
if ((0, gherkin_1.isDraft)(scenario)) {
|
|
128
|
+
results.push({ name: scenario.name, line: scenario.line, status: 'not-run', reason: 'tagged @draft — a draft is not validated; remove the tag once you have read it' });
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const foreign = options.sameOriginOnly ? foreignOpen(scenario.steps, baseUrl) : null;
|
|
132
|
+
if (foreign) {
|
|
133
|
+
results.push({
|
|
134
|
+
name: scenario.name,
|
|
135
|
+
line: scenario.line,
|
|
136
|
+
status: 'not-run',
|
|
137
|
+
step: { line: foreign.line, text: scenario.steps.find((s) => s.line === foreign.line)?.text ?? '' },
|
|
138
|
+
reason: `refused: it opens ${foreign.url}, which is not on ${baseUrl ?? 'a configured base URL'} — from an agent, only the app's own origin is opened (a person can run it with the CLI)`,
|
|
139
|
+
});
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const started = Date.now();
|
|
143
|
+
const result = await (0, live_1.proveScenario)(browser, scenario, baseUrl, session?.file);
|
|
144
|
+
results.push(result);
|
|
145
|
+
options.onProgress?.(` ${result.status === 'proven' ? '✔' : '·'} ${file}:${scenario.line} ${scenario.name} — ${result.status} (${((Date.now() - started) / 1000).toFixed(1)} s)`);
|
|
146
|
+
}
|
|
147
|
+
reports.push({ file, feature: feature.name, results });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
await browser.close().catch(() => undefined);
|
|
152
|
+
}
|
|
153
|
+
fs.mkdirSync(options.outDir, { recursive: true });
|
|
154
|
+
for (const report of reports) {
|
|
155
|
+
const code = (0, emit_1.renderFeatureSpec)({ featureName: report.feature, source: report.file, results: report.results, loggedIn: Boolean(session) });
|
|
156
|
+
if (!code)
|
|
157
|
+
continue;
|
|
158
|
+
const file = path.join(options.outDir, `${path.basename(report.file, '.feature')}.scenarios.spec.js`);
|
|
159
|
+
if (fs.existsSync(file)) {
|
|
160
|
+
if (fs.readFileSync(file, 'utf8') === code) {
|
|
161
|
+
report.spec = { file: rel(file), state: 'unchanged' };
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (!options.force) {
|
|
165
|
+
report.spec = { file: rel(file), state: 'kept' };
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
fs.writeFileSync(file, code, 'utf8');
|
|
170
|
+
report.spec = { file: rel(file), state: 'written' };
|
|
171
|
+
}
|
|
172
|
+
const totals = {};
|
|
173
|
+
for (const r of reports.flatMap((f) => f.results))
|
|
174
|
+
totals[r.status] = (totals[r.status] ?? 0) + 1;
|
|
175
|
+
return { ...empty, ran: true, totals, features: reports };
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/scenarios/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,oCAWC;AAiCD,4CA8EC;AA1KD,uCAAyB;AACzB,2CAA6B;AAC7B,sDAAoD;AACpD,sCAAkG;AAClG,uCAAkD;AAClD,mCAAoC;AACpC,iCAAiF;AACjF,iCAA2C;AAE3C;;;GAGG;AAEU,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,YAAY,GAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAuBjH,QAAA,gBAAgB,GAAG;IAC9B,6GAA6G;IAC7G,iBAAiB;IACjB,qDAAqD;IACrD,wBAAwB;IACxB,kCAAkC;IAClC,6BAA6B;IAC7B,8FAA8F;CAC/F,CAAC;AAEF,SAAgB,YAAY,CAAC,MAAc;IACzC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM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,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,MAAM,GAA4C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAClG,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a step says, what it was bound to, and how it is written — one structure for all three.
|
|
3
|
+
*
|
|
4
|
+
* The vocabulary is closed on purpose. A step outside it is not interpreted freely: it comes
|
|
5
|
+
* back as `null`, and the scenario is reported as needing a person. "Then the customer is
|
|
6
|
+
* happy" has no element to check, and a generator that invents one produces the test nobody
|
|
7
|
+
* can trust.
|
|
8
|
+
*
|
|
9
|
+
* The same `Target` builds the locator that runs during the proof (`live.ts`) and the line
|
|
10
|
+
* written into the test file (`renderStep`). Two descriptions of one locator would be the
|
|
11
|
+
* proof certifying a file it never ran.
|
|
12
|
+
*/
|
|
13
|
+
export type Intent = {
|
|
14
|
+
kind: 'open';
|
|
15
|
+
url: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'click';
|
|
18
|
+
name: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'fill';
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'choose';
|
|
26
|
+
name: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'check';
|
|
29
|
+
name: string;
|
|
30
|
+
on: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'select';
|
|
33
|
+
option: string;
|
|
34
|
+
label: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'see';
|
|
37
|
+
text: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'notSee';
|
|
40
|
+
text: string;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'url';
|
|
43
|
+
contains: string;
|
|
44
|
+
};
|
|
45
|
+
export type Target = {
|
|
46
|
+
by: 'role';
|
|
47
|
+
role: string;
|
|
48
|
+
name: string;
|
|
49
|
+
exact: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
by: 'label';
|
|
52
|
+
text: string;
|
|
53
|
+
exact: boolean;
|
|
54
|
+
} | {
|
|
55
|
+
by: 'placeholder';
|
|
56
|
+
text: string;
|
|
57
|
+
exact: boolean;
|
|
58
|
+
} | {
|
|
59
|
+
by: 'testid';
|
|
60
|
+
id: string;
|
|
61
|
+
} | {
|
|
62
|
+
by: 'text';
|
|
63
|
+
text: string;
|
|
64
|
+
exact: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type PlanStep = {
|
|
67
|
+
do: 'goto';
|
|
68
|
+
url: string;
|
|
69
|
+
} | {
|
|
70
|
+
do: 'click';
|
|
71
|
+
target: Target;
|
|
72
|
+
} | {
|
|
73
|
+
do: 'fill';
|
|
74
|
+
target: Target;
|
|
75
|
+
value: string;
|
|
76
|
+
} | {
|
|
77
|
+
do: 'check';
|
|
78
|
+
target: Target;
|
|
79
|
+
on: boolean;
|
|
80
|
+
} | {
|
|
81
|
+
do: 'select';
|
|
82
|
+
target: Target;
|
|
83
|
+
option: string;
|
|
84
|
+
} | {
|
|
85
|
+
do: 'expectVisible';
|
|
86
|
+
target: Target;
|
|
87
|
+
text?: string;
|
|
88
|
+
} | {
|
|
89
|
+
do: 'expectAbsent';
|
|
90
|
+
text: string;
|
|
91
|
+
} | {
|
|
92
|
+
do: 'expectUrl';
|
|
93
|
+
contains: string;
|
|
94
|
+
};
|
|
95
|
+
export declare const ASSERTIONS: ReadonlyArray<PlanStep['do']>;
|
|
96
|
+
export declare function isAssertion(step: PlanStep): boolean;
|
|
97
|
+
export declare const VOCABULARY: string[];
|
|
98
|
+
export declare function parseStep(text: string): Intent | null;
|
|
99
|
+
export declare function renderTarget(t: Target): string;
|
|
100
|
+
export declare function renderStep(step: PlanStep): string;
|
|
101
|
+
/**
|
|
102
|
+
* Whether `@ia-qa/self-healing` can repair this locator when the app moves.
|
|
103
|
+
*
|
|
104
|
+
* Only calls that state a role are rewritten by `fix` (`*ByRole`, `*ByLabel`, `*ByPlaceholder`).
|
|
105
|
+
* `getByText` names a string, not an element, and `getByTestId` is an identity the app owns. The
|
|
106
|
+
* file still says which is which, because "born maintained" is a claim about every line.
|
|
107
|
+
*/
|
|
108
|
+
export declare function repairable(t: Target): boolean;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What a step says, what it was bound to, and how it is written — one structure for all three.
|
|
4
|
+
*
|
|
5
|
+
* The vocabulary is closed on purpose. A step outside it is not interpreted freely: it comes
|
|
6
|
+
* back as `null`, and the scenario is reported as needing a person. "Then the customer is
|
|
7
|
+
* happy" has no element to check, and a generator that invents one produces the test nobody
|
|
8
|
+
* can trust.
|
|
9
|
+
*
|
|
10
|
+
* The same `Target` builds the locator that runs during the proof (`live.ts`) and the line
|
|
11
|
+
* written into the test file (`renderStep`). Two descriptions of one locator would be the
|
|
12
|
+
* proof certifying a file it never ran.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VOCABULARY = exports.ASSERTIONS = void 0;
|
|
16
|
+
exports.isAssertion = isAssertion;
|
|
17
|
+
exports.parseStep = parseStep;
|
|
18
|
+
exports.renderTarget = renderTarget;
|
|
19
|
+
exports.renderStep = renderStep;
|
|
20
|
+
exports.repairable = repairable;
|
|
21
|
+
exports.ASSERTIONS = ['expectVisible', 'expectAbsent', 'expectUrl'];
|
|
22
|
+
function isAssertion(step) {
|
|
23
|
+
return exports.ASSERTIONS.includes(step.do);
|
|
24
|
+
}
|
|
25
|
+
/** A role keyword written in a step, in either language, as the ARIA role it names. */
|
|
26
|
+
const ROLE_WORDS = {
|
|
27
|
+
button: 'button',
|
|
28
|
+
bouton: 'button',
|
|
29
|
+
link: 'link',
|
|
30
|
+
lien: 'link',
|
|
31
|
+
tab: 'tab',
|
|
32
|
+
onglet: 'tab',
|
|
33
|
+
'menu item': 'menuitem',
|
|
34
|
+
checkbox: 'checkbox',
|
|
35
|
+
radio: 'radio',
|
|
36
|
+
};
|
|
37
|
+
const Q = '"([^"]+)"';
|
|
38
|
+
const PATTERNS = [
|
|
39
|
+
{ re: new RegExp(`^I (?:open|go to|am on|visit)(?: the page)? ${Q}$`, 'i'), make: (m) => ({ kind: 'open', url: m[1] }) },
|
|
40
|
+
{ re: new RegExp(`^(?:j'ouvre|je vais sur|je suis sur)(?: la page)? ${Q}$`, 'i'), make: (m) => ({ kind: 'open', url: m[1] }) },
|
|
41
|
+
{ re: new RegExp(`^I (?:fill(?: in)?) ${Q} with ${Q}$`, 'i'), make: (m) => ({ kind: 'fill', label: m[1], value: m[2] }) },
|
|
42
|
+
{ re: new RegExp(`^I (?:type|enter) ${Q} (?:into|in) ${Q}$`, 'i'), make: (m) => ({ kind: 'fill', label: m[2], value: m[1] }) },
|
|
43
|
+
{ re: new RegExp(`^je (?:remplis|renseigne|saisis) ${Q} avec ${Q}$`, 'i'), make: (m) => ({ kind: 'fill', label: m[1], value: m[2] }) },
|
|
44
|
+
{ re: new RegExp(`^je (?:saisis|tape) ${Q} dans ${Q}$`, 'i'), make: (m) => ({ kind: 'fill', label: m[2], value: m[1] }) },
|
|
45
|
+
{ re: new RegExp(`^I select ${Q} (?:in|from) ${Q}$`, 'i'), make: (m) => ({ kind: 'select', option: m[1], label: m[2] }) },
|
|
46
|
+
{ re: new RegExp(`^je (?:choisis|sélectionne) ${Q} dans ${Q}$`, 'i'), make: (m) => ({ kind: 'select', option: m[1], label: m[2] }) },
|
|
47
|
+
{ re: new RegExp(`^I (?:choose|pick) ${Q}$`, 'i'), make: (m) => ({ kind: 'choose', name: m[1] }) },
|
|
48
|
+
{ re: new RegExp(`^je (?:choisis|sélectionne) ${Q}$`, 'i'), make: (m) => ({ kind: 'choose', name: m[1] }) },
|
|
49
|
+
{ re: new RegExp(`^I (check|tick|uncheck|untick) ${Q}$`, 'i'), make: (m) => ({ kind: 'check', name: m[2], on: !/^un/i.test(m[1]) }) },
|
|
50
|
+
{ re: new RegExp(`^je (coche|décoche) ${Q}$`, 'i'), make: (m) => ({ kind: 'check', name: m[2], on: m[1].toLowerCase() === 'coche' }) },
|
|
51
|
+
{
|
|
52
|
+
re: new RegExp(`^I (?:click|press|tap)(?: on)?(?: the)? ${Q}(?: (button|link|tab|menu item|checkbox|radio))?$`, 'i'),
|
|
53
|
+
make: (m) => ({ kind: 'click', name: m[1], ...(m[2] ? { role: ROLE_WORDS[m[2].toLowerCase()] } : {}) }),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
re: new RegExp(`^je (?:clique|appuie) sur (?:le |la |l'|les )?(?:(bouton|lien|onglet) )?${Q}$`, 'i'),
|
|
57
|
+
make: (m) => ({ kind: 'click', name: m[2], ...(m[1] ? { role: ROLE_WORDS[m[1].toLowerCase()] } : {}) }),
|
|
58
|
+
},
|
|
59
|
+
{ re: new RegExp(`^I (?:should not|shouldn't|do not|don't) see ${Q}$`, 'i'), make: (m) => ({ kind: 'notSee', text: m[1] }) },
|
|
60
|
+
{ re: new RegExp(`^je ne (?:vois pas|dois pas voir) ${Q}$`, 'i'), make: (m) => ({ kind: 'notSee', text: m[1] }) },
|
|
61
|
+
{ re: new RegExp(`^I (?:should )?see ${Q}$`, 'i'), make: (m) => ({ kind: 'see', text: m[1] }) },
|
|
62
|
+
{ re: new RegExp(`^je (?:vois|dois voir) ${Q}$`, 'i'), make: (m) => ({ kind: 'see', text: m[1] }) },
|
|
63
|
+
{ re: new RegExp(`^the (?:url|address) (?:should )?contains? ${Q}$`, 'i'), make: (m) => ({ kind: 'url', contains: m[1] }) },
|
|
64
|
+
{ re: new RegExp(`^l'(?:url|adresse) contient ${Q}$`, 'i'), make: (m) => ({ kind: 'url', contains: m[1] }) },
|
|
65
|
+
];
|
|
66
|
+
exports.VOCABULARY = [
|
|
67
|
+
'I open "<url or path>"',
|
|
68
|
+
'I click "<name>" [button|link|tab]',
|
|
69
|
+
'I fill "<label>" with "<value>"',
|
|
70
|
+
'I select "<option>" in "<label>"',
|
|
71
|
+
'I choose "<radio label>"',
|
|
72
|
+
'I check / uncheck "<checkbox label>"',
|
|
73
|
+
'I see "<text>"',
|
|
74
|
+
'I don\'t see "<text>"',
|
|
75
|
+
'the URL contains "<text>"',
|
|
76
|
+
];
|
|
77
|
+
/** Curly and French quotes are what people type in a document editor; they mean the same thing. */
|
|
78
|
+
function normaliseQuotes(text) {
|
|
79
|
+
return text
|
|
80
|
+
.replace(/[“”„]/g, '"')
|
|
81
|
+
.replace(/«\s*/g, '"')
|
|
82
|
+
.replace(/\s*»/g, '"')
|
|
83
|
+
.replace(/[‘’]/g, "'");
|
|
84
|
+
}
|
|
85
|
+
function parseStep(text) {
|
|
86
|
+
const t = normaliseQuotes(text).trim();
|
|
87
|
+
for (const p of PATTERNS) {
|
|
88
|
+
const m = t.match(p.re);
|
|
89
|
+
if (m)
|
|
90
|
+
return p.make(m);
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const quote = (s) => `'${s.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, '\\n')}'`;
|
|
95
|
+
function renderTarget(t) {
|
|
96
|
+
const exact = (e) => (e ? ', { exact: true }' : '');
|
|
97
|
+
switch (t.by) {
|
|
98
|
+
case 'role':
|
|
99
|
+
return `page.getByRole(${quote(t.role)}, { name: ${quote(t.name)}${t.exact ? ', exact: true' : ''} })`;
|
|
100
|
+
case 'label':
|
|
101
|
+
return `page.getByLabel(${quote(t.text)}${exact(t.exact)})`;
|
|
102
|
+
case 'placeholder':
|
|
103
|
+
return `page.getByPlaceholder(${quote(t.text)}${exact(t.exact)})`;
|
|
104
|
+
case 'testid':
|
|
105
|
+
return `page.getByTestId(${quote(t.id)})`;
|
|
106
|
+
case 'text':
|
|
107
|
+
return `page.getByText(${quote(t.text)}${exact(t.exact)})`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
111
|
+
function renderStep(step) {
|
|
112
|
+
switch (step.do) {
|
|
113
|
+
case 'goto':
|
|
114
|
+
return `await page.goto(${quote(step.url)});`;
|
|
115
|
+
case 'click':
|
|
116
|
+
return `await ${renderTarget(step.target)}.click();`;
|
|
117
|
+
case 'fill':
|
|
118
|
+
return `await ${renderTarget(step.target)}.fill(${quote(step.value)});`;
|
|
119
|
+
case 'check':
|
|
120
|
+
return `await ${renderTarget(step.target)}.${step.on ? 'check' : 'uncheck'}();`;
|
|
121
|
+
case 'select':
|
|
122
|
+
return `await ${renderTarget(step.target)}.selectOption({ label: ${quote(step.option)} });`;
|
|
123
|
+
case 'expectVisible':
|
|
124
|
+
return step.target.by === 'testid' && step.text !== undefined
|
|
125
|
+
? `await expect(${renderTarget(step.target)}).toContainText(${quote(step.text)});`
|
|
126
|
+
: `await expect(${renderTarget(step.target)}).toBeVisible();`;
|
|
127
|
+
case 'expectAbsent':
|
|
128
|
+
return `await expect(page.getByText(${quote(step.text)})).toHaveCount(0);`;
|
|
129
|
+
case 'expectUrl':
|
|
130
|
+
return `await expect(page).toHaveURL(/${escapeRegExp(step.contains)}/);`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether `@ia-qa/self-healing` can repair this locator when the app moves.
|
|
135
|
+
*
|
|
136
|
+
* Only calls that state a role are rewritten by `fix` (`*ByRole`, `*ByLabel`, `*ByPlaceholder`).
|
|
137
|
+
* `getByText` names a string, not an element, and `getByTestId` is an identity the app owns. The
|
|
138
|
+
* file still says which is which, because "born maintained" is a claim about every line.
|
|
139
|
+
*/
|
|
140
|
+
function repairable(t) {
|
|
141
|
+
return t.by === 'role' || t.by === 'label' || t.by === 'placeholder';
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/scenarios/steps.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAgCH,kCAEC;AA0ED,8BAOC;AAID,oCAcC;AAID,gCAqBC;AASD,gCAEC;AA3IY,QAAA,UAAU,GAAkC,CAAC,eAAe,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;AAExG,SAAgB,WAAW,CAAC,IAAc;IACxC,OAAO,kBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,GAA2B;IACzC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,UAAU;IACvB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,MAAM,CAAC,GAAG,WAAW,CAAC;AAEtB,MAAM,QAAQ,GAAiE;IAC7E,EAAE,EAAE,EAAE,IAAI,MAAM,CAAC,+CAA+C,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;IACxH,EAAE,EAAE,EAAE,IAAI,MAAM,CAAC,qDAAqD,C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AI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC;QAClF,KAAK,QAAQ;YACX,OAAO,SAAS,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,0BAA0B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9F,KAAK,eAAe;YAClB,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;gBAC3D,CAAC,CAAC,gBAAgB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAClF,CAAC,CAAC,gBAAgB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;QAClE,KAAK,cAAc;YACjB,OAAO,+BAA+B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC;QAC7E,KAAK,WAAW;YACd,OAAO,iCAAiC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7E,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,CAAS;IAClC,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC,EAAE,KAAK,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC;AACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ia-qa/qa-discovery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Find out what is in a web app before you test it — every page, form, field and API call it serves, the pages your end-to-end suite never visits, and starting Playwright tests for them. Deterministic and local, with an MCP server for agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"qa",
|
|
@@ -51,6 +51,7 @@ changed since `capturedAt`.
|
|
|
51
51
|
| "what is each entry point FOR?" | `ia-qa-discover-ai classify` — optional, BYOK (§5) |
|
|
52
52
|
| "what does somebody come to this page to DO?" | `ia-qa-discover-ai plan` — optional, BYOK (§5) |
|
|
53
53
|
| "write me a starting spec for an untested page" | `generate` — scaffolding only; the assertions stay human. With no page it targets the coverage gap **minus** the pages captured as a login wall or an error (those specs would assert a login form or a 404 under a feature's name, and pass while the app stays broken). Held-out pages are named with the reason: report them, do **not** re-run with `--include-login-walls` to make the message go away — for a wall the real remedy is a session (`scan --session <storageState.json>`) |
|
|
54
|
+
| "turn these test scenarios into automated tests" | `scenarios [dir]` (MCP `prove_scenarios`) — Gherkin in `scenarios/`, the human's. You may **draft** scenarios, always tagged `@draft`; only the human removes the tag (§4.9). Relay every column of the report, not only ✅ |
|
|
54
55
|
|
|
55
56
|
Exact flags: `ia-qa-discover <verb> --help`. Do not guess them from this file.
|
|
56
57
|
`scan`, `coverage`, `history` and both `-ai` verbs take `--json`. Prefer it over parsing prose.
|
|
@@ -98,6 +99,12 @@ sentence this tool can cause to be written.
|
|
|
98
99
|
into `scan` does not end up in files the user commits.
|
|
99
100
|
8. **Never edit `config.json` to add a page you have not seen in a capture.** `discover --apply`
|
|
100
101
|
(heal) and the config are the human's; propose, do not write.
|
|
102
|
+
9. **Never remove `@draft` from a scenario, and never edit a validated one to make `scenarios`
|
|
103
|
+
go green.** The tag is the human's validation. A ❌ *fails on the app as it is* means the app
|
|
104
|
+
or the scenario is wrong, and only the human can say which: rewriting the expected text to
|
|
105
|
+
what the page shows turns a bug report into a passing test. A ✋ *needs you* lists what the
|
|
106
|
+
page offers — relay it, do not pick one. A 🙈 *blind* test is not a test: never present it
|
|
107
|
+
as coverage.
|
|
101
108
|
|
|
102
109
|
## 5. What leaves the machine
|
|
103
110
|
|