@immense/vue-pom-generator 1.0.83 → 1.0.84
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/RELEASE_NOTES.md +52 -30
- package/class-generation/playwright-types.ts +120 -2
- package/dist/class-generation/playwright-types.d.ts +256 -2
- package/dist/class-generation/playwright-types.d.ts.map +1 -1
- package/dist/compiler-metadata-utils.d.ts.map +1 -1
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/index.cjs +20 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +20 -26
- package/dist/index.mjs.map +1 -1
- package/dist/pom-patterns.d.ts +28 -4
- package/dist/pom-patterns.d.ts.map +1 -1
- package/dist/tests/annotator-runtime-helpers.test.d.ts +2 -0
- package/dist/tests/annotator-runtime-helpers.test.d.ts.map +1 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts +2 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts +2 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts +2 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts +162 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts.map +1 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts +2 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts +2 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts +2 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts.map +1 -0
- package/dist/tests/helpers/typed-mocks.d.ts +58 -0
- package/dist/tests/helpers/typed-mocks.d.ts.map +1 -0
- package/dist/transform.d.ts +36 -5
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +261 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,50 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
I'll verify the actual commits in the release range to write accurate notes.
|
|
2
|
+
|
|
3
|
+
Let me fetch the PR details to understand the changes accurately.
|
|
4
|
+
|
|
5
|
+
Now I have full details on both PRs. Let me compose the release notes.
|
|
4
6
|
|
|
5
7
|
Highlights
|
|
6
8
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
with
|
|
14
|
-
|
|
9
|
+
- Eliminated getTemplateVariables / inferPomStringPattern — pattern kind and template variables are
|
|
10
|
+
now supplied explicitly at createPomStringPattern construction (required 3rd arg) and carried on
|
|
11
|
+
PomStringPattern, never re-derived from the formatted string.
|
|
12
|
+
- Narrowed Playwright types — PwPage/PwLocator became minimal structural interfaces
|
|
13
|
+
(BasePagePage/BasePageLocator) that real Playwright types still satisfy, enabling cast-free test
|
|
14
|
+
mocks.
|
|
15
|
+
- Tightened no-explicit-any to error in tests — every as any cast replaced with typed construction
|
|
16
|
+
via new shared mock helpers.
|
|
17
|
+
- Added broad test coverage — 10 new test files in tests/broad/ exercise previously uncovered
|
|
18
|
+
modules; 369 tests pass across 34 files.
|
|
19
|
+
- Introduced shared typed mock infrastructure (typed-mocks.ts, fake-runtime.ts) and expanded the
|
|
20
|
+
__internal export surface for unit testing.
|
|
15
21
|
|
|
16
22
|
Changes
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
Refactoring
|
|
25
|
+
|
|
26
|
+
- Removed getTemplateVariables / inferPomStringPattern; pattern kind and template variables are now
|
|
27
|
+
passed explicitly at createPomStringPattern construction and stored on PomStringPattern.
|
|
28
|
+
- toPomKeyPattern now returns { formatted, templateVariables }; applyResolvedDataTestId threads
|
|
29
|
+
template variables through.
|
|
30
|
+
- Added collapseWhitespace to utils.ts, replacing an inline regex in compiler-metadata-utils.ts.
|
|
31
|
+
- Expanded the transform / utils __internal export surface (including resetCaches) to support unit
|
|
32
|
+
testing.
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
duplicated inline copies).
|
|
22
|
-
- Added normalizePathSeparators to the annotator plugin.
|
|
23
|
-
- Exposed pure helpers — placementPrimarySide, stripSourcePosition, inferNameFromFile,
|
|
24
|
-
isComponentLikeSourceTag, formatSourceLabel, ignoredComponentNamePattern — via a __internal export
|
|
25
|
-
for unit tests.
|
|
26
|
-
- Added @example TSDoc to stripSourcePosition, inferNameFromFile, isComponentLikeSourceTag,
|
|
27
|
-
formatSourceLabel, and ignoredComponentNamePattern in vue-detector.ts.
|
|
34
|
+
Type Safety
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
- Replaced broad PwPage/PwLocator type aliases with minimal structural interfaces
|
|
37
|
+
(BasePagePage/BasePageLocator) that real Playwright types satisfy, so mocks need ~15 members with no
|
|
38
|
+
casts.
|
|
39
|
+
- Added an ESLint override turning ts/method-signature-style off for playwright-types.ts to keep
|
|
40
|
+
shorthand method signatures bivariant.
|
|
41
|
+
- Promoted no-explicit-any from off to error for the test config; replaced all as any casts with
|
|
42
|
+
typed construction via tests/helpers/typed-mocks.ts (hookFn, makeElementNode, makeTransformContext,
|
|
43
|
+
makeVNodeCall, …) and tests/broad/helpers/fake-runtime.ts (MockPage/MockLocator).
|
|
44
|
+
|
|
45
|
+
Testing
|
|
30
46
|
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
- Added standalone test files in tests/broad/ covering: class-generation-base-page-ts,
|
|
48
|
+
typescript-codegen-ts, manifest-generator-ts, compiler-metadata-utils-ts, metadata-collector-ts,
|
|
49
|
+
plugin-logger-ts, plugin-resolved-generation-options-ts, plugin-runtime-annotator-format-ts,
|
|
50
|
+
accessibility-audit-ts.
|
|
51
|
+
- Added tests/annotator-runtime-helpers.test.ts for annotator pure helpers.
|
|
52
|
+
- Updated existing tests (base-page, build-serve-parity, class-generation-coverage,
|
|
53
|
+
class-generation, existing-id-error, generated-tsc, metadata-collector, router-introspection,
|
|
54
|
+
transform, utils-coverage, utils, virtual-testids) to use typed mocks.
|
|
35
55
|
|
|
36
56
|
Breaking Changes
|
|
37
57
|
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
- Internal API only: getTemplateVariables and inferPomStringPattern were removed, and
|
|
59
|
+
createPomStringPattern now requires a 3rd argument (pattern kind). These are internal
|
|
60
|
+
code-generation utilities not part of the consumer-facing public API (defineVuePomGeneratorConfig /
|
|
61
|
+
vuePomGenerator), so downstream consumers are unaffected.
|
|
40
62
|
|
|
41
63
|
Pull Requests Included
|
|
42
64
|
|
|
43
|
-
- ]8;id=md-
|
|
65
|
+
- ]8;id=md-g075gk;https://github.com/immense/vue-pom-generator/pull/46#46 — refactor: eliminate getTemplateVariables, narrow Playwright types, tighten no-explicit-any]8;;]8;; ]8;;
|
|
44
66
|
(@dkattan)
|
|
67
|
+
- ]8;id=md-ga6r5j;https://github.com/immense/vue-pom-generator/pull/47#47 — test: add broad coverage for class-generation and plugin internals]8;;]8;; (@dkattan)]8;;
|
|
45
68
|
|
|
46
69
|
Testing
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
remains covered by the existing test suite.
|
|
71
|
+
Lint clean, typecheck clean, 369 tests pass across 34 files.
|
|
50
72
|
|
|
@@ -1,5 +1,123 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Keyboard, Response, Screencast } from "playwright";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Narrow subset of the Playwright {@link Locator} surface that the generated
|
|
5
|
+
* POM runtime (`base-page.ts`, `callout.ts`, `pointer.ts`) and generated page
|
|
6
|
+
* object accessors actually use.
|
|
7
|
+
*
|
|
8
|
+
* Locators flow through many chained calls and the full `Locator` interface has
|
|
9
|
+
* ~70 members — too many to stub in tests. Declaring the dependency as this
|
|
10
|
+
* narrow structural interface lets test doubles satisfy it with a handful of
|
|
11
|
+
* real methods, while a real Playwright `Locator` still satisfies it
|
|
12
|
+
* structurally (it has every member here). Member signatures mirror Playwright's
|
|
13
|
+
* own so call sites and downstream consumers keep working.
|
|
14
|
+
*
|
|
15
|
+
* @see BasePagePage for the narrowed page dependency.
|
|
16
|
+
*/
|
|
17
|
+
export interface BasePageLocator {
|
|
18
|
+
first(): BasePageLocator;
|
|
19
|
+
last(): BasePageLocator;
|
|
20
|
+
nth(index: number): BasePageLocator;
|
|
21
|
+
locator(
|
|
22
|
+
selector: string,
|
|
23
|
+
options?: { has?: BasePageLocator; hasNot?: BasePageLocator; hasNotText?: string | RegExp; hasText?: string | RegExp },
|
|
24
|
+
): BasePageLocator;
|
|
25
|
+
describe(description: string): BasePageLocator;
|
|
26
|
+
filter(options?: { has?: BasePageLocator; hasNot?: BasePageLocator; hasNotText?: string | RegExp; hasText?: string | RegExp; visible?: boolean }): BasePageLocator;
|
|
27
|
+
getByLabel(text: string | RegExp, options?: { exact?: boolean }): BasePageLocator;
|
|
28
|
+
getByText(text: string | RegExp, options?: { exact?: boolean }): BasePageLocator;
|
|
29
|
+
getByPlaceholder(text: string | RegExp, options?: { exact?: boolean }): BasePageLocator;
|
|
30
|
+
getByAltText(text: string | RegExp, options?: { exact?: boolean }): BasePageLocator;
|
|
31
|
+
getByTitle(text: string | RegExp, options?: { exact?: boolean }): BasePageLocator;
|
|
32
|
+
getByTestId(testId: string | RegExp): BasePageLocator;
|
|
33
|
+
getByRole(
|
|
34
|
+
role: string,
|
|
35
|
+
options?: {
|
|
36
|
+
checked?: boolean;
|
|
37
|
+
description?: string | RegExp;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
exact?: boolean;
|
|
40
|
+
expanded?: boolean;
|
|
41
|
+
includeHidden?: boolean;
|
|
42
|
+
level?: number;
|
|
43
|
+
name?: string | RegExp;
|
|
44
|
+
pressed?: boolean;
|
|
45
|
+
selected?: boolean;
|
|
46
|
+
},
|
|
47
|
+
): BasePageLocator;
|
|
48
|
+
count(): Promise<number>;
|
|
49
|
+
click(options?: { button?: "left" | "right" | "middle"; clickCount?: number; delay?: number; force?: boolean; noWaitAfter?: boolean; position?: { x: number; y: number }; timeout?: number; trial?: boolean }): Promise<void>;
|
|
50
|
+
clear(options?: { force?: boolean; noWaitAfter?: boolean; timeout?: number }): Promise<void>;
|
|
51
|
+
fill(value: string, options?: { force?: boolean; noWaitAfter?: boolean; timeout?: number }): Promise<void>;
|
|
52
|
+
hover(options?: { force?: boolean; noWaitAfter?: boolean; position?: { x: number; y: number }; timeout?: number; trial?: boolean }): Promise<void>;
|
|
53
|
+
press(key: string, options?: { delay?: number; noWaitAfter?: boolean; timeout?: number }): Promise<void>;
|
|
54
|
+
check(options?: { force?: boolean; noWaitAfter?: boolean; timeout?: number; trial?: boolean }): Promise<void>;
|
|
55
|
+
uncheck(options?: { force?: boolean; noWaitAfter?: boolean; timeout?: number; trial?: boolean }): Promise<void>;
|
|
56
|
+
scrollIntoViewIfNeeded(options?: { timeout?: number }): Promise<void>;
|
|
57
|
+
waitFor(options?: { state?: "attached" | "detached" | "visible" | "hidden"; timeout?: number }): Promise<void>;
|
|
58
|
+
isVisible(options?: { timeout?: number }): Promise<boolean>;
|
|
59
|
+
isHidden(options?: { timeout?: number }): Promise<boolean>;
|
|
60
|
+
isEnabled(options?: { timeout?: number }): Promise<boolean>;
|
|
61
|
+
isDisabled(options?: { timeout?: number }): Promise<boolean>;
|
|
62
|
+
textContent(options?: { timeout?: number }): Promise<string | null>;
|
|
63
|
+
innerText(options?: { timeout?: number }): Promise<string>;
|
|
64
|
+
innerHTML(options?: { timeout?: number }): Promise<string>;
|
|
65
|
+
getAttribute(name: string, options?: { timeout?: number }): Promise<string | null>;
|
|
66
|
+
boundingBox(options?: { timeout?: number }): Promise<{ x: number; y: number; width: number; height: number } | null>;
|
|
67
|
+
selectOption(
|
|
68
|
+
values: null | string | ReadonlyArray<string> | { value?: string; label?: string; index?: number } | ReadonlyArray<{ value?: string; label?: string; index?: number }>,
|
|
69
|
+
options?: { force?: boolean; noWaitAfter?: boolean; timeout?: number },
|
|
70
|
+
): Promise<string[]>;
|
|
71
|
+
type(text: string, options?: { delay?: number; noWaitAfter?: boolean; timeout?: number }): Promise<void>;
|
|
72
|
+
evaluate<R>(pageFunction: (element: { tagName: string; isContentEditable?: boolean }) => R | Promise<R>): Promise<R>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Narrow subset of the Playwright {@link Page} surface that the generated POM
|
|
77
|
+
* runtime depends on.
|
|
78
|
+
*
|
|
79
|
+
* The full `Page` interface has ~250 members — stubbing them all in tests is
|
|
80
|
+
* large and brittle. This interface declares only the members the runtime and
|
|
81
|
+
* generated page objects use, so test doubles need only a handful of real
|
|
82
|
+
* methods. A real Playwright `Page` still satisfies it structurally.
|
|
83
|
+
*
|
|
84
|
+
* `keyboard` and `screencast` keep their full Playwright types (`Keyboard`,
|
|
85
|
+
* `Screencast`) because those sub-objects are small and exposed verbatim to
|
|
86
|
+
* consumers (e.g. for video recording).
|
|
87
|
+
*/
|
|
88
|
+
export interface BasePagePage {
|
|
89
|
+
url(): string;
|
|
90
|
+
goto(url: string, options?: { referer?: string; timeout?: number; waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit" }): Promise<Response | null>;
|
|
91
|
+
locator(selector: string, options?: { has?: BasePageLocator; hasNot?: BasePageLocator; hasNotText?: string | RegExp; hasText?: string | RegExp }): BasePageLocator;
|
|
92
|
+
isVisible(selector: string, options?: { strict?: boolean; timeout?: number }): Promise<boolean>;
|
|
93
|
+
textContent(selector: string, options?: { strict?: boolean; timeout?: number }): Promise<string | null>;
|
|
94
|
+
waitForSelector(selector: string, options?: { state?: "attached" | "detached" | "visible" | "hidden"; timeout?: number; strict?: boolean }): Promise<unknown>;
|
|
95
|
+
hover(selector: string, options?: { force?: boolean; noWaitAfter?: boolean; position?: { x: number; y: number }; strict?: boolean; timeout?: number; trial?: boolean }): Promise<void>;
|
|
96
|
+
selectOption(
|
|
97
|
+
selector: string,
|
|
98
|
+
values: null | string | ReadonlyArray<string> | { value?: string; label?: string; index?: number } | ReadonlyArray<{ value?: string; label?: string; index?: number }>,
|
|
99
|
+
options?: { force?: boolean; noWaitAfter?: boolean; strict?: boolean; timeout?: number },
|
|
100
|
+
): Promise<string[]>;
|
|
101
|
+
waitForTimeout(timeout: number): Promise<void>;
|
|
102
|
+
evaluate<R, Arg = never>(pageFunction: string | ((arg: Arg) => R | Promise<R>), arg?: Arg): Promise<R>;
|
|
103
|
+
readonly keyboard: Keyboard;
|
|
104
|
+
readonly screencast: Screencast;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Page dependency type used by the generated POM runtime. Narrowed from
|
|
109
|
+
* Playwright's full `Page` to {@link BasePagePage} so test doubles can satisfy
|
|
110
|
+
* it without stubbing hundreds of members. A real `Page` is still assignable.
|
|
111
|
+
*/
|
|
112
|
+
export type PwPage = BasePagePage;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Locator type used by the generated POM runtime. Narrowed from Playwright's
|
|
116
|
+
* full `Locator` to {@link BasePageLocator}. A real `Locator` is still
|
|
117
|
+
* assignable.
|
|
118
|
+
*/
|
|
119
|
+
export type PwLocator = BasePageLocator;
|
|
120
|
+
|
|
121
|
+
export type { Keyboard, Screencast };
|
|
4
122
|
|
|
5
123
|
export type PwSelectOption = string | { value?: string; label?: string; index?: number };
|
|
@@ -1,5 +1,259 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Keyboard, Response, Screencast } from "playwright";
|
|
2
|
+
/**
|
|
3
|
+
* Narrow subset of the Playwright {@link Locator} surface that the generated
|
|
4
|
+
* POM runtime (`base-page.ts`, `callout.ts`, `pointer.ts`) and generated page
|
|
5
|
+
* object accessors actually use.
|
|
6
|
+
*
|
|
7
|
+
* Locators flow through many chained calls and the full `Locator` interface has
|
|
8
|
+
* ~70 members — too many to stub in tests. Declaring the dependency as this
|
|
9
|
+
* narrow structural interface lets test doubles satisfy it with a handful of
|
|
10
|
+
* real methods, while a real Playwright `Locator` still satisfies it
|
|
11
|
+
* structurally (it has every member here). Member signatures mirror Playwright's
|
|
12
|
+
* own so call sites and downstream consumers keep working.
|
|
13
|
+
*
|
|
14
|
+
* @see BasePagePage for the narrowed page dependency.
|
|
15
|
+
*/
|
|
16
|
+
export interface BasePageLocator {
|
|
17
|
+
first(): BasePageLocator;
|
|
18
|
+
last(): BasePageLocator;
|
|
19
|
+
nth(index: number): BasePageLocator;
|
|
20
|
+
locator(selector: string, options?: {
|
|
21
|
+
has?: BasePageLocator;
|
|
22
|
+
hasNot?: BasePageLocator;
|
|
23
|
+
hasNotText?: string | RegExp;
|
|
24
|
+
hasText?: string | RegExp;
|
|
25
|
+
}): BasePageLocator;
|
|
26
|
+
describe(description: string): BasePageLocator;
|
|
27
|
+
filter(options?: {
|
|
28
|
+
has?: BasePageLocator;
|
|
29
|
+
hasNot?: BasePageLocator;
|
|
30
|
+
hasNotText?: string | RegExp;
|
|
31
|
+
hasText?: string | RegExp;
|
|
32
|
+
visible?: boolean;
|
|
33
|
+
}): BasePageLocator;
|
|
34
|
+
getByLabel(text: string | RegExp, options?: {
|
|
35
|
+
exact?: boolean;
|
|
36
|
+
}): BasePageLocator;
|
|
37
|
+
getByText(text: string | RegExp, options?: {
|
|
38
|
+
exact?: boolean;
|
|
39
|
+
}): BasePageLocator;
|
|
40
|
+
getByPlaceholder(text: string | RegExp, options?: {
|
|
41
|
+
exact?: boolean;
|
|
42
|
+
}): BasePageLocator;
|
|
43
|
+
getByAltText(text: string | RegExp, options?: {
|
|
44
|
+
exact?: boolean;
|
|
45
|
+
}): BasePageLocator;
|
|
46
|
+
getByTitle(text: string | RegExp, options?: {
|
|
47
|
+
exact?: boolean;
|
|
48
|
+
}): BasePageLocator;
|
|
49
|
+
getByTestId(testId: string | RegExp): BasePageLocator;
|
|
50
|
+
getByRole(role: string, options?: {
|
|
51
|
+
checked?: boolean;
|
|
52
|
+
description?: string | RegExp;
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
exact?: boolean;
|
|
55
|
+
expanded?: boolean;
|
|
56
|
+
includeHidden?: boolean;
|
|
57
|
+
level?: number;
|
|
58
|
+
name?: string | RegExp;
|
|
59
|
+
pressed?: boolean;
|
|
60
|
+
selected?: boolean;
|
|
61
|
+
}): BasePageLocator;
|
|
62
|
+
count(): Promise<number>;
|
|
63
|
+
click(options?: {
|
|
64
|
+
button?: "left" | "right" | "middle";
|
|
65
|
+
clickCount?: number;
|
|
66
|
+
delay?: number;
|
|
67
|
+
force?: boolean;
|
|
68
|
+
noWaitAfter?: boolean;
|
|
69
|
+
position?: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
};
|
|
73
|
+
timeout?: number;
|
|
74
|
+
trial?: boolean;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
clear(options?: {
|
|
77
|
+
force?: boolean;
|
|
78
|
+
noWaitAfter?: boolean;
|
|
79
|
+
timeout?: number;
|
|
80
|
+
}): Promise<void>;
|
|
81
|
+
fill(value: string, options?: {
|
|
82
|
+
force?: boolean;
|
|
83
|
+
noWaitAfter?: boolean;
|
|
84
|
+
timeout?: number;
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
hover(options?: {
|
|
87
|
+
force?: boolean;
|
|
88
|
+
noWaitAfter?: boolean;
|
|
89
|
+
position?: {
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
};
|
|
93
|
+
timeout?: number;
|
|
94
|
+
trial?: boolean;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
press(key: string, options?: {
|
|
97
|
+
delay?: number;
|
|
98
|
+
noWaitAfter?: boolean;
|
|
99
|
+
timeout?: number;
|
|
100
|
+
}): Promise<void>;
|
|
101
|
+
check(options?: {
|
|
102
|
+
force?: boolean;
|
|
103
|
+
noWaitAfter?: boolean;
|
|
104
|
+
timeout?: number;
|
|
105
|
+
trial?: boolean;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
uncheck(options?: {
|
|
108
|
+
force?: boolean;
|
|
109
|
+
noWaitAfter?: boolean;
|
|
110
|
+
timeout?: number;
|
|
111
|
+
trial?: boolean;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
scrollIntoViewIfNeeded(options?: {
|
|
114
|
+
timeout?: number;
|
|
115
|
+
}): Promise<void>;
|
|
116
|
+
waitFor(options?: {
|
|
117
|
+
state?: "attached" | "detached" | "visible" | "hidden";
|
|
118
|
+
timeout?: number;
|
|
119
|
+
}): Promise<void>;
|
|
120
|
+
isVisible(options?: {
|
|
121
|
+
timeout?: number;
|
|
122
|
+
}): Promise<boolean>;
|
|
123
|
+
isHidden(options?: {
|
|
124
|
+
timeout?: number;
|
|
125
|
+
}): Promise<boolean>;
|
|
126
|
+
isEnabled(options?: {
|
|
127
|
+
timeout?: number;
|
|
128
|
+
}): Promise<boolean>;
|
|
129
|
+
isDisabled(options?: {
|
|
130
|
+
timeout?: number;
|
|
131
|
+
}): Promise<boolean>;
|
|
132
|
+
textContent(options?: {
|
|
133
|
+
timeout?: number;
|
|
134
|
+
}): Promise<string | null>;
|
|
135
|
+
innerText(options?: {
|
|
136
|
+
timeout?: number;
|
|
137
|
+
}): Promise<string>;
|
|
138
|
+
innerHTML(options?: {
|
|
139
|
+
timeout?: number;
|
|
140
|
+
}): Promise<string>;
|
|
141
|
+
getAttribute(name: string, options?: {
|
|
142
|
+
timeout?: number;
|
|
143
|
+
}): Promise<string | null>;
|
|
144
|
+
boundingBox(options?: {
|
|
145
|
+
timeout?: number;
|
|
146
|
+
}): Promise<{
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
} | null>;
|
|
152
|
+
selectOption(values: null | string | ReadonlyArray<string> | {
|
|
153
|
+
value?: string;
|
|
154
|
+
label?: string;
|
|
155
|
+
index?: number;
|
|
156
|
+
} | ReadonlyArray<{
|
|
157
|
+
value?: string;
|
|
158
|
+
label?: string;
|
|
159
|
+
index?: number;
|
|
160
|
+
}>, options?: {
|
|
161
|
+
force?: boolean;
|
|
162
|
+
noWaitAfter?: boolean;
|
|
163
|
+
timeout?: number;
|
|
164
|
+
}): Promise<string[]>;
|
|
165
|
+
type(text: string, options?: {
|
|
166
|
+
delay?: number;
|
|
167
|
+
noWaitAfter?: boolean;
|
|
168
|
+
timeout?: number;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
evaluate<R>(pageFunction: (element: {
|
|
171
|
+
tagName: string;
|
|
172
|
+
isContentEditable?: boolean;
|
|
173
|
+
}) => R | Promise<R>): Promise<R>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Narrow subset of the Playwright {@link Page} surface that the generated POM
|
|
177
|
+
* runtime depends on.
|
|
178
|
+
*
|
|
179
|
+
* The full `Page` interface has ~250 members — stubbing them all in tests is
|
|
180
|
+
* large and brittle. This interface declares only the members the runtime and
|
|
181
|
+
* generated page objects use, so test doubles need only a handful of real
|
|
182
|
+
* methods. A real Playwright `Page` still satisfies it structurally.
|
|
183
|
+
*
|
|
184
|
+
* `keyboard` and `screencast` keep their full Playwright types (`Keyboard`,
|
|
185
|
+
* `Screencast`) because those sub-objects are small and exposed verbatim to
|
|
186
|
+
* consumers (e.g. for video recording).
|
|
187
|
+
*/
|
|
188
|
+
export interface BasePagePage {
|
|
189
|
+
url(): string;
|
|
190
|
+
goto(url: string, options?: {
|
|
191
|
+
referer?: string;
|
|
192
|
+
timeout?: number;
|
|
193
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
|
|
194
|
+
}): Promise<Response | null>;
|
|
195
|
+
locator(selector: string, options?: {
|
|
196
|
+
has?: BasePageLocator;
|
|
197
|
+
hasNot?: BasePageLocator;
|
|
198
|
+
hasNotText?: string | RegExp;
|
|
199
|
+
hasText?: string | RegExp;
|
|
200
|
+
}): BasePageLocator;
|
|
201
|
+
isVisible(selector: string, options?: {
|
|
202
|
+
strict?: boolean;
|
|
203
|
+
timeout?: number;
|
|
204
|
+
}): Promise<boolean>;
|
|
205
|
+
textContent(selector: string, options?: {
|
|
206
|
+
strict?: boolean;
|
|
207
|
+
timeout?: number;
|
|
208
|
+
}): Promise<string | null>;
|
|
209
|
+
waitForSelector(selector: string, options?: {
|
|
210
|
+
state?: "attached" | "detached" | "visible" | "hidden";
|
|
211
|
+
timeout?: number;
|
|
212
|
+
strict?: boolean;
|
|
213
|
+
}): Promise<unknown>;
|
|
214
|
+
hover(selector: string, options?: {
|
|
215
|
+
force?: boolean;
|
|
216
|
+
noWaitAfter?: boolean;
|
|
217
|
+
position?: {
|
|
218
|
+
x: number;
|
|
219
|
+
y: number;
|
|
220
|
+
};
|
|
221
|
+
strict?: boolean;
|
|
222
|
+
timeout?: number;
|
|
223
|
+
trial?: boolean;
|
|
224
|
+
}): Promise<void>;
|
|
225
|
+
selectOption(selector: string, values: null | string | ReadonlyArray<string> | {
|
|
226
|
+
value?: string;
|
|
227
|
+
label?: string;
|
|
228
|
+
index?: number;
|
|
229
|
+
} | ReadonlyArray<{
|
|
230
|
+
value?: string;
|
|
231
|
+
label?: string;
|
|
232
|
+
index?: number;
|
|
233
|
+
}>, options?: {
|
|
234
|
+
force?: boolean;
|
|
235
|
+
noWaitAfter?: boolean;
|
|
236
|
+
strict?: boolean;
|
|
237
|
+
timeout?: number;
|
|
238
|
+
}): Promise<string[]>;
|
|
239
|
+
waitForTimeout(timeout: number): Promise<void>;
|
|
240
|
+
evaluate<R, Arg = never>(pageFunction: string | ((arg: Arg) => R | Promise<R>), arg?: Arg): Promise<R>;
|
|
241
|
+
readonly keyboard: Keyboard;
|
|
242
|
+
readonly screencast: Screencast;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Page dependency type used by the generated POM runtime. Narrowed from
|
|
246
|
+
* Playwright's full `Page` to {@link BasePagePage} so test doubles can satisfy
|
|
247
|
+
* it without stubbing hundreds of members. A real `Page` is still assignable.
|
|
248
|
+
*/
|
|
249
|
+
export type PwPage = BasePagePage;
|
|
250
|
+
/**
|
|
251
|
+
* Locator type used by the generated POM runtime. Narrowed from Playwright's
|
|
252
|
+
* full `Locator` to {@link BasePageLocator}. A real `Locator` is still
|
|
253
|
+
* assignable.
|
|
254
|
+
*/
|
|
255
|
+
export type PwLocator = BasePageLocator;
|
|
256
|
+
export type { Keyboard, Screencast };
|
|
3
257
|
export type PwSelectOption = string | {
|
|
4
258
|
value?: string;
|
|
5
259
|
label?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-types.d.ts","sourceRoot":"","sources":["../../class-generation/playwright-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,SAAS,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"playwright-types.d.ts","sourceRoot":"","sources":["../../class-generation/playwright-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,IAAI,eAAe,CAAC;IACzB,IAAI,IAAI,eAAe,CAAC;IACxB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,OAAO,CACL,QAAQ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,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,YAAY,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC;AAExC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-metadata-utils.d.ts","sourceRoot":"","sources":["../compiler-metadata-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"compiler-metadata-utils.d.ts","sourceRoot":"","sources":["../compiler-metadata-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,GAAE,MAAsB,GAAG,cAAc,CAQ9G;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAcrE;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CA+C/G;AAkCD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC,EAAE,OAAO,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,eAAe,GAAG,IAAI,CAqEzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":";AAEA,wBA+HG"}
|
package/dist/index.cjs
CHANGED
|
@@ -472,25 +472,11 @@ function pomMethodSignatureEquals(left, right) {
|
|
|
472
472
|
function isParameterizedPomPattern(kind) {
|
|
473
473
|
return kind === "parameterized";
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
const out = [];
|
|
477
|
-
const seen = /* @__PURE__ */ new Set();
|
|
478
|
-
const matches = formatted.matchAll(/\$\{(\w+)\}/g);
|
|
479
|
-
for (const match of matches) {
|
|
480
|
-
const variableName = match[1];
|
|
481
|
-
if (seen.has(variableName)) {
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
seen.add(variableName);
|
|
485
|
-
out.push(variableName);
|
|
486
|
-
}
|
|
487
|
-
return out;
|
|
488
|
-
}
|
|
489
|
-
function createPomStringPattern(formatted, patternKind) {
|
|
475
|
+
function createPomStringPattern(formatted, patternKind, templateVariables) {
|
|
490
476
|
return {
|
|
491
477
|
formatted,
|
|
492
478
|
patternKind,
|
|
493
|
-
templateVariables:
|
|
479
|
+
templateVariables: [...templateVariables]
|
|
494
480
|
};
|
|
495
481
|
}
|
|
496
482
|
function getPomPatternVariables(patterns, options = {}) {
|
|
@@ -1216,6 +1202,9 @@ function upperFirst(value) {
|
|
|
1216
1202
|
}
|
|
1217
1203
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
1218
1204
|
}
|
|
1205
|
+
function collapseWhitespace(value) {
|
|
1206
|
+
return value.replace(/\s+/g, " ").trim();
|
|
1207
|
+
}
|
|
1219
1208
|
function isAsciiUppercaseLetterCode(code) {
|
|
1220
1209
|
return code >= 65 && code <= 90;
|
|
1221
1210
|
}
|
|
@@ -2890,13 +2879,15 @@ function safeMethodNameFromParts(parts) {
|
|
|
2890
2879
|
function toPomKeyPattern(templateValue) {
|
|
2891
2880
|
const { templateLiteral } = templateValue.parsedTemplate;
|
|
2892
2881
|
let out = "";
|
|
2882
|
+
let hasExpression = false;
|
|
2893
2883
|
for (let i = 0; i < templateLiteral.quasis.length; i += 1) {
|
|
2894
2884
|
out += templateLiteral.quasis[i]?.value.raw ?? "";
|
|
2895
2885
|
if (templateLiteral.expressions[i]) {
|
|
2896
2886
|
out += "${key}";
|
|
2887
|
+
hasExpression = true;
|
|
2897
2888
|
}
|
|
2898
2889
|
}
|
|
2899
|
-
return out;
|
|
2890
|
+
return { formatted: out, templateVariables: hasExpression ? ["key"] : [] };
|
|
2900
2891
|
}
|
|
2901
2892
|
function applyResolvedDataTestId(args) {
|
|
2902
2893
|
const addHtmlAttribute = args.addHtmlAttribute ?? true;
|
|
@@ -3020,9 +3011,11 @@ Fix: either (1) include ${bestKeyPreservePlaceholder} in your :${attrLabel} temp
|
|
|
3020
3011
|
};
|
|
3021
3012
|
const normalizedRole = normalizeNativeRole(args.nativeRole) ?? "button";
|
|
3022
3013
|
const targetPageObjectModelClass = entryOverrides.targetPageObjectModelClass;
|
|
3023
|
-
const
|
|
3014
|
+
const pomKeyPattern = dataTestId.kind === "template" ? toPomKeyPattern(dataTestId) : null;
|
|
3015
|
+
const formattedDataTestIdForPom = dataTestId.kind === "template" ? pomKeyPattern.formatted : dataTestId.value;
|
|
3024
3016
|
const selectorPatternKind = dataTestId.kind === "template" ? "parameterized" : "static";
|
|
3025
|
-
const
|
|
3017
|
+
const selectorTemplateVariables = dataTestId.kind === "template" ? pomKeyPattern.templateVariables : [];
|
|
3018
|
+
const selectorPattern = createPomStringPattern(formattedDataTestIdForPom, selectorPatternKind, selectorTemplateVariables);
|
|
3026
3019
|
const selectorIsParameterized = selectorPatternKind === "parameterized";
|
|
3027
3020
|
const deriveBaseMethodNameFromHint = (hint) => {
|
|
3028
3021
|
const hintRaw = (hint ?? "").trim();
|
|
@@ -3300,7 +3293,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3300
3293
|
const dataTestIdEntry = {
|
|
3301
3294
|
selectorValue: entryOverrides.selectorValue ?? createPomStringPattern(
|
|
3302
3295
|
getAttributeValueText(dataTestId),
|
|
3303
|
-
dataTestId.kind === "template" ? "parameterized" : "static"
|
|
3296
|
+
dataTestId.kind === "template" ? "parameterized" : "static",
|
|
3297
|
+
selectorTemplateVariables
|
|
3304
3298
|
),
|
|
3305
3299
|
templateLiteral: entryOverrides.templateLiteral,
|
|
3306
3300
|
targetPageObjectModelClass: entryOverrides.targetPageObjectModelClass
|
|
@@ -3527,8 +3521,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3527
3521
|
name: generatedName2,
|
|
3528
3522
|
selector: {
|
|
3529
3523
|
kind: "withinTestIdByLabel",
|
|
3530
|
-
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind),
|
|
3531
|
-
label: createPomStringPattern(label, "static"),
|
|
3524
|
+
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind, selectorTemplateVariables),
|
|
3525
|
+
label: createPomStringPattern(label, "static", []),
|
|
3532
3526
|
exact: true
|
|
3533
3527
|
},
|
|
3534
3528
|
parameters: [createPomParameterSpec("annotationText", `string = ""`)]
|
|
@@ -3549,8 +3543,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3549
3543
|
name: generatedName,
|
|
3550
3544
|
selector: {
|
|
3551
3545
|
kind: "withinTestIdByLabel",
|
|
3552
|
-
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind),
|
|
3553
|
-
label: createPomStringPattern("${value}", "parameterized"),
|
|
3546
|
+
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind, selectorTemplateVariables),
|
|
3547
|
+
label: createPomStringPattern("${value}", "parameterized", ["value"]),
|
|
3554
3548
|
exact: true
|
|
3555
3549
|
},
|
|
3556
3550
|
parameters: [
|
|
@@ -9135,7 +9129,7 @@ function collectStaticTextContent(children) {
|
|
|
9135
9129
|
const visit = (nodes) => {
|
|
9136
9130
|
for (const node of nodes) {
|
|
9137
9131
|
if (node.type === compilerCore.NodeTypes.TEXT) {
|
|
9138
|
-
const text2 = node.content
|
|
9132
|
+
const text2 = collapseWhitespace(node.content);
|
|
9139
9133
|
if (text2) {
|
|
9140
9134
|
parts.push(text2);
|
|
9141
9135
|
}
|
|
@@ -9147,7 +9141,7 @@ function collectStaticTextContent(children) {
|
|
|
9147
9141
|
}
|
|
9148
9142
|
};
|
|
9149
9143
|
visit(children);
|
|
9150
|
-
const text = parts.join(" ")
|
|
9144
|
+
const text = collapseWhitespace(parts.join(" "));
|
|
9151
9145
|
return text || void 0;
|
|
9152
9146
|
}
|
|
9153
9147
|
function tryCreateElementMetadata(args) {
|