@e2e-dev/web 0.11.0-canary-20260928184528
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +138 -0
- package/dist/.build.json +1 -0
- package/dist/actions.d.ts +23 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +174 -0
- package/dist/actions.js.map +1 -0
- package/dist/attempt-session.d.ts +77 -0
- package/dist/attempt-session.d.ts.map +1 -0
- package/dist/attempt-session.js +293 -0
- package/dist/attempt-session.js.map +1 -0
- package/dist/browser-connection.d.ts +34 -0
- package/dist/browser-connection.d.ts.map +1 -0
- package/dist/browser-connection.js +86 -0
- package/dist/browser-connection.js.map +1 -0
- package/dist/capture-scope.d.ts +21 -0
- package/dist/capture-scope.d.ts.map +1 -0
- package/dist/capture-scope.js +61 -0
- package/dist/capture-scope.js.map +1 -0
- package/dist/cdp-recovery.d.ts +29 -0
- package/dist/cdp-recovery.d.ts.map +1 -0
- package/dist/cdp-recovery.js +84 -0
- package/dist/cdp-recovery.js.map +1 -0
- package/dist/cdp-selectors.d.ts +15 -0
- package/dist/cdp-selectors.d.ts.map +1 -0
- package/dist/cdp-selectors.js +52 -0
- package/dist/cdp-selectors.js.map +1 -0
- package/dist/closed-shadow.d.ts +64 -0
- package/dist/closed-shadow.d.ts.map +1 -0
- package/dist/closed-shadow.js +142 -0
- package/dist/closed-shadow.js.map +1 -0
- package/dist/dialogs.d.ts +38 -0
- package/dist/dialogs.d.ts.map +1 -0
- package/dist/dialogs.js +87 -0
- package/dist/dialogs.js.map +1 -0
- package/dist/engine.d.ts +26 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +176 -0
- package/dist/engine.js.map +1 -0
- package/dist/evaluation.d.ts +18 -0
- package/dist/evaluation.d.ts.map +1 -0
- package/dist/evaluation.js +35 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/in-page/read-semantics.d.ts +28 -0
- package/dist/in-page/read-semantics.d.ts.map +1 -0
- package/dist/in-page/read-semantics.js +1178 -0
- package/dist/in-page/read-semantics.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +40 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +117 -0
- package/dist/install.js.map +1 -0
- package/dist/label-selector.d.ts +37 -0
- package/dist/label-selector.d.ts.map +1 -0
- package/dist/label-selector.js +53 -0
- package/dist/label-selector.js.map +1 -0
- package/dist/locators.d.ts +76 -0
- package/dist/locators.d.ts.map +1 -0
- package/dist/locators.js +289 -0
- package/dist/locators.js.map +1 -0
- package/dist/observation-capture.d.ts +12 -0
- package/dist/observation-capture.d.ts.map +1 -0
- package/dist/observation-capture.js +93 -0
- package/dist/observation-capture.js.map +1 -0
- package/dist/observation.d.ts +63 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +280 -0
- package/dist/observation.js.map +1 -0
- package/dist/observe.d.ts +51 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +105 -0
- package/dist/observe.js.map +1 -0
- package/dist/operation-budget.d.ts +11 -0
- package/dist/operation-budget.d.ts.map +1 -0
- package/dist/operation-budget.js +40 -0
- package/dist/operation-budget.js.map +1 -0
- package/dist/protected-app.d.ts +32 -0
- package/dist/protected-app.d.ts.map +1 -0
- package/dist/protected-app.js +39 -0
- package/dist/protected-app.js.map +1 -0
- package/dist/provider.d.ts +158 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +311 -0
- package/dist/provider.js.map +1 -0
- package/dist/read-node.d.ts +152 -0
- package/dist/read-node.d.ts.map +1 -0
- package/dist/read-node.js +42 -0
- package/dist/read-node.js.map +1 -0
- package/dist/refs.d.ts +43 -0
- package/dist/refs.d.ts.map +1 -0
- package/dist/refs.js +85 -0
- package/dist/refs.js.map +1 -0
- package/dist/route-pattern.d.ts +13 -0
- package/dist/route-pattern.d.ts.map +1 -0
- package/dist/route-pattern.js +55 -0
- package/dist/route-pattern.js.map +1 -0
- package/dist/selector-engines.d.ts +6 -0
- package/dist/selector-engines.d.ts.map +1 -0
- package/dist/selector-engines.js +8 -0
- package/dist/selector-engines.js.map +1 -0
- package/dist/support.d.ts +147 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/support.js +366 -0
- package/dist/support.js.map +1 -0
- package/dist/surface.d.ts +313 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +691 -0
- package/dist/surface.js.map +1 -0
- package/dist/video.d.ts +59 -0
- package/dist/video.d.ts.map +1 -0
- package/dist/video.js +116 -0
- package/dist/video.js.map +1 -0
- package/dist/web.d.ts +191 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +382 -0
- package/dist/web.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Playwright surface: one browser per worker, one browser context per
|
|
3
|
+
* attempt, and the page every engine member delegates to. This is the closure
|
|
4
|
+
* state behind `web()`; the engine hooks in `engine.ts` and the `web`
|
|
5
|
+
* fixture in `web.ts` are thin delegates onto it. Action dispatch lives in
|
|
6
|
+
* `actions.ts` and tree capture in `observation.ts`. `AttemptSession` owns
|
|
7
|
+
* the attempt's live binding, recovery, references, and recordings.
|
|
8
|
+
*/
|
|
9
|
+
import type { BrowserContext, Page, Route } from 'playwright';
|
|
10
|
+
import { type EngineAppDeclaration, type EngineAttemptContext, type EngineCleanupContext, type EngineInitInfo, type EngineObserveOptions, type EnginePrepareInfo, type EnginePrepareResult, type EngineFinishInfo, type EngineSnapshot, type EngineState, type LocatorAction, type LocatorExpression, type NodeRef, type OperationContext, type PointerAction, type SemanticNode, type VideoSegment, type ViewportPoint, type ViewportSize } from 'e2e/engine';
|
|
11
|
+
import { type BrowserName } from './browser-connection.ts';
|
|
12
|
+
import { type BrowserProvider } from './provider.ts';
|
|
13
|
+
import { DialogRouter } from './dialogs.ts';
|
|
14
|
+
import { ErrorLatch } from './support.ts';
|
|
15
|
+
type RoutePredicate = (url: URL) => boolean;
|
|
16
|
+
type RouteHandler = (route: Route) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Attach to a remote browser over CDP instead of launching a local one. The
|
|
19
|
+
* seam a hosted-browser engine plugs into: a per-run cloud session (its
|
|
20
|
+
* endpoint provisioned only once the run starts) resolves through
|
|
21
|
+
* `cdpEndpoint` at `init`, and again at an attempt start after a disconnect.
|
|
22
|
+
* Supplying `reconnectEndpoint` opts into a persistent context instead.
|
|
23
|
+
* CDP attach is chromium-only.
|
|
24
|
+
*/
|
|
25
|
+
export interface WebConnectOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the CDP endpoint (a `ws://`/`wss://` or `http://` DevTools URL)
|
|
28
|
+
* to attach to. Async because a hosted endpoint is not known at config load;
|
|
29
|
+
* called once per worker in `init`, and again at the start of any attempt
|
|
30
|
+
* that finds the session dropped, so a fresh per-run URL reconnects cleanly.
|
|
31
|
+
* With `reconnectEndpoint`, init defers provisioning and every attempt
|
|
32
|
+
* calls this resolver for a fresh, dedicated browser instead.
|
|
33
|
+
* `signal` aborts when the init or attempt that needs the browser is
|
|
34
|
+
* cancelled or exceeds its budget: a resolver that provisions a session
|
|
35
|
+
* should stop and release it, since a browser that arrives late is detached.
|
|
36
|
+
*/
|
|
37
|
+
readonly cdpEndpoint: (signal: AbortSignal) => string | Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Opts into a dedicated persistent remote context. `cdpEndpoint` provisions
|
|
40
|
+
* a fresh browser at each attempt start; this resolver reconnects to that
|
|
41
|
+
* same browser after a transport drop. Called once before the next
|
|
42
|
+
* operation, within its budget. The original browser and page must survive.
|
|
43
|
+
* Dispatched operations are never retried. The host owns browser cleanup.
|
|
44
|
+
* Context replacement, headers, and basicAuth are unavailable in this mode.
|
|
45
|
+
*/
|
|
46
|
+
readonly reconnectEndpoint?: (signal: AbortSignal) => string | Promise<string>;
|
|
47
|
+
}
|
|
48
|
+
/** HTTP basic authentication the browser answers a `401` challenge with. */
|
|
49
|
+
export interface WebBasicAuth {
|
|
50
|
+
/** The user name; `:` is not allowed in one (RFC 7617). */
|
|
51
|
+
readonly username: string;
|
|
52
|
+
readonly password: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options of the browser engine: the app it drives (`url`, `command`,
|
|
56
|
+
* `services`, `environment`, `identity`, `readyUrl` - the
|
|
57
|
+
* engine contract's app declaration) plus the browser itself.
|
|
58
|
+
*/
|
|
59
|
+
export interface WebOptions extends EngineAppDeclaration {
|
|
60
|
+
/**
|
|
61
|
+
* Browser to launch, `chromium` by default. A `BrowserProvider` leases
|
|
62
|
+
* hosted browsers instead: one per worker slot at `prepare`, or one per
|
|
63
|
+
* attempt, each attached to over CDP and released when its scope ends. A
|
|
64
|
+
* provider implies chromium and excludes `connect`.
|
|
65
|
+
*/
|
|
66
|
+
readonly browser?: BrowserName | BrowserProvider;
|
|
67
|
+
/**
|
|
68
|
+
* Initial viewport of every attempt's page; default 1280 by 720. `null`
|
|
69
|
+
* emulates no size: the page fills the browser window, whatever size the
|
|
70
|
+
* window has (a hosted browser's live view, a headed run), and
|
|
71
|
+
* `web.setViewport` still fixes one for the rest of the attempt.
|
|
72
|
+
*/
|
|
73
|
+
readonly viewport?: ViewportSize | null;
|
|
74
|
+
/**
|
|
75
|
+
* Attach to a remote browser over CDP instead of launching locally. Requires
|
|
76
|
+
* the chromium browser (the default). Wired by a hosted-browser engine.
|
|
77
|
+
*/
|
|
78
|
+
readonly connect?: WebConnectOptions;
|
|
79
|
+
/**
|
|
80
|
+
* HTTP headers added to every request the browser sends to an allowed
|
|
81
|
+
* origin: a preview-protection bypass token, a tunnel's interstitial skip.
|
|
82
|
+
* Requests to any other origin (a CDN, an analytics endpoint, an identity
|
|
83
|
+
* provider) never carry them, so a header that is a secret stays with the
|
|
84
|
+
* app it unlocks. Names are case-insensitive; a header the page already
|
|
85
|
+
* sends under the same name is replaced. Applies to every path onto the
|
|
86
|
+
* page, deterministic and agent-driven alike. Injecting headers routes
|
|
87
|
+
* every request of the attempt, which turns the browser's HTTP cache off
|
|
88
|
+
* and blocks service workers (a worker's requests bypass routing, so a
|
|
89
|
+
* page it controlled would reach the gate bare), and a Playwright trace
|
|
90
|
+
* records request headers.
|
|
91
|
+
*/
|
|
92
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
93
|
+
/**
|
|
94
|
+
* HTTP basic authentication for a staging app behind a browser challenge.
|
|
95
|
+
* The browser answers a `401` with these credentials wherever one is
|
|
96
|
+
* issued, as Playwright's own `httpCredentials` does. Applies to every path
|
|
97
|
+
* onto the page.
|
|
98
|
+
*/
|
|
99
|
+
readonly basicAuth?: WebBasicAuth;
|
|
100
|
+
/**
|
|
101
|
+
* The attribute that carries an element's test id: what the `testId` query
|
|
102
|
+
* (`screen.getByTestId`) resolves and what `SemanticNode.testId` reports.
|
|
103
|
+
* Defaults to `data-testid`.
|
|
104
|
+
*/
|
|
105
|
+
readonly testIdAttribute?: string;
|
|
106
|
+
}
|
|
107
|
+
export declare class PlaywrightSurface {
|
|
108
|
+
/**
|
|
109
|
+
* Errors raised where nobody awaits them (dialog routing, route handlers)
|
|
110
|
+
* wait here and fail the next step that enters the surface.
|
|
111
|
+
*/
|
|
112
|
+
latch: ErrorLatch;
|
|
113
|
+
dialogs: DialogRouter;
|
|
114
|
+
private readonly browserName;
|
|
115
|
+
private readonly connection;
|
|
116
|
+
private readonly connect;
|
|
117
|
+
/** The provider's browsers, when `browser` names one; the runner and worker halves of the lease bookkeeping. */
|
|
118
|
+
private readonly leases;
|
|
119
|
+
private session;
|
|
120
|
+
private readonly usedContexts;
|
|
121
|
+
private readonly viewport;
|
|
122
|
+
/** Injected request headers, names lowercased so they replace the browser's own of the same name. */
|
|
123
|
+
private readonly headers;
|
|
124
|
+
private readonly basicAuth;
|
|
125
|
+
private readonly testIdAttribute;
|
|
126
|
+
private app;
|
|
127
|
+
private headed;
|
|
128
|
+
private artifactsDir;
|
|
129
|
+
private artifactCounter;
|
|
130
|
+
/**
|
|
131
|
+
* Attempt-scoped network routes. Registered on the
|
|
132
|
+
* context, not a page, so they cover every page the attempt opens - the
|
|
133
|
+
* first navigation included - and re-applied to each context the attempt
|
|
134
|
+
* replaces on `reset` or session restore.
|
|
135
|
+
*/
|
|
136
|
+
private routes;
|
|
137
|
+
constructor(options: WebOptions);
|
|
138
|
+
/**
|
|
139
|
+
* Installs the browser on first run, once per run before any worker, or
|
|
140
|
+
* leases the run's browsers from a provider. A CDP attach uses the
|
|
141
|
+
* remote's browser, so only a local launch needs the browser here. The
|
|
142
|
+
* download narrates through `info.log` and is bounded by the run's
|
|
143
|
+
* interrupt alone, never by a launch budget.
|
|
144
|
+
*/
|
|
145
|
+
prepare(info: EnginePrepareInfo): Promise<EnginePrepareResult | void>;
|
|
146
|
+
/** Releases the browsers `prepare` leased; a local launch or a `connect` has nothing to release. */
|
|
147
|
+
finish(info: EngineFinishInfo): Promise<void>;
|
|
148
|
+
/** Provisions the shared browser once per worker: a local launch, or a CDP attach. */
|
|
149
|
+
init(info: EngineInitInfo): Promise<void>;
|
|
150
|
+
/** Whether attempts ride a persistent remote context, provisioned per attempt, instead of contexts on one shared browser. */
|
|
151
|
+
private get persistent();
|
|
152
|
+
/**
|
|
153
|
+
* Provisions the shared browser through the shared connection — a launch, or a CDP attach
|
|
154
|
+
* via the connector — bounded by `signal`. Checked before the endpoint is
|
|
155
|
+
* resolved: a cancelled caller must never provision a remote session it will
|
|
156
|
+
* not use.
|
|
157
|
+
*/
|
|
158
|
+
private acquireBrowser;
|
|
159
|
+
/**
|
|
160
|
+
* Builds the connection's connector when attaching over CDP; undefined for a local
|
|
161
|
+
* launch. The connector honours `signal` at every await: the resolver
|
|
162
|
+
* receives it, the endpoint is not used once aborted, and a browser that
|
|
163
|
+
* connects after cancellation is detached at once rather than cached — the
|
|
164
|
+
* host's session is never held by an init or attempt that already gave up.
|
|
165
|
+
*/
|
|
166
|
+
private connector;
|
|
167
|
+
/**
|
|
168
|
+
* Where the shared browser's CDP endpoint comes from: the `connect`
|
|
169
|
+
* resolver, or the lease the worker holds from a provider; undefined for a
|
|
170
|
+
* local launch.
|
|
171
|
+
*/
|
|
172
|
+
private endpointSource;
|
|
173
|
+
/** The endpoint of the lease the worker holds; only reached with a provider. */
|
|
174
|
+
private leaseEndpoint;
|
|
175
|
+
/**
|
|
176
|
+
* The persistent remote context this attempt rides, when it does: the
|
|
177
|
+
* `connect` resolvers, or a browser leased for this attempt alone, which
|
|
178
|
+
* reconnects through the lease's own endpoint. Undefined for isolated
|
|
179
|
+
* contexts on the shared browser.
|
|
180
|
+
*/
|
|
181
|
+
private persistentBinding;
|
|
182
|
+
/** Opens one attempt owner before setup starts, so cleanup can cancel pending attachment. */
|
|
183
|
+
startAttempt(context: EngineAttemptContext): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Waits for a route or dialog handler still running, then rethrows the
|
|
186
|
+
* error one of them latched after the last step, so it fails this attempt
|
|
187
|
+
* instead of the next one's first operation. The latch itself is replaced
|
|
188
|
+
* by `startAttempt`, after this ran.
|
|
189
|
+
*/
|
|
190
|
+
settleAttempt(context: EngineCleanupContext): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Retires the owner before awaiting cleanup; late work cannot reach the
|
|
193
|
+
* next attempt. A browser leased for the attempt is released after its
|
|
194
|
+
* connection closes, whether or not the close succeeded.
|
|
195
|
+
*/
|
|
196
|
+
endAttempt(context: EngineCleanupContext): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Releases attempt resources, the worker's shared browser process, and a
|
|
199
|
+
* lease the worker acquired for itself: three independent tasks, in that
|
|
200
|
+
* order, every one attempted whatever the earlier ones did, and the first
|
|
201
|
+
* failure reported once all ran. A billed browser outlives a failed trace
|
|
202
|
+
* flush otherwise.
|
|
203
|
+
*/
|
|
204
|
+
dispose(context: EngineCleanupContext): Promise<void>;
|
|
205
|
+
/** Returns the active attempt, including its connection generation and references. */
|
|
206
|
+
private requireSession;
|
|
207
|
+
/** Registers one attempt-scoped route on the current context. */
|
|
208
|
+
route(predicate: RoutePredicate, handler: RouteHandler): Promise<void>;
|
|
209
|
+
/** Removes one registered route from the attempt and the current context. */
|
|
210
|
+
unroute(predicate: RoutePredicate, handler: RouteHandler): Promise<void>;
|
|
211
|
+
requirePage(): Page;
|
|
212
|
+
requireContext(): BrowserContext;
|
|
213
|
+
/** Creates the active page through the attempt's sole binding owner. */
|
|
214
|
+
ensurePage(): Promise<Page>;
|
|
215
|
+
/**
|
|
216
|
+
* The single entry of every operation: rethrows an error latched on an
|
|
217
|
+
* unawaited path, refuses a cancelled operation, races `fn` against the
|
|
218
|
+
* operation signal so an abort mid-call surfaces as `CANCELLED` instead of
|
|
219
|
+
* waiting out Playwright, and translates raw errors at the contract
|
|
220
|
+
* boundary. `translate` overrides the default translation for operations
|
|
221
|
+
* with a documented retryable failure mode.
|
|
222
|
+
*/
|
|
223
|
+
guard<T>(operation: OperationContext, label: string, fn: (operation: OperationContext) => Promise<T>, translate?: (cause: unknown, label: string) => Error): Promise<T>;
|
|
224
|
+
/** Opens one URL the harness resolved; the attempt's page is created on first use. */
|
|
225
|
+
open(url: string, operation: OperationContext): Promise<void>;
|
|
226
|
+
back(operation: OperationContext): Promise<void>;
|
|
227
|
+
/** Restarts the document while retaining this attempt's context and storage. */
|
|
228
|
+
restart(operation: OperationContext): Promise<void>;
|
|
229
|
+
/** Replaces the context with a clean one and opens its blank page. */
|
|
230
|
+
reset(operation: OperationContext): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Resolves one expression to every node it currently matches, fully read,
|
|
233
|
+
* in one in-page round trip. A `displayValue` query is filtered here by the
|
|
234
|
+
* value each element reported, so no per-node calls are needed; any
|
|
235
|
+
* `first`/`last`/`nth` on such a query then selects among those matches, and
|
|
236
|
+
* a filter placed after a position is checked on the selected element. A
|
|
237
|
+
* `visible` query drops the candidates whose hidden state the same read
|
|
238
|
+
* reported before either of those, so a position is among shown matches.
|
|
239
|
+
*/
|
|
240
|
+
locate(expression: LocatorExpression, operation: OperationContext): Promise<readonly SemanticNode[]>;
|
|
241
|
+
/**
|
|
242
|
+
* One action on a located or observed node. A `swipe` on the observation
|
|
243
|
+
* root is the viewport swipe: a wheel gesture sized by the viewport, with no
|
|
244
|
+
* element resolved behind it, so it needs only the page. Every other action
|
|
245
|
+
* on the root acts on the document element the root stands for.
|
|
246
|
+
*/
|
|
247
|
+
perform(ref: NodeRef, action: LocatorAction, operation: OperationContext): Promise<void>;
|
|
248
|
+
/** One pointer action at a viewport point in CSS pixels, with nothing resolved behind it; see `dispatchPointerAction`. */
|
|
249
|
+
performAt(point: ViewportPoint, action: PointerAction, operation: OperationContext): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Types into whatever holds focus. Keystrokes into a document body are
|
|
252
|
+
* accepted by the browser and lost, so the focused element is checked for
|
|
253
|
+
* editability first and the call refuses rather than "typing" into nothing.
|
|
254
|
+
* `replace` clears with select-all and delete: the only locator-free clear,
|
|
255
|
+
* scoped by the browser to the whole editing host, so it is opt-in.
|
|
256
|
+
*/
|
|
257
|
+
typeText(text: string, options: {
|
|
258
|
+
readonly replace: boolean;
|
|
259
|
+
}, operation: OperationContext): Promise<void>;
|
|
260
|
+
/** Sends one key to whatever holds focus, in the contract's key grammar Playwright shares. */
|
|
261
|
+
pressKey(key: string, operation: OperationContext): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Refuses focused typing when nothing that takes keystrokes has focus, in
|
|
264
|
+
* any frame of the page. Text fields and contenteditable hosts take them;
|
|
265
|
+
* so does any other focusable element the app made focusable (a canvas, a
|
|
266
|
+
* widget with a tabindex and its own key handling), because focusing it is
|
|
267
|
+
* how the app opted into keys. Focus on the body, a button, a link, a
|
|
268
|
+
* select, or a non-text input means the keystrokes would be discarded.
|
|
269
|
+
*/
|
|
270
|
+
private requireEditableFocus;
|
|
271
|
+
/**
|
|
272
|
+
* Checks that every frame selector along the expression matches exactly one
|
|
273
|
+
* element, each counted inside the frame before it, the way `project` walks
|
|
274
|
+
* the same chain; a frame-scoped `count` is 0 until that frame's document
|
|
275
|
+
* has loaded, which is what makes `FRAME_NOT_FOUND` worth retrying.
|
|
276
|
+
*/
|
|
277
|
+
private validateFrames;
|
|
278
|
+
/**
|
|
279
|
+
* Reserves one artifact path under the attempt directory: a per-attempt
|
|
280
|
+
* counter keeps names unique, the label keeps them readable.
|
|
281
|
+
*/
|
|
282
|
+
artifactPath(folder: string, label: string | undefined, extension: string): {
|
|
283
|
+
relative: string;
|
|
284
|
+
absolute: string;
|
|
285
|
+
};
|
|
286
|
+
/** Redacted at the source: secure fields in every frame are masked, as in observation pixels. */
|
|
287
|
+
screenshot(label: string | undefined, operation: OperationContext): Promise<string>;
|
|
288
|
+
/** Starts tracing the current attempt. */
|
|
289
|
+
startTrace(operation: OperationContext): Promise<void>;
|
|
290
|
+
/** Returns every trace segment finalized by the current attempt. */
|
|
291
|
+
stopTrace(operation: OperationContext): Promise<string | readonly string[]>;
|
|
292
|
+
/** Starts the attempt's video before a trace chooses its screencast dimensions. */
|
|
293
|
+
startVideo(operation: OperationContext): Promise<void>;
|
|
294
|
+
/** Finishes the attempt's recording and returns its finalized segments. */
|
|
295
|
+
stopVideo(operation: OperationContext): Promise<readonly VideoSegment[]>;
|
|
296
|
+
captureState(operation: OperationContext): Promise<EngineState>;
|
|
297
|
+
/** Replaces the attempt's context with one seeded from the snapshot. */
|
|
298
|
+
restoreState(state: EngineState, operation: OperationContext): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Captures one atomic semantic observation. Secure fields are masked in the
|
|
301
|
+
* page before the tree leaves the engine, and every node keeps a live
|
|
302
|
+
* element handle valid until the next observation replaces the generation.
|
|
303
|
+
*
|
|
304
|
+
* With `options.pixels`, masked viewport pixels are captured alongside the
|
|
305
|
+
* tree rather than after it, so the image and the node geometry describe the
|
|
306
|
+
* page as closely in time as two engine calls can.
|
|
307
|
+
*/
|
|
308
|
+
observe(operation: OperationContext, options?: EngineObserveOptions): Promise<EngineSnapshot>;
|
|
309
|
+
/** Captures privately, then publishes only into the page and ref generation that requested it. */
|
|
310
|
+
private captureObservation;
|
|
311
|
+
}
|
|
312
|
+
export {};
|
|
313
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAW,cAAc,EAA+B,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAIL,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG1F,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAW5C,OAAO,EAGL,UAAU,EAQX,MAAM,cAAc,CAAC;AAUtB,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;AAC5C,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAiBpD;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IA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