@immense/vue-pom-generator 1.0.58 → 1.0.59
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 +6 -18
- package/RELEASE_NOTES.md +75 -29
- package/class-generation/base-page.ts +6 -13
- package/class-generation/index.ts +226 -317
- package/class-generation/playwright-types.ts +1 -1
- package/click-instrumentation.ts +0 -4
- package/dist/class-generation/base-page.d.ts +1 -0
- package/dist/class-generation/base-page.d.ts.map +1 -1
- package/dist/class-generation/index.d.ts +2 -0
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/class-generation/playwright-types.d.ts +1 -1
- package/dist/class-generation/playwright-types.d.ts.map +1 -1
- package/dist/click-instrumentation.d.ts +0 -1
- package/dist/click-instrumentation.d.ts.map +1 -1
- package/dist/index.cjs +1216 -1008
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1218 -1010
- package/dist/index.mjs.map +1 -1
- package/dist/method-generation.d.ts +4 -2
- package/dist/method-generation.d.ts.map +1 -1
- package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
- package/dist/plugin/resolved-generation-options.d.ts +33 -0
- package/dist/plugin/resolved-generation-options.d.ts.map +1 -0
- package/dist/plugin/resolved-injection-options.d.ts +27 -0
- package/dist/plugin/resolved-injection-options.d.ts.map +1 -0
- package/dist/plugin/support/build-plugin.d.ts +2 -29
- package/dist/plugin/support/build-plugin.d.ts.map +1 -1
- package/dist/plugin/support/dev-plugin.d.ts +2 -28
- package/dist/plugin/support/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/support-plugins.d.ts +2 -32
- package/dist/plugin/support-plugins.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +6 -23
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/vue-plugin.d.ts.map +1 -1
- package/dist/pom-params.d.ts +40 -0
- package/dist/pom-params.d.ts.map +1 -0
- package/dist/pom-patterns.d.ts +31 -0
- package/dist/pom-patterns.d.ts.map +1 -0
- package/dist/routing/to-directive.d.ts +21 -0
- package/dist/routing/to-directive.d.ts.map +1 -1
- package/dist/tests/base-page.test.d.ts +2 -0
- package/dist/tests/base-page.test.d.ts.map +1 -0
- package/dist/tests/resolved-injection-options.test.d.ts +2 -0
- package/dist/tests/resolved-injection-options.test.d.ts.map +1 -0
- package/dist/transform.d.ts +0 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +129 -63
- package/dist/utils.d.ts.map +1 -1
- package/package.json +6 -4
- package/sequence-diagram.md +6 -6
package/README.md
CHANGED
|
@@ -69,12 +69,13 @@ That example is intentionally small, but it shows the real contract:
|
|
|
69
69
|
The generator does not use one naming trick. It layers several signals.
|
|
70
70
|
|
|
71
71
|
- **Click actions** prefer semantic handler names such as `save`, `openDetails`, or `runImport`.
|
|
72
|
+
- **Click handlers are instrumented** so generated Playwright helpers can wait on deterministic `__testid_event__` runtime events.
|
|
72
73
|
- **Inputs and wrapper components** prefer `v-model`, wrapper `valueAttribute`, or related model-like bindings.
|
|
73
74
|
- **Native elements** also consider `id` / `name` attributes.
|
|
74
75
|
- **Router links / `:to` bindings** can contribute route-based naming and typed navigation return types when the target can be resolved.
|
|
75
76
|
- **Wrapper components** can be explicit (`nativeWrappers`) or inferred from simple local SFC templates.
|
|
76
77
|
- **Fallback naming exists, but it is intentionally conservative.** That is why `generation.nameCollisionBehavior` exists.
|
|
77
|
-
- **Wrapper-action generation fails fast
|
|
78
|
+
- **Wrapper-action generation fails fast.** The generator blocks button-like wrapper `:handler` expressions that it cannot turn into a semantic action name.
|
|
78
79
|
|
|
79
80
|
Important limit: wrapper inference is helpful, not magical. The current implementation recursively inspects simple local SFC templates for the first inferable primitive (`input`, `textarea`, `select`, `button`, `vselect`, radio/checkbox inputs). It also recognizes some naming patterns like `*Button`. For anything more complex, configure `nativeWrappers` explicitly.
|
|
80
81
|
|
|
@@ -205,7 +206,6 @@ const pomConfig = defineVuePomGeneratorConfig({
|
|
|
205
206
|
script: { defineModel: true, propsDestructure: true },
|
|
206
207
|
},
|
|
207
208
|
logging: { verbosity: "info" },
|
|
208
|
-
errorBehavior: "error",
|
|
209
209
|
injection: {
|
|
210
210
|
attribute: "data-testid",
|
|
211
211
|
viewsDir: "src/views",
|
|
@@ -218,7 +218,7 @@ const pomConfig = defineVuePomGeneratorConfig({
|
|
|
218
218
|
AppRadioGroup: { role: "radio", requiresOptionDataTestIdPrefix: true },
|
|
219
219
|
},
|
|
220
220
|
excludeComponents: ["LegacyWidget"],
|
|
221
|
-
existingIdBehavior: "
|
|
221
|
+
existingIdBehavior: "error",
|
|
222
222
|
},
|
|
223
223
|
generation: {
|
|
224
224
|
emit: ["ts", "csharp"],
|
|
@@ -226,7 +226,7 @@ const pomConfig = defineVuePomGeneratorConfig({
|
|
|
226
226
|
namespace: "MyProject.Tests.Generated",
|
|
227
227
|
},
|
|
228
228
|
outDir: "tests/playwright/__generated__",
|
|
229
|
-
nameCollisionBehavior: "
|
|
229
|
+
nameCollisionBehavior: "error",
|
|
230
230
|
router: {
|
|
231
231
|
entry: "src/router/index.ts",
|
|
232
232
|
moduleShims: {
|
|
@@ -849,18 +849,6 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
849
849
|
logging: { verbosity: "debug" }
|
|
850
850
|
```
|
|
851
851
|
|
|
852
|
-
#### `errorBehavior`
|
|
853
|
-
|
|
854
|
-
- **What it does:** Controls strict/error behavior for generator checks.
|
|
855
|
-
- **Why it exists:** complex inline handlers can otherwise fall through to generic naming, which makes generated APIs harder to discover and review.
|
|
856
|
-
- **Benefit:** fail-fast behavior is the default, while `"ignore"` or the object form let you opt back into only the permissive checks you want.
|
|
857
|
-
- **Without it:** the default is `"error"`, so unsupported button-wrapper handlers stop generation instead of silently falling back.
|
|
858
|
-
- **Accepted values:**
|
|
859
|
-
- `"ignore"` — keep permissive defaults for all supported checks
|
|
860
|
-
- `"error"` — enable error-on-failure behavior for all supported checks (default)
|
|
861
|
-
- `{ missingSemanticNameBehavior: "ignore" }` — opt out only of the button-wrapper semantic-name check
|
|
862
|
-
- **Current scope:** this first pass is intentionally narrow. The object form currently supports `missingSemanticNameBehavior`, which targets button-like wrappers with `:handler`; value/model-driven wrappers still use their existing naming flow.
|
|
863
|
-
|
|
864
852
|
### `injection`
|
|
865
853
|
|
|
866
854
|
`injection` controls compile-time test-id derivation and template rewriting.
|
|
@@ -983,7 +971,7 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
983
971
|
- **What it does:** Chooses what happens when a template already has the target attribute.
|
|
984
972
|
- **Why it exists:** migrations usually start from a mixed codebase with manual ids already present.
|
|
985
973
|
- **Benefit:** lets you migrate gradually (`preserve`), force replacement (`overwrite`), or enforce cleanup (`error`).
|
|
986
|
-
- **Without it:** default is `"
|
|
974
|
+
- **Without it:** default is `"error"`.
|
|
987
975
|
- **Current options:**
|
|
988
976
|
- `"preserve"` — keep the existing attribute
|
|
989
977
|
- `"overwrite"` — replace it with the generated one
|
|
@@ -1030,7 +1018,7 @@ Set `generation: false` to keep injection and `virtual:testids` but skip emitted
|
|
|
1030
1018
|
- **What it does:** Controls what happens when two generated members inside the same class want the same name.
|
|
1031
1019
|
- **Why it exists:** collisions happen in real templates, especially when multiple elements share the same handler or weak fallback signals.
|
|
1032
1020
|
- **Benefit:** lets you decide between strictness and convenience.
|
|
1033
|
-
- **Without it:** the generator
|
|
1021
|
+
- **Without it:** the generator fails fast (`"error"`).
|
|
1034
1022
|
- **Current options:**
|
|
1035
1023
|
- `"error"` — fail fast
|
|
1036
1024
|
- `"warn"` — warn and suffix
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,31 +1,56 @@
|
|
|
1
|
-
●
|
|
2
|
-
notes.
|
|
3
|
-
|
|
4
|
-
● Based on the commit range v1.0.57..HEAD, only PR #19 is included in this release. Here are the
|
|
5
|
-
release notes:
|
|
6
|
-
|
|
7
|
-
---
|
|
1
|
+
● # Release Notes: v1.0.59
|
|
8
2
|
|
|
9
3
|
## Highlights
|
|
10
4
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
- **Major refactoring** of POM generation logic for improved maintainability and reliability
|
|
6
|
+
- **Zero runtime dependencies** – all runtime dependencies eliminated
|
|
7
|
+
- **Enhanced Nuxt support** – resolved app-root dev POM clobber and improved local app
|
|
8
|
+
integration
|
|
9
|
+
- **Split Playwright POM output** – added separate output files for better discoverability
|
|
10
|
+
- **Fail-fast error handling** – added early validation for dev snapshot generation and
|
|
11
|
+
unnameable handlers
|
|
12
|
+
- **Expanded test coverage** – new build–serve parity regression tests and additional test
|
|
13
|
+
suites
|
|
16
14
|
|
|
17
15
|
## Changes
|
|
18
16
|
|
|
19
|
-
**
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
17
|
+
**Core Generation & Architecture**
|
|
18
|
+
- Refactored POM generation logic across class-generation, method-generation, transform, and
|
|
19
|
+
utils modules
|
|
20
|
+
- Added `pom-params.ts` and `pom-patterns.ts` modules to centralize generation logic
|
|
21
|
+
- Improved routing `to-directive` handling for awaited handler wrappers
|
|
22
|
+
|
|
23
|
+
**Plugin System**
|
|
24
|
+
- Added `resolved-generation-options.ts` and `resolved-injection-options.ts` for clearer plugin
|
|
25
|
+
configuration
|
|
26
|
+
- Enhanced `create-vue-pom-generator-plugins`, build-plugin, and dev-plugin implementations
|
|
27
|
+
- Relaxed Vite peer dependency range for broader compatibility (#13)
|
|
28
|
+
|
|
29
|
+
**Bug Fixes**
|
|
30
|
+
- Fixed reparsing of generated test IDs (#21)
|
|
31
|
+
- Hardened local app integration (#19)
|
|
32
|
+
- Restored router DOM globals after introspection (#18)
|
|
33
|
+
- Resolved Nuxt app-root dev POM clobber (#15)
|
|
34
|
+
- Fixed keyed POM dedupe and C# navigation returns (#4)
|
|
25
35
|
|
|
26
|
-
**
|
|
27
|
-
-
|
|
28
|
-
-
|
|
36
|
+
**Error Handling & Validation**
|
|
37
|
+
- Added fail-fast on unnameable wrapper handlers (#11)
|
|
38
|
+
- Added fail-fast on dev snapshot generation errors (#6)
|
|
39
|
+
- Guarded manual releases (#16)
|
|
40
|
+
|
|
41
|
+
**Developer Experience**
|
|
42
|
+
- Split Playwright POM output for improved discoverability (#12)
|
|
43
|
+
- Achieved dev-mode POM generation parity with build mode (#5)
|
|
44
|
+
- Added PR release-notes preview comments (#1)
|
|
45
|
+
|
|
46
|
+
**Dependencies**
|
|
47
|
+
- Eliminated all runtime dependencies (#9)
|
|
48
|
+
- Updated package-lock.json to reflect dependency changes
|
|
49
|
+
|
|
50
|
+
**Testing**
|
|
51
|
+
- Added build–serve parity regression tests (#7)
|
|
52
|
+
- Added `base-page.test.ts`, `resolved-injection-options.test.ts`, and `playwright.d.ts` fixture
|
|
53
|
+
- Expanded coverage in class-generation, transform, utils, and options tests
|
|
29
54
|
|
|
30
55
|
## Breaking Changes
|
|
31
56
|
|
|
@@ -33,15 +58,36 @@
|
|
|
33
58
|
|
|
34
59
|
## Pull Requests Included
|
|
35
60
|
|
|
36
|
-
-
|
|
61
|
+
- #21 fix: avoid reparsing generated test ids
|
|
62
|
+
(https://github.com/immense/vue-pom-generator/pull/21)
|
|
63
|
+
- #19 fix: harden local app integration (https://github.com/immense/vue-pom-generator/pull/19)
|
|
64
|
+
- #18 fix: restore router DOM globals after introspection
|
|
65
|
+
(https://github.com/immense/vue-pom-generator/pull/18)
|
|
66
|
+
- #17 fix: support awaited handler wrappers
|
|
67
|
+
(https://github.com/immense/vue-pom-generator/pull/17)
|
|
68
|
+
- #16 fix: guard manual releases (https://github.com/immense/vue-pom-generator/pull/16)
|
|
69
|
+
- #15 fix: resolve Nuxt app-root dev POM clobber
|
|
70
|
+
(https://github.com/immense/vue-pom-generator/pull/15)
|
|
71
|
+
- #13 Relax Vite peer dependency range (https://github.com/immense/vue-pom-generator/pull/13)
|
|
72
|
+
- #12 feat: add split Playwright POM output for discoverability
|
|
73
|
+
(https://github.com/immense/vue-pom-generator/pull/12)
|
|
74
|
+
- #11 feat: fail fast on unnameable wrapper handlers
|
|
75
|
+
(https://github.com/immense/vue-pom-generator/pull/11)
|
|
76
|
+
- #9 refactor(deps): eliminate all runtime dependencies
|
|
77
|
+
(https://github.com/immense/vue-pom-generator/pull/9)
|
|
78
|
+
- #7 test: add build–serve parity regression tests
|
|
79
|
+
(https://github.com/immense/vue-pom-generator/pull/7)
|
|
80
|
+
- #6 fix: fail fast on dev snapshot generation errors
|
|
81
|
+
(https://github.com/immense/vue-pom-generator/pull/6)
|
|
82
|
+
- #5 fix: dev-mode POM generation parity with build mode
|
|
83
|
+
(https://github.com/immense/vue-pom-generator/pull/5)
|
|
84
|
+
- #4 Fix keyed POM dedupe and C# navigation returns
|
|
85
|
+
(https://github.com/immense/vue-pom-generator/pull/4)
|
|
86
|
+
- #1 Add PR release-notes preview comments (https://github.com/immense/vue-pom-generator/pull/1)
|
|
37
87
|
|
|
38
88
|
## Testing
|
|
39
89
|
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
- `npm run build`
|
|
44
|
-
- `npm test`
|
|
45
|
-
|
|
46
|
-
All tests passing with 258 net lines added across 13 files.
|
|
90
|
+
Comprehensive test coverage expansion with new test suites for base-page,
|
|
91
|
+
resolved-injection-options, and build–serve parity. Existing test suites updated to reflect
|
|
92
|
+
refactored architecture. All tests passing.
|
|
47
93
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PwLocator, PwPage } from "./playwright-types";
|
|
2
|
-
import { TESTID_CLICK_EVENT_NAME
|
|
2
|
+
import { TESTID_CLICK_EVENT_NAME } from "../click-instrumentation";
|
|
3
3
|
import type { TestIdClickEventDetail } from "../click-instrumentation";
|
|
4
4
|
import { Callout } from "./callout";
|
|
5
5
|
import type { CalloutRenderer } from "./callout";
|
|
@@ -118,6 +118,10 @@ export class BasePage {
|
|
|
118
118
|
this.pointer = new Pointer(this.page, this.testIdAttribute, this.callout, pointerRenderer);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
public get screencast(): PwPage["screencast"] {
|
|
122
|
+
return this.page.screencast;
|
|
123
|
+
}
|
|
124
|
+
|
|
121
125
|
private async waitForTestIdClickEventAfter(testId: string, options?: { timeoutMs?: number }): Promise<void> {
|
|
122
126
|
if (!REQUIRE_CLICK_EVENT) {
|
|
123
127
|
return;
|
|
@@ -135,7 +139,7 @@ export class BasePage {
|
|
|
135
139
|
// In that scenario, the click already did its job; don't fail the test infra.
|
|
136
140
|
try {
|
|
137
141
|
await this.page.evaluate(
|
|
138
|
-
({ eventName,
|
|
142
|
+
({ eventName, expectedTestId, timeoutMs, requireEvent, debug }) => {
|
|
139
143
|
return new Promise<void>((resolve, reject) => {
|
|
140
144
|
const g = globalThis;
|
|
141
145
|
if (!g || typeof g.addEventListener !== "function") {
|
|
@@ -143,16 +147,6 @@ export class BasePage {
|
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
|
|
146
|
-
// Mark strict mode in the page so the injected click wrapper can
|
|
147
|
-
// fail fast (no fallback) when instrumentation is expected.
|
|
148
|
-
if (requireEvent) {
|
|
149
|
-
try {
|
|
150
|
-
type GlobalWithFlag = typeof globalThis & { [k: string]: boolean | undefined };
|
|
151
|
-
(g as GlobalWithFlag)[strictFlagName] = true;
|
|
152
|
-
}
|
|
153
|
-
catch { /* noop */ }
|
|
154
|
-
}
|
|
155
|
-
|
|
156
150
|
const cleanup = (timer: ReturnType<typeof setTimeout>, onEvent: (evt: Event) => void) => {
|
|
157
151
|
clearTimeout(timer);
|
|
158
152
|
try {
|
|
@@ -216,7 +210,6 @@ export class BasePage {
|
|
|
216
210
|
},
|
|
217
211
|
{
|
|
218
212
|
eventName: TESTID_CLICK_EVENT_NAME,
|
|
219
|
-
strictFlagName: TESTID_CLICK_EVENT_STRICT_FLAG,
|
|
220
213
|
expectedTestId: testId,
|
|
221
214
|
timeoutMs,
|
|
222
215
|
requireEvent,
|