@vijaypjavvadi/bdd2pw 4.6.7 → 4.7.1
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/CHANGELOG.md +197 -0
- package/README.md +20 -18
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -1
- package/dist/discovery/mcpClient.js +1 -1
- package/dist/discovery/mcpClient.js.map +1 -1
- package/dist/emitters/pomwrightEmitter.d.ts +151 -0
- package/dist/emitters/pomwrightEmitter.js +488 -0
- package/dist/emitters/pomwrightEmitter.js.map +1 -0
- package/dist/index.js +141 -26
- package/dist/index.js.map +1 -1
- package/dist/llm/anthropicClient.js.map +1 -1
- package/dist/llm/openaiClient.js +1 -1
- package/dist/llm/openaiClient.js.map +1 -1
- package/dist/repo/pomwrightScanner.d.ts +40 -0
- package/dist/repo/pomwrightScanner.js +129 -0
- package/dist/repo/pomwrightScanner.js.map +1 -0
- package/dist/repo/projectScaffolder.d.ts +6 -0
- package/dist/repo/projectScaffolder.js +58 -0
- package/dist/repo/projectScaffolder.js.map +1 -1
- package/dist/reports/specMerge.js +1 -1
- package/dist/reports/specMerge.js.map +1 -1
- package/dist/transformers/hierarchyInferrer.d.ts +87 -0
- package/dist/transformers/hierarchyInferrer.js +236 -0
- package/dist/transformers/hierarchyInferrer.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/validate/tscRunner.js +21 -1
- package/dist/validate/tscRunner.js.map +1 -1
- package/package.json +2 -1
- package/templates/tsconfig.json.tmpl +1 -1
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v4.7.0 — POMWright target emitter (PoC per POMWright#63 design
|
|
4
|
+
* discussion with DyHex).
|
|
5
|
+
*
|
|
6
|
+
* Classic emission (the existing `pw-emit` path) produces a Page Object
|
|
7
|
+
* class with `readonly fieldName = page.getBy...` class fields. POMWright
|
|
8
|
+
* is structurally different:
|
|
9
|
+
*
|
|
10
|
+
* • Class extends `PageObject<Paths>`, where `Paths` is a TypeScript
|
|
11
|
+
* union of all registered dotted paths.
|
|
12
|
+
* • Locators are registered inside `defineLocators()` via
|
|
13
|
+
* `this.add(path).method(...)`, not as class fields.
|
|
14
|
+
* • The constructor calls `super(page, baseUrl, path)` so navigation
|
|
15
|
+
* is baked in.
|
|
16
|
+
* • Tests use POMWright's `test` fixture (extended from
|
|
17
|
+
* `@playwright/test`) and reach locators via `pom.getNestedLocator(path)`.
|
|
18
|
+
*
|
|
19
|
+
* This file produces the POMWright-shape POM + spec. The hierarchy
|
|
20
|
+
* inferrer (`src/transformers/hierarchyInferrer.ts`) walks each
|
|
21
|
+
* `LocatorChoice` and returns the dotted path; when no stable ancestor
|
|
22
|
+
* is found, the leaf is emitted flat with a `// TODO:` review marker
|
|
23
|
+
* (the explicit fallback DyHex asked for).
|
|
24
|
+
*
|
|
25
|
+
* Scope caveats (per the DyHex reply):
|
|
26
|
+
* - New-POM only. Existing POMWright POM update/augment is deferred.
|
|
27
|
+
* - Reusable locator segments (POMWright's full strength) are
|
|
28
|
+
* emitted as the straight dotted path a first implementation can
|
|
29
|
+
* produce; shared-segment deduplication across pages is a later
|
|
30
|
+
* feature.
|
|
31
|
+
* - `@step()` decoration on methods is not added yet (POMWright
|
|
32
|
+
* docs call it out as "any async method") — the PoC emits plain
|
|
33
|
+
* spec bodies without decorators to keep the scope honest.
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.emitPomwrightPom = emitPomwrightPom;
|
|
37
|
+
exports.emitPomwrightSpec = emitPomwrightSpec;
|
|
38
|
+
const hierarchyInferrer_1 = require("../transformers/hierarchyInferrer");
|
|
39
|
+
/**
|
|
40
|
+
* Render a POMWright-shape Page Object (pom module) from the IR.
|
|
41
|
+
*/
|
|
42
|
+
function emitPomwrightPom(input) {
|
|
43
|
+
const { pom, baseUrl, urlPath } = input;
|
|
44
|
+
const warnings = [];
|
|
45
|
+
const pathByFieldName = new Map();
|
|
46
|
+
// 1. Walk every LocatorChoice, infer its hierarchical path.
|
|
47
|
+
// Collect warnings for flat-fallback cases.
|
|
48
|
+
const inferred = pom.fields.map((choice) => ({ choice, inf: (0, hierarchyInferrer_1.inferPomwrightPath)(choice) }));
|
|
49
|
+
// 2. Build the Paths union — deduplicated set of EVERY intermediate
|
|
50
|
+
// segment in the chain. POMWright requires parents registered too
|
|
51
|
+
// when `getNestedLocator()` is called, because the chain is built
|
|
52
|
+
// bottom-up from the registered segments.
|
|
53
|
+
const allPaths = new Set();
|
|
54
|
+
// v4.7.1 — collect per-ancestor-path metadata from every inferred
|
|
55
|
+
// entry so the emitter can pick the right Playwright call (getByRole
|
|
56
|
+
// only when there's a real accessible name; .locator("#id") when
|
|
57
|
+
// only an id is available; attribute selector + review warning when
|
|
58
|
+
// we have an aria-labelledby ref without the label text).
|
|
59
|
+
const ancestorMetaByPath = new Map();
|
|
60
|
+
for (const { inf } of inferred) {
|
|
61
|
+
// Walk prefixes of the dotted path so parents are present.
|
|
62
|
+
for (let i = 1; i <= inf.segments.length; i++) {
|
|
63
|
+
allPaths.add(inf.segments.slice(0, i).join("."));
|
|
64
|
+
}
|
|
65
|
+
// Merge in ancestor metadata; first-write wins (if two elements
|
|
66
|
+
// share the same ancestor path, both have the same ancestor DOM
|
|
67
|
+
// and so the same metadata — order doesn't matter).
|
|
68
|
+
for (const [prefix, meta] of inf.ancestorSources) {
|
|
69
|
+
if (!ancestorMetaByPath.has(prefix))
|
|
70
|
+
ancestorMetaByPath.set(prefix, meta);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// v4.7.0 PoC gap #1 — fold in every existing registration's path so
|
|
74
|
+
// AUGMENT's union includes paths the user already wrote.
|
|
75
|
+
if (input.existingRegistrations) {
|
|
76
|
+
for (const p of input.existingRegistrations.keys()) {
|
|
77
|
+
allPaths.add(p);
|
|
78
|
+
// Register parent prefixes too, in case the user wrote just a
|
|
79
|
+
// leaf without the chain (unusual but legal).
|
|
80
|
+
const segs = p.split(".");
|
|
81
|
+
for (let i = 1; i <= segs.length; i++) {
|
|
82
|
+
allPaths.add(segs.slice(0, i).join("."));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const pathsSorted = [...allPaths].sort();
|
|
87
|
+
// 3. Populate pathByFieldName for the spec emitter.
|
|
88
|
+
for (const { choice, inf } of inferred) {
|
|
89
|
+
pathByFieldName.set(choice.fieldName, inf.path);
|
|
90
|
+
if (inf.reviewNeeded) {
|
|
91
|
+
warnings.push({
|
|
92
|
+
severity: "warn",
|
|
93
|
+
message: `POMWright hierarchy fell back to flat for "${choice.fieldName}" — ` +
|
|
94
|
+
`no stable ancestor (main/form/nav/section-with-name) was found in the scanned xpath/CSS. ` +
|
|
95
|
+
`Consider adding an id, aria-label or role to the container, or editing the registered ` +
|
|
96
|
+
`path in the generated POM by hand.`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// 4. Emit the class body.
|
|
101
|
+
const lines = [];
|
|
102
|
+
lines.push(`import { type Page } from "@playwright/test";`);
|
|
103
|
+
const hasNewMethods = typeof input.methodsAppend === "string" && input.methodsAppend.length > 0;
|
|
104
|
+
const hasExistingMethods = Array.isArray(input.existingMethods) && input.existingMethods.length > 0;
|
|
105
|
+
const needsStepImport = hasNewMethods || hasExistingMethods;
|
|
106
|
+
if (needsStepImport) {
|
|
107
|
+
lines.push(`import { PageObject, step } from "pomwright";`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
lines.push(`import { PageObject } from "pomwright";`);
|
|
111
|
+
}
|
|
112
|
+
lines.push(``);
|
|
113
|
+
lines.push(`type Paths =`);
|
|
114
|
+
for (let i = 0; i < pathsSorted.length; i++) {
|
|
115
|
+
const sep = i === pathsSorted.length - 1 ? ";" : "";
|
|
116
|
+
lines.push(` | ${JSON.stringify(pathsSorted[i])}${sep}`);
|
|
117
|
+
}
|
|
118
|
+
lines.push(``);
|
|
119
|
+
lines.push(`export class ${pom.className} extends PageObject<Paths> {`);
|
|
120
|
+
lines.push(` constructor(page: Page) {`);
|
|
121
|
+
lines.push(` super(page, ${JSON.stringify(baseUrl)}, ${JSON.stringify(urlPath)});`);
|
|
122
|
+
lines.push(` }`);
|
|
123
|
+
lines.push(``);
|
|
124
|
+
lines.push(` protected defineLocators(): void {`);
|
|
125
|
+
// Emit INTERMEDIATE ancestor segments first (so the chain parents
|
|
126
|
+
// resolve). Each segment becomes a single registration; POMWright
|
|
127
|
+
// chains them together on `getNestedLocator`.
|
|
128
|
+
// Strategy: for each unique path, register the leaf step only once.
|
|
129
|
+
// The segment's Playwright call: for a leaf locator we have the
|
|
130
|
+
// original `choice.api(args)`; for ancestor segments we synthesise
|
|
131
|
+
// `getByRole(tag, { name })` or `locator(tag)` as best effort.
|
|
132
|
+
const emitted = new Set();
|
|
133
|
+
// Register ancestors in order of depth so the output reads root-first.
|
|
134
|
+
for (const path of pathsSorted) {
|
|
135
|
+
if (emitted.has(path))
|
|
136
|
+
continue;
|
|
137
|
+
emitted.add(path);
|
|
138
|
+
// v4.7.0 PoC gap #1 — existing registration wins over a fresh pick
|
|
139
|
+
// for the same path (classic AUGMENT: human-curated tuning stays).
|
|
140
|
+
const existingReg = input.existingRegistrations?.get(path);
|
|
141
|
+
if (existingReg) {
|
|
142
|
+
lines.push(` this.add(${JSON.stringify(path)}).${existingReg};`);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
// Does a leaf LocatorChoice correspond exactly to this path?
|
|
146
|
+
const leafMatch = inferred.find((x) => x.inf.path === path);
|
|
147
|
+
if (leafMatch) {
|
|
148
|
+
const { api, args } = leafMatch.choice;
|
|
149
|
+
lines.push(` this.add(${JSON.stringify(path)}).${api}(${args});`);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
// v4.7.1 — attestqa POMWright review (POMWright#73 close). Ancestor
|
|
153
|
+
// registration now reads the attribute SOURCE from the inferrer
|
|
154
|
+
// metadata. `getByRole(role, { name })` is only valid when the name
|
|
155
|
+
// came from `aria-label` (or a computed name); `id` alone doesn't
|
|
156
|
+
// satisfy Playwright's name-requirement rule for roles like `form`
|
|
157
|
+
// or `region`, so we fall back to `.locator("<tag>#<id>")` in that
|
|
158
|
+
// case. `aria-labelledby` needs the referenced element's text —
|
|
159
|
+
// which the snapshot doesn't carry — so we fall back to an
|
|
160
|
+
// attribute selector AND push a review warning.
|
|
161
|
+
const meta = ancestorMetaByPath.get(path);
|
|
162
|
+
const landmarkRole = meta ? ARIA_LANDMARK_ROLE[meta.tag] : undefined;
|
|
163
|
+
if (!meta) {
|
|
164
|
+
// Shouldn't happen for well-formed paths, but keep a sane default.
|
|
165
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(path.split(".").pop() ?? path)});`);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (!meta.attrSource) {
|
|
169
|
+
// Bare landmark (`main`, `nav`, `header`, `footer`, `aside`).
|
|
170
|
+
if (landmarkRole) {
|
|
171
|
+
lines.push(` this.add(${JSON.stringify(path)}).getByRole(${JSON.stringify(landmarkRole)});`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(meta.tag)});`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if (meta.attrSource === "aria-label" && landmarkRole) {
|
|
178
|
+
// Real accessible name → getByRole with name.
|
|
179
|
+
lines.push(` this.add(${JSON.stringify(path)}).getByRole(${JSON.stringify(landmarkRole)}, { name: ${JSON.stringify(meta.attrValue ?? "")} });`);
|
|
180
|
+
}
|
|
181
|
+
else if (meta.attrSource === "id") {
|
|
182
|
+
// id alone → CSS id selector. Does NOT satisfy getByRole's name rule.
|
|
183
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(`${meta.tag}#${meta.attrValue}`)});`);
|
|
184
|
+
}
|
|
185
|
+
else if (meta.attrSource === "name") {
|
|
186
|
+
// form[name="X"] etc — not an accessible name either.
|
|
187
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(`${meta.tag}[name="${meta.attrValue}"]`)});`);
|
|
188
|
+
}
|
|
189
|
+
else if (meta.attrSource === "aria-labelledby") {
|
|
190
|
+
// We don't have the text of the referenced element in the snapshot.
|
|
191
|
+
// Register as an attribute selector so the locator at least compiles,
|
|
192
|
+
// and warn the user to replace it with getByRole(..., {name: <text>}).
|
|
193
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(`${meta.tag}[aria-labelledby="${meta.attrValue}"]`)});`);
|
|
194
|
+
warnings.push({
|
|
195
|
+
severity: "warn",
|
|
196
|
+
message: `POMWright: path "${path}" uses aria-labelledby ("${meta.attrValue}"); ` +
|
|
197
|
+
`the referenced element's text is not in the snapshot. Registered as an attribute selector. ` +
|
|
198
|
+
`Replace with .getByRole("${landmarkRole ?? meta.tag}", { name: "<actual label text>" }) if possible.`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
// Unknown attr source — safe fallback.
|
|
203
|
+
lines.push(` this.add(${JSON.stringify(path)}).locator(${JSON.stringify(meta.tag)});`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
lines.push(` }`);
|
|
207
|
+
if (hasNewMethods) {
|
|
208
|
+
lines.push(``);
|
|
209
|
+
lines.push(input.methodsAppend);
|
|
210
|
+
}
|
|
211
|
+
// v4.7.0 PoC gap #1 — preserve every @step() method the scanner
|
|
212
|
+
// extracted from the existing file, verbatim, AFTER any freshly
|
|
213
|
+
// synthesised methods. Deduplicates by name: a new methodsAppend
|
|
214
|
+
// entry with the same name as an existing method WINS (freshly
|
|
215
|
+
// regenerated bodies reflect the current scenarios).
|
|
216
|
+
if (hasExistingMethods) {
|
|
217
|
+
const newMethodNames = new Set();
|
|
218
|
+
if (input.methodsAppend) {
|
|
219
|
+
for (const m of input.methodsAppend.matchAll(/async\s+([A-Za-z_$][\w$]*)\s*\(/g)) {
|
|
220
|
+
newMethodNames.add(m[1]);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
for (const em of input.existingMethods) {
|
|
224
|
+
if (newMethodNames.has(em.name))
|
|
225
|
+
continue;
|
|
226
|
+
lines.push(``);
|
|
227
|
+
lines.push(` @step()`);
|
|
228
|
+
lines.push(` async ${em.name}(): Promise<void> {`);
|
|
229
|
+
for (const bl of em.body.split("\n")) {
|
|
230
|
+
lines.push(` ${bl}`);
|
|
231
|
+
}
|
|
232
|
+
lines.push(` }`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
lines.push(`}`);
|
|
236
|
+
lines.push(``);
|
|
237
|
+
return {
|
|
238
|
+
contents: lines.join("\n"),
|
|
239
|
+
pathByFieldName,
|
|
240
|
+
warnings,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const ARIA_LANDMARK_ROLE = {
|
|
244
|
+
main: "main",
|
|
245
|
+
nav: "navigation",
|
|
246
|
+
header: "banner",
|
|
247
|
+
footer: "contentinfo",
|
|
248
|
+
aside: "complementary",
|
|
249
|
+
section: "region",
|
|
250
|
+
form: "form",
|
|
251
|
+
dialog: "dialog",
|
|
252
|
+
table: "table",
|
|
253
|
+
fieldset: "group",
|
|
254
|
+
};
|
|
255
|
+
// Historical: `deCamel(userName)` → `"User Name"`. Was used by v4.7.0's
|
|
256
|
+
// ancestor fallback to guess at an accessible name from a camelCased
|
|
257
|
+
// path segment. Dropped in v4.7.1 when the emitter switched to reading
|
|
258
|
+
// the real attribute source (`aria-label` → real name; `id` → CSS id
|
|
259
|
+
// selector). Kept here with `_` prefix in case a future
|
|
260
|
+
// read-the-browser-computed-name path wants to recover from it.
|
|
261
|
+
function _deCamel(s) {
|
|
262
|
+
return s.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/^./, (c) => c.toUpperCase());
|
|
263
|
+
}
|
|
264
|
+
function emitPomwrightSpec(input) {
|
|
265
|
+
const warnings = [];
|
|
266
|
+
const { describeName, pomClassName, pomVar, pomImportPath, scenarios, pathByFieldName, } = input;
|
|
267
|
+
// Translate a `<pomVar>.<field>` reference into a
|
|
268
|
+
// `<pomVar>.getNestedLocator("<path>")` reference.
|
|
269
|
+
// Leaves `<pomVar>.page` (the base Page escape hatch) alone.
|
|
270
|
+
const translate = (expr) => {
|
|
271
|
+
// Simple regex rewrite — the PoC. Doesn't handle every TS syntax, but
|
|
272
|
+
// the binding emitter output is predictable enough that this works
|
|
273
|
+
// for the common rule-emitted shapes.
|
|
274
|
+
const escapedVar = pomVar.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
275
|
+
const re = new RegExp(`\\b${escapedVar}\\.([A-Za-z_$][\\w$]*)`, "g");
|
|
276
|
+
return expr.replace(re, (_m, field) => {
|
|
277
|
+
// Known POMWright base-class members — leave untouched.
|
|
278
|
+
if (field === "page" ||
|
|
279
|
+
field === "getNestedLocator" ||
|
|
280
|
+
field === "getLocatorSchema" ||
|
|
281
|
+
field === "navigation" ||
|
|
282
|
+
field === "sessionStorage") {
|
|
283
|
+
return _m;
|
|
284
|
+
}
|
|
285
|
+
// POMWright replaces the synthesised `goto()` with its own
|
|
286
|
+
// `navigation.goto()` helper that reads the baseUrl + path given
|
|
287
|
+
// to `super(...)` in the constructor.
|
|
288
|
+
if (field === "goto")
|
|
289
|
+
return `${pomVar}.navigation.goto`;
|
|
290
|
+
const p = pathByFieldName.get(field);
|
|
291
|
+
if (!p) {
|
|
292
|
+
warnings.push({
|
|
293
|
+
severity: "warn",
|
|
294
|
+
message: `POMWright translation: no path for field "${field}" — left as-is, test may not compile.`,
|
|
295
|
+
});
|
|
296
|
+
return _m;
|
|
297
|
+
}
|
|
298
|
+
return `${pomVar}.getNestedLocator(${JSON.stringify(p)})`;
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
// v4.7.0 — match the classic emitter's v4.6.4 default (skip).
|
|
302
|
+
const todoMode = input.todoStepHandling ?? "skip";
|
|
303
|
+
const renderBinding = (b) => {
|
|
304
|
+
const label = ((b.step.keyword ?? "").trim() +
|
|
305
|
+
" " +
|
|
306
|
+
(b.step.text ?? "").trim()).trim();
|
|
307
|
+
const labelLit = JSON.stringify(label || "(empty step)");
|
|
308
|
+
const body = [];
|
|
309
|
+
if (b.customBody) {
|
|
310
|
+
body.push(...translate(b.customBody).split("\n"));
|
|
311
|
+
}
|
|
312
|
+
else if (b.pomCall) {
|
|
313
|
+
const args = b.pomCall.args.join(", ");
|
|
314
|
+
body.push(translate(`await ${b.pomCall.page}.${b.pomCall.method}(${args});`));
|
|
315
|
+
}
|
|
316
|
+
else if (b.assertion) {
|
|
317
|
+
const locator = translate(b.assertion.locator);
|
|
318
|
+
const expected = b.assertion.expected !== undefined ? b.assertion.expected : "";
|
|
319
|
+
body.push(`await expect(${locator}).${b.assertion.matcher}(${expected});`);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// v4.7.0 — attestqa-handoff defence parity with the classic path.
|
|
323
|
+
// "throw" raises an error so the test fails at the unbound step;
|
|
324
|
+
// "skip" / "none" leave a TODO comment (skip short-circuits via
|
|
325
|
+
// the test.fixme at the top of the test; none accepts silent pass).
|
|
326
|
+
const safeWarning = (b.warning ?? "no rule matched this step").replace(/\r?\n/g, " ");
|
|
327
|
+
if (todoMode === "throw") {
|
|
328
|
+
body.push(`throw new Error(${JSON.stringify(`TODO (bdd2pw): step not implemented — ${safeWarning}`)});`);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
body.push(`// TODO: ${safeWarning}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return (` await test.step(${labelLit}, async () => {\n` +
|
|
335
|
+
body.map((l) => ` ${l}`).join("\n") +
|
|
336
|
+
`\n });`);
|
|
337
|
+
};
|
|
338
|
+
// v4.7.0 PoC gap #2a. When stepMethods is on, each scenario's
|
|
339
|
+
// binding body becomes a method on the POM, decorated with @step()
|
|
340
|
+
// from POMWright. The test then calls that method instead of
|
|
341
|
+
// inlining `test.step(...)` per Gherkin step.
|
|
342
|
+
const stepMethods = input.stepMethods === true;
|
|
343
|
+
const pomMethodChunks = [];
|
|
344
|
+
const methodNameFor = (scenarioName) => {
|
|
345
|
+
const safe = scenarioName
|
|
346
|
+
.replace(/[^a-zA-Z0-9]+/g, " ")
|
|
347
|
+
.trim()
|
|
348
|
+
.split(/\s+/)
|
|
349
|
+
.map((w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
|
|
350
|
+
.join("");
|
|
351
|
+
return `scenario${safe.charAt(0).toUpperCase()}${safe.slice(1)}` || "scenario";
|
|
352
|
+
};
|
|
353
|
+
const lines = [];
|
|
354
|
+
lines.push(`import { expect } from "@playwright/test";`);
|
|
355
|
+
lines.push(`import { test as base } from "pomwright";`);
|
|
356
|
+
lines.push(`import { ${pomClassName} } from "${pomImportPath}";`);
|
|
357
|
+
lines.push(``);
|
|
358
|
+
lines.push(`const test = base.extend<{ ${pomVar}: ${pomClassName} }>({`);
|
|
359
|
+
lines.push(` ${pomVar}: async ({ page }, use) => {`);
|
|
360
|
+
lines.push(` await use(new ${pomClassName}(page));`);
|
|
361
|
+
lines.push(` },`);
|
|
362
|
+
lines.push(`});`);
|
|
363
|
+
lines.push(``);
|
|
364
|
+
lines.push(`test.describe(${JSON.stringify(describeName)}, () => {`);
|
|
365
|
+
if (input.beforeEach && input.beforeEach.length) {
|
|
366
|
+
lines.push(` test.beforeEach(async ({ ${pomVar} }) => {`);
|
|
367
|
+
for (const b of input.beforeEach) {
|
|
368
|
+
lines.push(renderBinding(b).replace(/^ {2}/gm, " "));
|
|
369
|
+
}
|
|
370
|
+
lines.push(` });`);
|
|
371
|
+
lines.push(``);
|
|
372
|
+
}
|
|
373
|
+
for (const s of scenarios) {
|
|
374
|
+
if (s.tags)
|
|
375
|
+
for (const t of s.tags)
|
|
376
|
+
lines.push(` // ${t}`);
|
|
377
|
+
lines.push(` test(${JSON.stringify(s.name)}, async ({ ${pomVar} }) => {`);
|
|
378
|
+
// v4.7.0 — parity with the classic emitter's v4.6.4 unbound-step
|
|
379
|
+
// defence (attestqa handoff 2026-10-19 — silent pass is wrong).
|
|
380
|
+
// If any binding is TODO, prepend test.fixme so Playwright reports
|
|
381
|
+
// the test as skipped rather than silently passed. The step-methods
|
|
382
|
+
// branch is unaffected (the method body contains the TODOs there).
|
|
383
|
+
if (todoMode === "skip") {
|
|
384
|
+
const todoBindings = s.bindings.filter((b) => !b.customBody && !b.pomCall && !b.assertion);
|
|
385
|
+
if (todoBindings.length > 0) {
|
|
386
|
+
const titles = todoBindings
|
|
387
|
+
.slice(0, 3)
|
|
388
|
+
.map((b) => {
|
|
389
|
+
const kw = (b.step.keyword ?? "").trim();
|
|
390
|
+
const tx = (b.step.text ?? "").trim();
|
|
391
|
+
return (kw ? `${kw} ${tx}` : tx).trim();
|
|
392
|
+
})
|
|
393
|
+
.join(" | ");
|
|
394
|
+
const more = todoBindings.length > 3 ? ` (+${todoBindings.length - 3} more)` : "";
|
|
395
|
+
const reason = `bdd2pw: ${todoBindings.length} step(s) not bound — ${titles}${more}`;
|
|
396
|
+
lines.push(` test.fixme(true, ${JSON.stringify(reason.replace(/\r?\n/g, " "))});`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (stepMethods) {
|
|
400
|
+
// Call the POM method; the method itself carries @step() so the
|
|
401
|
+
// Playwright report viewer shows one row per scenario.
|
|
402
|
+
const m = methodNameFor(s.name);
|
|
403
|
+
lines.push(` await ${pomVar}.${m}();`);
|
|
404
|
+
// Collect the method body for the POM-append output. Inside the
|
|
405
|
+
// POM class method body, references to the page-object variable
|
|
406
|
+
// (`loginPage`) should become `this`; the method body translator
|
|
407
|
+
// rewrites `<pomVar>.<x>` → `this.<x>` for every rewrite the spec
|
|
408
|
+
// translator does for `<pomVar>.<x>` → `<pomVar>.getNestedLocator(...)`.
|
|
409
|
+
const translateInsideMethod = makeInsideMethodTranslator(pomVar, pathByFieldName, warnings);
|
|
410
|
+
const bodyLines = [];
|
|
411
|
+
for (const b of s.bindings) {
|
|
412
|
+
const translated = renderBindingBodyOnly(b, pomVar, translateInsideMethod);
|
|
413
|
+
for (const l of translated.split("\n"))
|
|
414
|
+
bodyLines.push(` ${l}`);
|
|
415
|
+
}
|
|
416
|
+
pomMethodChunks.push(` @step()\n async ${m}(): Promise<void> {\n${bodyLines.join("\n")}\n }`);
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
for (const b of s.bindings) {
|
|
420
|
+
lines.push(renderBinding(b).replace(/^ {2}/gm, " "));
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
lines.push(` });`);
|
|
424
|
+
lines.push(``);
|
|
425
|
+
}
|
|
426
|
+
lines.push(`});`);
|
|
427
|
+
const result = { contents: lines.join("\n"), warnings };
|
|
428
|
+
if (stepMethods && pomMethodChunks.length > 0) {
|
|
429
|
+
result.pomMethodsAppend = pomMethodChunks.join("\n\n");
|
|
430
|
+
}
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* v4.7.0 PoC gap #2a. Translator variant for use INSIDE a POM class
|
|
435
|
+
* method body. Rewrites `<pomVar>.<field>` references to `this.<field>`
|
|
436
|
+
* equivalents, so the emitted code is valid inside the class:
|
|
437
|
+
*
|
|
438
|
+
* loginPage.usernameInput.fill("x") (spec context)
|
|
439
|
+
* → this.getNestedLocator("main.form@login.input@username").fill("x") (method body)
|
|
440
|
+
*
|
|
441
|
+
* loginPage.goto() → this.navigation.goto()
|
|
442
|
+
* loginPage.page → this.page
|
|
443
|
+
* loginPage.navigation → this.navigation
|
|
444
|
+
*/
|
|
445
|
+
function makeInsideMethodTranslator(pomVar, pathByFieldName, warnings) {
|
|
446
|
+
const escapedVar = pomVar.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
447
|
+
const re = new RegExp(`\\b${escapedVar}\\.([A-Za-z_$][\\w$]*)`, "g");
|
|
448
|
+
return (expr) => expr.replace(re, (_m, field) => {
|
|
449
|
+
if (field === "page" ||
|
|
450
|
+
field === "getNestedLocator" ||
|
|
451
|
+
field === "getLocatorSchema" ||
|
|
452
|
+
field === "navigation" ||
|
|
453
|
+
field === "sessionStorage") {
|
|
454
|
+
return `this.${field}`;
|
|
455
|
+
}
|
|
456
|
+
if (field === "goto")
|
|
457
|
+
return `this.navigation.goto`;
|
|
458
|
+
const p = pathByFieldName.get(field);
|
|
459
|
+
if (!p) {
|
|
460
|
+
warnings.push({
|
|
461
|
+
severity: "warn",
|
|
462
|
+
message: `POMWright translation (inside method): no path for field "${field}" — left as-is, test may not compile.`,
|
|
463
|
+
});
|
|
464
|
+
return _m;
|
|
465
|
+
}
|
|
466
|
+
return `this.getNestedLocator(${JSON.stringify(p)})`;
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Render a binding as pure statements (no `test.step` wrapper) — used by
|
|
471
|
+
* the @step()-decorated method body. Mirrors renderBinding minus the
|
|
472
|
+
* step wrapper and label line.
|
|
473
|
+
*/
|
|
474
|
+
function renderBindingBodyOnly(b, pomVar, translate) {
|
|
475
|
+
if (b.customBody)
|
|
476
|
+
return translate(b.customBody);
|
|
477
|
+
if (b.pomCall) {
|
|
478
|
+
const args = b.pomCall.args.join(", ");
|
|
479
|
+
return translate(`await ${b.pomCall.page}.${b.pomCall.method}(${args});`);
|
|
480
|
+
}
|
|
481
|
+
if (b.assertion) {
|
|
482
|
+
const locator = translate(b.assertion.locator);
|
|
483
|
+
const expected = b.assertion.expected !== undefined ? b.assertion.expected : "";
|
|
484
|
+
return `await expect(${locator}).${b.assertion.matcher}(${expected});`;
|
|
485
|
+
}
|
|
486
|
+
return `// TODO: ${b.warning ?? "no rule matched this step"}`;
|
|
487
|
+
}
|
|
488
|
+
//# sourceMappingURL=pomwrightEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pomwr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