@e2e-dev/mobile 0.12.7 → 0.12.8-nightly-20261116092245
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 +5 -3
- package/dist/.build.json +1 -1
- package/dist/actions.d.ts +2 -2
- package/dist/actions.js +1 -1
- package/dist/bindings.d.ts +1 -1
- package/dist/bindings.js +1 -1
- package/dist/device.d.ts +1 -1
- package/dist/device.js +2 -2
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +1 -1
- package/dist/engine-entry.d.ts +15 -0
- package/dist/engine-entry.js +8 -0
- package/dist/engine.d.ts +5 -4
- package/dist/engine.js +6 -4
- package/dist/errors.js +1 -1
- package/dist/fixtures.d.ts +6 -0
- package/dist/fixtures.js +2 -0
- package/dist/index.d.ts +6 -18
- package/dist/index.js +3 -3
- package/dist/keyboard.d.ts +1 -1
- package/dist/links.d.ts +12 -3
- package/dist/links.js +30 -7
- package/dist/locate.d.ts +1 -1
- package/dist/locate.js +1 -1
- package/dist/nodes.d.ts +1 -1
- package/dist/options.d.ts +6 -4
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +2 -2
- package/dist/provider.d.ts +2 -2
- package/dist/provider.js +1 -1
- package/dist/selector.js +1 -1
- package/dist/support.d.ts +1 -1
- package/dist/support.js +1 -1
- package/dist/surface.d.ts +6 -2
- package/dist/surface.js +40 -8
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +2 -2
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
The mobile engine for [`e2e`](https://www.npmjs.com/package/e2e), built on
|
|
4
4
|
[agent-device](https://github.com/callstack/agent-device): iOS simulators,
|
|
5
|
-
Android emulators, and connected phones through the same
|
|
5
|
+
Android emulators, and connected phones through the same `@e2e-dev/core/engine` contract the browser engine
|
|
6
6
|
implements. A test written against `screen`, `expect`, `app`, and `agent` runs
|
|
7
|
-
on a device target unchanged;
|
|
7
|
+
on a device target unchanged; neither `e2e` nor `@e2e-dev/core` imports this package.
|
|
8
|
+
To drive a device from a program without the test runner, import `mobile` from
|
|
9
|
+
`@e2e-dev/mobile/engine` with [`@e2e-dev/core`](https://www.npmjs.com/package/@e2e-dev/core).
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -69,7 +71,7 @@ the other old app options are `INVALID_CONFIG` naming their key under `app`.
|
|
|
69
71
|
| Option | Meaning |
|
|
70
72
|
| --- | --- |
|
|
71
73
|
| `platform` | `'ios'` or `'android'`. |
|
|
72
|
-
| `device` | Simulator or emulator name or UDID, or a connected phone's name. A list is a pool: one worker per entry, worker slot `n` driving the `n`th. Omitted, every booted device of the platform is the pool, as many as the run has slots. |
|
|
74
|
+
| `device` | Simulator or emulator name or UDID, or a paired iPhone or iPad's name or a connected Android phone's name. A list is a pool: one worker per entry, worker slot `n` driving the `n`th. Omitted, every booted device of the platform is the pool, as many as the run has slots, a reachable paired iPhone or iPad included; with none booted, agent-device boots one (on iOS an iPhone over an iPad over an Apple TV, on Android a phone or tablet over a TV, then the newest OS, then name order). |
|
|
73
75
|
| `session` | agent-device session name, before the worker slot: slot `n` drives its device under `<session>-<n>`, `e2e-<target name>-<n>` by default. One run per session at a time. |
|
|
74
76
|
| `snapshot` | `'full'` (default, includes static text) or `'interactive'` (actionable nodes only). |
|
|
75
77
|
| `settle` | Milliseconds the UI must hold still after an agent action before the agent observes again, default `150`; `false` skips the wait. A test's steps do not settle, except `device.back()`; `expect` verifies their outcome. |
|
package/dist/.build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.12.
|
|
1
|
+
{"version":"0.12.8-nightly-20261116092245"}
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The action kinds a device surface declares, and the pointer dispatch that agrees with them. */
|
|
2
|
-
import type { LocatorActionKind, PointerAction, PointerActionKind, ViewportPoint } from 'e2e/engine';
|
|
2
|
+
import type { LocatorActionKind, PointerAction, PointerActionKind, ViewportPoint } from '@e2e-dev/core/engine';
|
|
3
3
|
import type { AgentDeviceClient } from './options.ts';
|
|
4
4
|
import { type InputBudget } from './support.ts';
|
|
5
5
|
/**
|
|
@@ -34,7 +34,7 @@ export declare const DEVICE_POINTER_ACTIONS: readonly PointerActionKind[];
|
|
|
34
34
|
* actions do; `stabilization` is the post-gesture option a swipe carries.
|
|
35
35
|
* A double tap is two presses (`count: 2`), as it is on a node:
|
|
36
36
|
* agent-device's own double-tap gesture reaches a React Native `Pressable`
|
|
37
|
-
* on iOS as one press, while two presses in a row land about 285 ms apart.
|
|
37
|
+
* on iOS as one press, while two presses in a row land about 285 to 335 ms apart.
|
|
38
38
|
* The kinds outside `DEVICE_POINTER_ACTIONS` never arrive: the harness
|
|
39
39
|
* routes only declared kinds. They are refused here so the switch stays
|
|
40
40
|
* exhaustive against the contract.
|
package/dist/actions.js
CHANGED
|
@@ -45,7 +45,7 @@ export const DEVICE_POINTER_ACTIONS = ['tap', 'doubleTap', 'longPress', 'swipeTo
|
|
|
45
45
|
* actions do; `stabilization` is the post-gesture option a swipe carries.
|
|
46
46
|
* A double tap is two presses (`count: 2`), as it is on a node:
|
|
47
47
|
* agent-device's own double-tap gesture reaches a React Native `Pressable`
|
|
48
|
-
* on iOS as one press, while two presses in a row land about 285 ms apart.
|
|
48
|
+
* on iOS as one press, while two presses in a row land about 285 to 335 ms apart.
|
|
49
49
|
* The kinds outside `DEVICE_POINTER_ACTIONS` never arrive: the harness
|
|
50
50
|
* routes only declared kinds. They are refused here so the switch stays
|
|
51
51
|
* exhaustive against the contract.
|
package/dist/bindings.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* reads one shape through one environment variable, whatever produced it.
|
|
7
7
|
*/
|
|
8
8
|
import type { createAgentDeviceClient } from 'agent-device';
|
|
9
|
-
import { type EngineAppInfo, type EngineFinishInfo, type EnginePrepareInfo } from 'e2e/engine';
|
|
9
|
+
import { type EngineAppInfo, type EngineFinishInfo, type EnginePrepareInfo } from '@e2e-dev/core/engine';
|
|
10
10
|
type AgentDeviceClientConfig = NonNullable<Parameters<typeof createAgentDeviceClient>[0]>;
|
|
11
11
|
/** An agent-device daemon other than the local one. */
|
|
12
12
|
export interface DeviceDaemon {
|
package/dist/bindings.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* reads one shape through one environment variable, whatever produced it.
|
|
7
7
|
*/
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
|
-
import { EngineError, obj } from 'e2e/engine';
|
|
9
|
+
import { EngineError, obj } from '@e2e-dev/core/engine';
|
|
10
10
|
/** What a binding calls its device in progress and error lines: the name, else the id, else nothing. */
|
|
11
11
|
export function deviceLabel(binding) {
|
|
12
12
|
return binding?.device ?? binding?.deviceId;
|
package/dist/device.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `device.<method>` step bounded by the action timeout.
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentDeviceClient as DeviceSessionClient } from 'agent-device';
|
|
8
|
-
import type { EngineFixtureContext, Locator } from 'e2e/engine';
|
|
8
|
+
import type { EngineFixtureContext, Locator } from '@e2e-dev/core/engine';
|
|
9
9
|
import type { DevicePermission, MobilePlatform, PermissionState } from './options.ts';
|
|
10
10
|
import type { DeviceSelection } from './pool.ts';
|
|
11
11
|
import type { AgentDeviceSurface, FoldPose, InstallAppOptions, InstalledApp, OpenAppOptions } from './surface.ts';
|
package/dist/device.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* assert device state, and the harness records each call as a
|
|
5
5
|
* `device.<method>` step bounded by the action timeout.
|
|
6
6
|
*/
|
|
7
|
-
import { linkLabel, linkTarget } from './links.js';
|
|
7
|
+
import { appLabel, linkLabel, linkTarget } from './links.js';
|
|
8
8
|
import { unsupported } from './support.js';
|
|
9
9
|
/**
|
|
10
10
|
* Why iOS refuses to take the device offline, before any device command:
|
|
@@ -141,7 +141,7 @@ export function createDeviceFixture(surface, context) {
|
|
|
141
141
|
setBiometrics: action,
|
|
142
142
|
enrollBiometrics: action,
|
|
143
143
|
installApp: { ...action, label: (appPath) => appPath ?? surface.appPath ?? 'appPath' },
|
|
144
|
-
openApp: { ...action, label: (app) =>
|
|
144
|
+
openApp: { ...action, label: (app) => appLabel(app) },
|
|
145
145
|
openLink: { ...action, label: (url) => linkLabel(url) },
|
|
146
146
|
closeApp: action,
|
|
147
147
|
clearKeychain: action,
|
package/dist/doctor.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (its install, the platform toolchain, the device, the app) for each device
|
|
4
4
|
* the target names, and the build `appPath` points at.
|
|
5
5
|
*/
|
|
6
|
-
import { type EngineDoctorCheck, type EngineDoctorInfo } from 'e2e/engine';
|
|
6
|
+
import { type EngineDoctorCheck, type EngineDoctorInfo } from '@e2e-dev/core/engine';
|
|
7
7
|
import type { ClientFactory, MobileOptions } from './options.ts';
|
|
8
8
|
/**
|
|
9
9
|
* Runs agent-device's doctor once per device the target names (once with no
|
package/dist/doctor.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { stat } from 'node:fs/promises';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import { obj } from 'e2e/engine';
|
|
8
|
+
import { obj } from '@e2e-dev/core/engine';
|
|
9
9
|
import { runCommand } from './errors.js';
|
|
10
10
|
import { deviceSelection, isDeviceList } from './pool.js';
|
|
11
11
|
/** Checks that apply to the whole machine, reported once however many devices the target names. */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@e2e-dev/mobile/engine`: the `mobile()` factory and its types, without
|
|
3
|
+
* `test`, so a program that drives a device with `@e2e-dev/core` never loads the
|
|
4
|
+
* test runner. The main entry re-exports all of it beside `test`.
|
|
5
|
+
*/
|
|
6
|
+
export { mobile } from './engine.ts';
|
|
7
|
+
/** The engine factory again, as the default export: what `e2e mcp` calls when `open_session` names this package as its `engine`. */
|
|
8
|
+
export { mobile as default } from './engine.ts';
|
|
9
|
+
export type { DevicePermission, LaunchPermissions, MobileOptions, MobilePlatform, PermissionState } from './options.ts';
|
|
10
|
+
export type { DeviceClientConfig, DeviceConnection, DeviceDaemon } from './bindings.ts';
|
|
11
|
+
export type { DeviceLease, DeviceProvider, DeviceReleaseContext, DeviceRequest } from './provider.ts';
|
|
12
|
+
export type { FoldPose, InstallAppOptions, InstalledApp, OpenAppOptions } from './surface.ts';
|
|
13
|
+
export type { BiometricSensor, Device, DeviceOrientation, DeviceSession, DeviceSessionClient, ForegroundApp } from './device.ts';
|
|
14
|
+
export type { DeviceSelection } from './pool.ts';
|
|
15
|
+
export type { MobileFixtures } from './fixtures.ts';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@e2e-dev/mobile/engine`: the `mobile()` factory and its types, without
|
|
3
|
+
* `test`, so a program that drives a device with `@e2e-dev/core` never loads the
|
|
4
|
+
* test runner. The main entry re-exports all of it beside `test`.
|
|
5
|
+
*/
|
|
6
|
+
export { mobile } from './engine.js';
|
|
7
|
+
/** The engine factory again, as the default export: what `e2e mcp` calls when `open_session` names this package as its `engine`. */
|
|
8
|
+
export { mobile as default } from './engine.js';
|
package/dist/engine.d.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* The agent-device engine for e2e: a mobile body built with the
|
|
3
3
|
* public `defineEngine`, validated by the same rules and graded by the same
|
|
4
4
|
* capabilities as any other engine. Core imports nothing from here; this
|
|
5
|
-
* package imports the contract from
|
|
5
|
+
* package imports the contract from `@e2e-dev/core/engine` and contributes the
|
|
6
6
|
* `device` fixture the way the browser engine contributes `browser`.
|
|
7
7
|
*/
|
|
8
|
-
import { type EngineHandle } from 'e2e/engine';
|
|
8
|
+
import { type EngineHandle } from '@e2e-dev/core/engine';
|
|
9
9
|
import type { MobileOptions } from './options.ts';
|
|
10
10
|
import { AgentDeviceSurface } from './surface.ts';
|
|
11
|
+
import type { MobileFixtures } from './fixtures.ts';
|
|
11
12
|
/** Assembles the manifest for one surface. Exported for tests that script the client. */
|
|
12
|
-
export declare function buildEngine(surface: AgentDeviceSurface): EngineHandle
|
|
13
|
+
export declare function buildEngine(surface: AgentDeviceSurface): EngineHandle<MobileFixtures>;
|
|
13
14
|
/** Creates one agent-device engine: one device session per worker; a test launches the pinned app with `app.open()`. */
|
|
14
|
-
export declare function mobile(options: MobileOptions): EngineHandle
|
|
15
|
+
export declare function mobile(options: MobileOptions): EngineHandle<MobileFixtures>;
|
|
15
16
|
/** The surface behind a handle this package created; undefined for any other engine. */
|
|
16
17
|
export declare function surfaceOf(engine: EngineHandle): AgentDeviceSurface | undefined;
|
package/dist/engine.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* The agent-device engine for e2e: a mobile body built with the
|
|
3
3
|
* public `defineEngine`, validated by the same rules and graded by the same
|
|
4
4
|
* capabilities as any other engine. Core imports nothing from here; this
|
|
5
|
-
* package imports the contract from
|
|
5
|
+
* package imports the contract from `@e2e-dev/core/engine` and contributes the
|
|
6
6
|
* `device` fixture the way the browser engine contributes `browser`.
|
|
7
7
|
*/
|
|
8
8
|
import { createRequire } from 'node:module';
|
|
9
9
|
import { createAgentDeviceClient } from 'agent-device';
|
|
10
|
-
import { ConfigurationError, defineEngine, obj } from 'e2e/engine';
|
|
10
|
+
import { ConfigurationError, defineEngine, obj } from '@e2e-dev/core/engine';
|
|
11
11
|
import { createDeviceFixture } from './device.js';
|
|
12
|
-
import { isLink } from './links.js';
|
|
12
|
+
import { isLink, linkTarget } from './links.js';
|
|
13
13
|
import { DEVICE_ACTIONS, DEVICE_POINTER_ACTIONS } from './actions.js';
|
|
14
14
|
import { AgentDeviceSurface, assertPermissions } from './surface.js';
|
|
15
15
|
const surfaces = new WeakMap();
|
|
@@ -49,6 +49,8 @@ export function buildEngine(surface) {
|
|
|
49
49
|
back: (operation) => surface.back(operation, surface.inputBudget('back', operation)),
|
|
50
50
|
restart: (operation) => surface.restart(operation),
|
|
51
51
|
reset: (operation) => surface.reset(operation),
|
|
52
|
+
// `app.open(path)` on a target with `app.linkBase`: the link opens in the pinned app, as `device.openLink` would.
|
|
53
|
+
openLink: async (url, operation) => await surface.openLink(linkTarget(url), undefined, operation.signal, surface.inputBudget('open link', operation)),
|
|
52
54
|
},
|
|
53
55
|
artifacts: {
|
|
54
56
|
screenshot: (label, operation) => surface.screenshot(label, operation, surface.inputBudget('screenshot', operation)),
|
|
@@ -99,7 +101,7 @@ function validateApp(app, { targetName }, platform) {
|
|
|
99
101
|
throw new ConfigurationError('INVALID_CONFIG', `${where} declares app.url, but a mobile() target cannot open a website in the device's browser yet; test the installed app with app.bundleId or app.appPath. When it lands, note that ${LOOPBACK_NOTES[platform] ?? LOOPBACK_NOTES.android}`);
|
|
100
102
|
}
|
|
101
103
|
if (app.bundleId === undefined && app.appPath === undefined) {
|
|
102
|
-
throw new ConfigurationError('INVALID_CONFIG', `${where} needs app.bundleId or app.appPath:
|
|
104
|
+
throw new ConfigurationError('INVALID_CONFIG', `${where} needs app.bundleId or app.appPath: mobile() launches an installed app, such as app: { bundleId: 'com.example.app' }`);
|
|
103
105
|
}
|
|
104
106
|
if (app.bundleId !== undefined && isLink(app.bundleId)) {
|
|
105
107
|
throw new ConfigurationError('INVALID_CONFIG', `${where} app.bundleId names an app by bundle id, package, or display name, not a link; a test opens a deep link or web link with device.openLink`);
|
package/dist/errors.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { isAgentDeviceError, normalizeAgentDeviceError } from 'agent-device';
|
|
28
28
|
import { defaultHintForCode } from 'agent-device/contracts';
|
|
29
|
-
import { EngineError, ConfigurationError, InfrastructureError, TestError, raceAbort } from 'e2e/engine';
|
|
29
|
+
import { EngineError, ConfigurationError, InfrastructureError, TestError, raceAbort } from '@e2e-dev/core/engine';
|
|
30
30
|
import { cancelled } from './support.js';
|
|
31
31
|
/**
|
|
32
32
|
* True for an error that already carries its classification: an `EngineError`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The fixtures a `mobile()` target contributes, as types only. */
|
|
2
|
+
import type { Device } from './device.ts';
|
|
3
|
+
/** What a session on a `mobile()` target holds beside `screen` and `app`: the `device` fixture. */
|
|
4
|
+
export interface MobileFixtures {
|
|
5
|
+
readonly device: Device;
|
|
6
|
+
}
|
package/dist/fixtures.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -5,29 +5,17 @@
|
|
|
5
5
|
* `e2e`; the agent-side tool pack lives on the `@e2e-dev/mobile/tools`
|
|
6
6
|
* subpath so this entry never loads the AI SDK.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
export
|
|
10
|
-
/** The engine factory
|
|
11
|
-
export {
|
|
12
|
-
export type { DevicePermission, LaunchPermissions, MobileOptions, MobilePlatform, PermissionState } from './options.ts';
|
|
13
|
-
export type { DeviceClientConfig, DeviceConnection, DeviceDaemon } from './bindings.ts';
|
|
14
|
-
export type { DeviceLease, DeviceProvider, DeviceReleaseContext, DeviceRequest } from './provider.ts';
|
|
15
|
-
export type { FoldPose, InstallAppOptions, InstalledApp, OpenAppOptions } from './surface.ts';
|
|
16
|
-
export type { BiometricSensor, Device, DeviceOrientation, DeviceSession, DeviceSessionClient, ForegroundApp } from './device.ts';
|
|
17
|
-
export type { DeviceSelection } from './pool.ts';
|
|
8
|
+
import type { MobileFixtures } from './fixtures.ts';
|
|
9
|
+
export * from './engine-entry.ts';
|
|
10
|
+
/** The engine factory as the default export: what `e2e mcp` calls when `open_session` names this package as its `engine`. */
|
|
11
|
+
export { default } from './engine-entry.ts';
|
|
18
12
|
/**
|
|
19
13
|
* `test` typed with this engine's contributed `device` fixture. The same
|
|
20
14
|
* runtime `test` as `e2e`'s; only the fixture types differ.
|
|
21
15
|
*/
|
|
22
|
-
export declare const test: import("e2e").TestAPI<import("e2e").TestFixtures &
|
|
23
|
-
device: Device;
|
|
24
|
-
}>;
|
|
16
|
+
export declare const test: import("e2e").TestAPI<import("e2e").TestFixtures & MobileFixtures>;
|
|
25
17
|
/** `describe` and the hooks, the same functions as `test.describe` and `test.beforeEach`, typed with the `device` fixture. */
|
|
26
18
|
export declare const describe: {
|
|
27
19
|
<Result>(title: string, body: import("e2e").SynchronousBody<Result>): void;
|
|
28
20
|
<Result>(title: string, options: import("e2e").DescribeOptions, body: import("e2e").SynchronousBody<Result>): void;
|
|
29
|
-
}, beforeEach: (fn: import("e2e").TestHookFn<import("e2e").TestFixtures &
|
|
30
|
-
device: Device;
|
|
31
|
-
}>) => void, afterEach: (fn: import("e2e").TestHookFn<import("e2e").TestFixtures & {
|
|
32
|
-
device: Device;
|
|
33
|
-
}>) => void, beforeAll: (fn: import("e2e").SuiteHookFn) => void, afterAll: (fn: import("e2e").SuiteHookFn) => void;
|
|
21
|
+
}, beforeEach: (fn: import("e2e").TestHookFn<import("e2e").TestFixtures & MobileFixtures>) => void, afterEach: (fn: import("e2e").TestHookFn<import("e2e").TestFixtures & MobileFixtures>) => void, beforeAll: (fn: import("e2e").SuiteHookFn) => void, afterAll: (fn: import("e2e").SuiteHookFn) => void;
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* subpath so this entry never loads the AI SDK.
|
|
7
7
|
*/
|
|
8
8
|
import { test as base } from 'e2e';
|
|
9
|
-
export
|
|
10
|
-
/** The engine factory
|
|
11
|
-
export {
|
|
9
|
+
export * from './engine-entry.js';
|
|
10
|
+
/** The engine factory as the default export: what `e2e mcp` calls when `open_session` names this package as its `engine`. */
|
|
11
|
+
export { default } from './engine-entry.js';
|
|
12
12
|
/**
|
|
13
13
|
* `test` typed with this engine's contributed `device` fixture. The same
|
|
14
14
|
* runtime `test` as `e2e`'s; only the fixture types differ.
|
package/dist/keyboard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Where the keyboard-dismissing drag may start on a screen without pressing anything. */
|
|
2
|
-
import type { ViewportSize } from 'e2e/engine';
|
|
2
|
+
import type { ViewportSize } from '@e2e-dev/core/engine';
|
|
3
3
|
import { type ProjectedSnapshot } from './nodes.ts';
|
|
4
4
|
import type { Point } from './support.ts';
|
|
5
5
|
/**
|
package/dist/links.d.ts
CHANGED
|
@@ -31,8 +31,17 @@ export declare function linkTarget(input: string): URL;
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function assertAppId(app: string): void;
|
|
33
33
|
/**
|
|
34
|
-
* The link as the report shows it
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* The link as the report shows it: parsed with the parser `openLink` opens
|
|
35
|
+
* it with, then without its userinfo, query, or fragment, any of which may
|
|
36
|
+
* carry a credential (a magic link's one-time token, a `user:password@`
|
|
37
|
+
* login), as `printableUrl` does on the web. A step label is kept for as long
|
|
38
|
+
* as the report is. A string that fails to parse is never echoed, as
|
|
39
|
+
* `linkTarget` never echoes it, and the label is a placeholder.
|
|
37
40
|
*/
|
|
38
41
|
export declare function linkLabel(input: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* The label of an `openApp` step: the app id as it is. `assertAppId` refuses
|
|
44
|
+
* a link, but the step is labeled before it runs, so a string shaped like a
|
|
45
|
+
* link gets the placeholder instead of whatever userinfo it carries.
|
|
46
|
+
*/
|
|
47
|
+
export declare function appLabel(app: string): string;
|
package/dist/links.js
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
* that read local content or inline a document, and the browser wrappers
|
|
11
11
|
* (`view-source:file:...`, `blob:`, `filesystem:`) that carry one inside.
|
|
12
12
|
*/
|
|
13
|
-
import { ConfigurationError, TestError } from 'e2e/engine';
|
|
14
|
-
const FORBIDDEN_PROTOCOLS = new Set(['file:', 'data:', 'javascript:', 'view-source:', 'blob:', 'filesystem:']);
|
|
13
|
+
import { ConfigurationError, isRefusedLinkScheme, TestError } from '@e2e-dev/core/engine';
|
|
15
14
|
/**
|
|
16
15
|
* What agent-device opens as a URL instead of resolving as an app: a
|
|
17
16
|
* `scheme:rest` string with no whitespace. Every string the device would
|
|
@@ -24,7 +23,7 @@ export function isLink(value) {
|
|
|
24
23
|
return LINK_SHAPE.test(value.trim());
|
|
25
24
|
}
|
|
26
25
|
function denyForbiddenScheme(protocol) {
|
|
27
|
-
if (
|
|
26
|
+
if (isRefusedLinkScheme(protocol)) {
|
|
28
27
|
throw new ConfigurationError('POLICY_DENIED', `forbidden URL scheme: ${protocol}`);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -62,11 +61,35 @@ export function assertAppId(app) {
|
|
|
62
61
|
denyForbiddenScheme(`${(link[1] ?? '').toLowerCase()}:`);
|
|
63
62
|
throw new TestError('INVALID_ARGUMENT', 'openApp opens an app by bundle id, package, or display name; open a deep link or web link with device.openLink');
|
|
64
63
|
}
|
|
64
|
+
/** What the report shows for a link that did not parse, or an app id that looks like a link. */
|
|
65
|
+
const LINK_PLACEHOLDER = '<link>';
|
|
65
66
|
/**
|
|
66
|
-
* The link as the report shows it
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* The link as the report shows it: parsed with the parser `openLink` opens
|
|
68
|
+
* it with, then without its userinfo, query, or fragment, any of which may
|
|
69
|
+
* carry a credential (a magic link's one-time token, a `user:password@`
|
|
70
|
+
* login), as `printableUrl` does on the web. A step label is kept for as long
|
|
71
|
+
* as the report is. A string that fails to parse is never echoed, as
|
|
72
|
+
* `linkTarget` never echoes it, and the label is a placeholder.
|
|
69
73
|
*/
|
|
70
74
|
export function linkLabel(input) {
|
|
71
|
-
|
|
75
|
+
let url;
|
|
76
|
+
try {
|
|
77
|
+
url = new URL(input);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return LINK_PLACEHOLDER;
|
|
81
|
+
}
|
|
82
|
+
url.username = '';
|
|
83
|
+
url.password = '';
|
|
84
|
+
url.search = '';
|
|
85
|
+
url.hash = '';
|
|
86
|
+
return url.href;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The label of an `openApp` step: the app id as it is. `assertAppId` refuses
|
|
90
|
+
* a link, but the step is labeled before it runs, so a string shaped like a
|
|
91
|
+
* link gets the placeholder instead of whatever userinfo it carries.
|
|
92
|
+
*/
|
|
93
|
+
export function appLabel(app) {
|
|
94
|
+
return isLink(app) ? LINK_PLACEHOLDER : app;
|
|
72
95
|
}
|
package/dist/locate.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* device just reported. One immediate pass, every match in document order;
|
|
5
5
|
* polling, strictness, and staleness stay with the runner.
|
|
6
6
|
*/
|
|
7
|
-
import { type LocatorExpression } from 'e2e/engine';
|
|
7
|
+
import { type LocatorExpression } from '@e2e-dev/core/engine';
|
|
8
8
|
import { type ProjectedNode } from './nodes.ts';
|
|
9
9
|
import type { MobilePlatform } from './options.ts';
|
|
10
10
|
/** Resolves one expression to the nodes it currently matches; `platform` is the one agent-device selectors match for. */
|
package/dist/locate.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* device just reported. One immediate pass, every match in document order;
|
|
5
5
|
* polling, strictness, and staleness stay with the runner.
|
|
6
6
|
*/
|
|
7
|
-
import { EngineError, matchesText } from 'e2e/engine';
|
|
7
|
+
import { EngineError, matchesText } from '@e2e-dev/core/engine';
|
|
8
8
|
import { isWithin } from './nodes.js';
|
|
9
9
|
import { compileSelector } from './selector.js';
|
|
10
10
|
/** Resolves one expression to the nodes it currently matches; `platform` is the one agent-device selectors match for. */
|
package/dist/nodes.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* ids the surface owns.
|
|
8
8
|
*/
|
|
9
9
|
import type { CaptureSnapshotResult, SnapshotNode } from 'agent-device';
|
|
10
|
-
import type { SemanticNode, ViewportSize } from 'e2e/engine';
|
|
10
|
+
import type { SemanticNode, ViewportSize } from '@e2e-dev/core/engine';
|
|
11
11
|
import type { Rect } from './support.ts';
|
|
12
12
|
/**
|
|
13
13
|
* One agent-device snapshot node as this engine reads it: agent-device's own
|
package/dist/options.d.ts
CHANGED
|
@@ -39,10 +39,12 @@ export interface MobileOptions {
|
|
|
39
39
|
* drives the `n`th, so `workers` at or above the pool size runs the target's
|
|
40
40
|
* files across every device at once. Omitted, the pool is every booted device
|
|
41
41
|
* of the platform at `prepare` that no other agent-device session holds, as
|
|
42
|
-
* many as the run has slots
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* many as the run has slots. A paired iPhone or iPad that is reachable (USB or network) counts as booted and
|
|
43
|
+
* joins the pool. With none booted, agent-device boots a shut-down one: on
|
|
44
|
+
* iOS an iPhone over an iPad over an Apple TV, on Android a phone or tablet
|
|
45
|
+
* over a TV, then the newest OS, then name order (a stopped Android emulator
|
|
46
|
+
* reports no OS version, so the name decides). With every booted one held,
|
|
47
|
+
* `prepare` fails. A `DeviceProvider` leases hosted devices
|
|
46
48
|
* instead: one per worker slot at `prepare`, each driven through the daemon
|
|
47
49
|
* and client configuration the lease names. A replacement worker resumes a
|
|
48
50
|
* healthy agent-device session on the same lease. Forced worker shutdown
|
package/dist/pool.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `init`, and `finish` releases what the source acquired.
|
|
12
12
|
*/
|
|
13
13
|
import type { DeviceBootOptions } from 'agent-device';
|
|
14
|
-
import { type EngineFinishInfo, type EnginePrepareInfo, type EnginePrepareResult } from 'e2e/engine';
|
|
14
|
+
import { type EngineFinishInfo, type EnginePrepareInfo, type EnginePrepareResult } from '@e2e-dev/core/engine';
|
|
15
15
|
import { type SlotBinding } from './bindings.ts';
|
|
16
16
|
import type { MobileOptions, MobilePlatform, ClientFactory } from './options.ts';
|
|
17
17
|
import { type RecordingDeviceProvider } from './provider.ts';
|
package/dist/pool.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* environment. The worker that owns a slot then resumes its session in
|
|
11
11
|
* `init`, and `finish` releases what the source acquired.
|
|
12
12
|
*/
|
|
13
|
-
import { ConfigurationError, EngineError, obj, withinCleanupBudget, } from 'e2e/engine';
|
|
13
|
+
import { ConfigurationError, EngineError, obj, withinCleanupBudget, } from '@e2e-dev/core/engine';
|
|
14
14
|
import { bindingsVariable, decodeBindings, deviceLabel, encodeBindings, pinnedApp } from './bindings.js';
|
|
15
15
|
import { isRunnerFailure, message, runCommand } from './errors.js';
|
|
16
16
|
import { asDeviceProvider, LeasedDevices } from './provider.js';
|
|
@@ -104,7 +104,7 @@ class BootedDevices {
|
|
|
104
104
|
throw new EngineError('ENGINE_FAILURE', `every booted ${this.platform} device is held by another agent-device session (${heldBy}); boot another one, close a holding session, or name the device in the target's \`device\` option`, { retryable: false });
|
|
105
105
|
}
|
|
106
106
|
if (chosen.length === 0) {
|
|
107
|
-
info.log(`no booted ${this.platform} device; agent-device boots a shut-down one (newest OS, then name)`);
|
|
107
|
+
info.log(`no booted ${this.platform} device; agent-device boots a shut-down one (iPhone over iPad over Apple TV on iOS, phone or tablet over TV on Android, then newest OS, then name)`);
|
|
108
108
|
return [{}];
|
|
109
109
|
}
|
|
110
110
|
const skipped = held.length === 0 ? '' : `, skipping ${held.length} held by another agent-device session (${heldBy})`;
|
package/dist/provider.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* knows any vendor: a hosted simulator service, a device farm, or a daemon on
|
|
9
9
|
* a machine down the hall are each one small provider in user code.
|
|
10
10
|
*/
|
|
11
|
-
import { type EngineFinishInfo, type EnginePrepareInfo, type ProviderRecordContext, type ProviderRecording } from 'e2e/engine';
|
|
11
|
+
import { type EngineFinishInfo, type EnginePrepareInfo, type ProviderRecordContext, type ProviderRecording } from '@e2e-dev/core/engine';
|
|
12
12
|
import { type DeviceClientConfig, type DeviceDaemon, type DeviceSource, type SlotBinding } from './bindings.ts';
|
|
13
13
|
import type { MobileOptions, MobilePlatform } from './options.ts';
|
|
14
14
|
/** What the engine asks a provider for: one device for one worker slot of a run. */
|
|
@@ -117,7 +117,7 @@ export interface DeviceProvider {
|
|
|
117
117
|
* records with agent-device. `lease` is the lease as it traveled to the
|
|
118
118
|
* worker: its `id` and the other fields declared on `DeviceLease`, never
|
|
119
119
|
* what else the provider kept on the object `acquire` returned.
|
|
120
|
-
* `ProviderRecording` comes from
|
|
120
|
+
* `ProviderRecording` comes from `@e2e-dev/core/engine`: its `stop` writes a file
|
|
121
121
|
* into the directory it is given, or names a recording the service keeps
|
|
122
122
|
* by URL.
|
|
123
123
|
*/
|
package/dist/provider.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { ConfigurationError, EngineError, isProviderRecording, obj, } from 'e2e/engine';
|
|
13
|
+
import { ConfigurationError, EngineError, isProviderRecording, obj, } from '@e2e-dev/core/engine';
|
|
14
14
|
import { isSlotBinding } from './bindings.js';
|
|
15
15
|
import { message } from './errors.js';
|
|
16
16
|
import { isLink } from './links.js';
|
package/dist/selector.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* strictness stays with the runner.
|
|
8
8
|
*/
|
|
9
9
|
import { listSelectorChainMatches, parseSelectorChain } from 'agent-device/selectors';
|
|
10
|
-
import { EngineError } from 'e2e/engine';
|
|
10
|
+
import { EngineError } from '@e2e-dev/core/engine';
|
|
11
11
|
import { message } from './errors.js';
|
|
12
12
|
/**
|
|
13
13
|
* Compiles one selector string for a platform. Alternatives (agent-device's
|
package/dist/support.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Shared helpers for the agent-device engine: error constructors, filenames, PNG headers, gestures, the screen location and size. */
|
|
2
2
|
import type { CaptureScreenshotResult, PressOptions } from 'agent-device';
|
|
3
|
-
import { EngineError, type Momentum, type ScrollDirection, type ViewportSize } from 'e2e/engine';
|
|
3
|
+
import { EngineError, type Momentum, type ScrollDirection, type ViewportSize } from '@e2e-dev/core/engine';
|
|
4
4
|
import type { AgentDeviceClient } from './options.ts';
|
|
5
5
|
export interface Point {
|
|
6
6
|
readonly x: number;
|
package/dist/support.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Shared helpers for the agent-device engine: error constructors, filenames, PNG headers, gestures, the screen location and size. */
|
|
2
|
-
import { EngineError, withTimeout } from 'e2e/engine';
|
|
2
|
+
import { EngineError, withTimeout } from '@e2e-dev/core/engine';
|
|
3
3
|
export function cancelled(text) {
|
|
4
4
|
return new EngineError('CANCELLED', text, { retryable: false });
|
|
5
5
|
}
|
package/dist/surface.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* wrapping the device's top-level elements; a `swipe` performed on that root
|
|
12
12
|
* scrolls the whole screen.
|
|
13
13
|
*/
|
|
14
|
-
import { type EngineAttemptContext, type EngineCleanupContext, type EngineDoctorCheck, type EngineDoctorInfo, 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';
|
|
14
|
+
import { type EngineAttemptContext, type EngineCleanupContext, type EngineDoctorCheck, type EngineDoctorInfo, type EngineInitInfo, type EngineObserveOptions, type EngineSnapshot, type LocatorAction, type LocatorExpression, type NodeRef, type OperationContext, type PointerAction, type VideoSegment, type SemanticNode, type ViewportPoint } from '@e2e-dev/core/engine';
|
|
15
15
|
import { type AgentDeviceClient, type ClientFactory, type DevicePermission, type LaunchPermissions, type MobileOptions, type PermissionState } from './options.ts';
|
|
16
16
|
import { DevicePool, type DeviceSelection } from './pool.ts';
|
|
17
17
|
import { InputBudget } from './support.ts';
|
|
@@ -119,6 +119,10 @@ export declare class AgentDeviceSurface {
|
|
|
119
119
|
private latestScreen;
|
|
120
120
|
/** Budget a control that came with the last action gets to finish arriving; see DEFAULT_TRANSITION_MS. */
|
|
121
121
|
private readonly transitionMs;
|
|
122
|
+
/** Whether snapshots keep interactive nodes only, from the `snapshot` option. */
|
|
123
|
+
private readonly interactiveSnapshots;
|
|
124
|
+
/** Whether recordings hide the touch overlay, from the `videoTouches` option. */
|
|
125
|
+
private readonly hideTouches;
|
|
122
126
|
/**
|
|
123
127
|
* The screen's logical size as last learned from a snapshot with geometry
|
|
124
128
|
* or from the device itself, so a snapshot without geometry (an empty
|
|
@@ -245,7 +249,7 @@ export declare class AgentDeviceSurface {
|
|
|
245
249
|
* no identity, and the package that took the link as its bundle id when
|
|
246
250
|
* the OS told it; the next snapshot names the foreground app either way.
|
|
247
251
|
*/
|
|
248
|
-
openLink(url: URL, app: string | undefined, signal: AbortSignal): Promise<void>;
|
|
252
|
+
openLink(url: URL, app: string | undefined, signal: AbortSignal, input?: InputBudget): Promise<void>;
|
|
249
253
|
/**
|
|
250
254
|
* What a launch leaves behind. The identity is the app agent-device named;
|
|
251
255
|
* a link the OS routed keeps the last known one until the next snapshot
|
package/dist/surface.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
15
15
|
import { tmpdir } from 'node:os';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
-
import { EngineError, KEY_NAMES, parseKey, raceAbort, rejectUnknownKeys, stopProviderRecording, withinCleanupBudget, ConfigurationError, TestError, } from 'e2e/engine';
|
|
17
|
+
import { EngineError, KEY_NAMES, parseKey, raceAbort, rejectUnknownKeys, stopProviderRecording, withinCleanupBudget, ConfigurationError, TestError, } from '@e2e-dev/core/engine';
|
|
18
18
|
import { isAppNotRunning, isSnapshotPresentationFailure, isUnreadableCapture, runCommand, staleOr } from './errors.js';
|
|
19
19
|
import { pointerInteraction, DEFAULT_LONG_PRESS_MS } from './actions.js';
|
|
20
20
|
import { resolveExpression } from './locate.js';
|
|
@@ -155,6 +155,8 @@ const MOBILE_OPTION_KEYS = Object.keys({
|
|
|
155
155
|
transition: true,
|
|
156
156
|
videoTouches: true,
|
|
157
157
|
});
|
|
158
|
+
/** Every `snapshot` value, kept equal to `MobileOptions['snapshot']` by the compiler. */
|
|
159
|
+
const SNAPSHOT_MODES = Object.keys({ full: true, interactive: true });
|
|
158
160
|
/** Every state a permission takes, kept equal to `PermissionState` by the compiler. */
|
|
159
161
|
const PERMISSION_STATES = Object.keys({ grant: true, deny: true, reset: true });
|
|
160
162
|
/**
|
|
@@ -225,6 +227,26 @@ function settleOptions(settle) {
|
|
|
225
227
|
}
|
|
226
228
|
return { settle: true, settleQuietMs: quietMs };
|
|
227
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Resolves the `snapshot` option to whether captures keep interactive nodes
|
|
232
|
+
* only; `'Interactive'` used to capture the full tree as if unset.
|
|
233
|
+
*/
|
|
234
|
+
function interactiveSnapshots(snapshot) {
|
|
235
|
+
if (snapshot !== undefined && !SNAPSHOT_MODES.includes(snapshot)) {
|
|
236
|
+
throw new ConfigurationError('INVALID_CONFIG', `mobile: \`snapshot\` must be ${SNAPSHOT_MODES.map((mode) => `'${mode}'`).join(' or ')}, got ${JSON.stringify(snapshot)}`);
|
|
237
|
+
}
|
|
238
|
+
return snapshot === 'interactive';
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Resolves the `videoTouches` option to whether recordings hide the touch
|
|
242
|
+
* overlay; `'false'` used to draw the touches as if unset.
|
|
243
|
+
*/
|
|
244
|
+
function hideTouches(videoTouches) {
|
|
245
|
+
if (videoTouches !== undefined && typeof videoTouches !== 'boolean') {
|
|
246
|
+
throw new ConfigurationError('INVALID_CONFIG', `mobile: \`videoTouches\` must be true or false, got ${JSON.stringify(videoTouches)}`);
|
|
247
|
+
}
|
|
248
|
+
return videoTouches === false;
|
|
249
|
+
}
|
|
228
250
|
/** Calls one of the harness's trace hooks; a hook that throws, or one an older harness lacks, never fails the device's work. */
|
|
229
251
|
function tellHarness(call) {
|
|
230
252
|
try {
|
|
@@ -283,6 +305,10 @@ export class AgentDeviceSurface {
|
|
|
283
305
|
latestScreen;
|
|
284
306
|
/** Budget a control that came with the last action gets to finish arriving; see DEFAULT_TRANSITION_MS. */
|
|
285
307
|
transitionMs;
|
|
308
|
+
/** Whether snapshots keep interactive nodes only, from the `snapshot` option. */
|
|
309
|
+
interactiveSnapshots;
|
|
310
|
+
/** Whether recordings hide the touch overlay, from the `videoTouches` option. */
|
|
311
|
+
hideTouches;
|
|
286
312
|
/**
|
|
287
313
|
* The screen's logical size as last learned from a snapshot with geometry
|
|
288
314
|
* or from the device itself, so a snapshot without geometry (an empty
|
|
@@ -299,6 +325,8 @@ export class AgentDeviceSurface {
|
|
|
299
325
|
this.pool = new DevicePool(options, createClient);
|
|
300
326
|
this.settleOptions = settleOptions(options.settle);
|
|
301
327
|
this.transitionMs = transitionMs(options.transition);
|
|
328
|
+
this.interactiveSnapshots = interactiveSnapshots(options.snapshot);
|
|
329
|
+
this.hideTouches = hideTouches(options.videoTouches);
|
|
302
330
|
}
|
|
303
331
|
/** Whether the target pins an app for `app.open()`, `app.restart()`, and `app.clearState()` to launch. */
|
|
304
332
|
get managesApp() {
|
|
@@ -485,7 +513,7 @@ export class AgentDeviceSurface {
|
|
|
485
513
|
path: absolute,
|
|
486
514
|
quality: 'medium',
|
|
487
515
|
recordingScope: 'device',
|
|
488
|
-
...(this.
|
|
516
|
+
...(this.hideTouches ? { hideTouches: true } : {}),
|
|
489
517
|
}), operation.signal);
|
|
490
518
|
// The device confirmed: it is recording from about now.
|
|
491
519
|
recording.startedAt = new Date().toISOString();
|
|
@@ -674,15 +702,19 @@ export class AgentDeviceSurface {
|
|
|
674
702
|
* no identity, and the package that took the link as its bundle id when
|
|
675
703
|
* the OS told it; the next snapshot names the foreground app either way.
|
|
676
704
|
*/
|
|
677
|
-
async openLink(url, app, signal) {
|
|
705
|
+
async openLink(url, app, signal, input) {
|
|
678
706
|
const target = app ?? this.pinnedApp;
|
|
679
707
|
if (target === undefined && this.options.platform === 'ios') {
|
|
680
708
|
throw new TestError('INVALID_ARGUMENT', "openLink needs an app on iOS: pass `app`, or pin one with the target's app.bundleId or app.appPath; the session observes the app a link is opened into");
|
|
681
709
|
}
|
|
682
|
-
const result = await this.command('device.openLink', (client) =>
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
710
|
+
const result = await this.command('device.openLink', (client) => {
|
|
711
|
+
const open = () => client.apps.open({
|
|
712
|
+
...this.selection(),
|
|
713
|
+
...(target === undefined ? { app: url.href } : { app: target, url: url.href }),
|
|
714
|
+
});
|
|
715
|
+
// An `app.open(path)` is an input like a tap: past its budget the link may have opened, so it is never repeated.
|
|
716
|
+
return input === undefined ? open() : input.send(open);
|
|
717
|
+
}, signal);
|
|
686
718
|
this.launched(result.appBundleId ?? (target === undefined ? undefined : (result.appName ?? target)));
|
|
687
719
|
}
|
|
688
720
|
/**
|
|
@@ -896,7 +928,7 @@ export class AgentDeviceSurface {
|
|
|
896
928
|
return logicalScreenSize(result);
|
|
897
929
|
}
|
|
898
930
|
async observe(operation, options, budget) {
|
|
899
|
-
const raw = await this.snapshotOrEmpty(operation, this.
|
|
931
|
+
const raw = await this.snapshotOrEmpty(operation, this.interactiveSnapshots, budget);
|
|
900
932
|
const projected = this.project(raw);
|
|
901
933
|
this.generation = new Map(projected.index.map((entry) => [entry.id, this.bind(entry, projected)]));
|
|
902
934
|
const viewport = await this.viewportFor(projected, operation.signal, budget);
|
package/dist/tools.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* the platforms of the engines it was built from, so a mixed suite never
|
|
7
7
|
* offers it on a browser.
|
|
8
8
|
*/
|
|
9
|
-
import { type DefinedTool } from 'e2e/agent';
|
|
10
|
-
import { type EngineHandle } from 'e2e/engine';
|
|
9
|
+
import { type DefinedTool } from '@e2e-dev/core/agent';
|
|
10
|
+
import { type EngineHandle } from '@e2e-dev/core/engine';
|
|
11
11
|
import { type DeviceSession } from './device.ts';
|
|
12
12
|
/**
|
|
13
13
|
* The running attempt's raw driver session, for a custom tool that needs
|
package/dist/tools.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* offers it on a browser.
|
|
8
8
|
*/
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
import { defineTool } from 'e2e/agent';
|
|
11
|
-
import { EngineError, TestError } from 'e2e/engine';
|
|
10
|
+
import { defineTool } from '@e2e-dev/core/agent';
|
|
11
|
+
import { EngineError, TestError } from '@e2e-dev/core/engine';
|
|
12
12
|
import { rawSession } from './device.js';
|
|
13
13
|
import { surfaceOf } from './engine.js';
|
|
14
14
|
import { isAppNotInstalled } from './errors.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e2e-dev/mobile",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8-nightly-20261116092245",
|
|
4
4
|
"description": "Mobile engine (iOS and Android) for e2e agentic end-to-end testing, built on agent-device",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"types": "./dist/index.d.ts",
|
|
42
42
|
"default": "./dist/index.js"
|
|
43
43
|
},
|
|
44
|
+
"./engine": {
|
|
45
|
+
"types": "./dist/engine-entry.d.ts",
|
|
46
|
+
"default": "./dist/engine-entry.js"
|
|
47
|
+
},
|
|
44
48
|
"./tools": {
|
|
45
49
|
"types": "./dist/tools.d.ts",
|
|
46
50
|
"default": "./dist/tools.js"
|
|
@@ -60,18 +64,23 @@
|
|
|
60
64
|
"zod": "4.6.7"
|
|
61
65
|
},
|
|
62
66
|
"peerDependencies": {
|
|
67
|
+
"@e2e-dev/core": "0.23.2-nightly-20261116092245",
|
|
63
68
|
"ai": "^7.0.0",
|
|
64
|
-
"e2e": "
|
|
69
|
+
"e2e": "0.23.2-nightly-20261116092245"
|
|
65
70
|
},
|
|
66
71
|
"peerDependenciesMeta": {
|
|
67
72
|
"ai": {
|
|
68
73
|
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"e2e": {
|
|
76
|
+
"optional": true
|
|
69
77
|
}
|
|
70
78
|
},
|
|
71
79
|
"devDependencies": {
|
|
80
|
+
"@e2e-dev/core": "0.23.2-nightly-20261116092245",
|
|
72
81
|
"@types/node": "26.6.6",
|
|
73
|
-
"ai": "7.0.
|
|
74
|
-
"e2e": "0.23.
|
|
82
|
+
"ai": "7.0.173",
|
|
83
|
+
"e2e": "0.23.2-nightly-20261116092245",
|
|
75
84
|
"typescript": "7.0.2",
|
|
76
85
|
"vitest": "5.1.0"
|
|
77
86
|
},
|