@immense/vue-pom-generator 1.0.93 → 1.0.95

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 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 fully understand arbitrary wrapper components automatically.** There is some wrapper inference for simple local SFCs and some naming conventions, but serious design-system components still need `injection.nativeWrappers`.
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** can be explicit (`nativeWrappers`) or inferred from simple local SFC templates.
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
- 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, and `a` *with `href`*/`RouterLink` → `link`). It also recognizes some naming patterns like `*Button`. For anything more complex, configure `nativeWrappers` explicitly.
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 an editable `<input role="combobox">` retains input behavior so generated actions fill it instead of calling native `selectOption()`. A `<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
- excludeComponents: ["LegacyWidget"],
244
+ skipTestIdGenerationInsideComponents: ["LegacyWidget"],
245
245
  existingIdBehavior: "error",
246
246
  },
247
247
  generation: {
@@ -1077,10 +1077,10 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
1077
1077
 
1078
1078
  #### `injection.nativeWrappers`
1079
1079
 
1080
- - **What it does:** Describes wrapper components so the generator can treat them like native controls.
1081
- - **Why it exists:** Many Vue apps wrap buttons, inputs, selects, radio groups, or third-party widgets behind design-system components.
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.
1082
1082
  - **Benefit:** You get stable control-specific ids and methods instead of generic component-shaped names.
1083
- - **Without it:** the generator relies on native elements, limited wrapper inference, and a few naming conventions.
1083
+ - **Without it:** ordinary local wrappers are inferred from Vue fallthrough targets and their native/ARIA semantics.
1084
1084
  - **Example:**
1085
1085
 
1086
1086
  ```ts
@@ -1096,10 +1096,10 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
1096
1096
 
1097
1097
  ##### `nativeWrappers[...].role`
1098
1098
 
1099
- - **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`).
1100
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.
1101
1101
  - **Benefit:** The generated API matches what the wrapped control actually does.
1102
- - **Optional / inferred:** `role` may be omitted. When omitted, the generator infers it from the wrapper's rendered template — a component rendering an `<a>` *with an `href`* (or a `RouterLink`, directly or through nested wrapper components like a shared `AppLink`) infers `link`, an `<input>` infers `input`, and so on. Recursion follows `wrapperSearchRoots`. A bare `<a>` without an `href` is **not** a link (it has no implicit ARIA role) and won't be classified as `link`. If no native role can be inferred, the generator **throws** rather than guessing — declare `role` explicitly for wrappers that don't render a recognized native control. Declaring `role` explicitly always takes precedence over inference.
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.
1103
1103
  - **Without it:** wrapper components may be treated as generic tags unless they can be inferred.
1104
1104
 
1105
1105
  ##### `nativeWrappers[...].valueAttribute`
@@ -1117,24 +1117,24 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
1117
1117
  - **Without it:** option-level ids may be incomplete or ambiguous.
1118
1118
  - **Caveat:** preserving an existing manual root id on these wrappers can be unsafe, and the current implementation will throw in that case.
1119
1119
 
1120
- #### `injection.excludeComponents`
1120
+ #### `injection.skipTestIdGenerationInsideComponents`
1121
1121
 
1122
- - **What it does:** Opts specific component names out of injection/collection.
1123
- - **Why it exists:** Some components are better left alone, or are generated/third-party surfaces you do not want rewritten.
1124
- - **Benefit:** Gives you a practical escape hatch without disabling the plugin globally.
1125
- - **Without it:** all in-scope Vue components are eligible for injection.
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.
1126
1126
  - **Example:**
1127
1127
 
1128
1128
  ```ts
1129
- injection: { excludeComponents: ["LegacyWidget"] }
1129
+ injection: { skipTestIdGenerationInsideComponents: ["LegacyWidget"] }
1130
1130
  ```
1131
1131
 
1132
1132
  #### `injection.wrapperSearchRoots`
1133
1133
 
1134
- - **What it does:** Adds extra roots for wrapper inference outside the configured page/component/layout directories.
1134
+ - **What it does:** Adds extra roots for wrapper inference outside the page/component/layout directories, which are searched automatically.
1135
1135
  - **Why it exists:** wrapper components often live in sibling packages or shared UI workspaces.
1136
1136
  - **Benefit:** local wrapper inference can still work across package boundaries.
1137
- - **Without it:** no extra wrapper lookup is done outside the configured app directories.
1137
+ - **Without it:** wrapper lookup is limited to the configured app directories.
1138
1138
  - **Example:**
1139
1139
 
1140
1140
  ```ts
package/RELEASE_NOTES.md CHANGED
@@ -1,36 +1,30 @@
1
- I'll verify the actual release contents before writing notes, since the provided PR list appears
2
- much longer than the diff suggests.
3
-
4
- v1.0.92's tip is #54, so only #56 is new in v1.0.93. Let me inspect the actual diff for accurate
5
- notes.
6
-
7
- Verification complete: v1.0.92 was tagged at #54's merge, so v1.0.93 contains only PR #56. Here are
8
- the release notes.
9
-
10
1
  Highlights
11
2
 
12
- - New public package entry point @immense/vue-pom-generator/playwright/runtime exposes the BasePage
13
- runtime for handwritten POMs to extend.
14
- - README documents the stable runtime contract and warns against importing from the regenerated
15
- _pom-runtime directory.
16
- - Packed smoke check now verifies the runtime entry exports BasePage and ObjectId from a packed
17
- install.
3
+ - Editable combobox wrappers (<input role="combobox">) now generate fill actions instead of native
4
+ selectOption(), which only works on <select> elements.
5
+ - Wrapper role inference now considers the underlying element tag when mapping the combobox ARIA
6
+ role, distinguishing editable inputs from native select-like comboboxes.
7
+ - Documentation and test coverage updated to reflect the corrected behavior.
18
8
 
19
9
  Changes
20
10
 
21
- - Packaging: Added the ./playwright/runtime subpath export (types/import/require) pointing at
22
- dist/class-generation/base-page.d.ts and dist/playwright/runtime.{mjs,cjs}.
23
- - Build: Registered the playwright/runtime source entry in vite.config.ts.
24
- - Docs: Documented importing BasePage from the public runtime entry for handwritten helpers, and
25
- clarified that a consumer's generated _pom-runtime directory is an implementation detail that should
26
- not be imported directly.
11
+ - wrapper-contract.ts: mapExplicitAriaRole now accepts the element tag and returns "input" for
12
+ <input>/<uinput> elements with role="combobox", falling back to "select" otherwise.
13
+ getElementControlRole passes the tag through to this function.
14
+ - README.md: Expanded the wrapper-inference section to explain that an editable <input
15
+ role="combobox"> retains input behavior so generated actions fill it rather than calling
16
+ selectOption().
17
+ - tests/wrapper-contract.test.ts: Added a test verifying that an editable combobox target resolves
18
+ to input interaction behavior.
19
+ - tests/transform.test.ts: Added an end-to-end test confirming a typeSearch method is generated
20
+ (and selectSearch is not) for an editable combobox wrapper.
27
21
 
28
22
  Pull Requests Included
29
23
 
30
- - ]8;id=md-1g2un4x;https://github.com/immense/vue-pom-generator/pull/56#56 feat(playwright): export POM runtime]8;;]8;; (@dkattan)]8;;
24
+ - #58 fix(wrappers): fill editable comboboxes (]8;id=md-1eex0z3;https://github.com/immense/vue-pom-generator/pull/58#58]8;;]8;;)]8;;
31
25
 
32
26
  Testing
33
27
 
34
- - Extended scripts/packed-smoke-check.mjs to assert the public runtime entry exports BasePage and
35
- ObjectId from a packed tarball install.
28
+ Added targeted tests for wrapper-contract inference and end-to-end transform output. Full suite (417
29
+ tests), typecheck, lint, build, and smoke-pack all passing per the PR.
36
30