@e2edev/mobile 0.8.0-canary-20260921180210
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 +149 -0
- package/dist/.build.json +1 -0
- package/dist/actions.d.ts +29 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +62 -0
- package/dist/actions.js.map +1 -0
- package/dist/bindings.d.ts +57 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +79 -0
- package/dist/bindings.js.map +1 -0
- package/dist/device.d.ts +77 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +101 -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 +92 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +95 -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/locate.d.ts +11 -0
- package/dist/locate.d.ts.map +1 -0
- package/dist/locate.js +115 -0
- package/dist/locate.js.map +1 -0
- package/dist/nodes.d.ts +86 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +315 -0
- package/dist/nodes.js.map +1 -0
- package/dist/options.d.ts +93 -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 +72 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +185 -0
- package/dist/pool.js.map +1 -0
- package/dist/provider.d.ts +105 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +98 -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 +58 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/support.js +82 -0
- package/dist/support.js.map +1 -0
- package/dist/surface.d.ts +243 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +837 -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 @@
|
|
|
1
|
+
{"version":3,"file":"locate.js","sourceRoot":"","sources":["../src/locate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAA8C,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,iEAAiE;AACjE,MAAM,UAAU,iBAAiB,CAAC,UAA6B,EAAE,KAA+B;IAC9F,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,OAAO,EAAE,CAAC;YACb,MAAM,UAAU,GACd,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;YAC5G,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;YACpF,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC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K,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
package/dist/nodes.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projection of an agent-device accessibility snapshot onto the contract's
|
|
3
|
+
* `SemanticNode` tree. agent-device hands back a flat list with tree
|
|
4
|
+
* coordinates (`index`, `parentIndex`, `depth`) and platform element types;
|
|
5
|
+
* this module rebuilds the tree, maps the types onto the closed role
|
|
6
|
+
* vocabulary `screen.getByRole` and trace relocation speak, and mints the
|
|
7
|
+
* ids the surface owns.
|
|
8
|
+
*/
|
|
9
|
+
import type { SemanticNode, ViewportSize } from 'e2e/engine';
|
|
10
|
+
import type { Rect } from './support.ts';
|
|
11
|
+
/** The subset of an agent-device snapshot node this engine reads. */
|
|
12
|
+
export interface RawNode {
|
|
13
|
+
readonly ref?: string;
|
|
14
|
+
readonly index?: number;
|
|
15
|
+
readonly parentIndex?: number;
|
|
16
|
+
readonly depth?: number;
|
|
17
|
+
readonly type?: string;
|
|
18
|
+
readonly role?: string;
|
|
19
|
+
readonly label?: string;
|
|
20
|
+
readonly value?: string;
|
|
21
|
+
readonly identifier?: string;
|
|
22
|
+
readonly rect?: Rect;
|
|
23
|
+
readonly enabled?: boolean;
|
|
24
|
+
readonly selected?: boolean;
|
|
25
|
+
readonly focused?: boolean;
|
|
26
|
+
readonly visibleToUser?: boolean;
|
|
27
|
+
readonly hittable?: boolean;
|
|
28
|
+
readonly appName?: string;
|
|
29
|
+
readonly windowTitle?: string;
|
|
30
|
+
}
|
|
31
|
+
/** One projected node with what the surface needs to act on it and to answer selector terms. */
|
|
32
|
+
export interface ProjectedNode {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
/** agent-device ref without its `@` prefix; empty for a node the runner cannot act on. */
|
|
35
|
+
readonly ref: string;
|
|
36
|
+
/** Platform element type, lower-cased (`text-field`, `cell`, `navigation-bar`). */
|
|
37
|
+
readonly kind: string;
|
|
38
|
+
readonly raw: RawNode;
|
|
39
|
+
readonly node: SemanticNode;
|
|
40
|
+
readonly parent: ProjectedNode | undefined;
|
|
41
|
+
}
|
|
42
|
+
export interface ProjectedSnapshot {
|
|
43
|
+
/** The device's top-level elements (windows, the application node); the surface wraps them in one root. */
|
|
44
|
+
readonly roots: readonly SemanticNode[];
|
|
45
|
+
/** Every node in document order, parents before children. */
|
|
46
|
+
readonly index: readonly ProjectedNode[];
|
|
47
|
+
readonly viewport: ViewportSize | undefined;
|
|
48
|
+
}
|
|
49
|
+
/** One element-type spelling for `NavigationBar`, `navigation-bar`, and `android.widget.NavigationBar` alike. */
|
|
50
|
+
export declare function normalizeKind(type: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Projects one snapshot. `mintId` is called once per node in document order,
|
|
53
|
+
* so the surface's id space stays unique across observations.
|
|
54
|
+
*/
|
|
55
|
+
export declare function projectSnapshot(raw: readonly RawNode[], options: {
|
|
56
|
+
readonly mintId: () => string;
|
|
57
|
+
}): ProjectedSnapshot;
|
|
58
|
+
/**
|
|
59
|
+
* The screen's logical size, read off the application or window node when
|
|
60
|
+
* the platform emits one, else the extent of every rect; undefined for a
|
|
61
|
+
* snapshot with no geometry at all.
|
|
62
|
+
*/
|
|
63
|
+
export declare function viewportOf(raw: readonly RawNode[]): ViewportSize | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The id of the root node every observation is reported under. It is the
|
|
66
|
+
* same across observations, as the contract requires: `perform(root, swipe)`
|
|
67
|
+
* is the viewport swipe, addressed from an earlier observation.
|
|
68
|
+
*/
|
|
69
|
+
export declare const ROOT_ID = "root";
|
|
70
|
+
/**
|
|
71
|
+
* The one root the contract wants over a device's several top-level
|
|
72
|
+
* elements. Its box is the viewport; it carries no name of its own, the
|
|
73
|
+
* foreground app being reported as the snapshot's location.
|
|
74
|
+
*/
|
|
75
|
+
export declare function screenRoot(roots: readonly SemanticNode[], viewport: ViewportSize): SemanticNode;
|
|
76
|
+
/**
|
|
77
|
+
* The visible screen's title: the navigation bar's (iOS) or toolbar's
|
|
78
|
+
* (Android) own label, else the first text inside it, else its identifier
|
|
79
|
+
* (UIKit names the bar after its title). Undefined when the screen has no
|
|
80
|
+
* title bar, which is the honest answer for a launch screen, a full-screen
|
|
81
|
+
* sheet, or Android's Settings home.
|
|
82
|
+
*/
|
|
83
|
+
export declare function screenTitle(snapshot: ProjectedSnapshot): string | undefined;
|
|
84
|
+
/** True when `entry` is a strict descendant of `ancestor`. */
|
|
85
|
+
export declare function isWithin(entry: ProjectedNode, ancestor: ProjectedNode): boolean;
|
|
86
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,qEAAqE;AACrE,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,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eAAO,MAAM,OAAO,SAAS,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAO/F;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAW3E;AAED,8DAA8D;AAC9D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAK/E"}
|
package/dist/nodes.js
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projection of an agent-device accessibility snapshot onto the contract's
|
|
3
|
+
* `SemanticNode` tree. agent-device hands back a flat list with tree
|
|
4
|
+
* coordinates (`index`, `parentIndex`, `depth`) and platform element types;
|
|
5
|
+
* this module rebuilds the tree, maps the types onto the closed role
|
|
6
|
+
* vocabulary `screen.getByRole` and trace relocation speak, and mints the
|
|
7
|
+
* ids the surface owns.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Platform element types onto the role vocabulary. Anything not listed keeps
|
|
11
|
+
* its lower-cased type as the role, so no information is lost; the map only
|
|
12
|
+
* makes the common controls answer the same `getByRole` a browser does.
|
|
13
|
+
*/
|
|
14
|
+
const ROLE_MAP = {
|
|
15
|
+
button: 'button',
|
|
16
|
+
link: 'link',
|
|
17
|
+
'text-field': 'textbox',
|
|
18
|
+
textfield: 'textbox',
|
|
19
|
+
'search-field': 'textbox',
|
|
20
|
+
'text-view': 'textbox',
|
|
21
|
+
'edit-text': 'textbox',
|
|
22
|
+
'secure-text-field': 'textbox',
|
|
23
|
+
securetextfield: 'textbox',
|
|
24
|
+
switch: 'switch',
|
|
25
|
+
toggle: 'switch',
|
|
26
|
+
checkbox: 'checkbox',
|
|
27
|
+
'check-box': 'checkbox',
|
|
28
|
+
slider: 'slider',
|
|
29
|
+
image: 'image',
|
|
30
|
+
'image-view': 'image',
|
|
31
|
+
'static-text': 'text',
|
|
32
|
+
text: 'text',
|
|
33
|
+
cell: 'listitem',
|
|
34
|
+
'list-item': 'listitem',
|
|
35
|
+
'table-cell': 'listitem',
|
|
36
|
+
'collection-cell': 'listitem',
|
|
37
|
+
tab: 'tab',
|
|
38
|
+
'tab-bar-item': 'tab',
|
|
39
|
+
'tab-bar-button': 'tab',
|
|
40
|
+
'menu-item': 'menuitem',
|
|
41
|
+
'menu-button': 'menuitem',
|
|
42
|
+
alert: 'alert',
|
|
43
|
+
dialog: 'dialog',
|
|
44
|
+
sheet: 'dialog',
|
|
45
|
+
'action-sheet': 'dialog',
|
|
46
|
+
heading: 'heading',
|
|
47
|
+
header: 'heading',
|
|
48
|
+
'navigation-bar': 'navigation',
|
|
49
|
+
'activity-indicator': 'status',
|
|
50
|
+
'progress-indicator': 'status',
|
|
51
|
+
};
|
|
52
|
+
const SECURE_KINDS = new Set(['secure-text-field', 'securetextfield', 'password-field']);
|
|
53
|
+
const CHECKABLE_ROLES = new Set(['switch', 'checkbox']);
|
|
54
|
+
const CHECKED_VALUES = new Set(['1', 'on', 'true', 'checked', 'selected']);
|
|
55
|
+
const UNCHECKED_VALUES = new Set(['0', 'off', 'false', 'unchecked']);
|
|
56
|
+
const SCREEN_KINDS = new Set(['application', 'app', 'window']);
|
|
57
|
+
/**
|
|
58
|
+
* Android view classes onto the role vocabulary, keyed by the simple class
|
|
59
|
+
* name in kebab case. A `TextView` is static text here where an iOS
|
|
60
|
+
* `TextView` is an editor, which is why the two platforms keep separate maps.
|
|
61
|
+
*/
|
|
62
|
+
const ANDROID_ROLE_MAP = {
|
|
63
|
+
'text-view': 'text',
|
|
64
|
+
'edit-text': 'textbox',
|
|
65
|
+
'auto-complete-text-view': 'textbox',
|
|
66
|
+
'text-input-edit-text': 'textbox',
|
|
67
|
+
'search-view': 'textbox',
|
|
68
|
+
button: 'button',
|
|
69
|
+
'image-button': 'button',
|
|
70
|
+
'material-button': 'button',
|
|
71
|
+
'image-view': 'image',
|
|
72
|
+
switch: 'switch',
|
|
73
|
+
'switch-compat': 'switch',
|
|
74
|
+
'switch-material': 'switch',
|
|
75
|
+
'toggle-button': 'switch',
|
|
76
|
+
'check-box': 'checkbox',
|
|
77
|
+
'material-check-box': 'checkbox',
|
|
78
|
+
'radio-button': 'radio',
|
|
79
|
+
'seek-bar': 'slider',
|
|
80
|
+
slider: 'slider',
|
|
81
|
+
spinner: 'combobox',
|
|
82
|
+
'web-view': 'document',
|
|
83
|
+
'recycler-view': 'list',
|
|
84
|
+
'list-view': 'list',
|
|
85
|
+
'grid-view': 'list',
|
|
86
|
+
'scroll-view': 'group',
|
|
87
|
+
'view-group': 'group',
|
|
88
|
+
view: 'group',
|
|
89
|
+
'compose-view': 'group',
|
|
90
|
+
'view-factory-holder': 'group',
|
|
91
|
+
'card-view': 'group',
|
|
92
|
+
};
|
|
93
|
+
/** Identifier suffixes of the view that carries an Android screen's title. */
|
|
94
|
+
const ANDROID_TITLE_IDS = [':id/collapsing_toolbar', ':id/action_bar', ':id/toolbar'];
|
|
95
|
+
/**
|
|
96
|
+
* Platform element type of one raw node as a kebab-case token: XCTest sends
|
|
97
|
+
* `NavigationBar` and `StaticText`, Android sends `android.widget.TextView`;
|
|
98
|
+
* both read as one vocabulary here, the Android package prefix dropped.
|
|
99
|
+
* `role` is the fallback some platforms send instead.
|
|
100
|
+
*/
|
|
101
|
+
function kindOf(raw) {
|
|
102
|
+
return normalizeKind(raw.type ?? raw.role ?? '');
|
|
103
|
+
}
|
|
104
|
+
/** True when a raw type is a qualified Android class name. */
|
|
105
|
+
function isAndroidClass(type) {
|
|
106
|
+
return type !== undefined && type.includes('.');
|
|
107
|
+
}
|
|
108
|
+
/** One element-type spelling for `NavigationBar`, `navigation-bar`, and `android.widget.NavigationBar` alike. */
|
|
109
|
+
export function normalizeKind(type) {
|
|
110
|
+
const simple = type.slice(type.lastIndexOf('.') + 1);
|
|
111
|
+
return simple
|
|
112
|
+
.replaceAll(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
113
|
+
.replaceAll(/[\s_]+/g, '-')
|
|
114
|
+
.toLowerCase();
|
|
115
|
+
}
|
|
116
|
+
/** Contract role for one platform element type. */
|
|
117
|
+
function roleOf(kind, android = false) {
|
|
118
|
+
if (kind === '')
|
|
119
|
+
return undefined;
|
|
120
|
+
if (android)
|
|
121
|
+
return ANDROID_ROLE_MAP[kind] ?? (kind.endsWith('layout') ? 'group' : kind);
|
|
122
|
+
return ROLE_MAP[kind] ?? kind;
|
|
123
|
+
}
|
|
124
|
+
function checkedOf(role, value) {
|
|
125
|
+
if (role === undefined || !CHECKABLE_ROLES.has(role) || value === undefined)
|
|
126
|
+
return undefined;
|
|
127
|
+
const lowered = value.trim().toLowerCase();
|
|
128
|
+
if (CHECKED_VALUES.has(lowered))
|
|
129
|
+
return true;
|
|
130
|
+
if (UNCHECKED_VALUES.has(lowered))
|
|
131
|
+
return false;
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
function stripRef(ref) {
|
|
135
|
+
if (ref === undefined)
|
|
136
|
+
return '';
|
|
137
|
+
return ref.startsWith('@') ? ref.slice(1) : ref;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Parent position of every raw node. `parentIndex` is authoritative when it
|
|
141
|
+
* names a node in the list; otherwise `depth` reconstructs nesting from the
|
|
142
|
+
* document order agent-device emits; a node with neither is a root.
|
|
143
|
+
*/
|
|
144
|
+
function parentPositions(raw) {
|
|
145
|
+
const byIndex = new Map();
|
|
146
|
+
raw.forEach((node, position) => {
|
|
147
|
+
if (typeof node.index === 'number')
|
|
148
|
+
byIndex.set(node.index, position);
|
|
149
|
+
});
|
|
150
|
+
const lastAtDepth = [];
|
|
151
|
+
return raw.map((node, position) => {
|
|
152
|
+
let parent;
|
|
153
|
+
if (typeof node.parentIndex === 'number' && node.parentIndex >= 0) {
|
|
154
|
+
const resolved = byIndex.get(node.parentIndex);
|
|
155
|
+
if (resolved !== undefined && resolved < position)
|
|
156
|
+
parent = resolved;
|
|
157
|
+
}
|
|
158
|
+
if (parent === undefined && typeof node.depth === 'number' && node.depth > 0) {
|
|
159
|
+
parent = lastAtDepth[node.depth - 1];
|
|
160
|
+
}
|
|
161
|
+
if (typeof node.depth === 'number') {
|
|
162
|
+
lastAtDepth[node.depth] = position;
|
|
163
|
+
lastAtDepth.length = node.depth + 1;
|
|
164
|
+
}
|
|
165
|
+
return parent;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Projects one snapshot. `mintId` is called once per node in document order,
|
|
170
|
+
* so the surface's id space stays unique across observations.
|
|
171
|
+
*/
|
|
172
|
+
export function projectSnapshot(raw, options) {
|
|
173
|
+
const parents = parentPositions(raw);
|
|
174
|
+
const children = new Map();
|
|
175
|
+
const roots = [];
|
|
176
|
+
parents.forEach((parent, position) => {
|
|
177
|
+
if (parent === undefined) {
|
|
178
|
+
roots.push(position);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const siblings = children.get(parent);
|
|
182
|
+
if (siblings === undefined)
|
|
183
|
+
children.set(parent, [position]);
|
|
184
|
+
else
|
|
185
|
+
siblings.push(position);
|
|
186
|
+
});
|
|
187
|
+
const index = [];
|
|
188
|
+
const build = (position, parent) => {
|
|
189
|
+
const source = raw[position];
|
|
190
|
+
const id = options.mintId();
|
|
191
|
+
const kind = kindOf(source);
|
|
192
|
+
const role = roleOf(kind, isAndroidClass(source.type));
|
|
193
|
+
const secure = SECURE_KINDS.has(kind);
|
|
194
|
+
const checked = checkedOf(role, source.value);
|
|
195
|
+
const states = {
|
|
196
|
+
...(source.enabled === false ? { disabled: true } : {}),
|
|
197
|
+
...(source.selected === true ? { selected: true } : {}),
|
|
198
|
+
...(source.focused === true ? { focused: true } : {}),
|
|
199
|
+
...(source.visibleToUser === false ? { hidden: true } : {}),
|
|
200
|
+
...(secure ? { secure: true } : {}),
|
|
201
|
+
...(checked === undefined ? {} : { checked }),
|
|
202
|
+
};
|
|
203
|
+
const identifier = source.identifier === undefined || source.identifier === '' ? undefined : source.identifier;
|
|
204
|
+
const projected = { node: undefined };
|
|
205
|
+
const entry = {
|
|
206
|
+
id,
|
|
207
|
+
ref: stripRef(source.ref),
|
|
208
|
+
kind,
|
|
209
|
+
raw: source,
|
|
210
|
+
parent,
|
|
211
|
+
get node() {
|
|
212
|
+
return projected.node;
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
index.push(entry);
|
|
216
|
+
const childNodes = (children.get(position) ?? []).map((child) => build(child, entry));
|
|
217
|
+
const node = {
|
|
218
|
+
ref: { id, revision: '' },
|
|
219
|
+
...(role === undefined ? {} : { role }),
|
|
220
|
+
// A device label is both the node's accessible name and its visible
|
|
221
|
+
// text, so `toHaveText` and `getByText` read the same string; the model
|
|
222
|
+
// rendering elides `text` whenever it equals `name`, so this costs nothing.
|
|
223
|
+
...(source.label === undefined || source.label === '' ? {} : { name: source.label, text: source.label }),
|
|
224
|
+
// A secure field's value is never observed; the tree carries that it is
|
|
225
|
+
// secure, not what it holds. Android echoes a text view's label as its
|
|
226
|
+
// value, which would render every line twice, so an echo is dropped.
|
|
227
|
+
...(secure || source.value === undefined || source.value === '' || source.value === source.label
|
|
228
|
+
? {}
|
|
229
|
+
: { value: source.value }),
|
|
230
|
+
...(secure ? { inputPurpose: 'password' } : {}),
|
|
231
|
+
...(Object.keys(states).length === 0 ? {} : { states }),
|
|
232
|
+
// The accessibility identifier (iOS) or resource id (Android) is the node's test id.
|
|
233
|
+
...(identifier === undefined ? {} : { testId: identifier }),
|
|
234
|
+
...(source.rect === undefined ? {} : { rect: { ...source.rect } }),
|
|
235
|
+
// Structural hint for tuned replay policies: an identifier survives relabeling; a label does not anchor.
|
|
236
|
+
...(identifier === undefined ? {} : { selector: `id=${quoteTerm(identifier)}` }),
|
|
237
|
+
...(childNodes.length === 0 ? {} : { children: childNodes }),
|
|
238
|
+
};
|
|
239
|
+
projected.node = node;
|
|
240
|
+
return node;
|
|
241
|
+
};
|
|
242
|
+
const rootNodes = roots.map((position) => build(position, undefined));
|
|
243
|
+
return { roots: rootNodes, index, viewport: viewportOf(raw) };
|
|
244
|
+
}
|
|
245
|
+
/** Quotes one selector term value the way agent-device's parser reads it back. */
|
|
246
|
+
function quoteTerm(value) {
|
|
247
|
+
return /[\s"]/.test(value) ? JSON.stringify(value) : value;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The screen's logical size, read off the application or window node when
|
|
251
|
+
* the platform emits one, else the extent of every rect; undefined for a
|
|
252
|
+
* snapshot with no geometry at all.
|
|
253
|
+
*/
|
|
254
|
+
export function viewportOf(raw) {
|
|
255
|
+
const screen = raw.find((node) => SCREEN_KINDS.has(kindOf(node)) && node.rect !== undefined);
|
|
256
|
+
if (screen?.rect !== undefined && screen.rect.width > 0 && screen.rect.height > 0) {
|
|
257
|
+
return { width: screen.rect.width, height: screen.rect.height };
|
|
258
|
+
}
|
|
259
|
+
let width = 0;
|
|
260
|
+
let height = 0;
|
|
261
|
+
for (const node of raw) {
|
|
262
|
+
if (node.rect === undefined)
|
|
263
|
+
continue;
|
|
264
|
+
width = Math.max(width, node.rect.x + node.rect.width);
|
|
265
|
+
height = Math.max(height, node.rect.y + node.rect.height);
|
|
266
|
+
}
|
|
267
|
+
return width > 0 && height > 0 ? { width, height } : undefined;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The id of the root node every observation is reported under. It is the
|
|
271
|
+
* same across observations, as the contract requires: `perform(root, swipe)`
|
|
272
|
+
* is the viewport swipe, addressed from an earlier observation.
|
|
273
|
+
*/
|
|
274
|
+
export const ROOT_ID = 'root';
|
|
275
|
+
/**
|
|
276
|
+
* The one root the contract wants over a device's several top-level
|
|
277
|
+
* elements. Its box is the viewport; it carries no name of its own, the
|
|
278
|
+
* foreground app being reported as the snapshot's location.
|
|
279
|
+
*/
|
|
280
|
+
export function screenRoot(roots, viewport) {
|
|
281
|
+
return {
|
|
282
|
+
ref: { id: ROOT_ID, revision: '' },
|
|
283
|
+
role: 'screen',
|
|
284
|
+
rect: { x: 0, y: 0, width: viewport.width, height: viewport.height },
|
|
285
|
+
...(roots.length === 0 ? {} : { children: roots }),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The visible screen's title: the navigation bar's (iOS) or toolbar's
|
|
290
|
+
* (Android) own label, else the first text inside it, else its identifier
|
|
291
|
+
* (UIKit names the bar after its title). Undefined when the screen has no
|
|
292
|
+
* title bar, which is the honest answer for a launch screen, a full-screen
|
|
293
|
+
* sheet, or Android's Settings home.
|
|
294
|
+
*/
|
|
295
|
+
export function screenTitle(snapshot) {
|
|
296
|
+
const bar = snapshot.index.find((entry) => entry.kind === 'navigation-bar') ??
|
|
297
|
+
snapshot.index.find((entry) => ANDROID_TITLE_IDS.some((suffix) => entry.raw.identifier?.endsWith(suffix) === true));
|
|
298
|
+
if (bar === undefined)
|
|
299
|
+
return undefined;
|
|
300
|
+
if (bar.raw.label !== undefined && bar.raw.label.trim() !== '')
|
|
301
|
+
return bar.raw.label;
|
|
302
|
+
const text = snapshot.index.find((entry) => entry.node.role === 'text' && entry.raw.label !== undefined && entry.raw.label.trim() !== '' && isWithin(entry, bar));
|
|
303
|
+
if (text !== undefined)
|
|
304
|
+
return text.raw.label;
|
|
305
|
+
return bar.raw.identifier === undefined || bar.raw.identifier.trim() === '' ? undefined : bar.raw.identifier;
|
|
306
|
+
}
|
|
307
|
+
/** True when `entry` is a strict descendant of `ancestor`. */
|
|
308
|
+
export function isWithin(entry, ancestor) {
|
|
309
|
+
for (let current = entry.parent; current !== undefined; current = current.parent) {
|
|
310
|
+
if (current === ancestor)
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../src/nodes.ts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K,EAAE,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAChI,CAAC;IACF,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC9C,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;AAC/G,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CAAC,KAAoB,EAAE,QAAuB;IACpE,KAAK,IAAI,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACjF,IAAI,OAAO,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the device engine is given: its options, and the agent-device client
|
|
3
|
+
* it drives them through. Shared by the surface (one session per worker) and
|
|
4
|
+
* the pool (the target's devices, one per worker slot).
|
|
5
|
+
*/
|
|
6
|
+
import type { createAgentDeviceClient } from 'agent-device';
|
|
7
|
+
import type { DeviceDaemon } from './bindings.ts';
|
|
8
|
+
import type { DeviceProvider } from './provider.ts';
|
|
9
|
+
export type AgentDeviceClient = ReturnType<typeof createAgentDeviceClient>;
|
|
10
|
+
/**
|
|
11
|
+
* Mints the agent-device client for one session, against a leased daemon
|
|
12
|
+
* when a provider supplied one, else the local daemon; the seam unit tests
|
|
13
|
+
* script.
|
|
14
|
+
*/
|
|
15
|
+
export type ClientFactory = (session: string, daemon?: DeviceDaemon) => AgentDeviceClient;
|
|
16
|
+
export type MobilePlatform = 'ios' | 'android';
|
|
17
|
+
/**
|
|
18
|
+
* Options of the device engine. Every optional value also accepts `undefined`,
|
|
19
|
+
* so values read straight from `process.env` need no conditional spread.
|
|
20
|
+
*/
|
|
21
|
+
export interface MobileOptions {
|
|
22
|
+
/** Platform the target's device runs. */
|
|
23
|
+
readonly platform: MobilePlatform;
|
|
24
|
+
/**
|
|
25
|
+
* App opened fresh at the start of every attempt: a bundle id, a package
|
|
26
|
+
* name, or a display name agent-device resolves (`Settings`). Without it the
|
|
27
|
+
* surface observes whatever is in the foreground, and `app.restart()` and
|
|
28
|
+
* `app.clearState()` are not available.
|
|
29
|
+
*/
|
|
30
|
+
readonly app?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Build to install on the device once per worker, before the first attempt:
|
|
33
|
+
* an iOS `.app` bundle or an Android `.apk`, resolved against the project
|
|
34
|
+
* root (the config's directory). Without `app`, the installed bundle id or
|
|
35
|
+
* package becomes the app opened fresh at the start of every attempt.
|
|
36
|
+
*/
|
|
37
|
+
readonly appPath?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Stable identity keying trace cache and session entries; defaults to `app`,
|
|
40
|
+
* else `appPath`. Declare one when the pinned app differs per run (a build
|
|
41
|
+
* path with a version in it) so entries survive the rename.
|
|
42
|
+
*/
|
|
43
|
+
readonly identity?: string | undefined;
|
|
44
|
+
/** Report label joining the cache identity; a simulator or emulator defaults to `test`. */
|
|
45
|
+
readonly environment?: 'test' | 'staging' | 'production' | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Simulator or emulator to use, by name or UDID. A list is a pool: the
|
|
48
|
+
* engine declares one worker per entry and worker slot `n` drives the
|
|
49
|
+
* `n`th, so `workers` at or above the pool size runs the target's files
|
|
50
|
+
* across every device at once. Omitted, the pool is every booted device of
|
|
51
|
+
* the platform at `prepare`, as many as the run has slots; with none booted,
|
|
52
|
+
* agent-device boots one. A `DeviceProvider` leases hosted devices instead:
|
|
53
|
+
* one per worker slot at `prepare`, each driven through the daemon the
|
|
54
|
+
* lease names, all released when the run ends.
|
|
55
|
+
*/
|
|
56
|
+
readonly device?: string | readonly string[] | DeviceProvider | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* agent-device session name, before the worker slot: slot `n` drives its
|
|
59
|
+
* device under `<session>-<n>`, `e2e-<target name>-<n>` by default. One run
|
|
60
|
+
* per session at a time: concurrent runs on the same session interleave
|
|
61
|
+
* taps.
|
|
62
|
+
*/
|
|
63
|
+
readonly session?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* What an observation captures. `full` (default) includes static text, so
|
|
66
|
+
* judgments can read values; `interactive` keeps only actionable nodes and
|
|
67
|
+
* is cheaper on screens with long lists.
|
|
68
|
+
*/
|
|
69
|
+
readonly snapshot?: 'full' | 'interactive' | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* How long the UI must hold still after a tap, fill, or back before the
|
|
72
|
+
* action counts as landed, in milliseconds; `false` skips the wait. The
|
|
73
|
+
* wait keeps the observation that follows an action off a transition
|
|
74
|
+
* frame; the runner's own polling (`expect`, actions waiting for their
|
|
75
|
+
* node) covers the rest, so a short window suffices. Default 150. Every
|
|
76
|
+
* frame of a running animation changes the tree, so a 150 ms window still
|
|
77
|
+
* catches a transition in flight; raise it for slow devices or apps that
|
|
78
|
+
* settle in stages, or lower it to 0 to keep only the first re-observation.
|
|
79
|
+
*/
|
|
80
|
+
readonly settle?: number | false | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* How long a control that appeared or moved with the last action is given
|
|
83
|
+
* to finish arriving before a test acts on it, in milliseconds. Default
|
|
84
|
+
* 500, the length of a modal or screen transition. Accessibility frames
|
|
85
|
+
* report a control's final position from the first frame of a transition,
|
|
86
|
+
* so this budget is the only thing that keeps a test from tapping a point
|
|
87
|
+
* the control has not reached; controls already on screen at the same
|
|
88
|
+
* place before the action are acted on at once. Raise it for slower
|
|
89
|
+
* transitions.
|
|
90
|
+
*/
|
|
91
|
+
readonly transition?: number | undefined;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=options.d.ts.map
|
|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AAC;IACvD;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7C;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C"}
|
package/dist/options.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the device engine is given: its options, and the agent-device client
|
|
3
|
+
* it drives them through. Shared by the surface (one session per worker) and
|
|
4
|
+
* the pool (the target's devices, one per worker slot).
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/png.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../src/png.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,UAAU,CAmB7E"}
|
package/dist/png.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Screenshot masking policy; PNG parsing and encoding belong to pngjs. */
|
|
2
|
+
import { PNG } from 'pngjs';
|
|
3
|
+
/** Paints each requested rectangle opaque black, rounding outward and clipping to the image. */
|
|
4
|
+
export function maskPng(bytes, rects) {
|
|
5
|
+
if (rects.length === 0)
|
|
6
|
+
return bytes;
|
|
7
|
+
const image = PNG.sync.read(Buffer.from(bytes));
|
|
8
|
+
for (const rect of rects) {
|
|
9
|
+
const x0 = Math.max(0, Math.floor(rect.x));
|
|
10
|
+
const y0 = Math.max(0, Math.floor(rect.y));
|
|
11
|
+
const x1 = Math.min(image.width, Math.ceil(rect.x + rect.width));
|
|
12
|
+
const y1 = Math.min(image.height, Math.ceil(rect.y + rect.height));
|
|
13
|
+
for (let y = y0; y < y1; y += 1) {
|
|
14
|
+
for (let x = x0; x < x1; x += 1) {
|
|
15
|
+
const at = (y * image.width + x) * 4;
|
|
16
|
+
image.data[at] = 0;
|
|
17
|
+
image.data[at + 1] = 0;
|
|
18
|
+
image.data[at + 2] = 0;
|
|
19
|
+
image.data[at + 3] = 255;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return PNG.sync.write(image);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=png.js.map
|
package/dist/png.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.js","sourceRoot":"","sources":["../src/png.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,gGAAgG;AAChG,MAAM,UAAU,OAAO,CAAC,KAAiB,EAAE,KAAsB;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,I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