@immense/vue-pom-generator 1.0.92 → 1.0.94
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 +33 -17
- package/RELEASE_NOTES.md +64 -100
- package/dist/index.cjs +789 -296
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +790 -297
- package/dist/index.mjs.map +1 -1
- package/dist/playwright/runtime.cjs +945 -0
- package/dist/playwright/runtime.cjs.map +1 -0
- package/dist/playwright/runtime.mjs +945 -0
- package/dist/playwright/runtime.mjs.map +1 -0
- package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
- package/dist/plugin/internal/build-plugin.d.ts +1 -1
- package/dist/plugin/internal/build-plugin.d.ts.map +1 -1
- package/dist/plugin/internal/dev-plugin.d.ts +1 -1
- package/dist/plugin/internal/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/internal-plugins.d.ts +1 -1
- package/dist/plugin/internal-plugins.d.ts.map +1 -1
- package/dist/plugin/resolved-injection-options.d.ts +2 -2
- package/dist/plugin/resolved-injection-options.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +13 -7
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/vue-plugin.d.ts +1 -1
- package/dist/plugin/vue-plugin.d.ts.map +1 -1
- package/dist/tests/wrapper-contract.test.d.ts +2 -0
- package/dist/tests/wrapper-contract.test.d.ts.map +1 -0
- package/dist/transform.d.ts +6 -12
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/vite.config.d.ts.map +1 -1
- package/dist/wrapper-contract.d.ts +37 -0
- package/dist/wrapper-contract.d.ts.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ If you already use Playwright with `getByTestId`, the point is simple: this pack
|
|
|
23
23
|
## What this does not do
|
|
24
24
|
|
|
25
25
|
- **It is not a runtime DOM crawler.** It only knows what it can learn from Vue SFC templates and router introspection.
|
|
26
|
-
- **It does not
|
|
26
|
+
- **It does not execute arbitrary wrapper data flow.** It understands Vue's normal fallthrough patterns, direct `useAttrs()` aliases, explicit configured-test-id forwarding, and simple helpers that omit named attributes. Polymorphic or third-party controls can still need `injection.nativeWrappers` overrides.
|
|
27
27
|
- **It cannot infer query-value types from arbitrary route-props code.** Generated `goTo()` accepts discovered query keys as optional `string | number` values; callers still choose and supply the values appropriate for their application.
|
|
28
28
|
- **It does not auto-attach every file in `pom/custom`.** Custom helpers are imported, but they only affect generated classes when you explicitly configure attachments, or when they match the built-in `Toggle` / `Checkbox` widget conventions.
|
|
29
29
|
- **It does not make override classes globally replace generated classes.** `pom/overrides` only changes generated fixture instantiation. Direct imports from the generated barrel still give you the generated class unless you import your override yourself.
|
|
@@ -75,11 +75,11 @@ The generator does not use one naming trick. It layers several signals.
|
|
|
75
75
|
- **Inputs and wrapper components** prefer `v-model`, wrapper `valueAttribute`, or related model-like bindings.
|
|
76
76
|
- **Native elements** also consider `id` / `name` attributes.
|
|
77
77
|
- **Router links / `:to` bindings** can contribute route-based naming and typed navigation return types when the target can be resolved.
|
|
78
|
-
- **Wrapper components**
|
|
78
|
+
- **Wrapper components** are inferred from the rendered element that actually receives Vue fallthrough attributes; `nativeWrappers` supplies exceptional overrides.
|
|
79
79
|
- **Fallback naming exists, but it is intentionally conservative.** That is why `generation.nameCollisionBehavior` exists.
|
|
80
80
|
- **Wrapper-action generation fails fast.** The generator blocks button-like wrapper `:handler` expressions that it cannot turn into a semantic action name.
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
Wrapper inference follows the public attribute contract instead of scanning for an arbitrary interactive descendant. It recognizes automatic single-root fallthrough, `v-bind="$attrs"`, aliases returned by `useAttrs()`, explicit forwarding such as `:data-testid="$attrs['data-testid']"`, and simple helpers that copy all attributes except named keys. The role comes from that target's explicit static ARIA role first, then its native HTML semantics. This means `<button role="tab">` is a tab, while `<div><button>...</button></div>` is not misclassified as a button wrapper because the caller's test id lands on the `<div>`. Nested wrappers are followed recursively. Polymorphic targets with different roles are deliberately left unresolved; configure `nativeWrappers` when one stable generated role is still appropriate.
|
|
83
83
|
|
|
84
84
|
## Playwright before/after examples
|
|
85
85
|
|
|
@@ -241,7 +241,7 @@ const pomConfig = defineVuePomGeneratorConfig({
|
|
|
241
241
|
AppTextField: { role: "input" },
|
|
242
242
|
AppRadioGroup: { role: "radio", requiresOptionDataTestIdPrefix: true },
|
|
243
243
|
},
|
|
244
|
-
|
|
244
|
+
skipTestIdGenerationInsideComponents: ["LegacyWidget"],
|
|
245
245
|
existingIdBehavior: "error",
|
|
246
246
|
},
|
|
247
247
|
generation: {
|
|
@@ -594,6 +594,22 @@ This is where most people need precision.
|
|
|
594
594
|
|
|
595
595
|
Every `.ts` file in `customPoms.dir` is available for import from the generated TypeScript output.
|
|
596
596
|
|
|
597
|
+
Handwritten helpers that extend the generator runtime should use its public entry point:
|
|
598
|
+
|
|
599
|
+
```ts
|
|
600
|
+
import { BasePage } from "@immense/vue-pom-generator/playwright/runtime";
|
|
601
|
+
|
|
602
|
+
export class DataGrid extends BasePage {
|
|
603
|
+
async selectFirstRow(): Promise<void> {
|
|
604
|
+
await this.page.getByRole("row").nth(1).click();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
Do not import from a consumer's generated `_pom-runtime` directory. That directory is regenerated
|
|
610
|
+
and is an implementation detail of the emitted files; the package export is the stable contract for
|
|
611
|
+
handwritten POMs.
|
|
612
|
+
|
|
597
613
|
- in aggregated mode, helper files become imports in the shared aggregate
|
|
598
614
|
- in split mode, each generated file imports only the helpers it actually needs
|
|
599
615
|
|
|
@@ -1061,10 +1077,10 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
1061
1077
|
|
|
1062
1078
|
#### `injection.nativeWrappers`
|
|
1063
1079
|
|
|
1064
|
-
- **What it does:**
|
|
1065
|
-
- **Why it exists:**
|
|
1080
|
+
- **What it does:** Overrides or augments source-derived wrapper contracts.
|
|
1081
|
+
- **Why it exists:** Polymorphic controls, third-party components without local SFC source, and domain-specific option widgets cannot always expose one role/value contract through static Vue source.
|
|
1066
1082
|
- **Benefit:** You get stable control-specific ids and methods instead of generic component-shaped names.
|
|
1067
|
-
- **Without it:**
|
|
1083
|
+
- **Without it:** ordinary local wrappers are inferred from Vue fallthrough targets and their native/ARIA semantics.
|
|
1068
1084
|
- **Example:**
|
|
1069
1085
|
|
|
1070
1086
|
```ts
|
|
@@ -1080,10 +1096,10 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
1080
1096
|
|
|
1081
1097
|
##### `nativeWrappers[...].role`
|
|
1082
1098
|
|
|
1083
|
-
- **What it does:** Chooses the native behavior to emulate (`button`, `input`, `select`, `vselect`, `checkbox`, `toggle`, `radio`, `grid`, `link`).
|
|
1099
|
+
- **What it does:** Chooses the native behavior to emulate (`button`, `input`, `select`, `vselect`, `checkbox`, `toggle`, `radio`, `grid`, `link`, `tab`).
|
|
1084
1100
|
- **Why it exists:** Role drives both test-id suffixes and generated POM method families (`click...`, `type...`, `select...`, etc.). `link` is the role for anchor-rendering wrappers (components that render an `<a>`/`RouterLink`); it produces `...Link` accessors and `-link` test-id suffixes, with `goTo...` navigation methods when a `:to` route target is resolvable.
|
|
1085
1101
|
- **Benefit:** The generated API matches what the wrapped control actually does.
|
|
1086
|
-
- **Optional / inferred:** `role` may be omitted.
|
|
1102
|
+
- **Optional / inferred:** `role` may be omitted. The generator resolves the element that receives the configured test-id, honors a static ARIA `role` before implicit tag semantics, and follows nested wrapper contracts. A bare `<a>` without `href` is not a link. If the target is non-interactive or multiple forwarding targets have different roles, the generator throws for a configured wrapper with no role rather than guessing. Declaring `role` explicitly always takes precedence.
|
|
1087
1103
|
- **Without it:** wrapper components may be treated as generic tags unless they can be inferred.
|
|
1088
1104
|
|
|
1089
1105
|
##### `nativeWrappers[...].valueAttribute`
|
|
@@ -1101,24 +1117,24 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
1101
1117
|
- **Without it:** option-level ids may be incomplete or ambiguous.
|
|
1102
1118
|
- **Caveat:** preserving an existing manual root id on these wrappers can be unsafe, and the current implementation will throw in that case.
|
|
1103
1119
|
|
|
1104
|
-
#### `injection.
|
|
1120
|
+
#### `injection.skipTestIdGenerationInsideComponents`
|
|
1105
1121
|
|
|
1106
|
-
- **What it does:**
|
|
1107
|
-
- **Why it exists:**
|
|
1108
|
-
- **
|
|
1109
|
-
- **
|
|
1122
|
+
- **What it does:** Prevents generated test ids and POM members anywhere inside the named component implementations.
|
|
1123
|
+
- **Why it exists:** It is a last-resort escape hatch for generated, third-party, or otherwise untransformable SFC templates.
|
|
1124
|
+
- **Wrapper components usually do not need it:** When a wrapper explicitly forwards fallthrough attributes, the generator suppresses generation only on the forwarding target. Other interactive controls inside the wrapper still receive generated ids and methods.
|
|
1125
|
+
- **Tradeoff:** This skips the entire component implementation, so use it only when target-level fallthrough analysis cannot describe the source.
|
|
1110
1126
|
- **Example:**
|
|
1111
1127
|
|
|
1112
1128
|
```ts
|
|
1113
|
-
injection: {
|
|
1129
|
+
injection: { skipTestIdGenerationInsideComponents: ["LegacyWidget"] }
|
|
1114
1130
|
```
|
|
1115
1131
|
|
|
1116
1132
|
#### `injection.wrapperSearchRoots`
|
|
1117
1133
|
|
|
1118
|
-
- **What it does:** Adds extra roots for wrapper inference outside the
|
|
1134
|
+
- **What it does:** Adds extra roots for wrapper inference outside the page/component/layout directories, which are searched automatically.
|
|
1119
1135
|
- **Why it exists:** wrapper components often live in sibling packages or shared UI workspaces.
|
|
1120
1136
|
- **Benefit:** local wrapper inference can still work across package boundaries.
|
|
1121
|
-
- **Without it:**
|
|
1137
|
+
- **Without it:** wrapper lookup is limited to the configured app directories.
|
|
1122
1138
|
- **Example:**
|
|
1123
1139
|
|
|
1124
1140
|
```ts
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,119 +1,83 @@
|
|
|
1
|
-
I'll
|
|
2
|
-
|
|
1
|
+
I'll analyze the provided information and verify which PRs fall within the release window using the
|
|
2
|
+
GitHub API.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
The git log confirms only one commit (#57) in the range. Let me verify PR merge times using the
|
|
5
|
+
GitHub API.
|
|
5
6
|
|
|
6
|
-
Let me
|
|
7
|
+
Good — v1.0.93..HEAD contains only #57 (v1.0.93 points at #56). Let me get PR #57's details and diff
|
|
8
|
+
for accurate notes.
|
|
7
9
|
|
|
8
|
-
Now I
|
|
9
|
-
me
|
|
10
|
-
|
|
11
|
-
Let me check the diagnostics module and README changes to round out the picture.
|
|
12
|
-
|
|
13
|
-
I now have a complete picture. v1.0.91 was tagged at PR #53's commit, so v1.0.92 contains only PR
|
|
14
|
-
#54. Let me write the release notes.
|
|
10
|
+
Now I have all the information needed. Only PR #57 is in this release (v1.0.93 points at #56's
|
|
11
|
+
commit). Let me verify the test files were updated.
|
|
15
12
|
|
|
16
13
|
Highlights
|
|
17
14
|
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ancestor chain (bounded to five seconds); infinite decorative animations are ignored.
|
|
15
|
+
- New wrapper-contract inference engine (wrapper-contract.ts, 1,009 lines) replaces heuristic
|
|
16
|
+
template scanning with Vue's actual attribute-fallthrough contract — it follows automatic
|
|
17
|
+
single-root fallthrough, v-bind="$attrs", useAttrs() aliases, explicit :data-testid forwarding, and
|
|
18
|
+
simple copy-all-except helpers.
|
|
19
|
+
- Role resolution honors ARIA first. The target element's static ARIA role is checked before native
|
|
20
|
+
tag semantics, so <button role="tab"> is correctly classified as a tab while a <div> wrapping a
|
|
21
|
+
<button> is no longer misclassified as a button wrapper.
|
|
22
|
+
- Polymorphic targets fail fast. When multiple forwarding targets expose different roles, the
|
|
23
|
+
generator throws rather than guessing — you declare role explicitly when a single stable role is
|
|
24
|
+
appropriate.
|
|
25
|
+
- New tab role added to NativeRole, enabling tab-pattern wrapper components to generate correct
|
|
26
|
+
accessors and test-id suffixes.
|
|
27
|
+
- Inferred wrappers auto-derive valueAttribute from common semantic attributes (aria-label, name,
|
|
28
|
+
id, title, label) when none is configured.
|
|
33
29
|
|
|
34
30
|
Changes
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
playwright/no-wait-for-selector, playwright/no-force-option, and
|
|
64
|
-
playwright/prefer-web-first-assertions as errors.
|
|
65
|
-
- Banned low-level POM action helpers (clickByTestId, clickLocator) via the no-raw-locator-action
|
|
66
|
-
rule.
|
|
67
|
-
- Added scrollIntoViewIfNeeded to the recognized locator-action set.
|
|
68
|
-
- Restructured the plugin export to include a configs record alongside rules.
|
|
69
|
-
- Added eslint-plugin-playwright (^2.11.0) as a runtime dependency.
|
|
70
|
-
|
|
71
|
-
Action & Animation Behavior
|
|
72
|
-
|
|
73
|
-
- Generated actions now fail within a five-second total budget; redundant runtime waits removed.
|
|
74
|
-
- Generated clicks await finite CSS animations on the target's ancestor chain before proceeding,
|
|
75
|
-
bounded to five seconds; infinite decorative animations are ignored.
|
|
76
|
-
- Animations and presentation delays are disabled by default; recording/demo projects opt in via
|
|
77
|
-
the generated animation fixture option.
|
|
78
|
-
|
|
79
|
-
Codegen & Navigation
|
|
80
|
-
|
|
81
|
-
- Centralized router navigation emission in route-navigation-codegen.ts; cold pages now boot the
|
|
82
|
-
application, wait for Vue Router's initial navigation to settle, then use router.push, while warm
|
|
83
|
-
pages use the same awaited push without re-booting.
|
|
84
|
-
- Tightened fragment, wrapper, radio, checkbox, pointer, and transitive-POM codegen behavior
|
|
85
|
-
uncovered by consumer testing.
|
|
86
|
-
- Updated class-generation/base-page.ts, class-generation/index.ts, class-generation/pointer.ts,
|
|
87
|
-
class-generation/playwright-types.ts, method-generation.ts, transform.ts, and router-bridge.ts to
|
|
88
|
-
support the above.
|
|
89
|
-
|
|
90
|
-
Plugin & Build
|
|
91
|
-
|
|
92
|
-
- Updated plugin/internal-plugins.ts, plugin/internal/build-plugin.ts, and
|
|
93
|
-
plugin/internal/dev-plugin.ts for manifest and reporter integration.
|
|
94
|
-
- Updated vite.config.ts and scripts/packed-smoke-check.mjs accordingly.
|
|
95
|
-
|
|
96
|
-
Documentation
|
|
97
|
-
|
|
98
|
-
- Expanded README.md with sections on fast Playwright failures, the bundled reporter, the POM
|
|
99
|
-
manifest, recommended lint rules, and animation handling.
|
|
32
|
+
Wrapper Contract Inference
|
|
33
|
+
|
|
34
|
+
- Extracted all wrapper-inference logic from transform.ts into a dedicated wrapper-contract.ts
|
|
35
|
+
module, reducing transform.ts by ~500 lines.
|
|
36
|
+
- getNativeHtmlControlRole and toKebabCaseTag moved into wrapper-contract.ts; transform.ts now
|
|
37
|
+
imports resolved contracts via resolveWrapperContractForTag.
|
|
38
|
+
- Nested wrappers are followed recursively; the contract tracks per-target roles, forwarded test-id
|
|
39
|
+
offsets, and explicit-vs-implicit forwarding distinctions.
|
|
40
|
+
- nativeWrappers is now an override/augmentation layer on top of source-derived contracts rather
|
|
41
|
+
than the primary configuration mechanism.
|
|
42
|
+
- getNativeWrapperTransformInfo in utils.ts now resolves valueAttribute from inferred semantic
|
|
43
|
+
attributes when an explicit value is absent.
|
|
44
|
+
|
|
45
|
+
Plugin Options
|
|
46
|
+
|
|
47
|
+
- wrapperSearchRoots now automatically includes configured page, component, and layout directories
|
|
48
|
+
— no manual duplication needed.
|
|
49
|
+
- README updated to document the new fallthrough-based inference model, the tab role, and the
|
|
50
|
+
revised nativeWrappers semantics.
|
|
51
|
+
|
|
52
|
+
Tests
|
|
53
|
+
|
|
54
|
+
- New tests/wrapper-contract.test.ts (222 lines) covering fallthrough detection, useAttrs()
|
|
55
|
+
aliases, explicit forwarding, ARIA-role precedence, polymorphic-target errors, and recursive
|
|
56
|
+
nesting.
|
|
57
|
+
- Existing tests (build-serve-parity, dev-plugin-options, resolved-injection-options, transform,
|
|
58
|
+
vue-plugin-state) updated for the renamed option.
|
|
100
59
|
|
|
101
60
|
Breaking Changes
|
|
102
61
|
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
62
|
+
- injection.excludeComponents → injection.skipTestIdGenerationInsideComponents: The option is
|
|
63
|
+
renamed and semantically narrowed. Normal wrapper components no longer need it — fallthrough targets
|
|
64
|
+
are suppressed at the element level while internal controls remain generated. Use it only as a
|
|
65
|
+
last-resort escape hatch for untransformable SFC templates.
|
|
66
|
+
- nativeWrappers without role now errors when no single role can be proven from the source.
|
|
67
|
+
Previously it silently defaulted to button; now it throws so misclassified wrappers surface
|
|
68
|
+
immediately.
|
|
69
|
+
- wrapperSearchRoots auto-includes source directories. If you previously listed your
|
|
70
|
+
component/page/layout dirs in wrapperSearchRoots, they are now searched automatically and can be
|
|
71
|
+
removed from the list.
|
|
108
72
|
|
|
109
73
|
Pull Requests Included
|
|
110
74
|
|
|
111
|
-
- ]8;id=md-
|
|
75
|
+
- ]8;id=md-1fsv1fy;https://github.com/immense/vue-pom-generator/pull/57#57 — Infer Vue wrapper contracts from fallthrough targets]8;;]8;; (@dkattan)]8;;
|
|
112
76
|
|
|
113
77
|
Testing
|
|
114
78
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
79
|
+
- New tests/wrapper-contract.test.ts suite added covering the full fallthrough-contract inference
|
|
80
|
+
model.
|
|
81
|
+
- Existing test suites updated and passing with the renamed skipTestIdGenerationInsideComponents
|
|
82
|
+
option and revised wrapper-resolution behavior.
|
|
119
83
|
|