@atomic-testing/playwright 0.88.0 → 0.90.0
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 +7 -0
- package/dist/index.cjs +114 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -52
- package/dist/index.d.mts +45 -52
- package/dist/index.mjs +115 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/PlaywrightInteractor.ts +139 -73
- package/src/createTestEngine.ts +9 -2
- package/src/index.ts +0 -1
- package/src/testRunnerAdapter.ts +0 -81
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BlurOption, BoundingRect, ClickOption, CssProperty, EnterTextOption, FocusOption, HoverOption, Interactor, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, Optional, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
1
|
+
import { BlurOption, BoundingRect, ClickOption, CssProperty, EnterTextOption, FocusOption, HoverOption, ITestEngineOption, Interactor, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, Optional, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
2
2
|
import { Page } from "@playwright/test";
|
|
3
|
-
import { E2eTestInterface, E2eTestRunEnvironmentFixture, TestFrameworkMapper } from "@atomic-testing/internal-test-runner";
|
|
4
3
|
|
|
5
4
|
//#region src/createTestEngine.d.ts
|
|
6
5
|
/**
|
|
@@ -9,9 +8,12 @@ import { E2eTestInterface, E2eTestRunEnvironmentFixture, TestFrameworkMapper } f
|
|
|
9
8
|
* @param page - Playwright page used for interaction.
|
|
10
9
|
* @param partDefinitions - Scene part definitions describing the scene
|
|
11
10
|
* structure for the engine.
|
|
11
|
+
* @param _option - Reserved for entry-point symmetry with the other adapters;
|
|
12
|
+
* currently ignored. `rootElement` is not applicable to Playwright, which drives
|
|
13
|
+
* a real browser page rather than mounting into a host element.
|
|
12
14
|
* @returns A configured {@link TestEngine} ready for use.
|
|
13
15
|
*/
|
|
14
|
-
declare function createTestEngine<T extends ScenePart>(page: Page, partDefinitions: T): TestEngine<T>;
|
|
16
|
+
declare function createTestEngine<T extends ScenePart>(page: Page, partDefinitions: T, _option?: ITestEngineOption): TestEngine<T>;
|
|
15
17
|
//#endregion
|
|
16
18
|
//#region src/PlaywrightInteractor.d.ts
|
|
17
19
|
/**
|
|
@@ -23,11 +25,32 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
23
25
|
* @param page - Playwright page instance used to drive the browser.
|
|
24
26
|
*/
|
|
25
27
|
constructor(page: Page);
|
|
28
|
+
/**
|
|
29
|
+
* Run a Playwright mutation and normalize a "locator matched nothing" failure
|
|
30
|
+
* into {@link ElementNotFoundError}, so a missing element throws the same error
|
|
31
|
+
* class here as it does in `DOMInteractor`, regardless of environment (the
|
|
32
|
+
* unified contract ratified in ADR-006).
|
|
33
|
+
*
|
|
34
|
+
* Playwright auto-waits for actionability and then throws its own
|
|
35
|
+
* `TimeoutError`. We translate that to `ElementNotFoundError` ONLY when the
|
|
36
|
+
* element genuinely does not exist (count 0) and otherwise rethrow the original
|
|
37
|
+
* error — preserving Playwright's auto-wait for an element that exists but is
|
|
38
|
+
* briefly not actionable (covered, disabled, animating). The trade-off is that
|
|
39
|
+
* a truly-missing element waits out the page's action timeout before throwing;
|
|
40
|
+
* bound it with `page.setDefaultTimeout` when fast failure matters.
|
|
41
|
+
*
|
|
42
|
+
* @param locator - Locator the mutation targets
|
|
43
|
+
* @param action - Method name used in the error message (e.g. `'click'`)
|
|
44
|
+
* @param run - The Playwright action to execute
|
|
45
|
+
* @throws {ElementNotFoundError} If the action fails and the element is absent
|
|
46
|
+
*/
|
|
47
|
+
private runMutation;
|
|
26
48
|
/**
|
|
27
49
|
* Select the given option values on a `<select>` element.
|
|
28
50
|
*
|
|
29
51
|
* @param locator - Locator to the `<select>` element.
|
|
30
52
|
* @param values - Values to select.
|
|
53
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
31
54
|
*/
|
|
32
55
|
selectOptionValue(locator: PartLocator, values: string[]): Promise<void>;
|
|
33
56
|
/**
|
|
@@ -35,23 +58,21 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
35
58
|
*
|
|
36
59
|
* Playwright's native `setInputFiles` reads the given paths from disk and
|
|
37
60
|
* populates the input's `FileList`, firing the change event — the only way to
|
|
38
|
-
* fill a file input, whose value cannot be set programmatically.
|
|
39
|
-
* this layer's convention, no `ElementNotFoundError` is fabricated: a missing
|
|
40
|
-
* element surfaces through Playwright's own auto-wait timeout.
|
|
61
|
+
* fill a file input, whose value cannot be set programmatically.
|
|
41
62
|
*
|
|
42
63
|
* @param locator - Locator of the `<input type="file">` element
|
|
43
64
|
* @param files - One or more filesystem paths to upload
|
|
65
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
44
66
|
*/
|
|
45
67
|
setInputFiles(locator: PartLocator, files: string | string[]): Promise<void>;
|
|
46
68
|
/**
|
|
47
69
|
* Scroll the located element into view, no-op if already visible.
|
|
48
70
|
*
|
|
49
71
|
* Delegates to Playwright's `scrollIntoViewIfNeeded`, which performs a real
|
|
50
|
-
* layout-aware scroll in the browser.
|
|
51
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
52
|
-
* Playwright's own auto-wait timeout.
|
|
72
|
+
* layout-aware scroll in the browser.
|
|
53
73
|
*
|
|
54
74
|
* @param locator - Locator of the element to scroll into view
|
|
75
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
55
76
|
*/
|
|
56
77
|
scrollIntoView(locator: PartLocator): Promise<void>;
|
|
57
78
|
/**
|
|
@@ -63,24 +84,22 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
63
84
|
* whereas evaluating `scrollBy` on the resolved element scrolls exactly that
|
|
64
85
|
* element. This is a deliberate deviation from ADR 0001's per-engine table
|
|
65
86
|
* (which lists `page.mouse.wheel`), taking the alternative the step-5 prompt
|
|
66
|
-
* permits ("or evaluate el.scrollBy") for cross-browser determinism.
|
|
67
|
-
* {@link scrollIntoView}, no `ElementNotFoundError` is fabricated; a missing
|
|
68
|
-
* element surfaces through Playwright's own auto-wait timeout.
|
|
87
|
+
* permits ("or evaluate el.scrollBy") for cross-browser determinism.
|
|
69
88
|
*
|
|
70
89
|
* @param locator - Locator of the scrollable element
|
|
71
90
|
* @param delta - Pixel offset to scroll by
|
|
91
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
72
92
|
*/
|
|
73
93
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
74
94
|
/**
|
|
75
95
|
* Drag the source element and drop it onto the target element.
|
|
76
96
|
*
|
|
77
97
|
* Delegates to Playwright's native `Locator.dragTo`, which performs a real,
|
|
78
|
-
* layout-aware drag gesture in the browser.
|
|
79
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
80
|
-
* Playwright's own auto-wait timeout.
|
|
98
|
+
* layout-aware drag gesture in the browser.
|
|
81
99
|
*
|
|
82
100
|
* @param source - Locator of the element to drag
|
|
83
101
|
* @param target - Locator of the drop target
|
|
102
|
+
* @throws {ElementNotFoundError} If either the source or target is not found
|
|
84
103
|
*/
|
|
85
104
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
86
105
|
/**
|
|
@@ -91,9 +110,9 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
91
110
|
* {@link mouseMove}/{@link mouseDown} — `mouseMove` resets the pointer with
|
|
92
111
|
* `page.mouse.move(0, 0)` after hovering, which would corrupt the drag path
|
|
93
112
|
* (see ADR 0001, option 5). The center comes from {@link getBoundingRect},
|
|
94
|
-
* which throws `ElementNotFoundError` when the element has no box
|
|
95
|
-
*
|
|
96
|
-
*
|
|
113
|
+
* which throws `ElementNotFoundError` when the element has no box, so this
|
|
114
|
+
* shares that "element not found" contract instead of re-deriving the box +
|
|
115
|
+
* guard here.
|
|
97
116
|
*
|
|
98
117
|
* @param locator - Locator of the element to drag
|
|
99
118
|
* @param delta - Pixel offset to drag by
|
|
@@ -117,16 +136,16 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
117
136
|
getSelectLabels(locator: PartLocator): Promise<Optional<readonly string[]>>;
|
|
118
137
|
getStyleValue(locator: PartLocator, propertyName: CssProperty): Promise<Optional<string>>;
|
|
119
138
|
enterText(locator: PartLocator, text: string, option?: Optional<Partial<EnterTextOption>>): Promise<void>;
|
|
139
|
+
setRangeValue(locator: PartLocator, value: number): Promise<void>;
|
|
120
140
|
click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void>;
|
|
121
141
|
/**
|
|
122
142
|
* Dispatch a right-click on the located element to open its context menu.
|
|
123
143
|
*
|
|
124
144
|
* Delegates to Playwright's native right-button click, which fires a real
|
|
125
|
-
* `contextmenu` event in the browser.
|
|
126
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
127
|
-
* Playwright's own auto-wait timeout.
|
|
145
|
+
* `contextmenu` event in the browser.
|
|
128
146
|
*
|
|
129
147
|
* @param locator - Locator of the element to right-click
|
|
148
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
130
149
|
*/
|
|
131
150
|
contextMenu(locator: PartLocator): Promise<void>;
|
|
132
151
|
hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void>;
|
|
@@ -141,7 +160,6 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
141
160
|
blur(locator: PartLocator, _option?: Partial<BlurOption>): Promise<void>;
|
|
142
161
|
pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void>;
|
|
143
162
|
activate(locator: PartLocator): Promise<void>;
|
|
144
|
-
wait(ms: number): Promise<void>;
|
|
145
163
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
146
164
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
147
165
|
getAttribute(locator: PartLocator, name: string, isMultiple: true): Promise<readonly string[]>;
|
|
@@ -152,9 +170,8 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
152
170
|
* Get the located element's bounding rectangle.
|
|
153
171
|
*
|
|
154
172
|
* `boundingBox()` returns `null` for a detached/invisible element rather than
|
|
155
|
-
* auto-waiting, so this
|
|
156
|
-
*
|
|
157
|
-
* (ADR 0001).
|
|
173
|
+
* auto-waiting, so this throws `ElementNotFoundError` directly (no auto-wait)
|
|
174
|
+
* — matching the unified "element not found" contract (ADR-006).
|
|
158
175
|
*
|
|
159
176
|
* @param locator - Locator of the element to measure
|
|
160
177
|
* @returns The element's bounding rectangle in CSS pixels
|
|
@@ -165,37 +182,13 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
165
182
|
isChecked(locator: PartLocator): Promise<boolean>;
|
|
166
183
|
isDisabled(locator: PartLocator): Promise<boolean>;
|
|
167
184
|
isReadonly(locator: PartLocator): Promise<boolean>;
|
|
185
|
+
isRequired(locator: PartLocator): Promise<boolean>;
|
|
186
|
+
isError(locator: PartLocator): Promise<boolean>;
|
|
168
187
|
isVisible(locator: PartLocator): Promise<boolean>;
|
|
169
188
|
hasCssClass(locator: PartLocator, className: string): Promise<boolean>;
|
|
170
189
|
hasAttribute(locator: PartLocator, name: string): Promise<boolean>;
|
|
171
190
|
innerHTML(locator: PartLocator): Promise<string>;
|
|
172
|
-
clone(): Interactor;
|
|
173
191
|
}
|
|
174
192
|
//#endregion
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Navigate the current Playwright page to the provided URL.
|
|
178
|
-
*
|
|
179
|
-
* @param url - Destination URL to load.
|
|
180
|
-
* @param fixture - Optional test fixture supplying the Playwright page.
|
|
181
|
-
*/
|
|
182
|
-
declare function goto(url: string): Promise<void>;
|
|
183
|
-
declare function goto(url: string, fixture: E2eTestRunEnvironmentFixture): Promise<void>;
|
|
184
|
-
/**
|
|
185
|
-
* Create a {@link TestEngine} bound to the Playwright page in the given fixture.
|
|
186
|
-
*
|
|
187
|
-
* @param scenePart - Scene definition to drive.
|
|
188
|
-
* @param fixture - Fixture providing the Playwright page.
|
|
189
|
-
*/
|
|
190
|
-
declare function playwrightGetTestEngine<T extends ScenePart>(scenePart: T, fixture: E2eTestRunEnvironmentFixture): TestEngine<T>;
|
|
191
|
-
/**
|
|
192
|
-
* Playwright adapter for the TestFrameworkMapper interface.
|
|
193
|
-
*/
|
|
194
|
-
declare const playWrightTestFrameworkMapper: TestFrameworkMapper;
|
|
195
|
-
/**
|
|
196
|
-
* Get a typed interface for running end-to-end tests with Playwright.
|
|
197
|
-
*/
|
|
198
|
-
declare function getTestRunnerInterface<T extends ScenePart>(): E2eTestInterface<T>;
|
|
199
|
-
//#endregion
|
|
200
|
-
export { PlaywrightInteractor, createTestEngine, getTestRunnerInterface, goto, playWrightTestFrameworkMapper, playwrightGetTestEngine };
|
|
193
|
+
export { PlaywrightInteractor, createTestEngine };
|
|
201
194
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BlurOption, BoundingRect, ClickOption, CssProperty, EnterTextOption, FocusOption, HoverOption, Interactor, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, Optional, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
1
|
+
import { BlurOption, BoundingRect, ClickOption, CssProperty, EnterTextOption, FocusOption, HoverOption, ITestEngineOption, Interactor, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, Optional, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
2
2
|
import { Page } from "@playwright/test";
|
|
3
|
-
import { E2eTestInterface, E2eTestRunEnvironmentFixture, TestFrameworkMapper } from "@atomic-testing/internal-test-runner";
|
|
4
3
|
|
|
5
4
|
//#region src/createTestEngine.d.ts
|
|
6
5
|
/**
|
|
@@ -9,9 +8,12 @@ import { E2eTestInterface, E2eTestRunEnvironmentFixture, TestFrameworkMapper } f
|
|
|
9
8
|
* @param page - Playwright page used for interaction.
|
|
10
9
|
* @param partDefinitions - Scene part definitions describing the scene
|
|
11
10
|
* structure for the engine.
|
|
11
|
+
* @param _option - Reserved for entry-point symmetry with the other adapters;
|
|
12
|
+
* currently ignored. `rootElement` is not applicable to Playwright, which drives
|
|
13
|
+
* a real browser page rather than mounting into a host element.
|
|
12
14
|
* @returns A configured {@link TestEngine} ready for use.
|
|
13
15
|
*/
|
|
14
|
-
declare function createTestEngine<T extends ScenePart>(page: Page, partDefinitions: T): TestEngine<T>;
|
|
16
|
+
declare function createTestEngine<T extends ScenePart>(page: Page, partDefinitions: T, _option?: ITestEngineOption): TestEngine<T>;
|
|
15
17
|
//#endregion
|
|
16
18
|
//#region src/PlaywrightInteractor.d.ts
|
|
17
19
|
/**
|
|
@@ -23,11 +25,32 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
23
25
|
* @param page - Playwright page instance used to drive the browser.
|
|
24
26
|
*/
|
|
25
27
|
constructor(page: Page);
|
|
28
|
+
/**
|
|
29
|
+
* Run a Playwright mutation and normalize a "locator matched nothing" failure
|
|
30
|
+
* into {@link ElementNotFoundError}, so a missing element throws the same error
|
|
31
|
+
* class here as it does in `DOMInteractor`, regardless of environment (the
|
|
32
|
+
* unified contract ratified in ADR-006).
|
|
33
|
+
*
|
|
34
|
+
* Playwright auto-waits for actionability and then throws its own
|
|
35
|
+
* `TimeoutError`. We translate that to `ElementNotFoundError` ONLY when the
|
|
36
|
+
* element genuinely does not exist (count 0) and otherwise rethrow the original
|
|
37
|
+
* error — preserving Playwright's auto-wait for an element that exists but is
|
|
38
|
+
* briefly not actionable (covered, disabled, animating). The trade-off is that
|
|
39
|
+
* a truly-missing element waits out the page's action timeout before throwing;
|
|
40
|
+
* bound it with `page.setDefaultTimeout` when fast failure matters.
|
|
41
|
+
*
|
|
42
|
+
* @param locator - Locator the mutation targets
|
|
43
|
+
* @param action - Method name used in the error message (e.g. `'click'`)
|
|
44
|
+
* @param run - The Playwright action to execute
|
|
45
|
+
* @throws {ElementNotFoundError} If the action fails and the element is absent
|
|
46
|
+
*/
|
|
47
|
+
private runMutation;
|
|
26
48
|
/**
|
|
27
49
|
* Select the given option values on a `<select>` element.
|
|
28
50
|
*
|
|
29
51
|
* @param locator - Locator to the `<select>` element.
|
|
30
52
|
* @param values - Values to select.
|
|
53
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
31
54
|
*/
|
|
32
55
|
selectOptionValue(locator: PartLocator, values: string[]): Promise<void>;
|
|
33
56
|
/**
|
|
@@ -35,23 +58,21 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
35
58
|
*
|
|
36
59
|
* Playwright's native `setInputFiles` reads the given paths from disk and
|
|
37
60
|
* populates the input's `FileList`, firing the change event — the only way to
|
|
38
|
-
* fill a file input, whose value cannot be set programmatically.
|
|
39
|
-
* this layer's convention, no `ElementNotFoundError` is fabricated: a missing
|
|
40
|
-
* element surfaces through Playwright's own auto-wait timeout.
|
|
61
|
+
* fill a file input, whose value cannot be set programmatically.
|
|
41
62
|
*
|
|
42
63
|
* @param locator - Locator of the `<input type="file">` element
|
|
43
64
|
* @param files - One or more filesystem paths to upload
|
|
65
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
44
66
|
*/
|
|
45
67
|
setInputFiles(locator: PartLocator, files: string | string[]): Promise<void>;
|
|
46
68
|
/**
|
|
47
69
|
* Scroll the located element into view, no-op if already visible.
|
|
48
70
|
*
|
|
49
71
|
* Delegates to Playwright's `scrollIntoViewIfNeeded`, which performs a real
|
|
50
|
-
* layout-aware scroll in the browser.
|
|
51
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
52
|
-
* Playwright's own auto-wait timeout.
|
|
72
|
+
* layout-aware scroll in the browser.
|
|
53
73
|
*
|
|
54
74
|
* @param locator - Locator of the element to scroll into view
|
|
75
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
55
76
|
*/
|
|
56
77
|
scrollIntoView(locator: PartLocator): Promise<void>;
|
|
57
78
|
/**
|
|
@@ -63,24 +84,22 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
63
84
|
* whereas evaluating `scrollBy` on the resolved element scrolls exactly that
|
|
64
85
|
* element. This is a deliberate deviation from ADR 0001's per-engine table
|
|
65
86
|
* (which lists `page.mouse.wheel`), taking the alternative the step-5 prompt
|
|
66
|
-
* permits ("or evaluate el.scrollBy") for cross-browser determinism.
|
|
67
|
-
* {@link scrollIntoView}, no `ElementNotFoundError` is fabricated; a missing
|
|
68
|
-
* element surfaces through Playwright's own auto-wait timeout.
|
|
87
|
+
* permits ("or evaluate el.scrollBy") for cross-browser determinism.
|
|
69
88
|
*
|
|
70
89
|
* @param locator - Locator of the scrollable element
|
|
71
90
|
* @param delta - Pixel offset to scroll by
|
|
91
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
72
92
|
*/
|
|
73
93
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
74
94
|
/**
|
|
75
95
|
* Drag the source element and drop it onto the target element.
|
|
76
96
|
*
|
|
77
97
|
* Delegates to Playwright's native `Locator.dragTo`, which performs a real,
|
|
78
|
-
* layout-aware drag gesture in the browser.
|
|
79
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
80
|
-
* Playwright's own auto-wait timeout.
|
|
98
|
+
* layout-aware drag gesture in the browser.
|
|
81
99
|
*
|
|
82
100
|
* @param source - Locator of the element to drag
|
|
83
101
|
* @param target - Locator of the drop target
|
|
102
|
+
* @throws {ElementNotFoundError} If either the source or target is not found
|
|
84
103
|
*/
|
|
85
104
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
86
105
|
/**
|
|
@@ -91,9 +110,9 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
91
110
|
* {@link mouseMove}/{@link mouseDown} — `mouseMove` resets the pointer with
|
|
92
111
|
* `page.mouse.move(0, 0)` after hovering, which would corrupt the drag path
|
|
93
112
|
* (see ADR 0001, option 5). The center comes from {@link getBoundingRect},
|
|
94
|
-
* which throws `ElementNotFoundError` when the element has no box
|
|
95
|
-
*
|
|
96
|
-
*
|
|
113
|
+
* which throws `ElementNotFoundError` when the element has no box, so this
|
|
114
|
+
* shares that "element not found" contract instead of re-deriving the box +
|
|
115
|
+
* guard here.
|
|
97
116
|
*
|
|
98
117
|
* @param locator - Locator of the element to drag
|
|
99
118
|
* @param delta - Pixel offset to drag by
|
|
@@ -117,16 +136,16 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
117
136
|
getSelectLabels(locator: PartLocator): Promise<Optional<readonly string[]>>;
|
|
118
137
|
getStyleValue(locator: PartLocator, propertyName: CssProperty): Promise<Optional<string>>;
|
|
119
138
|
enterText(locator: PartLocator, text: string, option?: Optional<Partial<EnterTextOption>>): Promise<void>;
|
|
139
|
+
setRangeValue(locator: PartLocator, value: number): Promise<void>;
|
|
120
140
|
click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void>;
|
|
121
141
|
/**
|
|
122
142
|
* Dispatch a right-click on the located element to open its context menu.
|
|
123
143
|
*
|
|
124
144
|
* Delegates to Playwright's native right-button click, which fires a real
|
|
125
|
-
* `contextmenu` event in the browser.
|
|
126
|
-
* `ElementNotFoundError` is fabricated: a missing element surfaces through
|
|
127
|
-
* Playwright's own auto-wait timeout.
|
|
145
|
+
* `contextmenu` event in the browser.
|
|
128
146
|
*
|
|
129
147
|
* @param locator - Locator of the element to right-click
|
|
148
|
+
* @throws {ElementNotFoundError} If the element is not found
|
|
130
149
|
*/
|
|
131
150
|
contextMenu(locator: PartLocator): Promise<void>;
|
|
132
151
|
hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void>;
|
|
@@ -141,7 +160,6 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
141
160
|
blur(locator: PartLocator, _option?: Partial<BlurOption>): Promise<void>;
|
|
142
161
|
pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void>;
|
|
143
162
|
activate(locator: PartLocator): Promise<void>;
|
|
144
|
-
wait(ms: number): Promise<void>;
|
|
145
163
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
146
164
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
147
165
|
getAttribute(locator: PartLocator, name: string, isMultiple: true): Promise<readonly string[]>;
|
|
@@ -152,9 +170,8 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
152
170
|
* Get the located element's bounding rectangle.
|
|
153
171
|
*
|
|
154
172
|
* `boundingBox()` returns `null` for a detached/invisible element rather than
|
|
155
|
-
* auto-waiting, so this
|
|
156
|
-
*
|
|
157
|
-
* (ADR 0001).
|
|
173
|
+
* auto-waiting, so this throws `ElementNotFoundError` directly (no auto-wait)
|
|
174
|
+
* — matching the unified "element not found" contract (ADR-006).
|
|
158
175
|
*
|
|
159
176
|
* @param locator - Locator of the element to measure
|
|
160
177
|
* @returns The element's bounding rectangle in CSS pixels
|
|
@@ -165,37 +182,13 @@ declare class PlaywrightInteractor implements Interactor {
|
|
|
165
182
|
isChecked(locator: PartLocator): Promise<boolean>;
|
|
166
183
|
isDisabled(locator: PartLocator): Promise<boolean>;
|
|
167
184
|
isReadonly(locator: PartLocator): Promise<boolean>;
|
|
185
|
+
isRequired(locator: PartLocator): Promise<boolean>;
|
|
186
|
+
isError(locator: PartLocator): Promise<boolean>;
|
|
168
187
|
isVisible(locator: PartLocator): Promise<boolean>;
|
|
169
188
|
hasCssClass(locator: PartLocator, className: string): Promise<boolean>;
|
|
170
189
|
hasAttribute(locator: PartLocator, name: string): Promise<boolean>;
|
|
171
190
|
innerHTML(locator: PartLocator): Promise<string>;
|
|
172
|
-
clone(): Interactor;
|
|
173
191
|
}
|
|
174
192
|
//#endregion
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Navigate the current Playwright page to the provided URL.
|
|
178
|
-
*
|
|
179
|
-
* @param url - Destination URL to load.
|
|
180
|
-
* @param fixture - Optional test fixture supplying the Playwright page.
|
|
181
|
-
*/
|
|
182
|
-
declare function goto(url: string): Promise<void>;
|
|
183
|
-
declare function goto(url: string, fixture: E2eTestRunEnvironmentFixture): Promise<void>;
|
|
184
|
-
/**
|
|
185
|
-
* Create a {@link TestEngine} bound to the Playwright page in the given fixture.
|
|
186
|
-
*
|
|
187
|
-
* @param scenePart - Scene definition to drive.
|
|
188
|
-
* @param fixture - Fixture providing the Playwright page.
|
|
189
|
-
*/
|
|
190
|
-
declare function playwrightGetTestEngine<T extends ScenePart>(scenePart: T, fixture: E2eTestRunEnvironmentFixture): TestEngine<T>;
|
|
191
|
-
/**
|
|
192
|
-
* Playwright adapter for the TestFrameworkMapper interface.
|
|
193
|
-
*/
|
|
194
|
-
declare const playWrightTestFrameworkMapper: TestFrameworkMapper;
|
|
195
|
-
/**
|
|
196
|
-
* Get a typed interface for running end-to-end tests with Playwright.
|
|
197
|
-
*/
|
|
198
|
-
declare function getTestRunnerInterface<T extends ScenePart>(): E2eTestInterface<T>;
|
|
199
|
-
//#endregion
|
|
200
|
-
export { PlaywrightInteractor, createTestEngine, getTestRunnerInterface, goto, playWrightTestFrameworkMapper, playwrightGetTestEngine };
|
|
193
|
+
export { PlaywrightInteractor, createTestEngine };
|
|
201
194
|
//# sourceMappingURL=index.d.mts.map
|