@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.
@@ -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,U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E,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[];
@@ -67,6 +67,37 @@ async function scaffoldProject(opts) {
67
67
  });
68
68
  const filesWritten = [...result.filesWritten];
69
69
  const warnings = [...result.warnings];
70
+ // v4.7.1 audit fix — pw-emit's bundled tsconfig.json.tmpl writes
71
+ // `"module": "commonjs"` + `"moduleResolution": "node"`. TypeScript
72
+ // 5.5+ treats `moduleResolution: "node"` as the removed `node10`
73
+ // alias and errors. The valid replacement pairs are:
74
+ // - module=node16 + moduleResolution=node16 (but requires `.js`
75
+ // extensions on relative imports — breaks our `../pages/login.page`)
76
+ // - module=esnext + moduleResolution=bundler (ESM-flavoured; lenient
77
+ // on extensions; works with Playwright's test runner, which
78
+ // accepts both module systems transparently)
79
+ //
80
+ // Patching both keys to the bundler pair is the clean fix. The emitted
81
+ // imports (`import { PageObject } from "pomwright"`) are already
82
+ // ESM-style, so no spec changes needed. Type-check-only; actual
83
+ // runtime goes through `npx playwright test` which handles both.
84
+ // Idempotent: skips if already patched. Follow-up: fix at the pw-emit
85
+ // template level.
86
+ const emittedTsconfig = path.join(opts.repoRoot, "tsconfig.json");
87
+ if (await fs.pathExists(emittedTsconfig)) {
88
+ try {
89
+ const raw = await fs.readFile(emittedTsconfig, "utf8");
90
+ if (/"moduleResolution"\s*:\s*"node"(?!(?:16|next))/.test(raw)) {
91
+ const patched = raw
92
+ .replace(/("module"\s*:\s*)"commonjs"/, '$1"esnext"')
93
+ .replace(/("moduleResolution"\s*:\s*)"node"(?!(?:16|next))/, '$1"bundler"');
94
+ await fs.writeFile(emittedTsconfig, patched, "utf8");
95
+ }
96
+ }
97
+ catch {
98
+ // Non-fatal — leave the tsconfig as emitted.
99
+ }
100
+ }
70
101
  if (opts.selfHealing) {
71
102
  if (opts.legacyHealing) {
72
103
  warnings.push({
@@ -80,6 +111,33 @@ async function scaffoldProject(opts) {
80
111
  await emitPwSelfHealScaffold(opts.repoRoot, opts.selfHealingMode ?? "hybrid", filesWritten, warnings);
81
112
  }
82
113
  }
114
+ // v4.7.0 — POMWright target PoC. When the scaffolder is emitting
115
+ // POMWright-shape POMs (opts.target === "pomwright"), the emitted
116
+ // project needs `pomwright` as a dev-dependency; otherwise the POM's
117
+ // `import { PageObject } from "pomwright"` line doesn't resolve on
118
+ // the first `npm install` in the output repo. Idempotent — re-scaffold
119
+ // with the same target doesn't produce a duplicate entry.
120
+ if (opts.target === "pomwright") {
121
+ const pkgPath = path.join(opts.repoRoot, "package.json");
122
+ if (await fs.pathExists(pkgPath)) {
123
+ try {
124
+ const pkgRaw = await fs.readFile(pkgPath, "utf8");
125
+ const pkg = JSON.parse(pkgRaw);
126
+ pkg.devDependencies ?? (pkg.devDependencies = {});
127
+ if (!pkg.devDependencies["pomwright"]) {
128
+ pkg.devDependencies["pomwright"] = "^3.0.0";
129
+ const trailer = pkgRaw.endsWith("\n") ? "\n" : "";
130
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + trailer, "utf8");
131
+ }
132
+ }
133
+ catch {
134
+ warnings.push({
135
+ severity: "warn",
136
+ message: "Could not append `pomwright` to package.json — file was malformed. Add it manually: `npm i -D pomwright`.",
137
+ });
138
+ }
139
+ }
140
+ }
83
141
  return {
84
142
  filesWritten,
85
143
  alreadyExisted,
@@ -1 +1 @@
1
- {"version":3,"file":"projectScaffolder.js","sourceRoot":"","sources":["../../src/repo/projectScaffolder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;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,EACR,qGAAqG;aACxG,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACpD,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,EAAE,CAAC,SAAS,CAChB,OAAO,EACP,uEAAuE;YACrE,sEAAsE;YACtE,mEAAmE;YACnE,yEAAyE,EAC3E,MAAM,CACP,CAAC;QACF,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -51,7 +51,7 @@ function extractUserBlocks(existing) {
51
51
  let m;
52
52
  while ((m = re.exec(existing)) !== null) {
53
53
  const id = m[1];
54
- const body = m[2];
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,O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ocatorChoice`
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
+ /**
34
+ * v4.7.1 — attestqa POMWright review (POMWright#73 close). Playwright's
35
+ * `getByRole(role, { name })` requires the accessible name to come from
36
+ * `aria-label` or the browser's computed name — `id` alone does NOT
37
+ * satisfy it. Earlier (v4.7.0) the inferrer collapsed every ancestor
38
+ * attribute source into the segment name, so `form[@id="login"]` got
39
+ * emitted as `getByRole("form", { name: "Login" })` — which never
40
+ * matches on a real page and silently kills the whole subtree.
41
+ *
42
+ * Fix: carry the attribute SOURCE through to the emitter so it can pick
43
+ * the right Playwright call:
44
+ * - `aria-label="X"` → `getByRole(role, { name: "X" })` ✓ real a11y name
45
+ * - `id="X"` only → `.locator("<tag>#X")` ✓ CSS id fallback
46
+ * - `aria-labelledby="Y"` → `.locator("<tag>[aria-labelledby='Y']")` + review marker
47
+ * (we don't have element#Y's text in the snapshot)
48
+ * - `name="X"` (form attr) → `.locator("<tag>[name='X']")`
49
+ * - landmark bare (main etc) → `getByRole(landmark)` unchanged
50
+ */
51
+ export type AncestorAttrSource = "aria-label" | "id" | "aria-labelledby" | "name";
52
+ export interface AncestorMeta {
53
+ tag: string;
54
+ attrSource?: AncestorAttrSource;
55
+ attrValue?: string;
56
+ }
57
+ export interface InferredPath {
58
+ /** The dotted POMWright path, e.g. "main.form@login.input@username". */
59
+ path: string;
60
+ /** Segments in order, root-first. Convenient for callers that want to
61
+ * register parent segments too. */
62
+ segments: string[];
63
+ /** True when the DOM didn't give us enough to chain reliably; the
64
+ * caller should emit a review marker. */
65
+ reviewNeeded: boolean;
66
+ /** v4.7.1 — per-ancestor-segment metadata so the emitter can pick the
67
+ * right Playwright call (id-only → `.locator('#id')`, aria-label →
68
+ * `getByRole(role, { name })`, etc.). Keyed by the full dotted path
69
+ * prefix of the segment (e.g. "main", "main.form@login"). Leaf segment
70
+ * is NOT in this map — the leaf uses the picked LocatorChoice's own api. */
71
+ ancestorSources: Map<string, AncestorMeta>;
72
+ }
73
+ /**
74
+ * Build the POMWright path for a single `LocatorChoice`.
75
+ *
76
+ * Strategy:
77
+ * 1. Extract ancestor container segments from xpath (preferred) or
78
+ * CSS selector. Each stable ancestor becomes `<tag>@<name>`
79
+ * (name from `id`, `name`, `aria-label` — whichever exists).
80
+ * Ancestors without any of those are dropped (not stable).
81
+ * 2. The leaf's own segment comes from the element's role (or tag)
82
+ * plus its accessible name / label / placeholder / testid /
83
+ * field-name.
84
+ * 3. If no stable ancestors are found, the path is just the leaf;
85
+ * `reviewNeeded = true` so the emitter can warn.
86
+ */
87
+ export declare function inferPomwrightPath(choice: LocatorChoice): InferredPath;
@@ -0,0 +1,236 @@
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
+ // v4.7.1 audit fix — for GENERIC wrapper tags (`div`/`span`/`p`/`section`/
98
+ // `article`) prefer the actual ARIA role (e.g. `alert` for a div with
99
+ // role="alert") over the tag-to-noun mapping (which maps div → "region").
100
+ // Otherwise the path says `main.region@error` but the locator uses
101
+ // `getByRole("alert", ...)` — semantically confusing. For specific tags
102
+ // (`input` / `button` / `a` / `img` / `h1-h6`), keep the tag mapping:
103
+ // `input@username` reads better than `textbox@username`.
104
+ const GENERIC_WRAPPER_TAGS = new Set(["div", "span", "p", "section", "article"]);
105
+ const leafNoun = GENERIC_WRAPPER_TAGS.has(el.tag)
106
+ ? (el.role ?? ROLE_NOUN[el.tag] ?? "element")
107
+ : (ROLE_NOUN[el.tag] ?? el.role ?? "element");
108
+ const leafName = (0, naming_1.camelCase)(choice.fieldName)
109
+ // Strip any role suffix the classic picker appended (`usernameInput` → `username`).
110
+ .replace(/(Input|Button|Link|Select|Checkbox|Radio|Heading|Alert|Image|Textarea)$/, "") || (0, naming_1.camelCase)(choice.fieldName);
111
+ const leafSegment = `${leafNoun}@${leafName}`;
112
+ // Walk xpath first (most reliable), fall back to CSS selector.
113
+ // v4.7.1 — extractAncestors now returns each segment with its source
114
+ // metadata so the emitter can pick the right Playwright call.
115
+ const ancestorMetas = extractAncestors(el.xpath, el.cssSelector);
116
+ if (ancestorMetas.length === 0) {
117
+ return {
118
+ path: leafSegment,
119
+ segments: [leafSegment],
120
+ reviewNeeded: true,
121
+ ancestorSources: new Map(),
122
+ };
123
+ }
124
+ const ancestorSegments = ancestorMetas.map((m) => m.segment);
125
+ const segments = [...ancestorSegments, leafSegment];
126
+ // Build the ancestorSources map keyed by the full dotted prefix of
127
+ // each ancestor segment (e.g. "main", "main.form@login"). The leaf
128
+ // segment is NOT in the map because its locator comes from the
129
+ // LocatorChoice the picker chose for the element itself.
130
+ const ancestorSources = new Map();
131
+ for (let i = 0; i < ancestorMetas.length; i++) {
132
+ const prefix = ancestorSegments.slice(0, i + 1).join(".");
133
+ ancestorSources.set(prefix, {
134
+ tag: ancestorMetas[i].tag,
135
+ attrSource: ancestorMetas[i].attrSource,
136
+ attrValue: ancestorMetas[i].attrValue,
137
+ });
138
+ }
139
+ return {
140
+ path: segments.join("."),
141
+ segments,
142
+ reviewNeeded: false,
143
+ ancestorSources,
144
+ };
145
+ }
146
+ /**
147
+ * v4.7.1 — walk an xpath (preferred) or CSS selector and return
148
+ * stable-ancestor entries (root-first). Each entry carries BOTH the
149
+ * segment name AND the attribute source that produced the name, so
150
+ * downstream can pick the right Playwright call. Earlier (v4.7.0) only
151
+ * the segment name was returned, which forced the emitter to assume
152
+ * every attribute was accessible-name-worthy — wrong for `id` /
153
+ * `aria-labelledby` / `name`.
154
+ */
155
+ function extractAncestors(xpath, css) {
156
+ const entries = [];
157
+ if (xpath) {
158
+ const steps = xpath.split("/").filter(Boolean);
159
+ for (const step of steps) {
160
+ const m = step.match(/^(?<tag>[a-zA-Z][a-zA-Z0-9-]*|\*)(?:\[@(?<attr>id|name|aria-label|aria-labelledby)="(?<val>[^"]+)"\])?(?:\[\d+\])?$/);
161
+ if (!m || !m.groups)
162
+ continue;
163
+ const tag = m.groups.tag.toLowerCase();
164
+ const attrName = m.groups.attr;
165
+ const attrVal = m.groups.val;
166
+ // Landmarks: stable on their own; emitted as bare `getByRole(role)`.
167
+ if (["main", "nav", "header", "footer", "aside"].includes(tag)) {
168
+ entries.push({ segment: tag, tag });
169
+ continue;
170
+ }
171
+ // Other container tags: require a name attribute to be stable.
172
+ if (STABLE_CONTAINER_TAGS.has(tag) && attrVal && attrName) {
173
+ entries.push({
174
+ segment: `${tag}@${(0, naming_1.camelCase)(attrVal)}`,
175
+ tag,
176
+ attrSource: attrName,
177
+ attrValue: attrVal,
178
+ });
179
+ continue;
180
+ }
181
+ // `*[@id="..."]` — unknown tag with an id → generic section segment.
182
+ if (tag === "*" && attrVal && attrName) {
183
+ entries.push({
184
+ segment: `section@${(0, naming_1.camelCase)(attrVal)}`,
185
+ tag: "section",
186
+ attrSource: attrName,
187
+ attrValue: attrVal,
188
+ });
189
+ continue;
190
+ }
191
+ }
192
+ if (entries.length > 0)
193
+ return entries;
194
+ }
195
+ // CSS selector fallback — far weaker, but catches `main form#login input[name=username]`
196
+ // style selectors. Only parse the DESCENDANT chain (spaces), ignore
197
+ // combinators like `>` and `+` for the PoC.
198
+ if (css) {
199
+ const parts = css.split(/\s+/).filter(Boolean);
200
+ for (const part of parts) {
201
+ const tagMatch = part.match(/^([a-zA-Z][a-zA-Z0-9-]*)/);
202
+ const idMatch = part.match(/#([a-zA-Z_][\w-]*)/);
203
+ const ariaLabelMatch = part.match(/\[aria-label=["']([^"']+)["']\]/);
204
+ const tag = (tagMatch ? tagMatch[1] : "").toLowerCase();
205
+ if (["main", "nav", "header", "footer", "aside"].includes(tag)) {
206
+ entries.push({ segment: tag, tag });
207
+ }
208
+ else if (STABLE_CONTAINER_TAGS.has(tag) && ariaLabelMatch) {
209
+ entries.push({
210
+ segment: `${tag}@${(0, naming_1.camelCase)(ariaLabelMatch[1])}`,
211
+ tag,
212
+ attrSource: "aria-label",
213
+ attrValue: ariaLabelMatch[1],
214
+ });
215
+ }
216
+ else if (STABLE_CONTAINER_TAGS.has(tag) && idMatch) {
217
+ entries.push({
218
+ segment: `${tag}@${(0, naming_1.camelCase)(idMatch[1])}`,
219
+ tag,
220
+ attrSource: "id",
221
+ attrValue: idMatch[1],
222
+ });
223
+ }
224
+ else if (!tag && idMatch) {
225
+ entries.push({
226
+ segment: `section@${(0, naming_1.camelCase)(idMatch[1])}`,
227
+ tag: "section",
228
+ attrSource: "id",
229
+ attrValue: idMatch[1],
230
+ });
231
+ }
232
+ }
233
+ }
234
+ return entries;
235
+ }
236
+ //# sourceMappingURL=hierarchyInferrer.js.map