@e2e-dev/mobile 0.8.0-canary-20260928184528
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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +159 -0
- package/dist/.build.json +1 -0
- package/dist/actions.d.ts +41 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +70 -0
- package/dist/actions.js.map +1 -0
- package/dist/bindings.d.ts +87 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +112 -0
- package/dist/bindings.js.map +1 -0
- package/dist/device.d.ts +117 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +116 -0
- package/dist/device.js.map +1 -0
- package/dist/engine.d.ts +17 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +98 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +61 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +223 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/links.d.ts +41 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +79 -0
- package/dist/links.js.map +1 -0
- package/dist/locate.d.ts +11 -0
- package/dist/locate.d.ts.map +1 -0
- package/dist/locate.js +119 -0
- package/dist/locate.js.map +1 -0
- package/dist/nodes.d.ts +107 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +530 -0
- package/dist/nodes.js.map +1 -0
- package/dist/options.d.ts +134 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/png.d.ts +4 -0
- package/dist/png.d.ts.map +1 -0
- package/dist/png.js +25 -0
- package/dist/png.js.map +1 -0
- package/dist/pool.d.ts +99 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +235 -0
- package/dist/pool.js.map +1 -0
- package/dist/provider.d.ts +119 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +112 -0
- package/dist/provider.js.map +1 -0
- package/dist/selector.d.ts +17 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +84 -0
- package/dist/selector.js.map +1 -0
- package/dist/support.d.ts +63 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/support.js +87 -0
- package/dist/support.js.map +1 -0
- package/dist/surface.d.ts +405 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +1159 -0
- package/dist/surface.js.map +1 -0
- package/dist/tools.d.ts +24 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +90 -0
- package/dist/tools.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent-device surface: one simulator or emulator session, driven through
|
|
3
|
+
* agent-device's typed client, exposed to the runner as the contract's
|
|
4
|
+
* observe/locate/perform members. It owns the id space (one fresh generation
|
|
5
|
+
* per observation), the attempt state (artifact directory, screenshot
|
|
6
|
+
* counter), and every translation between the contract's vocabulary and
|
|
7
|
+
* agent-device's commands. Its device and session come from the target's
|
|
8
|
+
* `DevicePool`, by worker slot. The runner owns everything else.
|
|
9
|
+
*
|
|
10
|
+
* Every observation is reported under one root of a stable id (`ROOT_ID`)
|
|
11
|
+
* wrapping the device's top-level elements; a `swipe` performed on that root
|
|
12
|
+
* scrolls the whole screen.
|
|
13
|
+
*/
|
|
14
|
+
import { type EngineAttemptContext, type EngineCleanupContext, type EngineInitInfo, type EngineObserveOptions, type EngineSnapshot, type LocatorAction, type LocatorExpression, type NodeRef, type OperationContext, type PointerAction, type VideoSegment, type SemanticNode, type ViewportPoint } from 'e2e/engine';
|
|
15
|
+
import type { AgentDeviceClient, ClientFactory, DevicePermission, LaunchPermissions, MobileOptions, PermissionState } from './options.ts';
|
|
16
|
+
import { DevicePool } from './pool.ts';
|
|
17
|
+
/** How `installApp` puts a build on the device. */
|
|
18
|
+
export interface InstallAppOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Bundle id or package of the build. `reinstall` needs one: agent-device
|
|
21
|
+
* removes that app before installing. Defaults to the pinned app.
|
|
22
|
+
*/
|
|
23
|
+
readonly app?: string;
|
|
24
|
+
/** Remove the installed app first so the build starts with no data. */
|
|
25
|
+
readonly reinstall?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What an install put on the device, as agent-device identified it. */
|
|
28
|
+
export interface InstalledApp {
|
|
29
|
+
/** The bundle id or package to open the app by. */
|
|
30
|
+
readonly app: string;
|
|
31
|
+
readonly bundleId?: string;
|
|
32
|
+
}
|
|
33
|
+
/** How `device.openApp` launches an app. */
|
|
34
|
+
export interface OpenAppOptions {
|
|
35
|
+
/** Terminate the app first, so it starts fresh; without it a running app is brought forward as it is. */
|
|
36
|
+
readonly relaunch?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Arguments this launch hands the app: its process arguments on iOS,
|
|
39
|
+
* `am start` arguments on Android. Replaces the engine's `launchArguments`
|
|
40
|
+
* for a relaunch of the pinned app.
|
|
41
|
+
*/
|
|
42
|
+
readonly launchArguments?: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Permissions the app holds before this launch, each granted, denied, or
|
|
45
|
+
* reset. Replaces the engine's `permissions` for a relaunch of the pinned
|
|
46
|
+
* app.
|
|
47
|
+
*/
|
|
48
|
+
readonly permissions?: LaunchPermissions;
|
|
49
|
+
}
|
|
50
|
+
/** What agent-device is told about settling after an action. */
|
|
51
|
+
type SettleOptions = {
|
|
52
|
+
readonly settle: true;
|
|
53
|
+
readonly settleQuietMs: number;
|
|
54
|
+
} | Record<never, never>;
|
|
55
|
+
export declare class AgentDeviceSurface {
|
|
56
|
+
readonly options: MobileOptions;
|
|
57
|
+
private readonly createClient;
|
|
58
|
+
private client;
|
|
59
|
+
private attempt;
|
|
60
|
+
/** The device this worker drives, the pool's binding for its slot; undefined leaves the choice to agent-device. */
|
|
61
|
+
private device;
|
|
62
|
+
private generation;
|
|
63
|
+
private readonly located;
|
|
64
|
+
private idCounter;
|
|
65
|
+
private appIdentity;
|
|
66
|
+
/**
|
|
67
|
+
* The app this worker's agent-device session is on, and so the app a
|
|
68
|
+
* permission command there acts on: what the warm-up in `prepare` opened
|
|
69
|
+
* under the session this worker resumed, while that session is still open,
|
|
70
|
+
* then whatever this surface last opened. Undefined while nothing has been opened in the session, and once
|
|
71
|
+
* `closeApp` ended it.
|
|
72
|
+
*/
|
|
73
|
+
private sessionApp;
|
|
74
|
+
/** The app the build `appPath` installed, once `init` has, itself or through a lease. */
|
|
75
|
+
private installedApp;
|
|
76
|
+
/** Where relative build paths resolve; the run's project root once init has told us. */
|
|
77
|
+
private projectRoot;
|
|
78
|
+
/** The session and device this worker drives, for the error messages whose recovery is per device; set in init. */
|
|
79
|
+
private where;
|
|
80
|
+
/**
|
|
81
|
+
* Commands still running on the device. agent-device takes no abort
|
|
82
|
+
* signal, so a cancelled or timed-out call is only abandoned by its
|
|
83
|
+
* caller; it keeps executing. The next attempt waits for these to settle
|
|
84
|
+
* before it opens anything, so a ghost tap can never land in a retry.
|
|
85
|
+
*/
|
|
86
|
+
private readonly inflight;
|
|
87
|
+
/** The target's devices, one per worker slot; `init` takes this worker's from it. */
|
|
88
|
+
readonly pool: DevicePool;
|
|
89
|
+
/** The settle wait every action carries: quiet window from the `settle` option, or nothing when it is `false`. */
|
|
90
|
+
readonly settleOptions: SettleOptions;
|
|
91
|
+
/** When this surface last acted on the device (an input or an app launch); the screen may be in transition for a while after. */
|
|
92
|
+
private lastActionAt;
|
|
93
|
+
/** The screen as last projected before that action, to tell controls that were already there from ones that came with it. */
|
|
94
|
+
private indexBeforeAction;
|
|
95
|
+
/** The most recent projection of the screen, from any observe or locate. */
|
|
96
|
+
private latestIndex;
|
|
97
|
+
/** Budget a control that came with the last action gets to finish arriving; see DEFAULT_TRANSITION_MS. */
|
|
98
|
+
private readonly transitionMs;
|
|
99
|
+
/**
|
|
100
|
+
* The screen's logical size as last learned from a snapshot with geometry
|
|
101
|
+
* or from the device itself, so a snapshot without geometry (an empty
|
|
102
|
+
* screen before any app is open, a sparse tree) still reports the viewport
|
|
103
|
+
* every observation must carry.
|
|
104
|
+
*/
|
|
105
|
+
private knownViewport;
|
|
106
|
+
constructor(options: MobileOptions, createClient: ClientFactory);
|
|
107
|
+
/** Whether the manifest declares app restart and state clearing. */
|
|
108
|
+
get managesApp(): boolean;
|
|
109
|
+
/** The app `app.open()` launches: the `app` option, else the build `appPath` installed. */
|
|
110
|
+
get pinnedApp(): string | undefined;
|
|
111
|
+
/** Whether an attempt is running on this surface right now. */
|
|
112
|
+
get attemptRunning(): boolean;
|
|
113
|
+
/** The live client; INVALID_STATE before init or after dispose. */
|
|
114
|
+
requireClient(): AgentDeviceClient;
|
|
115
|
+
/**
|
|
116
|
+
* Runs one agent-device command under an operation budget and translates
|
|
117
|
+
* its failure. Contributed-fixture methods route through here too, so the
|
|
118
|
+
* device fixture never carries its own error mapping.
|
|
119
|
+
*/
|
|
120
|
+
command<T>(label: string, run: (client: AgentDeviceClient) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
121
|
+
/**
|
|
122
|
+
* Runs a fixture command that changes the screen (a back, the home screen,
|
|
123
|
+
* a dismissed alert or keyboard, a rotation) and records it as an action,
|
|
124
|
+
* so a control that arrives with the change waits out the transition
|
|
125
|
+
* budget before a test acts on it, as it does after a tap. Without this a
|
|
126
|
+
* `device.back()` followed by a tap lands where the returning screen has
|
|
127
|
+
* not yet arrived.
|
|
128
|
+
*/
|
|
129
|
+
screenCommand<T>(label: string, run: (client: AgentDeviceClient) => Promise<T>, signal: AbortSignal): Promise<T>;
|
|
130
|
+
/** Registers one device command as in flight until it settles. */
|
|
131
|
+
private track;
|
|
132
|
+
/**
|
|
133
|
+
* Waits for every abandoned command to settle, within the caller's
|
|
134
|
+
* budget. A command that never settles fails the attempt launch instead of
|
|
135
|
+
* racing it: the launch timeout is the honest bound on a stuck device.
|
|
136
|
+
*/
|
|
137
|
+
private settleInflight;
|
|
138
|
+
/** The device selection this worker's commands take. */
|
|
139
|
+
private selection;
|
|
140
|
+
init(info: EngineInitInfo): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* The app the warm-up left the slot's session on, while agent-device still
|
|
143
|
+
* holds that session. Only the slot's first worker finds it: a worker
|
|
144
|
+
* retired after a failing test closed it in `dispose`, and a permission
|
|
145
|
+
* command on a closed session reaches no device. A session not listed, or
|
|
146
|
+
* a list that fails, leaves the app unknown, and the first permission
|
|
147
|
+
* change opens it again.
|
|
148
|
+
*/
|
|
149
|
+
private resumedSessionApp;
|
|
150
|
+
startAttempt(context: EngineAttemptContext): Promise<void>;
|
|
151
|
+
endAttempt(context: EngineCleanupContext): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Asks the device to record its screen into the attempt directory. Taps stay
|
|
154
|
+
* visible in the recording (agent-device's touch indicator), which is the
|
|
155
|
+
* closest a phone comes to a cursor.
|
|
156
|
+
*/
|
|
157
|
+
startVideo(operation: OperationContext): Promise<void>;
|
|
158
|
+
/** Stops the recording and returns its one segment, or none when the device wrote nothing. */
|
|
159
|
+
stopVideo(operation: OperationContext): Promise<readonly VideoSegment[]>;
|
|
160
|
+
dispose(context: EngineCleanupContext): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Opens an app in the session, remembering its identity for the path
|
|
163
|
+
* anchor. A link is refused before the device sees it: agent-device would
|
|
164
|
+
* open it as a URL, and `openLink` is the path that carries the
|
|
165
|
+
* navigation rule.
|
|
166
|
+
*/
|
|
167
|
+
openApp(app: string, options: OpenAppOptions, signal: AbortSignal): Promise<void>;
|
|
168
|
+
/** One `open` of an app, remembered as the session's app and as the screen's replacement. */
|
|
169
|
+
private open;
|
|
170
|
+
/**
|
|
171
|
+
* Puts an app's permissions in place before it launches. agent-device sets
|
|
172
|
+
* a permission on the app its session is on, so a session on another app,
|
|
173
|
+
* or on none yet, is first brought onto this one with a foreground open;
|
|
174
|
+
* the warm-up in `prepare` did that for the pinned app under the session
|
|
175
|
+
* this worker resumed, so its first launch needs none. Before the launch,
|
|
176
|
+
* never after: iOS terminates a running app whose
|
|
177
|
+
* permission changed, and Android one whose permission was revoked, so a
|
|
178
|
+
* change after the launch would leave the test on no screen.
|
|
179
|
+
*/
|
|
180
|
+
private presetPermissions;
|
|
181
|
+
/**
|
|
182
|
+
* One permission change for `device.setPermission`: on the app the session
|
|
183
|
+
* is on, which is what agent-device acts on. With none known here (nothing
|
|
184
|
+
* opened yet, `closeApp`, a worker resumed on a bare session) the pinned
|
|
185
|
+
* app is brought to the foreground first. agent-device's own refusal, met
|
|
186
|
+
* when its session lost the app since (a failed attempt left it on none),
|
|
187
|
+
* gets the same foreground open and the command once more.
|
|
188
|
+
*/
|
|
189
|
+
setPermission(permission: DevicePermission, state: PermissionState, signal: AbortSignal): Promise<void>;
|
|
190
|
+
private permission;
|
|
191
|
+
/**
|
|
192
|
+
* Opens a link on the device, into `app` (the pinned app when none is
|
|
193
|
+
* named). Bound to an app, agent-device hands the link to it and the
|
|
194
|
+
* session observes that app afterwards: iOS launches the app first for a
|
|
195
|
+
* web link and then opens the URL, Android starts a VIEW intent on the
|
|
196
|
+
* package. Without an app the OS routes the link to the scheme's app, a
|
|
197
|
+
* verified app link owner, or the browser. iOS needs the app: an unbound
|
|
198
|
+
* `open <url>` there leaves no app session, so the next snapshot would
|
|
199
|
+
* fail, and agent-device refuses a deep link without one on a physical
|
|
200
|
+
* device anyway. An unbound open reports the URL as its app name, which is
|
|
201
|
+
* no identity, and the package that took the link as its bundle id when
|
|
202
|
+
* the OS told it; the next snapshot names the foreground app either way.
|
|
203
|
+
*/
|
|
204
|
+
openLink(url: URL, app: string | undefined, signal: AbortSignal): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* What a launch leaves behind. The identity is the app agent-device named;
|
|
207
|
+
* a link the OS routed keeps the last known one until the next snapshot
|
|
208
|
+
* reports the foreground app.
|
|
209
|
+
*/
|
|
210
|
+
private launched;
|
|
211
|
+
/**
|
|
212
|
+
* Forgets the screen after a launch or a close. There is no screen before
|
|
213
|
+
* it worth matching against: every control of whatever shows next is
|
|
214
|
+
* arriving, whatever the previous screen looked like, and none of its
|
|
215
|
+
* bindings names a node that still exists.
|
|
216
|
+
*/
|
|
217
|
+
private screenReplaced;
|
|
218
|
+
/**
|
|
219
|
+
* Terminates the session's app, then ends the session. agent-device's bare
|
|
220
|
+
* `close` ends the session and leaves the app running, so the next
|
|
221
|
+
* `openApp` would resume it mid-flow; a close that names the app
|
|
222
|
+
* terminates it first. The app is the one the session last observed, else
|
|
223
|
+
* the pinned one; with neither known there is nothing to terminate and
|
|
224
|
+
* only the session ends.
|
|
225
|
+
*/
|
|
226
|
+
closeApp(signal: AbortSignal): Promise<void>;
|
|
227
|
+
/**
|
|
228
|
+
* Installs a build on the session's device. `reinstall` removes the app
|
|
229
|
+
* named by `options.app` (else the pinned app) first, so the build starts
|
|
230
|
+
* with no data; a plain install replaces the binary and keeps its data.
|
|
231
|
+
*/
|
|
232
|
+
installApp(appPath: string | undefined, options: InstallAppOptions, signal: AbortSignal): Promise<InstalledApp>;
|
|
233
|
+
private snapshot;
|
|
234
|
+
/**
|
|
235
|
+
* One capture, taken again once when the iOS runner acquired the tree but
|
|
236
|
+
* failed its own presentation check on it (a viewport it could not read, a
|
|
237
|
+
* malformed graph). The check is per capture and a capture is a read, so
|
|
238
|
+
* the retry is safe; a second failure is the runner's and propagates.
|
|
239
|
+
*/
|
|
240
|
+
private capture;
|
|
241
|
+
/**
|
|
242
|
+
* Snapshot for an observation. Without a pinned app, an observation before
|
|
243
|
+
* anything is open is an empty screen rather than a fault: the model's next
|
|
244
|
+
* move is the open tool, and failing the step would take that move away.
|
|
245
|
+
*/
|
|
246
|
+
private snapshotOrEmpty;
|
|
247
|
+
private project;
|
|
248
|
+
/**
|
|
249
|
+
* The viewport of a snapshot: its own geometry, else the last one this
|
|
250
|
+
* session learned, else the device's logical screen size read off one
|
|
251
|
+
* screenshot. A device whose size cannot be learned fails the observation:
|
|
252
|
+
* the harness measures every rect and point against the viewport, so an
|
|
253
|
+
* invented one would misplace every tap.
|
|
254
|
+
*/
|
|
255
|
+
private viewportFor;
|
|
256
|
+
/** The device's logical screen size as its screenshot reports it; undefined when it reports none. */
|
|
257
|
+
private probeViewport;
|
|
258
|
+
observe(operation: OperationContext, options?: EngineObserveOptions): Promise<EngineSnapshot>;
|
|
259
|
+
/** Retains only action bindings for matches, independently of the observation generation. */
|
|
260
|
+
locate(expression: LocatorExpression, operation: OperationContext): Promise<readonly SemanticNode[]>;
|
|
261
|
+
private resolveRef;
|
|
262
|
+
private actionTarget;
|
|
263
|
+
/**
|
|
264
|
+
* The node a toggle press must land on. UIKit reports a settings row as a
|
|
265
|
+
* labelled `Switch` spanning the whole row with the real control as an
|
|
266
|
+
* unlabelled `Switch` child at its trailing edge; a press at the row's
|
|
267
|
+
* centre hits the label and changes nothing. The innermost same-role
|
|
268
|
+
* descendant with a ref is the control; a node without one is its own.
|
|
269
|
+
*/
|
|
270
|
+
private controlOf;
|
|
271
|
+
/** Copies the fields actions use and pre-resolves a toggle's inner control. */
|
|
272
|
+
private bind;
|
|
273
|
+
/**
|
|
274
|
+
* The node a binding stands for, in a fresh snapshot: same role, same test
|
|
275
|
+
* id, same name and text, and of those the one closest to where it was.
|
|
276
|
+
*/
|
|
277
|
+
private refind;
|
|
278
|
+
/**
|
|
279
|
+
* Lets a control that came with the last action finish arriving before a
|
|
280
|
+
* test acts on it, and answers the binding to act on. A control already
|
|
281
|
+
* present at the same place in the snapshot the last action was resolved
|
|
282
|
+
* from is not in transition and is acted on at once; anything else waits
|
|
283
|
+
* out the remainder of the transition budget since that action and is then
|
|
284
|
+
* found again in a fresh snapshot. The budget is the only signal that the
|
|
285
|
+
* transition is over, since the tree cannot tell a sliding control from a
|
|
286
|
+
* landed one; the fresh snapshot is where the control landed. Android
|
|
287
|
+
* reports a window's frames while it slides in, so a ref resolved
|
|
288
|
+
* mid-flight would send the action where the control was: below the
|
|
289
|
+
* screen, for a modal rising from the bottom.
|
|
290
|
+
*/
|
|
291
|
+
private settled;
|
|
292
|
+
/** The same control in a fresh snapshot; the binding as it was when the snapshot no longer lists it. */
|
|
293
|
+
private relocated;
|
|
294
|
+
/**
|
|
295
|
+
* Records an action the device received: the screen as it was projected
|
|
296
|
+
* before it, and when it returned. The transition budget counts from the
|
|
297
|
+
* return, since the input lands late in the command's own round trip.
|
|
298
|
+
*/
|
|
299
|
+
private markAction;
|
|
300
|
+
perform(ref: NodeRef, action: LocatorAction, operation: OperationContext): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* Keys on a touch surface, in the contract's key grammar: `Enter` submits
|
|
303
|
+
* through the soft keyboard, `Space` and any single character are typed
|
|
304
|
+
* into the focused field. agent-device exposes no key event bus, so
|
|
305
|
+
* modifiers and the other named keys (`Escape`, `Tab`, `Backspace`, the
|
|
306
|
+
* arrows) have nothing to land on and are refused.
|
|
307
|
+
*/
|
|
308
|
+
private pressKey;
|
|
309
|
+
/**
|
|
310
|
+
* One pointer action at a screen point in logical pixels, the space every
|
|
311
|
+
* node's bounds are in, with no element resolved behind it. `settle` waits
|
|
312
|
+
* for the UI to go quiet, as the node taps do.
|
|
313
|
+
*/
|
|
314
|
+
performAt(point: ViewportPoint, action: PointerAction, operation: OperationContext): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Types into whatever holds focus through the device's text-input path;
|
|
317
|
+
* agent-device's `type` lands on the focused field. `replace` is not a
|
|
318
|
+
* device primitive without a target, so it is refused rather than faked:
|
|
319
|
+
* the model clears a listed field by filling it by id.
|
|
320
|
+
*/
|
|
321
|
+
typeText(text: string, options: {
|
|
322
|
+
readonly replace: boolean;
|
|
323
|
+
}, operation: OperationContext): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* One key to the focused field, with the same reach as a node press: Enter
|
|
326
|
+
* submits through the soft keyboard, Space and single characters are typed.
|
|
327
|
+
* Modifiers and the other named keys have no event bus to land on.
|
|
328
|
+
*/
|
|
329
|
+
pressFocusedKey(key: string, operation: OperationContext): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Hides the soft keyboard, so a control it covered can be reached.
|
|
332
|
+
* agent-device presses the keyboard's own dismiss key and refuses when the
|
|
333
|
+
* keyboard has none (an iPhone), because a touch outside the keyboard is a
|
|
334
|
+
* guess about the screen it never makes on a caller's behalf. The engine
|
|
335
|
+
* makes that guess, the way a user does and Maestro's `hideKeyboard` does,
|
|
336
|
+
* in {@link dismissKeyboardByGesture}.
|
|
337
|
+
*/
|
|
338
|
+
dismissKeyboard(signal: AbortSignal): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* A keyboard with no dismiss key goes the way a user sends it away: a short
|
|
341
|
+
* drag at the centre of the screen, which a scroll view turns into a
|
|
342
|
+
* dismissal, each followed by a fresh look at whether the keyboard is still
|
|
343
|
+
* there. Horizontal first: on a vertical scroll view it is no scroll, so
|
|
344
|
+
* React Native's scroll view takes it as the touch outside the keyboard
|
|
345
|
+
* that dismisses by default, where a vertical drag scrolls the content and
|
|
346
|
+
* dismisses only under `keyboardDismissMode="on-drag"`. Vertical second,
|
|
347
|
+
* for the scroll views that dismiss on a drag alone. Maestro's
|
|
348
|
+
* `hideKeyboard` drags in the other order, and on a React Native screen
|
|
349
|
+
* that costs a drag plus the settle after it. The simulator's "Speed up
|
|
350
|
+
* your typing" tip, which sits over a keyboard the first time it appears,
|
|
351
|
+
* goes through its Continue button first. A drag is a guess about what sits
|
|
352
|
+
* at the centre, so the sequence stops the moment the keyboard is gone, and
|
|
353
|
+
* a keyboard that outlives both drags fails naming what does work. Each
|
|
354
|
+
* look is the observation's own capture, sparse-tree retries included: a
|
|
355
|
+
* one-node tree has no keys and would pass for a dismissed keyboard.
|
|
356
|
+
*/
|
|
357
|
+
private dismissKeyboardByGesture;
|
|
358
|
+
/**
|
|
359
|
+
* The simulator shows a "Speed up your typing" tip over the keyboard the
|
|
360
|
+
* first time it appears; its Continue button is the only way past it, and
|
|
361
|
+
* Maestro's `hideKeyboard` presses it too. Answers the capture after the
|
|
362
|
+
* press, or the one given when no tip is showing.
|
|
363
|
+
*/
|
|
364
|
+
private dismissKeyboardTip;
|
|
365
|
+
back(operation: OperationContext): Promise<void>;
|
|
366
|
+
restart(operation: OperationContext): Promise<void>;
|
|
367
|
+
/** Clears the pinned app's persisted state and relaunches it: the device equivalent of a fresh context. */
|
|
368
|
+
reset(operation: OperationContext): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Resets the simulator's keychain through agent-device. simctl resets the
|
|
371
|
+
* whole simulator's, not one app's, and only a simulator has one to reset:
|
|
372
|
+
* Android is refused before any device command.
|
|
373
|
+
*/
|
|
374
|
+
clearKeychain(signal: AbortSignal): Promise<void>;
|
|
375
|
+
/**
|
|
376
|
+
* A redacted screenshot artifact. The device paints secure fields as dots,
|
|
377
|
+
* but the last typed character shows in clear, so every secure node's
|
|
378
|
+
* bounds are painted over before the file is kept. A secure node without
|
|
379
|
+
* bounds cannot be masked, and an image that cannot be redacted is not
|
|
380
|
+
* written at all.
|
|
381
|
+
*/
|
|
382
|
+
screenshot(label: string | undefined, operation: OperationContext): Promise<string>;
|
|
383
|
+
/** Raw device pixels; cleanup follows the capture even when its caller abandons it. */
|
|
384
|
+
private rawScreenshot;
|
|
385
|
+
/**
|
|
386
|
+
* One screenshot into a temp directory that is removed once `read` has
|
|
387
|
+
* taken what it needs from the response or the file, even when the caller
|
|
388
|
+
* abandons the capture.
|
|
389
|
+
*/
|
|
390
|
+
private captureScreenshot;
|
|
391
|
+
/**
|
|
392
|
+
* Screenshot with every secure node on the current screen painted over.
|
|
393
|
+
* Observes first so the regions describe the screen the pixels show;
|
|
394
|
+
* throws when a secure field cannot be covered, because an image that may
|
|
395
|
+
* hold a credential must not leave the engine.
|
|
396
|
+
*/
|
|
397
|
+
private maskedScreenshot;
|
|
398
|
+
/**
|
|
399
|
+
* Viewport pixels for an observation. Best-effort: a screenshot that cannot
|
|
400
|
+
* be produced or redacted costs the observation its image, not the step.
|
|
401
|
+
*/
|
|
402
|
+
private capturePixels;
|
|
403
|
+
}
|
|
404
|
+
export {};
|
|
405
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EAEZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI1I,OAAO,EAAE,UAAU,EAAyC,MAAM,WAAW,CAAC;AAe9E,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAaD,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,yGAAyG;IACzG,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CA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