@delacour/warden-e2e 0.2.0 → 0.4.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/{chunk-7ns30pbp.mjs → chunk-3874jt2j.mjs} +295 -172
- package/index.mjs +37 -37
- package/package.json +2 -2
- package/preload.mjs +103 -42
- package/types/core/src/exec.d.ts +2 -0
- package/types/core/src/providers/provider.types.d.ts +7 -0
- package/types/e2e/src/devtools/cdp.d.ts +7 -2
- package/types/e2e/src/devtools/devtools.types.d.ts +13 -0
- package/types/e2e/src/devtools/session.d.ts +8 -1
- package/types/e2e/src/driver/ios/ios-driver.d.ts +7 -6
- package/types/e2e/src/driver/ios/simd-protocol.d.ts +23 -0
- package/types/e2e/src/driver/ios/type-budget.d.ts +8 -4
- package/types/e2e/src/driver/observation-cache.d.ts +3 -1
- package/types/e2e/src/driver/typing.d.ts +10 -0
- package/types/e2e/src/preload.d.ts +5 -0
- package/types/e2e/src/screen/field.d.ts +11 -1
- package/types/e2e/src/screen/locator.d.ts +24 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KeyName, Modifier, Point, Rect } from "../driver/driver.types";
|
|
2
2
|
import { type Momentum, type SwipeDirection } from "./actions";
|
|
3
3
|
import type { Observed, Runtime } from "./context";
|
|
4
|
+
import { type FillVia } from "./field";
|
|
4
5
|
import type { NodeEntry } from "./nodes";
|
|
5
6
|
import { type RoleOptions, type TestIdOptions, type TextQueryOptions } from "./queries";
|
|
6
7
|
import { type LocatorExpression } from "./query";
|
|
@@ -39,6 +40,10 @@ export type TapOptions = ActionOptions & {
|
|
|
39
40
|
/** gap between checks of `until`. Default 250 ms. Needs `until`. */
|
|
40
41
|
pollMs?: number;
|
|
41
42
|
};
|
|
43
|
+
/** `fill` puts the text in by paste where the driver can (iOS) or types it: see `FillVia`. A retry always types. */
|
|
44
|
+
export type FillOptions = ActionOptions & {
|
|
45
|
+
via?: FillVia;
|
|
46
|
+
};
|
|
42
47
|
export type LongPressOptions = ActionOptions & {
|
|
43
48
|
durationMs?: number;
|
|
44
49
|
};
|
|
@@ -137,12 +142,21 @@ export declare class Locator {
|
|
|
137
142
|
* driver with a cheap hit-test first tries `aimFromKept`, which checks the kept snapshot with a hit-test instead.)
|
|
138
143
|
* A fresh snapshot can also be of a screen still moving, so a match is taken only once its frame held still across
|
|
139
144
|
* two looks with no input between them (Playwright's "stable"): the look a read or an `expect` kept, when there is
|
|
140
|
-
* one, costs nothing; with none, a look less than `STABLE_INPUT_GAP_MS` after an input is checked by one more
|
|
141
|
-
*
|
|
145
|
+
* one, costs nothing; with none, a look less than `STABLE_INPUT_GAP_MS` after an input is checked by one more: a
|
|
146
|
+
* hit-test at the element where that is cheap (`stillByHitTest`), else a snapshot. An element that never stops
|
|
147
|
+
* moving is taken after `MAX_STABILITY_LOOKS` extra looks.
|
|
142
148
|
*/
|
|
143
149
|
private actionable;
|
|
144
150
|
/** One look of `actionable`: done, not yet, or `moving` (the match has not held still yet; look again at once). */
|
|
145
151
|
private actionableLook;
|
|
152
|
+
/**
|
|
153
|
+
* The second look of the stable-frame rule as a hit-test, where that is cheap (`capabilities.cheapHitTest`, iOS:
|
|
154
|
+
* one element back instead of the whole tree): the element held still when the hit at its tap point is that element
|
|
155
|
+
* (`sameElement`, as in `aimFromKept`). Only for a look with nothing to compare against (the one that followed an
|
|
156
|
+
* input): a look that differs from the one before it is known to be moving. Never with system alerts answered: the
|
|
157
|
+
* app-scoped hit-test may not see an alert that came up since the look, the full second look does.
|
|
158
|
+
*/
|
|
159
|
+
private stillByHitTest;
|
|
146
160
|
/**
|
|
147
161
|
* Whether `entry`'s frame, to 1 pt, is where the look before this one had this locator's one match. Without that look:
|
|
148
162
|
* still unless an input ended less than `STABLE_INPUT_GAP_MS` before this one. No observation cache = still (no history).
|
|
@@ -173,7 +187,10 @@ export declare class Locator {
|
|
|
173
187
|
*/
|
|
174
188
|
private tapOnce;
|
|
175
189
|
/**
|
|
176
|
-
* Polls `plan.until` for `plan.windowMs`, one look at the screen per check
|
|
190
|
+
* Polls `plan.until` for `plan.windowMs`, one look at the screen per check, the first one right after the press
|
|
191
|
+
* (`driver.tap` returns once the HID press is over, ~85 ms, and an AX read queues behind the app's main thread, so
|
|
192
|
+
* that look usually already shows the screen the press made; measured: holding it back to `pollMs` saved no read
|
|
193
|
+
* and cost 250 ms a press). A locator is checked on the snapshot of
|
|
177
194
|
* the poll itself, which is also compared with `pressedOn` (the hash of the screen the press aimed from): once the
|
|
178
195
|
* screen changed the press landed, so it is never sent again (`landed`, even when `until` is late); a screen still
|
|
179
196
|
* unchanged on `UNCHANGED_CHECKS` checks in a row from `UNCHANGED_AFTER_MS` on is pressed again at once. A function
|
|
@@ -188,10 +205,12 @@ export declare class Locator {
|
|
|
188
205
|
* Replaces the content of a text field: focus with the caret at the end, empty it (select all and type over the selection when
|
|
189
206
|
* the driver can, nothing for a field that is empty or shows a placeholder), type, then poll until the field holds
|
|
190
207
|
* the text on consecutive reads (the accessibility value lags the keys). A mismatch is retried once with one Backspace
|
|
191
|
-
* per character and a retype (a field that refuses select-all).
|
|
208
|
+
* per character and a retype (a field that refuses select-all). `via` (default `"paste"`) is how the text goes in on
|
|
209
|
+
* the first attempt: a paste on iOS, typing where the driver cannot paste or when the pasteboard write fails; the
|
|
210
|
+
* retry always types, so a field that mangles a paste (a mask, a maxLength) still ends up right. Secure fields cannot be read back, so they are not
|
|
192
211
|
* verified.
|
|
193
212
|
*/
|
|
194
|
-
fill(text: string, options?:
|
|
213
|
+
fill(text: string, options?: FillOptions): Promise<void>;
|
|
195
214
|
/** Empties a text field (select all and one Backspace when the driver can), then checks it is empty (one more pass of counted Backspaces when it is not). */
|
|
196
215
|
clear(options?: ActionOptions): Promise<void>;
|
|
197
216
|
/** Types at the caret; the field is tapped (caret to the end) first unless it already has focus. */
|