@vijaypjavvadi/bdd2pw 4.6.7 → 4.7.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/CHANGELOG.md +124 -0
- package/README.md +18 -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 +445 -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 +27 -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 +57 -0
- package/dist/transformers/hierarchyInferrer.js +192 -0
- package/dist/transformers/hierarchyInferrer.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v4.7.0 — POMWright POM scanner (PoC gap #1 close-out). Parses an
|
|
3
|
+
* existing POMWright-shape Page Object file into the same
|
|
4
|
+
* `PageObjectIR` shape the classic repo scanner produces, so the
|
|
5
|
+
* AUGMENT path treats POMWright POMs as first-class input and doesn't
|
|
6
|
+
* destroy them on re-scaffold.
|
|
7
|
+
*
|
|
8
|
+
* What we parse out of a POMWright POM:
|
|
9
|
+
* - the class name (`export class LoginPage extends PageObject<Paths>`)
|
|
10
|
+
* - the super(...) call args: baseUrl + urlPath
|
|
11
|
+
* - every `this.add("<path>").<api>(<args>);` registration from the
|
|
12
|
+
* `defineLocators()` body, mapped back to a `LocatorChoice` with
|
|
13
|
+
* the dotted path encoded in `fieldName`.
|
|
14
|
+
* - every `@step()`-decorated async method on the class (preserved
|
|
15
|
+
* verbatim via `PomMethodIR`).
|
|
16
|
+
*
|
|
17
|
+
* What we DON'T parse yet (deferred — flagged as unparseable):
|
|
18
|
+
* - `getLocatorSchema(path).filter(...)` chains inside method bodies —
|
|
19
|
+
* these are preserved verbatim as method `body` but not round-tripped.
|
|
20
|
+
* - Shared-locator imports (`import { registerMain } from './_shared/main'`).
|
|
21
|
+
* - Session-storage schema arguments to `super(...)`.
|
|
22
|
+
*
|
|
23
|
+
* Mirrors `src/repo/repoScanner.ts` in its contract (returns the same
|
|
24
|
+
* `RepoScanResult.unparseableFieldNames` for anything the regex
|
|
25
|
+
* couldn't decode, so the attestqa v4.5.x safety nets (P0-1 REUSE
|
|
26
|
+
* no-op, P0-3 unparseable → missing, P0-4 spec-reference guard) all
|
|
27
|
+
* apply unchanged.
|
|
28
|
+
*/
|
|
29
|
+
import type { PageObjectIR } from "../types";
|
|
30
|
+
/**
|
|
31
|
+
* Parse a POMWright POM file's source text into IR.
|
|
32
|
+
*
|
|
33
|
+
* Returns `undefined` when the file doesn't look like a POMWright POM
|
|
34
|
+
* at all (no `extends PageObject<` substring); the caller then falls
|
|
35
|
+
* back to the classic scanner.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parsePomwrightSource(source: string, filePath: string): {
|
|
38
|
+
pom: PageObjectIR;
|
|
39
|
+
unparseableFieldNames: string[];
|
|
40
|
+
} | undefined;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v4.7.0 — POMWright POM scanner (PoC gap #1 close-out). Parses an
|
|
4
|
+
* existing POMWright-shape Page Object file into the same
|
|
5
|
+
* `PageObjectIR` shape the classic repo scanner produces, so the
|
|
6
|
+
* AUGMENT path treats POMWright POMs as first-class input and doesn't
|
|
7
|
+
* destroy them on re-scaffold.
|
|
8
|
+
*
|
|
9
|
+
* What we parse out of a POMWright POM:
|
|
10
|
+
* - the class name (`export class LoginPage extends PageObject<Paths>`)
|
|
11
|
+
* - the super(...) call args: baseUrl + urlPath
|
|
12
|
+
* - every `this.add("<path>").<api>(<args>);` registration from the
|
|
13
|
+
* `defineLocators()` body, mapped back to a `LocatorChoice` with
|
|
14
|
+
* the dotted path encoded in `fieldName`.
|
|
15
|
+
* - every `@step()`-decorated async method on the class (preserved
|
|
16
|
+
* verbatim via `PomMethodIR`).
|
|
17
|
+
*
|
|
18
|
+
* What we DON'T parse yet (deferred — flagged as unparseable):
|
|
19
|
+
* - `getLocatorSchema(path).filter(...)` chains inside method bodies —
|
|
20
|
+
* these are preserved verbatim as method `body` but not round-tripped.
|
|
21
|
+
* - Shared-locator imports (`import { registerMain } from './_shared/main'`).
|
|
22
|
+
* - Session-storage schema arguments to `super(...)`.
|
|
23
|
+
*
|
|
24
|
+
* Mirrors `src/repo/repoScanner.ts` in its contract (returns the same
|
|
25
|
+
* `RepoScanResult.unparseableFieldNames` for anything the regex
|
|
26
|
+
* couldn't decode, so the attestqa v4.5.x safety nets (P0-1 REUSE
|
|
27
|
+
* no-op, P0-3 unparseable → missing, P0-4 spec-reference guard) all
|
|
28
|
+
* apply unchanged.
|
|
29
|
+
*/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.parsePomwrightSource = parsePomwrightSource;
|
|
32
|
+
/**
|
|
33
|
+
* Parse a POMWright POM file's source text into IR.
|
|
34
|
+
*
|
|
35
|
+
* Returns `undefined` when the file doesn't look like a POMWright POM
|
|
36
|
+
* at all (no `extends PageObject<` substring); the caller then falls
|
|
37
|
+
* back to the classic scanner.
|
|
38
|
+
*/
|
|
39
|
+
function parsePomwrightSource(source, filePath) {
|
|
40
|
+
if (!/extends\s+PageObject\s*</.test(source))
|
|
41
|
+
return undefined;
|
|
42
|
+
// 1. Class name
|
|
43
|
+
const classMatch = source.match(/export\s+class\s+([A-Z][A-Za-z0-9_$]*)\s+extends\s+PageObject</);
|
|
44
|
+
if (!classMatch)
|
|
45
|
+
return undefined;
|
|
46
|
+
const className = classMatch[1];
|
|
47
|
+
// 2. super(page, baseUrl, path [, options]) arguments
|
|
48
|
+
// `super(page, "https://example.com", "/login")` or with { sessionStorage }.
|
|
49
|
+
const superMatch = source.match(/super\s*\(\s*page\s*,\s*(["'])([^"']+)\1\s*,\s*(["'])([^"']+)\3/);
|
|
50
|
+
const baseUrl = superMatch?.[2];
|
|
51
|
+
const urlPath = superMatch?.[4];
|
|
52
|
+
const url = baseUrl && urlPath ? baseUrl.replace(/\/$/, "") + urlPath : undefined;
|
|
53
|
+
// 3. Parse every `this.add("<path>").<api>(<args>);` line inside
|
|
54
|
+
// defineLocators(). We scope the search to just that method body
|
|
55
|
+
// so stray `.add(` calls elsewhere (unlikely but possible) are
|
|
56
|
+
// ignored.
|
|
57
|
+
const defineMatch = source.match(/protected\s+defineLocators\s*\(\s*\)\s*:\s*void\s*\{([\s\S]*?)\n\s*\}/);
|
|
58
|
+
const defineBody = defineMatch?.[1] ?? "";
|
|
59
|
+
const fields = [];
|
|
60
|
+
const unparseable = [];
|
|
61
|
+
// Match `this.add("<path>").<api>(<args>);` — tolerant of multi-line
|
|
62
|
+
// args by taking everything up to the terminating `);\n`.
|
|
63
|
+
const addRe = /this\.add\s*\(\s*(["'])([^"']+)\1\s*\)\s*\.([A-Za-z_$][\w$]*)\s*\(([\s\S]*?)\)\s*;/g;
|
|
64
|
+
let m;
|
|
65
|
+
const seenPaths = new Set();
|
|
66
|
+
while ((m = addRe.exec(defineBody)) !== null) {
|
|
67
|
+
const path = m[2];
|
|
68
|
+
const api = m[3];
|
|
69
|
+
const args = m[4].trim();
|
|
70
|
+
if (seenPaths.has(path))
|
|
71
|
+
continue;
|
|
72
|
+
seenPaths.add(path);
|
|
73
|
+
const allowedApis = new Set([
|
|
74
|
+
"getByRole",
|
|
75
|
+
"getByLabel",
|
|
76
|
+
"getByPlaceholder",
|
|
77
|
+
"getByTestId",
|
|
78
|
+
"getByText",
|
|
79
|
+
"getByAltText",
|
|
80
|
+
"getByTitle",
|
|
81
|
+
"locator",
|
|
82
|
+
]);
|
|
83
|
+
const confidence = allowedApis.has(api)
|
|
84
|
+
? "unique"
|
|
85
|
+
: "unparseable";
|
|
86
|
+
if (confidence === "unparseable")
|
|
87
|
+
unparseable.push(path);
|
|
88
|
+
fields.push({
|
|
89
|
+
api: api,
|
|
90
|
+
args,
|
|
91
|
+
// The POMWright path IS the field identity for this scanner; the
|
|
92
|
+
// emitter's rendering step names Paths by the path string directly.
|
|
93
|
+
// `fieldName` here is the full dotted path so the AUGMENT
|
|
94
|
+
// comparison ("is this path referenced by any step?") works
|
|
95
|
+
// against the POMWright path vocabulary.
|
|
96
|
+
fieldName: path,
|
|
97
|
+
source: { tag: "" },
|
|
98
|
+
confidence,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// 4. Extract each `@step()`-decorated async method body. Preserved as
|
|
102
|
+
// an opaque `PomMethodIR` so re-emit doesn't lose hand-written
|
|
103
|
+
// helper code. Matches:
|
|
104
|
+
// @step()
|
|
105
|
+
// async scenarioX(): Promise<void> { ... }
|
|
106
|
+
const methods = [];
|
|
107
|
+
const methodRe = /@step\s*\(\s*\)\s*\n?\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*\(([\s\S]*?)\)\s*:\s*Promise\s*<\s*[^>]+>\s*\{([\s\S]*?)\n\s*\}/g;
|
|
108
|
+
let mm;
|
|
109
|
+
while ((mm = methodRe.exec(source)) !== null) {
|
|
110
|
+
methods.push({
|
|
111
|
+
name: mm[1],
|
|
112
|
+
params: [], // param parsing is best-effort; preserve the body verbatim
|
|
113
|
+
body: mm[3].trim(),
|
|
114
|
+
// "existing" marks a method we scanned from disk — the AUGMENT
|
|
115
|
+
// path preserves it verbatim rather than re-synthesising.
|
|
116
|
+
origin: "existing",
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const pom = {
|
|
120
|
+
className,
|
|
121
|
+
filePath,
|
|
122
|
+
url,
|
|
123
|
+
fields,
|
|
124
|
+
methods,
|
|
125
|
+
exists: true,
|
|
126
|
+
};
|
|
127
|
+
return { pom, unparseableFieldNames: unparseable };
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=pomwrightScanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pomwrightScanner.js","sourceRoot":"","sources":["../../src/repo/pomwrightScanner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;AAWH,oDA0GC;AAjHD;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,MAAc,EACd,QAAgB;IAEhB,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAE/D,gBAAgB;IAChB,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAC7B,gEAAgE,CACjE,CAAC;IACF,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAEhC,sDAAsD;IACtD,gFAAgF;IAChF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAC7B,iEAAiE,CAClE,CAAC;IACF,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,GAAG,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAElF,iEAAiE;IACjE,oEAAoE;IACpE,kEAAkE;IAClE,cAAc;IACd,MAAM,WAAW,G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,IAAI;YACf,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;YACnB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,sEAAsE;IACtE,kEAAkE;IAClE,2BAA2B;IAC3B,eAAe;IACf,gDAAgD;IAChD,MAAM,OAAO,GAAkB,EAAE,CAAC;IAClC,MAAM,QAAQ,GACZ,4HAA4H,CAAC;IAC/H,IAAI,EAA0B,CAAC;IAC/B,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;YACX,MAAM,EAAE,EAAE,EAAE,2DAA2D;YACvE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YAClB,+DAA+D;YAC/D,0DAA0D;YAC1D,MAAM,EAAE,UAAU;SACnB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,GAAG,GAAiB;QACxB,SAAS;QACT,QAAQ;QACR,GAAG;QACH,MAAM;QACN,OAAO;QACP,MAAM,EAAE,IAAI;KACb,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -55,6 +55,12 @@ export interface ScaffoldProjectOptions {
|
|
|
55
55
|
* Issue 9 and pw-emit v1.3.0.
|
|
56
56
|
*/
|
|
57
57
|
dependencyStrategy?: "caret" | "exact";
|
|
58
|
+
/**
|
|
59
|
+
* v4.7.0 — when set to "pomwright", append the `pomwright` package to
|
|
60
|
+
* the scaffolded repo's `devDependencies`. Default `"classic"` emits
|
|
61
|
+
* the pre-v4.7.0 package.json.
|
|
62
|
+
*/
|
|
63
|
+
target?: "classic" | "pomwright";
|
|
58
64
|
}
|
|
59
65
|
export interface ScaffoldProjectResult {
|
|
60
66
|
filesWritten: string[];
|
|
@@ -80,6 +80,33 @@ async function scaffoldProject(opts) {
|
|
|
80
80
|
await emitPwSelfHealScaffold(opts.repoRoot, opts.selfHealingMode ?? "hybrid", filesWritten, warnings);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
// v4.7.0 — POMWright target PoC. When the scaffolder is emitting
|
|
84
|
+
// POMWright-shape POMs (opts.target === "pomwright"), the emitted
|
|
85
|
+
// project needs `pomwright` as a dev-dependency; otherwise the POM's
|
|
86
|
+
// `import { PageObject } from "pomwright"` line doesn't resolve on
|
|
87
|
+
// the first `npm install` in the output repo. Idempotent — re-scaffold
|
|
88
|
+
// with the same target doesn't produce a duplicate entry.
|
|
89
|
+
if (opts.target === "pomwright") {
|
|
90
|
+
const pkgPath = path.join(opts.repoRoot, "package.json");
|
|
91
|
+
if (await fs.pathExists(pkgPath)) {
|
|
92
|
+
try {
|
|
93
|
+
const pkgRaw = await fs.readFile(pkgPath, "utf8");
|
|
94
|
+
const pkg = JSON.parse(pkgRaw);
|
|
95
|
+
pkg.devDependencies ?? (pkg.devDependencies = {});
|
|
96
|
+
if (!pkg.devDependencies["pomwright"]) {
|
|
97
|
+
pkg.devDependencies["pomwright"] = "^3.0.0";
|
|
98
|
+
const trailer = pkgRaw.endsWith("\n") ? "\n" : "";
|
|
99
|
+
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + trailer, "utf8");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
warnings.push({
|
|
104
|
+
severity: "warn",
|
|
105
|
+
message: "Could not append `pomwright` to package.json — file was malformed. Add it manually: `npm i -D pomwright`.",
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
83
110
|
return {
|
|
84
111
|
filesWritten,
|
|
85
112
|
alreadyExisted,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectScaffolder.js","sourceRoot":"","sources":["../../src/repo/projectScaffolder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;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((m = re.exec(existing)) !== null) {
|
|
53
53
|
const id = m[1];
|
|
54
|
-
const
|
|
54
|
+
const _body = m[2]; // kept via m[2] capture semantics; actual splice uses m[0] below
|
|
55
55
|
// Stash the WHOLE block including markers so the splice keeps
|
|
56
56
|
// them in the output. (If we only captured `body`, a subsequent
|
|
57
57
|
// regen would lose the markers and the next regen wouldn't see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specMerge.js","sourceRoot":"","sources":["../../src/reports/specMerge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;AAYH,4CAEC;AAGD,8CAeC;AAsBD,0CAiCC;AAMD,wDAUC;AArGD,mEAAmE;AACnE,MAAM,aAAa,GACjB,iGAAiG,CAAC;AAEpG,gEAAgE;AAChE,SAAS,eAAe,CAAC,OAAe,EAAE,MAAc;IACtD,OAAO,yBAAyB,OAAO,WAAW,MAAM,EAAE,CAAC;AAC7D,CAAC;AAED,2EAA2E;AAC3E,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,4BAA4B,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,2DAA2D;AAC3D,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjD,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"specMerge.js","sourceRoot":"","sources":["../../src/reports/specMerge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;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CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v4.7.0 — attestqa POMWright PoC (POMWright#63). Given a `LocatorChoice`
|
|
3
|
+
* (the picked locator for one element on the scanned page), infer the
|
|
4
|
+
* dotted POMWright path for that element by walking its xpath / CSS
|
|
5
|
+
* selector for stable ancestor containers.
|
|
6
|
+
*
|
|
7
|
+
* The POMWright convention from DyHex's README example:
|
|
8
|
+
* path: `main.form@login.input@username`
|
|
9
|
+
* └┬─┘ └──┬────┘ └───┬───────┘
|
|
10
|
+
* │ │ └ leaf: <noun>@<name> (name = accessible)
|
|
11
|
+
* │ └ container: <tag>@<id-or-name>
|
|
12
|
+
* └ root: top-level landmark (main | nav | aside | header | footer)
|
|
13
|
+
*
|
|
14
|
+
* Containers we treat as stable ancestors (i.e. stable enough to anchor
|
|
15
|
+
* a path segment without the test becoming brittle):
|
|
16
|
+
* main, nav, header, footer, aside, section (only when it has an
|
|
17
|
+
* aria-label or id), form (only when it has a name, id, or
|
|
18
|
+
* aria-label), dialog (only with aria-label/aria-labelledby).
|
|
19
|
+
*
|
|
20
|
+
* Elements we treat as LEAVES (named by role or test-id, not container):
|
|
21
|
+
* button, link, textbox/input, checkbox, radio, combobox, img, heading.
|
|
22
|
+
*
|
|
23
|
+
* When the xpath / CSS doesn't yield any stable ancestor → return a
|
|
24
|
+
* FLAT path (just the leaf) plus a `reviewNeeded: true` flag so the
|
|
25
|
+
* caller can emit a `// TODO: review hierarchy for <name>` comment.
|
|
26
|
+
* This is the explicit design call from the POMWright maintainer:
|
|
27
|
+
* "where the DOM doesn't provide enough information to reliably
|
|
28
|
+
* establish a hierarchy, I'd much rather see simpler locator paths
|
|
29
|
+
* or something flagged for manual review than an unnecessarily
|
|
30
|
+
* complicated or brittle chain."
|
|
31
|
+
*/
|
|
32
|
+
import type { LocatorChoice } from "../types";
|
|
33
|
+
export interface InferredPath {
|
|
34
|
+
/** The dotted POMWright path, e.g. "main.form@login.input@username". */
|
|
35
|
+
path: string;
|
|
36
|
+
/** Segments in order, root-first. Convenient for callers that want to
|
|
37
|
+
* register parent segments too. */
|
|
38
|
+
segments: string[];
|
|
39
|
+
/** True when the DOM didn't give us enough to chain reliably; the
|
|
40
|
+
* caller should emit a review marker. */
|
|
41
|
+
reviewNeeded: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build the POMWright path for a single `LocatorChoice`.
|
|
45
|
+
*
|
|
46
|
+
* Strategy:
|
|
47
|
+
* 1. Extract ancestor container segments from xpath (preferred) or
|
|
48
|
+
* CSS selector. Each stable ancestor becomes `<tag>@<name>`
|
|
49
|
+
* (name from `id`, `name`, `aria-label` — whichever exists).
|
|
50
|
+
* Ancestors without any of those are dropped (not stable).
|
|
51
|
+
* 2. The leaf's own segment comes from the element's role (or tag)
|
|
52
|
+
* plus its accessible name / label / placeholder / testid /
|
|
53
|
+
* field-name.
|
|
54
|
+
* 3. If no stable ancestors are found, the path is just the leaf;
|
|
55
|
+
* `reviewNeeded = true` so the emitter can warn.
|
|
56
|
+
*/
|
|
57
|
+
export declare function inferPomwrightPath(choice: LocatorChoice): InferredPath;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v4.7.0 — attestqa POMWright PoC (POMWright#63). Given a `LocatorChoice`
|
|
4
|
+
* (the picked locator for one element on the scanned page), infer the
|
|
5
|
+
* dotted POMWright path for that element by walking its xpath / CSS
|
|
6
|
+
* selector for stable ancestor containers.
|
|
7
|
+
*
|
|
8
|
+
* The POMWright convention from DyHex's README example:
|
|
9
|
+
* path: `main.form@login.input@username`
|
|
10
|
+
* └┬─┘ └──┬────┘ └───┬───────┘
|
|
11
|
+
* │ │ └ leaf: <noun>@<name> (name = accessible)
|
|
12
|
+
* │ └ container: <tag>@<id-or-name>
|
|
13
|
+
* └ root: top-level landmark (main | nav | aside | header | footer)
|
|
14
|
+
*
|
|
15
|
+
* Containers we treat as stable ancestors (i.e. stable enough to anchor
|
|
16
|
+
* a path segment without the test becoming brittle):
|
|
17
|
+
* main, nav, header, footer, aside, section (only when it has an
|
|
18
|
+
* aria-label or id), form (only when it has a name, id, or
|
|
19
|
+
* aria-label), dialog (only with aria-label/aria-labelledby).
|
|
20
|
+
*
|
|
21
|
+
* Elements we treat as LEAVES (named by role or test-id, not container):
|
|
22
|
+
* button, link, textbox/input, checkbox, radio, combobox, img, heading.
|
|
23
|
+
*
|
|
24
|
+
* When the xpath / CSS doesn't yield any stable ancestor → return a
|
|
25
|
+
* FLAT path (just the leaf) plus a `reviewNeeded: true` flag so the
|
|
26
|
+
* caller can emit a `// TODO: review hierarchy for <name>` comment.
|
|
27
|
+
* This is the explicit design call from the POMWright maintainer:
|
|
28
|
+
* "where the DOM doesn't provide enough information to reliably
|
|
29
|
+
* establish a hierarchy, I'd much rather see simpler locator paths
|
|
30
|
+
* or something flagged for manual review than an unnecessarily
|
|
31
|
+
* complicated or brittle chain."
|
|
32
|
+
*/
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.inferPomwrightPath = inferPomwrightPath;
|
|
35
|
+
const naming_1 = require("../utils/naming");
|
|
36
|
+
/** Container tags we recognise as path-segment-worthy ancestors. */
|
|
37
|
+
const STABLE_CONTAINER_TAGS = new Set([
|
|
38
|
+
"main",
|
|
39
|
+
"nav",
|
|
40
|
+
"header",
|
|
41
|
+
"footer",
|
|
42
|
+
"aside",
|
|
43
|
+
"section",
|
|
44
|
+
"form",
|
|
45
|
+
"dialog",
|
|
46
|
+
"fieldset",
|
|
47
|
+
"table",
|
|
48
|
+
]);
|
|
49
|
+
/** Map a container tag to its POMWright "role noun" for leaf naming. */
|
|
50
|
+
const ROLE_NOUN = {
|
|
51
|
+
button: "button",
|
|
52
|
+
a: "link",
|
|
53
|
+
input: "input",
|
|
54
|
+
textarea: "input",
|
|
55
|
+
select: "select",
|
|
56
|
+
img: "image",
|
|
57
|
+
label: "label",
|
|
58
|
+
h1: "heading",
|
|
59
|
+
h2: "heading",
|
|
60
|
+
h3: "heading",
|
|
61
|
+
h4: "heading",
|
|
62
|
+
h5: "heading",
|
|
63
|
+
h6: "heading",
|
|
64
|
+
table: "table",
|
|
65
|
+
form: "form",
|
|
66
|
+
nav: "nav",
|
|
67
|
+
dialog: "dialog",
|
|
68
|
+
fieldset: "group",
|
|
69
|
+
aside: "aside",
|
|
70
|
+
section: "section",
|
|
71
|
+
header: "header",
|
|
72
|
+
footer: "footer",
|
|
73
|
+
main: "main",
|
|
74
|
+
td: "cell",
|
|
75
|
+
th: "header",
|
|
76
|
+
li: "item",
|
|
77
|
+
p: "text",
|
|
78
|
+
span: "text",
|
|
79
|
+
div: "region",
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Build the POMWright path for a single `LocatorChoice`.
|
|
83
|
+
*
|
|
84
|
+
* Strategy:
|
|
85
|
+
* 1. Extract ancestor container segments from xpath (preferred) or
|
|
86
|
+
* CSS selector. Each stable ancestor becomes `<tag>@<name>`
|
|
87
|
+
* (name from `id`, `name`, `aria-label` — whichever exists).
|
|
88
|
+
* Ancestors without any of those are dropped (not stable).
|
|
89
|
+
* 2. The leaf's own segment comes from the element's role (or tag)
|
|
90
|
+
* plus its accessible name / label / placeholder / testid /
|
|
91
|
+
* field-name.
|
|
92
|
+
* 3. If no stable ancestors are found, the path is just the leaf;
|
|
93
|
+
* `reviewNeeded = true` so the emitter can warn.
|
|
94
|
+
*/
|
|
95
|
+
function inferPomwrightPath(choice) {
|
|
96
|
+
const el = choice.source;
|
|
97
|
+
const leafNoun = ROLE_NOUN[el.tag] ?? el.role ?? "element";
|
|
98
|
+
const leafName = (0, naming_1.camelCase)(choice.fieldName)
|
|
99
|
+
// Strip any role suffix the classic picker appended (`usernameInput` → `username`).
|
|
100
|
+
.replace(/(Input|Button|Link|Select|Checkbox|Radio|Heading|Alert|Image|Textarea)$/, "") || (0, naming_1.camelCase)(choice.fieldName);
|
|
101
|
+
const leafSegment = `${leafNoun}@${leafName}`;
|
|
102
|
+
// Walk xpath first (most reliable), fall back to CSS selector.
|
|
103
|
+
const ancestorSegments = extractAncestors(el.xpath, el.cssSelector);
|
|
104
|
+
if (ancestorSegments.length === 0) {
|
|
105
|
+
return {
|
|
106
|
+
path: leafSegment,
|
|
107
|
+
segments: [leafSegment],
|
|
108
|
+
reviewNeeded: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const segments = [...ancestorSegments, leafSegment];
|
|
112
|
+
return {
|
|
113
|
+
path: segments.join("."),
|
|
114
|
+
segments,
|
|
115
|
+
reviewNeeded: false,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Walk an xpath (preferred) or CSS selector and return stable-ancestor
|
|
120
|
+
* segments, root-first. Each segment is `<tag>@<name>` when a name is
|
|
121
|
+
* available, or `<tag>` for landmarks (`main`, `header`, `nav`,
|
|
122
|
+
* `footer`, `aside`) which are unique enough on their own.
|
|
123
|
+
*/
|
|
124
|
+
function extractAncestors(xpath, css) {
|
|
125
|
+
const segments = [];
|
|
126
|
+
if (xpath) {
|
|
127
|
+
// xpath like `/html/body/main/form[@id="login"]/input[@name="username"]`
|
|
128
|
+
// or `//*[@id="login"]/form/input`. Parse step-by-step.
|
|
129
|
+
const steps = xpath.split("/").filter(Boolean);
|
|
130
|
+
for (const step of steps) {
|
|
131
|
+
// Step shapes:
|
|
132
|
+
// main
|
|
133
|
+
// form[@id="login"]
|
|
134
|
+
// section[@aria-label="Checkout"]
|
|
135
|
+
// div[2] — positional, not stable → skip
|
|
136
|
+
// *[@id="login"] — any-tag with id
|
|
137
|
+
// dialog[@aria-labelledby="h"]
|
|
138
|
+
const m = step.match(/^(?<tag>[a-zA-Z][a-zA-Z0-9-]*|\*)(?:\[@(?<attr>id|name|aria-label|aria-labelledby)="(?<val>[^"]+)"\])?(?:\[\d+\])?$/);
|
|
139
|
+
if (!m || !m.groups)
|
|
140
|
+
continue;
|
|
141
|
+
const tag = m.groups.tag.toLowerCase();
|
|
142
|
+
const attrVal = m.groups.val;
|
|
143
|
+
// Landmarks: stable on their own.
|
|
144
|
+
if (["main", "nav", "header", "footer", "aside"].includes(tag)) {
|
|
145
|
+
segments.push(tag);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
// Other container tags: require a name attribute to be stable.
|
|
149
|
+
if (STABLE_CONTAINER_TAGS.has(tag) && attrVal) {
|
|
150
|
+
segments.push(`${tag}@${(0, naming_1.camelCase)(attrVal)}`);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
// `*[@id="..."]` — unknown tag, named by id → treat as a generic
|
|
154
|
+
// section segment; keep because id is stable.
|
|
155
|
+
if (tag === "*" && attrVal) {
|
|
156
|
+
segments.push(`section@${(0, naming_1.camelCase)(attrVal)}`);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
// Any other step (positional divs, unnamed containers, leaves) is
|
|
160
|
+
// dropped — unstable or redundant.
|
|
161
|
+
}
|
|
162
|
+
if (segments.length > 0)
|
|
163
|
+
return segments;
|
|
164
|
+
}
|
|
165
|
+
// CSS selector fallback — far weaker, but catches `main form#login input[name=username]`
|
|
166
|
+
// style selectors. Only parse the DESCENDANT chain (spaces), ignore
|
|
167
|
+
// combinators like `>` and `+` for the PoC.
|
|
168
|
+
if (css) {
|
|
169
|
+
const parts = css.split(/\s+/).filter(Boolean);
|
|
170
|
+
for (const part of parts) {
|
|
171
|
+
// part like `main` or `form#login` or `#checkout` or `section[aria-label="X"]`
|
|
172
|
+
const tagMatch = part.match(/^([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
173
|
+
const idMatch = part.match(/#([a-zA-Z_][\w-]*)/);
|
|
174
|
+
const ariaLabelMatch = part.match(/\[aria-label=["']([^"']+)["']\]/);
|
|
175
|
+
const tag = (tagMatch ? tagMatch[1] : "").toLowerCase();
|
|
176
|
+
const name = idMatch?.[1] ?? ariaLabelMatch?.[1];
|
|
177
|
+
if (["main", "nav", "header", "footer", "aside"].includes(tag)) {
|
|
178
|
+
segments.push(tag);
|
|
179
|
+
}
|
|
180
|
+
else if (STABLE_CONTAINER_TAGS.has(tag) && name) {
|
|
181
|
+
segments.push(`${tag}@${(0, naming_1.camelCase)(name)}`);
|
|
182
|
+
}
|
|
183
|
+
else if (!tag && name) {
|
|
184
|
+
// Bare `#login` → section-like anchor.
|
|
185
|
+
segments.push(`section@${(0, naming_1.camelCase)(name)}`);
|
|
186
|
+
}
|
|
187
|
+
// Leaves inside the chain are handled by the caller's leaf segment.
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return segments;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=hierarchyInferrer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchyInferrer.js","sourceRoot":"","sources":["../../src/transformers/hierarchyInferrer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;AA6EH,gDA8BC;AAxGD,4CAA4C;AAE5C,oEAAoE;AACpE,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;CACR,CAAC,CAAC;AAEH,wEAAwE;AACxE,MAAM,SAAS,GAA2B;IACxC,MAAM,EAAE,QAAQ;IAChB,CAAC,EAAE,MAAM;IACT,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE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EAAE,CAAC;gBAClD,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,IAAA,kBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7C,CAAC;iBAAM,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;gBACxB,uCAAuC;gBACvC,QAAQ,CAAC,IAAI,CAAC,WAAW,IAAA,kBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,oEAAoE;QACtE,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -262,6 +262,34 @@ export interface ScaffoldOptions {
|
|
|
262
262
|
* bare `// TODO:` comment, no runtime signal. Not recommended.
|
|
263
263
|
*/
|
|
264
264
|
todoStepHandling?: "skip" | "throw" | "none";
|
|
265
|
+
/**
|
|
266
|
+
* v4.7.0 — alternative output shape (POMWright integration PoC, per
|
|
267
|
+
* DyHex design discussion on POMWright#63). `"classic"` (default)
|
|
268
|
+
* keeps byte-identical behaviour: Page Object classes with
|
|
269
|
+
* `readonly fieldName = page.getBy...` properties. `"pomwright"`
|
|
270
|
+
* emits `class LoginPage extends PageObject<Paths>` with locators
|
|
271
|
+
* registered under hierarchical dotted paths
|
|
272
|
+
* (`main.form@login.input@username`) via `this.add(path).method()`.
|
|
273
|
+
* The companion spec uses POMWright's own `test` fixture so
|
|
274
|
+
* `getNestedLocator(path)` works.
|
|
275
|
+
*
|
|
276
|
+
* POMWright is a runtime dep of the emitted project when this is
|
|
277
|
+
* set; add `pomwright` to the scaffolded repo's package.json.
|
|
278
|
+
*
|
|
279
|
+
* New POMs only in the PoC — updating existing POMWright POMs is
|
|
280
|
+
* deferred until the LocatorRegistry round-trip is figured out.
|
|
281
|
+
*/
|
|
282
|
+
target?: "classic" | "pomwright";
|
|
283
|
+
/**
|
|
284
|
+
* v4.7.0 PoC gap #2a close-out. When `target === "pomwright"` and
|
|
285
|
+
* this is true, each scenario's bindings become a `@step()`-decorated
|
|
286
|
+
* method on the POM, and the test calls that method instead of
|
|
287
|
+
* inlining `test.step(...)` per Gherkin step. The Playwright report
|
|
288
|
+
* then shows one row per scenario — matching how a hand-written
|
|
289
|
+
* POMWright suite reads. Ignored when `target !== "pomwright"`.
|
|
290
|
+
* Default: false.
|
|
291
|
+
*/
|
|
292
|
+
pomwrightStepMethods?: boolean;
|
|
265
293
|
llm?: "anthropic" | "openai" | "gemini";
|
|
266
294
|
governanceUrl?: string;
|
|
267
295
|
templates?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vijaypjavvadi/bdd2pw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Scaffold runnable Playwright TypeScript tests from Gherkin .feature files. Detects existing Page Objects, scans live pages via Microsoft Playwright MCP, emits POMs + specs, ready for execution. CLI + HTTP service. Optional governed LLM fallback (Anthropic / OpenAI / Gemini).",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bdd2pw": "dist/cli.js"
|