@e2e-dev/electron 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +91 -2
  4. package/dist/.build.json +1 -0
  5. package/dist/actionability.d.ts +41 -0
  6. package/dist/actionability.js +121 -0
  7. package/dist/actions.d.ts +52 -0
  8. package/dist/actions.js +418 -0
  9. package/dist/app-process.d.ts +114 -0
  10. package/dist/app-process.js +610 -0
  11. package/dist/budget.d.ts +33 -0
  12. package/dist/budget.js +64 -0
  13. package/dist/capture.d.ts +21 -0
  14. package/dist/capture.js +137 -0
  15. package/dist/cdp/connection.d.ts +68 -0
  16. package/dist/cdp/connection.js +232 -0
  17. package/dist/cdp/input.d.ts +67 -0
  18. package/dist/cdp/input.js +195 -0
  19. package/dist/cdp/keys.d.ts +21 -0
  20. package/dist/cdp/keys.js +114 -0
  21. package/dist/console-text.d.ts +4 -0
  22. package/dist/console-text.js +27 -0
  23. package/dist/devtools.d.ts +36 -0
  24. package/dist/devtools.js +111 -0
  25. package/dist/dialogs.d.ts +38 -0
  26. package/dist/dialogs.js +81 -0
  27. package/dist/electron.d.ts +9 -0
  28. package/dist/electron.js +174 -0
  29. package/dist/engine-entry.d.ts +13 -0
  30. package/dist/engine-entry.js +9 -0
  31. package/dist/engine.d.ts +27 -0
  32. package/dist/engine.js +98 -0
  33. package/dist/errors.d.ts +17 -0
  34. package/dist/errors.js +54 -0
  35. package/dist/evaluate.d.ts +40 -0
  36. package/dist/evaluate.js +115 -0
  37. package/dist/executable.d.ts +29 -0
  38. package/dist/executable.js +249 -0
  39. package/dist/ffmpeg.d.ts +12 -0
  40. package/dist/ffmpeg.js +100 -0
  41. package/dist/fields.d.ts +93 -0
  42. package/dist/fields.js +254 -0
  43. package/dist/file-bound.d.ts +31 -0
  44. package/dist/file-bound.js +104 -0
  45. package/dist/fixtures.d.ts +168 -0
  46. package/dist/fixtures.js +6 -0
  47. package/dist/in-page/masks.d.ts +25 -0
  48. package/dist/in-page/masks.js +140 -0
  49. package/dist/in-page/node-ops.d.ts +96 -0
  50. package/dist/in-page/node-ops.js +406 -0
  51. package/dist/index.d.ts +18 -0
  52. package/dist/index.js +18 -0
  53. package/dist/launcher.d.ts +45 -0
  54. package/dist/launcher.js +167 -0
  55. package/dist/locate.d.ts +46 -0
  56. package/dist/locate.js +103 -0
  57. package/dist/main-process.d.ts +25 -0
  58. package/dist/main-process.js +60 -0
  59. package/dist/options.d.ts +65 -0
  60. package/dist/options.js +120 -0
  61. package/dist/page.d.ts +100 -0
  62. package/dist/page.js +229 -0
  63. package/dist/runner-test.d.ts +15 -0
  64. package/dist/runner-test.js +45 -0
  65. package/dist/snapshot.d.ts +143 -0
  66. package/dist/snapshot.js +260 -0
  67. package/dist/surface.d.ts +158 -0
  68. package/dist/surface.js +602 -0
  69. package/dist/tree.d.ts +51 -0
  70. package/dist/tree.js +406 -0
  71. package/dist/video.d.ts +42 -0
  72. package/dist/video.js +253 -0
  73. package/dist/windows.d.ts +81 -0
  74. package/dist/windows.js +200 -0
  75. package/package.json +72 -3
@@ -0,0 +1,260 @@
1
+ /**
2
+ * One `DOMSnapshot.captureSnapshot` document, indexed once: each element's
3
+ * facts by backend DOM node id, and the questions the projection asks of the
4
+ * document's order (source text, white space between runs, table cells,
5
+ * subtrees). Pure: the surface reads the snapshot, this answers from it.
6
+ */
7
+ /** The computed styles a snapshot is captured with, in the order `layout.styles` lists them. */
8
+ export const SNAPSHOT_STYLES = ['visibility'];
9
+ /** Elements a screenshot paints over besides a secure field's value: the nested documents the engine does not read. */
10
+ export const MASKED_TAGS = ['IFRAME', 'FRAME', 'WEBVIEW', 'EMBED', 'OBJECT'];
11
+ /** Elements a click on a label would press instead of the label's own control. */
12
+ const CONTROL_TAGS = new Set(['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'SUMMARY']);
13
+ /** `Node.TEXT_NODE`. */
14
+ const TEXT_NODE = 3;
15
+ /** A password input: it reports no value and no text, and a screenshot paints it over. */
16
+ export function isSecureField(nodeName, attributes) {
17
+ return nodeName === 'INPUT' && attributes['type']?.toLowerCase() === 'password';
18
+ }
19
+ /** Collapses runs of white space the way rendered text reads. */
20
+ export function collapse(text) {
21
+ return text.replace(/\s+/g, ' ').trim();
22
+ }
23
+ export class DomSnapshot {
24
+ strings;
25
+ names;
26
+ parents;
27
+ types;
28
+ values;
29
+ backendIds;
30
+ attributePairs;
31
+ closedShadow;
32
+ rendered;
33
+ facts = new Map();
34
+ /** Per node with a layout box, its device-pixel bounds. */
35
+ boxes = new Map();
36
+ /** The label elements that name an id with `for`, by that id. */
37
+ labelsFor = new Map();
38
+ /** Per node, how many white-space-only text nodes precede or are it. */
39
+ blanks = [];
40
+ /** Per node, its nearest table cell, or -1. */
41
+ cells = [];
42
+ constructor(document, strings) {
43
+ const { nodes, layout } = document;
44
+ this.strings = strings;
45
+ this.names = nodes.nodeName ?? [];
46
+ this.parents = nodes.parentIndex ?? [];
47
+ this.types = nodes.nodeType ?? [];
48
+ this.values = nodes.nodeValue ?? [];
49
+ this.backendIds = nodes.backendNodeId ?? [];
50
+ this.attributePairs = nodes.attributes ?? [];
51
+ this.rendered = new Set(layout.nodeIndex);
52
+ this.closedShadow = new Set([...this.rare(nodes.shadowRootType)].filter(([, type]) => type === 'closed').map(([node]) => node));
53
+ this.types.forEach((_, index) => this.blanks.push((this.blanks[index - 1] ?? 0) + (/^\s+$/.test(this.sourceText(index) ?? '') ? 1 : 0)));
54
+ // A parent precedes its children, so its cell is known first.
55
+ this.names.forEach((_, index) => {
56
+ const name = this.nameAt(index);
57
+ this.cells.push(name === 'TD' || name === 'TH' ? index : (this.cells[this.parents[index] ?? -1] ?? -1));
58
+ });
59
+ this.indexFacts(nodes, layout);
60
+ }
61
+ /** The element with this backend DOM node id, if the snapshot holds it. */
62
+ element(backendNodeId) {
63
+ return this.facts.get(backendNodeId);
64
+ }
65
+ /** Every node of the document, text nodes included, by backend DOM node id. */
66
+ elements() {
67
+ return this.facts.entries();
68
+ }
69
+ /** A text node's text as the source has it, white space included; undefined for any other node. */
70
+ sourceText(index) {
71
+ return this.types[index] === TEXT_NODE ? (this.strings[this.values[index]] ?? '') : undefined;
72
+ }
73
+ /** Whether the source has white space (a text node of nothing else) between two nodes, which reads as a space, as it renders. */
74
+ gap(from, to) {
75
+ return from >= 0 && to > from && (this.blanks[to - 1] ?? 0) - (this.blanks[from] ?? 0) > 0;
76
+ }
77
+ /** The snapshot index of the node's parent, or -1 for the document. */
78
+ parentOf(index) {
79
+ return this.parents[index] ?? -1;
80
+ }
81
+ /** The node's nearest table cell, from the DOM: Chromium gives a layout table's cells no cell role. */
82
+ cellOf(index) {
83
+ return this.cells[index] ?? -1;
84
+ }
85
+ /** The snapshot indices inside the node at `index`, itself included: its descendants follow it in document order. */
86
+ subtree(index) {
87
+ const inside = new Set([index]);
88
+ for (let at = index + 1; at < this.parents.length && inside.has(this.parents[at] ?? -1); at += 1)
89
+ inside.add(at);
90
+ return inside;
91
+ }
92
+ /** The text content of the node at `index`, white space collapsed. */
93
+ textContent(index) {
94
+ return collapse([...this.subtree(index)].map((at) => this.sourceText(at) ?? '').join(''));
95
+ }
96
+ /** The backend ids of the node's ancestors, nearest first. */
97
+ *ancestors(index) {
98
+ for (let at = this.parents[index] ?? -1; at >= 0; at = this.parents[at] ?? -1)
99
+ yield this.backendIds[at];
100
+ }
101
+ /** Whether anything inside the node, itself aside, has a layout box: what a `display: contents` wrapper holds. */
102
+ rendersContent(index) {
103
+ for (const at of this.subtree(index))
104
+ if (at !== index && this.rendered.has(at))
105
+ return true;
106
+ return false;
107
+ }
108
+ /**
109
+ * Whether a shown label of the element's own draws it: a label around it or
110
+ * one whose `for` names it, with a box, that is no control itself and holds
111
+ * no other one. A checkbox or radio with no box under such a label is on
112
+ * screen as the label, as the web reads it.
113
+ */
114
+ drawnByLabel(index) {
115
+ const id = this.attributesAt(index)['id'];
116
+ // An empty `for` names no element, as `label.control` reads it.
117
+ const labels = id === undefined || id === '' ? [] : [...(this.labelsFor.get(id) ?? [])];
118
+ // A label around the control is its label only when it has no `for`, which names another control or none.
119
+ for (let at = this.parents[index] ?? -1; at >= 0; at = this.parents[at] ?? -1)
120
+ if (this.nameAt(at) === 'LABEL' && !('for' in this.attributesAt(at)))
121
+ labels.push(at);
122
+ return labels.some((label) => {
123
+ const box = this.boxes.get(label);
124
+ if (box === undefined || (box[2] ?? 0) === 0 || (box[3] ?? 0) === 0)
125
+ return false;
126
+ for (const at of this.subtree(label))
127
+ if (at !== index && at !== label && this.isControl(at))
128
+ return false;
129
+ return true;
130
+ });
131
+ }
132
+ /**
133
+ * How many rendered elements a screenshot must paint over and a selector
134
+ * cannot reach: password inputs and nested documents inside a closed shadow
135
+ * root, at any depth. The snapshot enters every shadow root, so it holds
136
+ * whatever the accessibility tree leaves out (`aria-hidden`, the node cap).
137
+ * Every other such element in the document, open shadow roots included, a
138
+ * selector mask covers.
139
+ */
140
+ unmaskableCount() {
141
+ if (this.closedShadow.size === 0)
142
+ return 0;
143
+ let count = 0;
144
+ this.names.forEach((_, index) => {
145
+ if (!this.rendered.has(index))
146
+ return;
147
+ const name = this.nameAt(index);
148
+ if (!isSecureField(name, this.attributesAt(index)) && !MASKED_TAGS.includes(name))
149
+ return;
150
+ for (let at = index; at >= 0; at = this.parents[at] ?? -1) {
151
+ if (this.closedShadow.has(at)) {
152
+ count += 1;
153
+ return;
154
+ }
155
+ }
156
+ });
157
+ return count;
158
+ }
159
+ isControl(index) {
160
+ if (CONTROL_TAGS.has(this.nameAt(index)))
161
+ return true;
162
+ const attributes = this.attributesAt(index);
163
+ return 'contenteditable' in attributes || attributes['role'] === 'button' || attributes['role'] === 'link';
164
+ }
165
+ nameAt(index) {
166
+ return this.strings[this.names[index]] ?? '';
167
+ }
168
+ attributesAt(index) {
169
+ const pairs = this.attributePairs[index] ?? [];
170
+ const record = {};
171
+ for (let at = 0; at + 1 < pairs.length; at += 2)
172
+ record[(this.strings[pairs[at]] ?? '').toLowerCase()] = this.strings[pairs[at + 1]] ?? '';
173
+ return record;
174
+ }
175
+ rare(table) {
176
+ const values = new Map();
177
+ table?.index.forEach((node, at) => values.set(node, this.strings[table.value[at]] ?? ''));
178
+ return values;
179
+ }
180
+ indexFacts(nodes, layout) {
181
+ const inputValues = this.rare(nodes.inputValue);
182
+ const textValues = this.rare(nodes.textValue);
183
+ const selectValues = this.selectValues(nodes.optionSelected?.index ?? []);
184
+ const checked = new Set(nodes.inputChecked?.index ?? []);
185
+ const withText = this.nodesWithText();
186
+ const bounds = this.boxes;
187
+ const invisible = new Set();
188
+ layout.nodeIndex.forEach((node, at) => {
189
+ if (!bounds.has(node))
190
+ bounds.set(node, layout.bounds[at]);
191
+ const visibility = this.strings[layout.styles?.[at]?.[0] ?? -1];
192
+ if (visibility === 'hidden' || visibility === 'collapse')
193
+ invisible.add(node);
194
+ });
195
+ this.backendIds.forEach((backendNodeId, index) => {
196
+ const named = this.nameAt(index) === 'LABEL' ? this.attributesAt(index)['for'] : undefined;
197
+ if (named !== undefined)
198
+ this.labelsFor.set(named, [...(this.labelsFor.get(named) ?? []), index]);
199
+ const input = inputValues.get(index);
200
+ const text = textValues.get(index);
201
+ const selected = selectValues.get(index);
202
+ const box = bounds.get(index);
203
+ this.facts.set(backendNodeId, {
204
+ index,
205
+ nodeName: this.nameAt(index),
206
+ attributes: this.attributesAt(index),
207
+ hasText: withText.has(index),
208
+ invisible: invisible.has(index),
209
+ checked: checked.has(index),
210
+ ...(input === undefined ? {} : { inputValue: input }),
211
+ ...(text === undefined ? {} : { textValue: text }),
212
+ ...(selected === undefined ? {} : { selectValue: selected }),
213
+ ...(box === undefined ? {} : { bounds: box }),
214
+ });
215
+ });
216
+ }
217
+ /** The node indices whose text content holds anything but white space: every ancestor of such a text node. */
218
+ nodesWithText() {
219
+ const marked = new Set();
220
+ this.types.forEach((_, index) => {
221
+ if ((this.sourceText(index) ?? '').trim() === '')
222
+ return;
223
+ for (let at = this.parents[index] ?? -1; at >= 0 && !marked.has(at); at = this.parents[at] ?? -1)
224
+ marked.add(at);
225
+ });
226
+ return marked;
227
+ }
228
+ /**
229
+ * Each select's value, by node index: what its first selected option
230
+ * submits, the option's `value` attribute or else its text, as
231
+ * `HTMLSelectElement.value` reads it. An option's text is all the text
232
+ * under it, with ASCII white space collapsed and no other: a no-break
233
+ * space stays one.
234
+ */
235
+ selectValues(selected) {
236
+ const values = new Map();
237
+ if (selected.length === 0)
238
+ return values;
239
+ const texts = new Map();
240
+ this.types.forEach((_, index) => {
241
+ const text = this.sourceText(index);
242
+ if (text === undefined)
243
+ return;
244
+ let option = this.parents[index] ?? -1;
245
+ while (option >= 0 && this.nameAt(option) !== 'OPTION')
246
+ option = this.parents[option] ?? -1;
247
+ if (option >= 0)
248
+ texts.set(option, (texts.get(option) ?? '') + text);
249
+ });
250
+ for (const option of selected.toSorted((a, b) => a - b)) {
251
+ let select = this.parents[option] ?? -1;
252
+ while (select >= 0 && this.nameAt(select) !== 'SELECT')
253
+ select = this.parents[select] ?? -1;
254
+ if (select < 0 || values.has(select))
255
+ continue;
256
+ values.set(select, this.attributesAt(option)['value'] ?? (texts.get(option) ?? '').replace(/[\t\n\f\r ]+/g, ' ').replace(/^ | $/g, ''));
257
+ }
258
+ return values;
259
+ }
260
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * The Electron surface: one app per attempt, launched by `app.open()` with
3
+ * an empty user-data directory of the attempt's own, its windows read
4
+ * through Chromium's accessibility tree over the DevTools protocol and
5
+ * driven with trusted input events. Everything here goes through the engine
6
+ * contract of `@e2e-dev/core/engine` and the DevTools protocol itself: the
7
+ * engine starts the binary and speaks the protocol with no library between.
8
+ *
9
+ * The state has three lifetimes, each in a module of its own: the worker's
10
+ * (options, executable), the attempt's (its user-data directory and
11
+ * artifacts), and the running app's (`AppProcess` and `Windows`).
12
+ */
13
+ import type { ComputedStyleProperty, ComputedStyleValues, ViewportIntersection, VideoSegment, EngineAttemptContext, EngineCleanupContext, EngineDoctorCheck, EngineDoctorInfo, EngineInitInfo, EngineObserveOptions, EnginePrepareInfo, EngineSnapshot, LocatorAction, LocatorExpression, NodeRef, OperationContext, PointerAction, SemanticNode, ViewportPoint } from '@e2e-dev/core/engine';
14
+ import { type LaunchExtra } from './app-process.ts';
15
+ import { Budget } from './budget.ts';
16
+ import { type DialogHandler } from './dialogs.ts';
17
+ import type { ElectronMainModule } from './fixtures.ts';
18
+ import { type ResolvedElectronOptions } from './options.ts';
19
+ import type { WindowMatcher } from './fixtures.ts';
20
+ import { type AppWindow } from './windows.ts';
21
+ export declare class ElectronSurface {
22
+ private readonly options;
23
+ private projectRoot;
24
+ private appInfo;
25
+ private runEnv;
26
+ private executable;
27
+ private attempt;
28
+ private userDataDir;
29
+ /** What `electron.launch()` added to this attempt's launches. */
30
+ private launchExtra;
31
+ private uploadsDir;
32
+ private artifactCounter;
33
+ private recorder;
34
+ /** Recordings started this attempt, for their file names. */
35
+ private recordings;
36
+ private readonly devtools;
37
+ private readonly windowList;
38
+ private readonly dialogs;
39
+ private readonly app;
40
+ constructor(options: ResolvedElectronOptions);
41
+ prepare(info: EnginePrepareInfo): Promise<void>;
42
+ doctor(info: EngineDoctorInfo): Promise<readonly EngineDoctorCheck[]>;
43
+ init(info: EngineInitInfo): Promise<void>;
44
+ startAttempt(context: EngineAttemptContext): Promise<void>;
45
+ endAttempt(context: EngineCleanupContext): Promise<void>;
46
+ /** A dialog the test's last step opened has no next step to fail: the attempt fails with it, as a step would. */
47
+ settleAttempt(context: EngineCleanupContext): Promise<void>;
48
+ dispose(context: EngineCleanupContext): Promise<void>;
49
+ /** `app.open()` and `app.restart()`: quits the app if it runs and launches it again on the attempt's app data. */
50
+ restart(operation: OperationContext): Promise<void>;
51
+ /** `app.clearState()`: quits the app, empties its data, and launches it again. */
52
+ reset(operation: OperationContext): Promise<void>;
53
+ /** `electron.userDataDir`: the attempt's own directory, there before the app is launched so a test can put data in it. */
54
+ dataDirectory(): string;
55
+ /** `electron.launch()`: a fresh launch as `app.open()` does, with `extra` added to this and every later launch of the attempt. */
56
+ launchWith(extra: LaunchExtra, operation: OperationContext): Promise<void>;
57
+ /** The project root, which a test's relative paths resolve against. */
58
+ get root(): string;
59
+ private launch;
60
+ private projection;
61
+ /**
62
+ * Reads the shown window. A window can close between being picked and being
63
+ * read, before its close event arrives: it is discarded and the window shown
64
+ * in its place is read. A window whose renderer crashed answers nothing: the
65
+ * read waits, until `deadline`, for the app to load it again, then says it
66
+ * crashed. Undefined when no window is open.
67
+ */
68
+ private readShown;
69
+ /**
70
+ * Whether work on a window failed because the window closed, which can
71
+ * happen before its close event arrives. It is forgotten here, so the
72
+ * caller goes on with the window shown in its place.
73
+ */
74
+ private closedUnder;
75
+ observe(operation: OperationContext, options?: EngineObserveOptions): Promise<EngineSnapshot>;
76
+ locate(expression: LocatorExpression, operation: OperationContext): Promise<readonly SemanticNode[]>;
77
+ /**
78
+ * Hands the trace the screen an action left, as `locate` hands it the one
79
+ * it matched against: bounded to a second, and never failing the action.
80
+ */
81
+ private traceScreen;
82
+ private actions;
83
+ /** Why the window is not one to observe, trace, or capture: it shows a local file outside the app's directory. */
84
+ private leftApp;
85
+ /** Fails the step that follows a dialog nothing answered, or whose handler failed. */
86
+ private failOnDialog;
87
+ private requireWindow;
88
+ /**
89
+ * Every action goes through here: its input within the operation's budget,
90
+ * then time for the UI to settle when an agent acts (it reads the screen
91
+ * right after; a test's own steps verify with `expect`), then the screen
92
+ * it left for the trace.
93
+ */
94
+ private act;
95
+ perform(ref: NodeRef, action: LocatorAction, operation: OperationContext): Promise<void>;
96
+ performAt(point: ViewportPoint, action: PointerAction, operation: OperationContext): Promise<void>;
97
+ typeText(text: string, options: {
98
+ readonly replace: boolean;
99
+ }, operation: OperationContext): Promise<void>;
100
+ pressKey(key: string, operation: OperationContext): Promise<void>;
101
+ /**
102
+ * `electron.keyboard.*` and `electron.mouse.*`: input to the shown window,
103
+ * wherever its focus and pointer are, taking its turn after the gestures
104
+ * before it as every action does.
105
+ */
106
+ input(label: string, send: (window: AppWindow, budget: Budget) => Promise<void>, operation: OperationContext): Promise<void>;
107
+ switchTab(index: number, operation: OperationContext): Promise<void>;
108
+ closeTab(index: number, operation: OperationContext): Promise<void>;
109
+ /** The app's open windows, in the order they opened. */
110
+ openWindows(): readonly AppWindow[];
111
+ /** `electron.activeWindow()`: the window `screen` reads. */
112
+ shownWindow(): AppWindow;
113
+ isActiveWindow(window: AppWindow): boolean;
114
+ /** `window.activate()`: reads and acts in the window from now on. */
115
+ activateWindow(window: AppWindow, operation: OperationContext): Promise<void>;
116
+ /** `window.close()`: any window, the app's last one too. */
117
+ closeWindow(window: AppWindow, operation: OperationContext): Promise<void>;
118
+ /** `window.evaluate()`: runs test code in the window's page, with the app's own globals. */
119
+ evaluateInWindow<R, A>(window: AppWindow, fn: (arg: A) => R | Promise<R>, arg: A, operation: OperationContext): Promise<R>;
120
+ /** `window.reload()`: the window's document loaded again. */
121
+ reloadWindow(window: AppWindow, operation: OperationContext): Promise<void>;
122
+ /** `electron.window()`: the first open window `which` matches, waited for until the operation's deadline. */
123
+ findWindow(which: WindowMatcher, operation: OperationContext): Promise<AppWindow>;
124
+ /**
125
+ * `electron.waitForWindow()`: runs `trigger`, waits for a window that was
126
+ * not open before it, and makes that window the active one. The trigger is
127
+ * test code: its error is reported as it is.
128
+ */
129
+ waitForWindow(trigger: () => Promise<void>, operation: OperationContext): Promise<AppWindow>;
130
+ /**
131
+ * `window.title()`: the document's title, else the OS window's for a
132
+ * document with none, or one that does not answer as a crashed renderer's
133
+ * does not. Either is a title `electron.window({ title })` matches.
134
+ */
135
+ windowTitle(window: AppWindow, operation: OperationContext): Promise<string>;
136
+ /** `electron.onDialog()`: answers the app's dialogs from now on, until what it returns is called. */
137
+ onDialog(handler: DialogHandler): () => void;
138
+ /** Runs a function in the app's main process. */
139
+ evaluate<R, A>(fn: (electron: ElectronMainModule, arg: A) => R | Promise<R>, arg: A, operation: OperationContext): Promise<R>;
140
+ readStyle(ref: NodeRef, properties: readonly ComputedStyleProperty[], operation: OperationContext): Promise<ComputedStyleValues>;
141
+ viewportIntersection(ref: NodeRef, operation: OperationContext): Promise<ViewportIntersection>;
142
+ /** `app.back()`: the shown window's previous history entry, when it has one. */
143
+ back(operation: OperationContext): Promise<void>;
144
+ /**
145
+ * Runs `trigger` and waits for the next download the app starts to finish,
146
+ * then copies the file into the attempt's artifacts. The trigger is test
147
+ * code: its error is reported as it is.
148
+ */
149
+ waitForDownload(trigger: () => Promise<void>, operation: OperationContext): Promise<{
150
+ readonly path: string;
151
+ readonly absolutePath: string;
152
+ readonly suggestedFilename: string;
153
+ }>;
154
+ screenshot(label: string | undefined, operation: OperationContext): Promise<string>;
155
+ /** Starts a recording: of the shown window now, and of each one shown after it, through a relaunch too. */
156
+ startVideo(operation: OperationContext): Promise<void>;
157
+ stopVideo(): Promise<readonly VideoSegment[]>;
158
+ }