@immense/vue-pom-generator 1.0.77 → 1.0.79
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 +46 -3
- package/RELEASE_NOTES.md +21 -55
- package/class-generation/index.ts +87 -37
- package/dist/index.cjs +164 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +165 -48
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
- package/dist/plugin/internal/build-plugin.d.ts +1 -0
- package/dist/plugin/internal/build-plugin.d.ts.map +1 -1
- package/dist/plugin/internal/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/internal-plugins.d.ts +1 -0
- package/dist/plugin/internal-plugins.d.ts.map +1 -1
- package/dist/plugin/vue-plugin.d.ts +2 -0
- package/dist/plugin/vue-plugin.d.ts.map +1 -1
- package/dist/transform.d.ts +11 -0
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,8 +136,26 @@ test("shows the list", async ({ page }) => {
|
|
|
136
136
|
|
|
137
137
|
**After**
|
|
138
138
|
|
|
139
|
+
First compose your project's `test` once. The generator does **not** export a `test` — it
|
|
140
|
+
exports `withPomFixtures`, which attaches the generated POM fixtures to a base you own:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// tests/playwright/test-base.ts
|
|
144
|
+
import { test as playwrightTest, expect } from "@playwright/test";
|
|
145
|
+
import { withPomFixtures } from "./__generated__/fixtures.g";
|
|
146
|
+
|
|
147
|
+
// Anything added here is inherited by every spec: console-error capture,
|
|
148
|
+
// error-overlay detection, auth, API cleanup, ...
|
|
149
|
+
const base = playwrightTest.extend({ /* project-wide fixtures */ });
|
|
150
|
+
|
|
151
|
+
export const test = withPomFixtures(base);
|
|
152
|
+
export { expect };
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Then specs import `test` from that module:
|
|
156
|
+
|
|
139
157
|
```ts
|
|
140
|
-
import { test, expect } from "../tests/playwright/
|
|
158
|
+
import { test, expect } from "../tests/playwright/test-base";
|
|
141
159
|
|
|
142
160
|
test("shows the list", async ({ userListPage }) => {
|
|
143
161
|
await userListPage.goTo();
|
|
@@ -150,6 +168,8 @@ Why this is better:
|
|
|
150
168
|
- less setup noise in tests
|
|
151
169
|
- fixture types stay aligned with generated classes
|
|
152
170
|
- if `tests/playwright/pom/overrides/UserListPage.ts` exists, the fixture will instantiate that override class automatically
|
|
171
|
+
- there is exactly one `test` object in the project, so project-wide fixtures cannot silently
|
|
172
|
+
miss some specs
|
|
153
173
|
|
|
154
174
|
Without fixtures, you still use the generated POMs, but every test has to construct them manually.
|
|
155
175
|
|
|
@@ -612,6 +632,27 @@ Without `flatten`, helper composition still works; you just call through the hel
|
|
|
612
632
|
|
|
613
633
|
When `generation.playwright.fixtures` is enabled, the generator emits a strongly typed Playwright fixture module.
|
|
614
634
|
|
|
635
|
+
### The generated module does not own `test`
|
|
636
|
+
|
|
637
|
+
`fixtures.g.ts` exports `withPomFixtures`, not a ready-made `test`. Owning the `test` object
|
|
638
|
+
is a project concern: a project needs exactly one `test` so that project-wide fixtures
|
|
639
|
+
(console-error capture, error-overlay detection, auth) are inherited by *every* spec. If the
|
|
640
|
+
generator exported its own `test`, a project would end up with two runners and specs would
|
|
641
|
+
silently miss whichever fixtures were attached to the other one.
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
// tests/playwright/test-base.ts — the single `test` your specs import
|
|
645
|
+
import { test as playwrightTest, expect } from "@playwright/test";
|
|
646
|
+
import { withPomFixtures } from "./__generated__/fixtures.g";
|
|
647
|
+
|
|
648
|
+
export const test = withPomFixtures(playwrightTest.extend({ /* project-wide fixtures */ }));
|
|
649
|
+
export { expect };
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
The module also exports the fixture types (`PomFixtures`, `GeneratedPageFixtures`,
|
|
653
|
+
`GeneratedComponentFixtures`, `PlaywrightOptions`, `PomFactory`) and re-exports `expect`
|
|
654
|
+
for convenience.
|
|
655
|
+
|
|
615
656
|
What it gives you:
|
|
616
657
|
|
|
617
658
|
- lower-camel-case fixtures for views (`UserListPage` → `userListPage`)
|
|
@@ -622,6 +663,7 @@ What it gives you:
|
|
|
622
663
|
|
|
623
664
|
Current caveats:
|
|
624
665
|
|
|
666
|
+
- `withPomFixtures` requires a base whose test args include Playwright's `page` (i.e. anything derived from `@playwright/test`'s `test`)
|
|
625
667
|
- there are no generated `openXPage` helpers; tests call `goTo()` explicitly when available
|
|
626
668
|
- override preference only affects fixture construction
|
|
627
669
|
- component fixtures are skipped when their lower-camel-case name would collide with reserved Playwright fixture names such as `page`, `context`, `browser`, or `request`
|
|
@@ -808,8 +850,9 @@ Why it exists:
|
|
|
808
850
|
Recommended usage:
|
|
809
851
|
|
|
810
852
|
1. enable generated fixtures in the generator
|
|
811
|
-
2.
|
|
812
|
-
3.
|
|
853
|
+
2. compose a single project `test` with `withPomFixtures` (see the fixtures section) and have specs import it
|
|
854
|
+
3. migrate specs from `({ page })` to generated fixtures like `({ dashboardPage })`
|
|
855
|
+
4. turn this rule on for `tests/playwright/**/*.spec.ts`
|
|
813
856
|
|
|
814
857
|
Example flat config:
|
|
815
858
|
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,70 +1,36 @@
|
|
|
1
|
-
I'll investigate the actual repository state to understand the full scope of changes between v1.0.76
|
|
2
|
-
and HEAD.
|
|
3
|
-
|
|
4
|
-
Let me check the tag timing and PR merge dates to understand which PRs are actually new in this
|
|
5
|
-
release.
|
|
6
|
-
|
|
7
|
-
Now I understand - v1.0.76 was tagged at 2026-07-28T17:02:36-05:00 (start of window) and HEAD is at
|
|
8
|
-
2026-07-29T07:09:25-05:00 (end of window). Let me verify which PRs were actually merged in this
|
|
9
|
-
window.
|
|
10
|
-
|
|
11
|
-
Let me verify the merge times of key PRs to confirm which are actually in this release window.
|
|
12
|
-
|
|
13
|
-
Now I have clear evidence. Only PR #36 is new in this release:
|
|
14
|
-
|
|
15
|
-
- #36 (e5b00f4): 2026-07-29T07:09:25-05:00 = HEAD (end of window)
|
|
16
|
-
- #35 (28e58a2): 2026-07-28T17:02:36-05:00 = v1.0.76 (start of window)
|
|
17
|
-
- #34 and earlier: all before the window start
|
|
18
|
-
|
|
19
|
-
Let me examine the actual diff to write accurate release notes.
|
|
20
|
-
|
|
21
|
-
Now I have a complete understanding. Let me also check the PR #36 description for additional
|
|
22
|
-
context.
|
|
23
|
-
|
|
24
|
-
I now have all the information needed. The git evidence is conclusive:
|
|
25
|
-
|
|
26
|
-
- v1.0.76 was tagged at commit #35 (2026-07-28T17:02:36-05:00)
|
|
27
|
-
- HEAD is commit #36 (2026-07-29T07:09:25-05:00)
|
|
28
|
-
- Only PR #36 is in the v1.0.76..HEAD range
|
|
29
|
-
- All other listed PRs (#1–#35) were already released in prior versions
|
|
30
|
-
|
|
31
|
-
Here are the release notes:
|
|
32
|
-
|
|
33
1
|
Highlights
|
|
34
2
|
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
3
|
+
- Breaking API change: the generator now exports withPomFixtures instead of a generated test
|
|
4
|
+
function, giving consumers explicit control over Playwright fixture wiring (#39)
|
|
5
|
+
- Fixed a self-referential child instance created for recursively-nested components (#38)
|
|
6
|
+
- Removed product-specific (Immy/Ayla) heuristics and fixtures, making the generator fully generic
|
|
7
|
+
(#40)
|
|
8
|
+
- Deleted stale pom-element-wrapper design and implementation plan documents (#41)
|
|
39
9
|
|
|
40
10
|
Changes
|
|
41
11
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- This ensures slot-scope and v-for key detection can walk past v-if/v-for wrappers to find the
|
|
48
|
-
enclosing <template> or v-for element, producing stable keyed test IDs such as
|
|
49
|
-
`MyComp-${maintenanceItem.key ?? ...}-MoveToTop-button`.
|
|
50
|
-
|
|
51
|
-
Tests
|
|
52
|
-
|
|
53
|
-
- Added regression test verifying stable keyed test IDs for scoped-slot data objects through v-if
|
|
54
|
-
wrappers.
|
|
55
|
-
- Added regression test verifying stable keyed test IDs for scoped-slot data objects destructured
|
|
56
|
-
with an explicit key prop.
|
|
12
|
+
- Generation API: Export withPomFixtures instead of generating a test function; README,
|
|
13
|
+
generated-tsc fixtures, and test suites updated to match (#39)
|
|
14
|
+
- Bug fix: Drop the self-referential child instance created for recursively-nested components (#38)
|
|
15
|
+
- Cleanup: Remove product-specific (Immy/Ayla) heuristics and fixtures from class generation (#40)
|
|
16
|
+
- Docs: Remove stale pom-element-wrapper design and implementation plan documents (#41)
|
|
57
17
|
|
|
58
18
|
Breaking Changes
|
|
59
19
|
|
|
60
|
-
|
|
20
|
+
- The generator no longer emits a generated test function. It now exports withPomFixtures, which
|
|
21
|
+
consumers must use to wire up Playwright tests. Update any imports of the generated test to use
|
|
22
|
+
withPomFixtures instead. (#39)
|
|
61
23
|
|
|
62
24
|
Pull Requests Included
|
|
63
25
|
|
|
64
|
-
- ]8;id=md-
|
|
26
|
+
- ]8;id=md-fq7jrl;https://github.com/immense/vue-pom-generator/pull/41#41]8;;]8;; — chore: remove stale pom-element-wrapper plan docs]8;;
|
|
27
|
+
- ]8;id=md-fg7y2m;https://github.com/immense/vue-pom-generator/pull/40#40]8;;]8;; — chore: remove product-specific (Immy/Ayla) heuristics and fixtures]8;;
|
|
28
|
+
- ]8;id=md-1d0dvwm;https://github.com/immense/vue-pom-generator/pull/39#39]8;;]8;; — feat!: export withPomFixtures instead of a generated test]8;;
|
|
29
|
+
- ]8;id=md-1dadhll;https://github.com/immense/vue-pom-generator/pull/38#38]8;;]8;; — fix: drop self-referential child instance for recursively-nested components]8;;
|
|
65
30
|
|
|
66
31
|
Testing
|
|
67
32
|
|
|
68
|
-
|
|
69
|
-
|
|
33
|
+
- Updated test suites (generated-tsc, transform, class-generation-coverage, existing-id-error,
|
|
34
|
+
utils-coverage) and regenerated TypeScript fixtures (playwright-test.d.ts) to reflect the new
|
|
35
|
+
withPomFixtures API and the recursive-nesting fix.
|
|
70
36
|
|
|
@@ -1417,17 +1417,24 @@ function maybeGenerateFixtureRegistry(
|
|
|
1417
1417
|
const fixturesContent = renderSourceFile(fixtureFileName, (sourceFile) => {
|
|
1418
1418
|
sourceFile.addStatements("/** Generated Playwright fixtures (typed page objects). */");
|
|
1419
1419
|
|
|
1420
|
+
// NOTE: this file intentionally does NOT create or export a `test` runner.
|
|
1421
|
+
// Owning the `test` object is a project concern, not a code-generation concern:
|
|
1422
|
+
// projects need to attach their own global fixtures (console-error capture,
|
|
1423
|
+
// error-overlay detection, auth, ...) and there must be exactly one `test` that
|
|
1424
|
+
// specs import. Instead we export `withPomFixtures`, which attaches the generated
|
|
1425
|
+
// POM fixtures to whatever base `test` the project owns.
|
|
1420
1426
|
addNamedImport(sourceFile, {
|
|
1421
1427
|
moduleSpecifier: "@playwright/test",
|
|
1422
|
-
namedImports: [
|
|
1423
|
-
"expect",
|
|
1424
|
-
{ name: "test", alias: "base" },
|
|
1425
|
-
],
|
|
1428
|
+
namedImports: ["expect"],
|
|
1426
1429
|
});
|
|
1427
1430
|
addNamedImport(sourceFile, {
|
|
1428
1431
|
moduleSpecifier: "@playwright/test",
|
|
1429
1432
|
isTypeOnly: true,
|
|
1430
|
-
namedImports: [
|
|
1433
|
+
namedImports: [
|
|
1434
|
+
{ name: "Page", alias: "PwPage" },
|
|
1435
|
+
"PlaywrightTestArgs",
|
|
1436
|
+
"TestType",
|
|
1437
|
+
],
|
|
1431
1438
|
});
|
|
1432
1439
|
sourceFile.addImportDeclaration({
|
|
1433
1440
|
namespaceImport: "Pom",
|
|
@@ -1514,6 +1521,15 @@ function maybeGenerateFixtureRegistry(
|
|
|
1514
1521
|
name: "GeneratedComponentFixtures",
|
|
1515
1522
|
type: "{ [K in keyof typeof componentCtors]: InstanceType<(typeof componentCtors)[K]> }",
|
|
1516
1523
|
});
|
|
1524
|
+
sourceFile.addTypeAlias({
|
|
1525
|
+
isExported: true,
|
|
1526
|
+
name: "PomFixtures",
|
|
1527
|
+
docs: [{
|
|
1528
|
+
description: "Every fixture contributed by the generator: the `animation` option, the internal\n"
|
|
1529
|
+
+ "`pomSetup`/`pomFactory` fixtures, and one fixture per generated page/component POM.",
|
|
1530
|
+
}],
|
|
1531
|
+
type: "PlaywrightOptions & PomSetupFixture & PomFactoryFixture & GeneratedPageFixtures & GeneratedComponentFixtures",
|
|
1532
|
+
});
|
|
1517
1533
|
|
|
1518
1534
|
sourceFile.addFunction({
|
|
1519
1535
|
name: "makePomFixture",
|
|
@@ -1538,44 +1554,66 @@ function maybeGenerateFixtureRegistry(
|
|
|
1538
1554
|
],
|
|
1539
1555
|
});
|
|
1540
1556
|
|
|
1541
|
-
sourceFile.
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1557
|
+
sourceFile.addStatements([
|
|
1558
|
+
"/**",
|
|
1559
|
+
" * Attach the generated POM fixtures to a project-owned Playwright `test`.",
|
|
1560
|
+
" *",
|
|
1561
|
+
" * This generator deliberately does not export a `test` of its own. Projects should own",
|
|
1562
|
+
" * exactly one `test` object so project-wide fixtures (console-error capture, error-overlay",
|
|
1563
|
+
" * detection, auth, ...) are inherited by every spec. Compose it once in a project module:",
|
|
1564
|
+
" *",
|
|
1565
|
+
" * const base = playwrightTest.extend({ ...project-wide fixtures... });",
|
|
1566
|
+
" * export const test = withPomFixtures(base);",
|
|
1567
|
+
" *",
|
|
1568
|
+
" * Then have every spec import `test` from that module.",
|
|
1569
|
+
" */",
|
|
1570
|
+
].join("\n"));
|
|
1571
|
+
sourceFile.addFunction({
|
|
1572
|
+
isExported: true,
|
|
1573
|
+
name: "withPomFixtures",
|
|
1574
|
+
typeParameters: [
|
|
1575
|
+
{ name: "TTestArgs", constraint: "PlaywrightTestArgs" },
|
|
1576
|
+
{ name: "TWorkerArgs", constraint: "object" },
|
|
1577
|
+
],
|
|
1578
|
+
parameters: [{ name: "base", type: "TestType<TTestArgs, TWorkerArgs>" }],
|
|
1579
|
+
returnType: "TestType<TTestArgs & PomFixtures, TWorkerArgs>",
|
|
1580
|
+
statements: (writer) => {
|
|
1581
|
+
writer.write("return base.extend<PomFixtures>(");
|
|
1582
|
+
writer.block(() => {
|
|
1583
|
+
writer.writeLine("animation: [{");
|
|
1584
|
+
writer.indent(() => {
|
|
1585
|
+
writer.writeLine('pointer: { durationMilliseconds: 250, transitionStyle: "ease-in-out", clickDelayMilliseconds: 0 },');
|
|
1586
|
+
writer.writeLine("keyboard: { typeDelayMilliseconds: 100 },");
|
|
1587
|
+
});
|
|
1588
|
+
writer.writeLine("}, { option: true }],");
|
|
1589
|
+
// The fixture callbacks are annotated explicitly rather than relying on
|
|
1590
|
+
// contextual typing: `base` is generic here, so TypeScript cannot resolve
|
|
1591
|
+
// Playwright's `Fixtures<...>` parameter types and the callbacks would
|
|
1592
|
+
// otherwise be implicitly `any` (an error under `noImplicitAny`).
|
|
1593
|
+
writer.writeLine("pomSetup: [async ({ animation }: PomFixtures, use: (r: void) => Promise<void>) => {");
|
|
1594
|
+
writer.indent(() => {
|
|
1595
|
+
writer.writeLine("Pom.setPlaywrightAnimationOptions(animation);");
|
|
1596
|
+
writer.writeLine("await use();");
|
|
1597
|
+
});
|
|
1598
|
+
writer.writeLine("}, { auto: true }],");
|
|
1599
|
+
writer.writeLine("pomFactory: async ({ page }: { page: PwPage }, use: (r: PomFactory) => Promise<void>) => {");
|
|
1600
|
+
writer.indent(() => {
|
|
1601
|
+
writer.writeLine("await use({");
|
|
1561
1602
|
writer.indent(() => {
|
|
1562
|
-
writer.writeLine("
|
|
1563
|
-
writer.indent(() => {
|
|
1564
|
-
writer.writeLine("create: <T>(ctor: PomConstructor<T>) => new ctor(page),");
|
|
1565
|
-
});
|
|
1566
|
-
writer.writeLine("});");
|
|
1603
|
+
writer.writeLine("create: <T>(ctor: PomConstructor<T>) => new ctor(page),");
|
|
1567
1604
|
});
|
|
1568
|
-
writer.writeLine("}
|
|
1569
|
-
writer.writeLine("...createPomFixtures(pageCtors),");
|
|
1570
|
-
writer.writeLine("...createPomFixtures(componentCtors),");
|
|
1605
|
+
writer.writeLine("});");
|
|
1571
1606
|
});
|
|
1572
|
-
writer.
|
|
1573
|
-
|
|
1574
|
-
|
|
1607
|
+
writer.writeLine("},");
|
|
1608
|
+
writer.writeLine("...createPomFixtures(pageCtors),");
|
|
1609
|
+
writer.writeLine("...createPomFixtures(componentCtors),");
|
|
1610
|
+
});
|
|
1611
|
+
writer.write(") as TestType<TTestArgs & PomFixtures, TWorkerArgs>;");
|
|
1612
|
+
},
|
|
1575
1613
|
});
|
|
1576
1614
|
|
|
1577
1615
|
sourceFile.addExportDeclaration({
|
|
1578
|
-
namedExports: ["
|
|
1616
|
+
namedExports: ["expect"],
|
|
1579
1617
|
});
|
|
1580
1618
|
}, {
|
|
1581
1619
|
prefixText: buildFilePrefix({
|
|
@@ -1640,9 +1678,21 @@ function prepareViewObjectModelClass(
|
|
|
1640
1678
|
const rawComponentRefsForInstances = usedComponentSet?.size
|
|
1641
1679
|
? usedComponentSet
|
|
1642
1680
|
: childrenComponentSet;
|
|
1681
|
+
// A component may render itself recursively (e.g. a tree/list that nests same-named
|
|
1682
|
+
// children). Without this guard the generator emits `this.<SelfName> = new <SelfName>(page)`
|
|
1683
|
+
// in the constructor, which infinitely recurses the moment any POM transitively
|
|
1684
|
+
// instantiates this class. A self-reference is never a useful child instance (it would
|
|
1685
|
+
// just re-wrap the same page), so drop it before it becomes a property + ctor assignment.
|
|
1686
|
+
const ownClassName = toPascalCaseLocal(componentName);
|
|
1687
|
+
const isSelfReference = (ref: string): boolean => {
|
|
1688
|
+
return toPascalCaseLocal(normalizeTrackedComponentRef(ref)) === ownClassName && ownClassName.length > 0;
|
|
1689
|
+
};
|
|
1643
1690
|
const componentRefsForInstances = new Set<string>();
|
|
1644
1691
|
for (const ref of rawComponentRefsForInstances) {
|
|
1645
1692
|
const resolvedRef = resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref);
|
|
1693
|
+
if (isSelfReference(resolvedRef)) {
|
|
1694
|
+
continue;
|
|
1695
|
+
}
|
|
1646
1696
|
const resolvedDependencies = componentHierarchyMap.get(resolvedRef);
|
|
1647
1697
|
if (!resolvedDependencies?.dataTestIdSet.size) {
|
|
1648
1698
|
continue;
|