@immense/vue-pom-generator 1.0.78 → 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 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/__generated__/fixtures.g";
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. migrate specs from `({ page })` to generated fixtures like `({ dashboardPage })`
812
- 3. turn this rule on for `tests/playwright/**/*.spec.ts`
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,73 +1,36 @@
1
- I'll verify which PRs actually fall within the release window by checking their merge timestamps via
2
- the GitHub API.
3
-
4
- Let me verify the v1.0.77 tag position relative to PR #36's merge.
5
-
6
- v1.0.77 points to #36's merge commit, confirming #36 belongs to the prior release. Only #37 (plus a
7
- follow-up test commit) is in v1.0.78. Let me get the PR details and diff for accurate notes.
8
-
9
- Let me check the plugin wiring changes to fully understand the feature.
10
-
11
- I now have everything needed. Verification summary:
12
-
13
- - v1.0.77 tag = e5b00f4 (PR #36 merge), so #36 belongs to the prior release.
14
- - Range v1.0.77..HEAD contains only #37's merge commit (03d66fa) plus a follow-up test fix
15
- (d12efe7).
16
- - The long PR list in the prompt spans months; only #37 falls in the release window and git range.
17
-
18
- -----------------------------------------------------------------------------------------------
19
-
20
1
  Highlights
21
2
 
22
- - Introduces a cross-file key registry so child components rendered inside keyed slot scopes (e.g.
23
- <template #item="{ data, key }">) get automatically keyed testids
24
- - Parent templates record which prop receives the slot-scope data; child components look up the
25
- registry to key their internal testids (e.g. RolePermissionSubject-${subject.key ?? subject.id ??
26
- …}-SelectAll-button)
27
- - Relies on Rolldown's depth-first module processing to guarantee the parent is always compiled
28
- before the child
29
- - Threads the shared registry through both the build and dev plugin pipelines
30
- - Adds new slot-scope variable extraction utilities plus positive/negative regression tests
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)
31
9
 
32
10
  Changes
33
11
 
34
- Cross-file key registry
35
-
36
- - Added CrossFileKeyRegistry type (Map<string, string>) exported from transform.ts
37
- - Parent transform records childComponentName → slotDataPropName when a component is rendered
38
- inside a v-slot keyed scope
39
- - Child transform consults the registry to build a keyed fallback expression when no in-file slot
40
- key is found
41
-
42
- Plugin pipeline
43
-
44
- - Threaded crossFileKeyRegistry through createVuePomGeneratorPlugins, createInternalPlugins, the
45
- build processor, the dev processor, and the Vue plugin
46
- - Build mode shares the registry across files; dev mode uses a provisional per-file key registry
47
- - Added crossFileKeyRegistry to shared generator state
48
-
49
- Utilities
50
-
51
- - New tryExtractSlotScopeVariableNames parses slot-scope bindings (simple identifiers, object
52
- destructuring, aliases, rest elements)
53
- - New getContainedInSlotTemplateNode walks the hierarchy map to the nearest enclosing scoped-slot
54
- <template>
55
- - Refactored getContainedInSlotDataKeyInfo to reuse getContainedInSlotTemplateNode
56
- - Exported previously-internal helpers: findTemplateSlotScopeExpression,
57
- buildSlotScopeFallbackKeyExpression, toResolvedKeyInfo, tryGetTemplateSlotScopeKeyInfo
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)
58
17
 
59
- Tests
18
+ Breaking Changes
60
19
 
61
- - Added transform tests for the cross-file key registry (keyed case and non-keyed negative case)
62
- - Updated the vue-plugin-state test to include crossFileKeyRegistry in shared state
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)
63
23
 
64
24
  Pull Requests Included
65
25
 
66
- - #37 feat: cross-file key registry for child components in keyed slots — by @dkattan
67
- (]8;id=md-1fs9wuc;https://github.com/immense/vue-pom-generator/pull/37https://github.com/immense/vue-pom-generator/pull/37]8;;]8;;)]8;;
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;;
68
30
 
69
31
  Testing
70
32
 
71
- All 204 tests pass per PR #37, including new cross-file key registry regression tests covering both
72
- the keyed and non-keyed cases.
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.
73
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: [{ name: "Page", alias: "PwPage" }],
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.addVariableStatement({
1542
- declarationKind: VariableDeclarationKind.Const,
1543
- declarations: [{
1544
- name: "test",
1545
- initializer: (writer) => {
1546
- writer.write("base.extend<PlaywrightOptions & PomSetupFixture & PomFactoryFixture & GeneratedPageFixtures & GeneratedComponentFixtures>(");
1547
- writer.block(() => {
1548
- writer.writeLine("animation: [{");
1549
- writer.indent(() => {
1550
- writer.writeLine('pointer: { durationMilliseconds: 250, transitionStyle: "ease-in-out", clickDelayMilliseconds: 0 },');
1551
- writer.writeLine("keyboard: { typeDelayMilliseconds: 100 },");
1552
- });
1553
- writer.writeLine("}, { option: true }],");
1554
- writer.writeLine("pomSetup: [async ({ animation }, use) => {");
1555
- writer.indent(() => {
1556
- writer.writeLine("Pom.setPlaywrightAnimationOptions(animation);");
1557
- writer.writeLine("await use();");
1558
- });
1559
- writer.writeLine("}, { auto: true }],");
1560
- writer.writeLine("pomFactory: async ({ page }, use) => {");
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("await use({");
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.write(")");
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: ["test", "expect"],
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;
package/dist/index.cjs CHANGED
@@ -5526,15 +5526,16 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
5526
5526
  sourceFile.addStatements("/** Generated Playwright fixtures (typed page objects). */");
5527
5527
  addNamedImport(sourceFile, {
5528
5528
  moduleSpecifier: "@playwright/test",
5529
- namedImports: [
5530
- "expect",
5531
- { name: "test", alias: "base" }
5532
- ]
5529
+ namedImports: ["expect"]
5533
5530
  });
5534
5531
  addNamedImport(sourceFile, {
5535
5532
  moduleSpecifier: "@playwright/test",
5536
5533
  isTypeOnly: true,
5537
- namedImports: [{ name: "Page", alias: "PwPage" }]
5534
+ namedImports: [
5535
+ { name: "Page", alias: "PwPage" },
5536
+ "PlaywrightTestArgs",
5537
+ "TestType"
5538
+ ]
5538
5539
  });
5539
5540
  sourceFile.addImportDeclaration({
5540
5541
  namespaceImport: "Pom",
@@ -5618,6 +5619,14 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
5618
5619
  name: "GeneratedComponentFixtures",
5619
5620
  type: "{ [K in keyof typeof componentCtors]: InstanceType<(typeof componentCtors)[K]> }"
5620
5621
  });
5622
+ sourceFile.addTypeAlias({
5623
+ isExported: true,
5624
+ name: "PomFixtures",
5625
+ docs: [{
5626
+ description: "Every fixture contributed by the generator: the `animation` option, the internal\n`pomSetup`/`pomFactory` fixtures, and one fixture per generated page/component POM."
5627
+ }],
5628
+ type: "PlaywrightOptions & PomSetupFixture & PomFactoryFixture & GeneratedPageFixtures & GeneratedComponentFixtures"
5629
+ });
5621
5630
  sourceFile.addFunction({
5622
5631
  name: "makePomFixture",
5623
5632
  typeParameters: [{ name: "T" }],
@@ -5640,43 +5649,61 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
5640
5649
  "return out as any;"
5641
5650
  ]
5642
5651
  });
5643
- sourceFile.addVariableStatement({
5644
- declarationKind: tsMorph.VariableDeclarationKind.Const,
5645
- declarations: [{
5646
- name: "test",
5647
- initializer: (writer) => {
5648
- writer.write("base.extend<PlaywrightOptions & PomSetupFixture & PomFactoryFixture & GeneratedPageFixtures & GeneratedComponentFixtures>(");
5649
- writer.block(() => {
5650
- writer.writeLine("animation: [{");
5651
- writer.indent(() => {
5652
- writer.writeLine('pointer: { durationMilliseconds: 250, transitionStyle: "ease-in-out", clickDelayMilliseconds: 0 },');
5653
- writer.writeLine("keyboard: { typeDelayMilliseconds: 100 },");
5654
- });
5655
- writer.writeLine("}, { option: true }],");
5656
- writer.writeLine("pomSetup: [async ({ animation }, use) => {");
5657
- writer.indent(() => {
5658
- writer.writeLine("Pom.setPlaywrightAnimationOptions(animation);");
5659
- writer.writeLine("await use();");
5660
- });
5661
- writer.writeLine("}, { auto: true }],");
5662
- writer.writeLine("pomFactory: async ({ page }, use) => {");
5652
+ sourceFile.addStatements([
5653
+ "/**",
5654
+ " * Attach the generated POM fixtures to a project-owned Playwright `test`.",
5655
+ " *",
5656
+ " * This generator deliberately does not export a `test` of its own. Projects should own",
5657
+ " * exactly one `test` object so project-wide fixtures (console-error capture, error-overlay",
5658
+ " * detection, auth, ...) are inherited by every spec. Compose it once in a project module:",
5659
+ " *",
5660
+ " * const base = playwrightTest.extend({ ...project-wide fixtures... });",
5661
+ " * export const test = withPomFixtures(base);",
5662
+ " *",
5663
+ " * Then have every spec import `test` from that module.",
5664
+ " */"
5665
+ ].join("\n"));
5666
+ sourceFile.addFunction({
5667
+ isExported: true,
5668
+ name: "withPomFixtures",
5669
+ typeParameters: [
5670
+ { name: "TTestArgs", constraint: "PlaywrightTestArgs" },
5671
+ { name: "TWorkerArgs", constraint: "object" }
5672
+ ],
5673
+ parameters: [{ name: "base", type: "TestType<TTestArgs, TWorkerArgs>" }],
5674
+ returnType: "TestType<TTestArgs & PomFixtures, TWorkerArgs>",
5675
+ statements: (writer) => {
5676
+ writer.write("return base.extend<PomFixtures>(");
5677
+ writer.block(() => {
5678
+ writer.writeLine("animation: [{");
5679
+ writer.indent(() => {
5680
+ writer.writeLine('pointer: { durationMilliseconds: 250, transitionStyle: "ease-in-out", clickDelayMilliseconds: 0 },');
5681
+ writer.writeLine("keyboard: { typeDelayMilliseconds: 100 },");
5682
+ });
5683
+ writer.writeLine("}, { option: true }],");
5684
+ writer.writeLine("pomSetup: [async ({ animation }: PomFixtures, use: (r: void) => Promise<void>) => {");
5685
+ writer.indent(() => {
5686
+ writer.writeLine("Pom.setPlaywrightAnimationOptions(animation);");
5687
+ writer.writeLine("await use();");
5688
+ });
5689
+ writer.writeLine("}, { auto: true }],");
5690
+ writer.writeLine("pomFactory: async ({ page }: { page: PwPage }, use: (r: PomFactory) => Promise<void>) => {");
5691
+ writer.indent(() => {
5692
+ writer.writeLine("await use({");
5663
5693
  writer.indent(() => {
5664
- writer.writeLine("await use({");
5665
- writer.indent(() => {
5666
- writer.writeLine("create: <T>(ctor: PomConstructor<T>) => new ctor(page),");
5667
- });
5668
- writer.writeLine("});");
5694
+ writer.writeLine("create: <T>(ctor: PomConstructor<T>) => new ctor(page),");
5669
5695
  });
5670
- writer.writeLine("},");
5671
- writer.writeLine("...createPomFixtures(pageCtors),");
5672
- writer.writeLine("...createPomFixtures(componentCtors),");
5696
+ writer.writeLine("});");
5673
5697
  });
5674
- writer.write(")");
5675
- }
5676
- }]
5698
+ writer.writeLine("},");
5699
+ writer.writeLine("...createPomFixtures(pageCtors),");
5700
+ writer.writeLine("...createPomFixtures(componentCtors),");
5701
+ });
5702
+ writer.write(") as TestType<TTestArgs & PomFixtures, TWorkerArgs>;");
5703
+ }
5677
5704
  });
5678
5705
  sourceFile.addExportDeclaration({
5679
- namedExports: ["test", "expect"]
5706
+ namedExports: ["expect"]
5680
5707
  });
5681
5708
  }, {
5682
5709
  prefixText: buildFilePrefix({
@@ -5726,9 +5753,16 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
5726
5753
  return match;
5727
5754
  };
5728
5755
  const rawComponentRefsForInstances = usedComponentSet?.size ? usedComponentSet : childrenComponentSet;
5756
+ const ownClassName = toPascalCaseLocal(componentName);
5757
+ const isSelfReference = (ref) => {
5758
+ return toPascalCaseLocal(normalizeTrackedComponentRef(ref)) === ownClassName && ownClassName.length > 0;
5759
+ };
5729
5760
  const componentRefsForInstances = /* @__PURE__ */ new Set();
5730
5761
  for (const ref of rawComponentRefsForInstances) {
5731
5762
  const resolvedRef = resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref);
5763
+ if (isSelfReference(resolvedRef)) {
5764
+ continue;
5765
+ }
5732
5766
  const resolvedDependencies = componentHierarchyMap.get(resolvedRef);
5733
5767
  if (!resolvedDependencies?.dataTestIdSet.size) {
5734
5768
  continue;
@@ -7453,7 +7487,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7453
7487
  const inferred = tryInferNativeWrapperRoleFromSfc(element.tag, vueFilesPathMap, wrapperSearchRoots);
7454
7488
  if (inferred?.role) {
7455
7489
  nativeWrappers[element.tag] = { role: inferred.role, inferred: true };
7456
- } else if (element.tag.endsWith("Button") || element.tag === "AylaButton") {
7490
+ } else if (element.tag.endsWith("Button")) {
7457
7491
  nativeWrappers[element.tag] = { role: "button" };
7458
7492
  } else if (element.tag === "DxDataGrid") {
7459
7493
  nativeWrappers[element.tag] = { role: "grid" };