spana-test 0.9.0 → 0.11.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.
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +11 -8
- package/dist/agent-fixture-5C4MCWRD.js +20 -0
- package/dist/{allure-RAEK4SIH.js → allure-FGVR5LND.js} +5 -1
- package/dist/allure-FGVR5LND.js.map +1 -0
- package/dist/app-RSDPDTKT.js +10 -0
- package/dist/cache-command-PANUAEMZ.js +12 -0
- package/dist/{chunk-Y2RZNOKU.js → chunk-26NJXP55.js} +2 -2
- package/dist/{chunk-ALPQES3J.js → chunk-3IZMPNE7.js} +549 -2002
- package/dist/chunk-3IZMPNE7.js.map +1 -0
- package/dist/chunk-4KK4E3N3.js +3587 -0
- package/dist/chunk-4KK4E3N3.js.map +1 -0
- package/dist/{chunk-IGTK5MHB.js → chunk-4SA7JK5D.js} +23 -15
- package/dist/chunk-4SA7JK5D.js.map +1 -0
- package/dist/{chunk-PLE7RFQE.js → chunk-64UZQP7Z.js} +52 -3
- package/dist/chunk-64UZQP7Z.js.map +1 -0
- package/dist/chunk-6PTUVG6A.js +127 -0
- package/dist/chunk-6PTUVG6A.js.map +1 -0
- package/dist/chunk-FPQAJNE3.js +2874 -0
- package/dist/chunk-FPQAJNE3.js.map +1 -0
- package/dist/{chunk-3UVSUVHW.js → chunk-FXBWACUT.js} +530 -3360
- package/dist/chunk-FXBWACUT.js.map +1 -0
- package/dist/chunk-OPTNFLBL.js +556 -0
- package/dist/chunk-OPTNFLBL.js.map +1 -0
- package/dist/chunk-S7MSBZ3F.js +72 -0
- package/dist/chunk-S7MSBZ3F.js.map +1 -0
- package/dist/chunk-SGZMO456.js +2125 -0
- package/dist/chunk-SGZMO456.js.map +1 -0
- package/dist/{chunk-2KRVN4WN.js → chunk-SIJJVN2D.js} +358 -3
- package/dist/chunk-SIJJVN2D.js.map +1 -0
- package/dist/{chunk-SF7UYW4I.js → chunk-VUNH4AJD.js} +4 -4
- package/dist/{chunk-UEWZ2EXL.js → chunk-WS2TVNMY.js} +107 -1976
- package/dist/chunk-WS2TVNMY.js.map +1 -0
- package/dist/{chunk-FP6PVHHR.js → chunk-WZAQANN6.js} +2 -2
- package/dist/{chunk-JZZ2W2XH.js → chunk-XA6LWLZQ.js} +65 -3
- package/dist/chunk-XA6LWLZQ.js.map +1 -0
- package/dist/cli.js +195 -17
- package/dist/cli.js.map +1 -1
- package/dist/config-loader-CNGIW2XK.js +9 -0
- package/dist/{console-BGAK7Z2L.js → console-DIYEJSSP.js} +9 -2
- package/dist/console-DIYEJSSP.js.map +1 -0
- package/dist/{discover-RLSKEBAX.js → discover-NKDMB4UI.js} +3 -3
- package/dist/{doctor-command-YTCQ2SC7.js → doctor-command-6ZVJWCW7.js} +5 -4
- package/dist/{doctor-command-YTCQ2SC7.js.map → doctor-command-6ZVJWCW7.js.map} +1 -1
- package/dist/{app-DSh1ejLh.d.ts → flow-DddAj1xv.d.ts} +1002 -355
- package/dist/gherkin/steps.d.ts +1 -2
- package/dist/{html-JO2YNRWX.js → html-FLMWPFQD.js} +2 -1
- package/dist/html-FLMWPFQD.js.map +1 -0
- package/dist/index.d.ts +498 -131
- package/dist/index.js +491 -278
- package/dist/index.js.map +1 -1
- package/dist/{junit-HLC62MK6.js → junit-CGB3LKHD.js} +3 -2
- package/dist/junit-CGB3LKHD.js.map +1 -0
- package/dist/local-DM3YBSV5.js +31 -0
- package/dist/{runner-TF4OKPYP.js → runner-WOVZWUQR.js} +6 -2
- package/dist/runner-WOVZWUQR.js.map +1 -0
- package/dist/{server-IS4K5FCT.js → server-ING5D5ZJ.js} +2 -2
- package/dist/server-ING5D5ZJ.js.map +1 -0
- package/dist/{server-4YLBAZEM.js → server-JNQ2PLCC.js} +17 -14
- package/dist/{server-4YLBAZEM.js.map → server-JNQ2PLCC.js.map} +1 -1
- package/dist/session-5TNWVGQQ.js +21 -0
- package/dist/session-5TNWVGQQ.js.map +1 -0
- package/dist/{session-CgvT-Oso.d.ts → session-uT8xL03K.d.ts} +5 -1
- package/dist/{studio-command-RFPV2DS7.js → studio-command-KK7A3KN6.js} +2 -2
- package/dist/{test-command-UEJG5AI6.js → test-command-QGIJBRH7.js} +278 -41
- package/dist/test-command-QGIJBRH7.js.map +1 -0
- package/dist/{validator-BLOLIHUY.js → validator-WO5IL7IY.js} +3 -3
- package/dist/validator-WO5IL7IY.js.map +1 -0
- package/package.json +10 -10
- package/dist/allure-RAEK4SIH.js.map +0 -1
- package/dist/chunk-2KRVN4WN.js.map +0 -1
- package/dist/chunk-3UVSUVHW.js.map +0 -1
- package/dist/chunk-ALPQES3J.js.map +0 -1
- package/dist/chunk-IGTK5MHB.js.map +0 -1
- package/dist/chunk-JZZ2W2XH.js.map +0 -1
- package/dist/chunk-PLE7RFQE.js.map +0 -1
- package/dist/chunk-UEWZ2EXL.js.map +0 -1
- package/dist/config-loader-F5YAY7RP.js +0 -9
- package/dist/console-BGAK7Z2L.js.map +0 -1
- package/dist/flow-CSMwD9Fh.d.ts +0 -69
- package/dist/html-JO2YNRWX.js.map +0 -1
- package/dist/junit-HLC62MK6.js.map +0 -1
- package/dist/session-K7FCRKOC.js +0 -18
- package/dist/test-command-UEJG5AI6.js.map +0 -1
- /package/dist/{config-loader-F5YAY7RP.js.map → agent-fixture-5C4MCWRD.js.map} +0 -0
- /package/dist/{discover-RLSKEBAX.js.map → app-RSDPDTKT.js.map} +0 -0
- /package/dist/{runner-TF4OKPYP.js.map → cache-command-PANUAEMZ.js.map} +0 -0
- /package/dist/{chunk-Y2RZNOKU.js.map → chunk-26NJXP55.js.map} +0 -0
- /package/dist/{chunk-SF7UYW4I.js.map → chunk-VUNH4AJD.js.map} +0 -0
- /package/dist/{chunk-FP6PVHHR.js.map → chunk-WZAQANN6.js.map} +0 -0
- /package/dist/{server-IS4K5FCT.js.map → config-loader-CNGIW2XK.js.map} +0 -0
- /package/dist/{session-K7FCRKOC.js.map → discover-NKDMB4UI.js.map} +0 -0
- /package/dist/{validator-BLOLIHUY.js.map → local-DM3YBSV5.js.map} +0 -0
- /package/dist/{studio-command-RFPV2DS7.js.map → studio-command-KK7A3KN6.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { a as FlowDefinition, F as FlowContext,
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export { w as ArtifactConfig, x as BackUntilVisibleOptions, y as BridgeConfig, z as BrowserCookie, C as BrowserHAR, F as BrowserNetworkConditions, G as BrowserRequestClient, H as BrowserRequestOptions, I as BrowserRequestResponse, J as BrowserResponseInfo, K as CdpSessionHandle, L as DeviceInfo, M as DeviceStateConfig, N as DismissKeyboardOptions, O as DomChannelKind, Q as DomRect, U as ElectronAppConfig, W as FrameScope, X as InjectedRuntimeMethod, Y as IsolatedBrowserContext, Z as LaunchOptions, _ as NegatedPromiseExpectation, $ as ObjectSelector, a0 as PollExpectation, a1 as PollMatchers, a2 as PromiseExpectFn, a3 as PromiseExpectation, a4 as RelativeSelector, a5 as RetryAssertionOptions, a6 as SPANA_INJECTED_RUNTIME_SCRIPT, a7 as ScrollUntilVisibleOptions, a8 as SelectorModifiers, a9 as StorybookConfig, aa as StorybookOpenOptions, ab as StorybookValue, ac as ToPassExpectation, ad as TouchAction, ae as TouchSequence, af as VideoRecordingMode, ag as WarmDaemonConfig, ah as WebBrowserEngine, ai as WebContextIsolation, aj as WebExecutionConfig, ak as WebResourceBlockType, al as buildDomActionabilityDiagScript, am as buildDomFillScript, an as buildDomWaitForHiddenScript, ao as buildDomWaitForMatchScript, ap as buildDomWaitForSelectorScript, aq as buildInjectedCallScript, ar as byCss, as as byRole, at as defineConfig, au as filterSelector, av as first, aw as inFrame, ax as isComposableDomSelector, ay as isSystemUISelector, az as isTestIDSelector, aA as last, aB as nth, aC as or, aD as systemUI, aE as within } from './app-DSh1ejLh.js';
|
|
5
|
-
import { E as Element, B as Bounds, C as ConnectOptions, S as Session } from './session-CgvT-Oso.js';
|
|
1
|
+
import { R as RawDriverService, D as DriverError, a as DomElementMatch, P as Platform, E as ExtendedSelector, T as TapMode, b as ProvConfig, c as DomChannel, d as DomTargetInfo, S as Selector, e as DomWaitForSelectorOptions, f as DomWaitForHiddenOptions, g as DomWaitForMatchOptions, h as DomWaitForMatchResult, i as DomFillOptions, B as BrowserRouteMatcher, j as BrowserMockResponse, k as DomIdleOptions, l as DomStorageEntries, m as DomClearStorageOptions, n as BrowserConsoleLog, o as BrowserJSError, p as BrowserName, V as VirtualAuthenticatorOptions, q as BrowserEmulationOptions, r as FlowDefinition, s as ElectrobunAppConfig, t as ElectrobunRenderer, A as AppiumExecutionConfig, u as AppConfig, v as VirtualCredential, F as FlowContext, w as FlowConfig, x as VirtualCredentialInput, y as PromiseApp, z as FlowFn, C as BrowserHAR } from './flow-DddAj1xv.js';
|
|
2
|
+
export { G as AgentActExecutor, H as AgentProviderConfig, I as ArtifactConfig, J as BackUntilVisibleOptions, K as BiometricOptions, L as BridgeConfig, M as BrowserCookie, N as BrowserDialogHandler, O as BrowserDialogInfo, Q as BrowserDownloadInfo, U as BrowserNetworkConditions, W as BrowserRequestClient, X as BrowserRequestOptions, Y as BrowserRequestResponse, Z as BrowserResponseInfo, _ as CacheWriteStatus, $ as CdpSessionHandle, a0 as CreateFlowAgentOptions, a1 as DataSnapshotOptions, a2 as DataSnapshotResult, a3 as DeviceInfo, a4 as DeviceStateConfig, a5 as DismissKeyboardOptions, a6 as DomChannelKind, a7 as DomRect, a8 as ElectronAppConfig, a9 as ExploreSessionResult, aa as FlowAgent, ab as FlowSkipCondition, ac as FrameScope, ad as Geolocation, ae as InjectedRuntimeMethod, af as IsolatedBrowserContext, ag as LaunchOptions, ah as NegatedPromiseExpectation, ai as ObjectSelector, aj as Orientation, ak as PermissionOptions, al as PollExpectation, am as PollMatchers, an as ProjectConfig, ao as ProjectExecutionPlan, ap as PromiseExpectFn, aq as PromiseExpectation, ar as PushPayload, as as RecordedAction, at as RelativeSelector, au as ReplayCacheEntry, av as ReplayCacheMode, aw as ReplayCacheStore, ax as ReplayCacheSummary, ay as ReplaySession, az as ReplaySessionOptions, aA as ReplayStepOutcome, aB as RetryAssertionOptions, aC as RunningWebServer, aD as SPANA_INJECTED_RUNTIME_SCRIPT, aE as ScrollUntilVisibleOptions, aF as SecondarySession, aG as SecondarySessionOptions, aH as SecretValue, aI as SelectOptionInput, aJ as SelectorModifiers, aK as Sessions, aL as StartWebServersOptions, aM as StorybookConfig, aN as StorybookOpenOptions, aO as StorybookValue, aP as ToPassExpectation, aQ as TouchAction, aR as TouchSequence, aS as VideoRecordingMode, aT as WarmDaemonConfig, aU as WebBrowserEngine, aV as WebContextIsolation, aW as WebExecutionConfig, aX as WebResourceBlockType, aY as WebServerConfig, aZ as assertDataSnapshot, a_ as buildDomActionabilityDiagScript, a$ as buildDomFillScript, b0 as buildDomWaitForHiddenScript, b1 as buildDomWaitForMatchScript, b2 as buildDomWaitForSelectorScript, b3 as buildInjectedCallScript, b4 as buildReplayCacheKey, b5 as byCss, b6 as byRole, b7 as checkServerReady, b8 as createFlowAgent, b9 as createOpenAICompatibleAgentProvider, ba as defineConfig, bb as filterFlowsForProject, bc as filterSelector, bd as first, be as flow, bf as formatActionsAsFlowCode, bg as inFrame, bh as isComposableDomSelector, bi as isHttpUrlReady, bj as isSecretValue, bk as isSystemUISelector, bl as isTcpPortOpen, bm as isTestIDSelector, bn as last, bo as matchDataSnapshot, bp as nth, bq as or, br as replayRecordedAction, bs as resolveProjectExecutionPlan, bt as runExploreSession, bu as secret, bv as startWebServer, bw as startWebServers, bx as systemUI, by as unique, bz as within } from './flow-DddAj1xv.js';
|
|
3
|
+
import { E as Element, B as Bounds, C as ConnectOptions, S as Session } from './session-uT8xL03K.js';
|
|
6
4
|
import { Socket } from 'node:net';
|
|
7
5
|
import { Effect } from 'effect';
|
|
8
6
|
import { Browser, _electron, chromium } from 'playwright-core';
|
|
@@ -166,6 +164,9 @@ interface FlowResult {
|
|
|
166
164
|
platform: Platform;
|
|
167
165
|
/** Final status after all retry attempts. */
|
|
168
166
|
status: "passed" | "failed" | "skipped";
|
|
167
|
+
/** Declaration responsible for skipping the flow, if explicitly skipped. */
|
|
168
|
+
modifier?: "skip" | "fixme";
|
|
169
|
+
skipReason?: string;
|
|
169
170
|
/** True if the flow failed initially but passed on retry. */
|
|
170
171
|
flaky?: boolean;
|
|
171
172
|
/** Number of attempts made (present when retries > 0). */
|
|
@@ -244,6 +245,22 @@ interface Reporter {
|
|
|
244
245
|
platformFlowCounts?: Partial<Record<Platform, number>>;
|
|
245
246
|
}
|
|
246
247
|
|
|
248
|
+
interface StepRecordOptions {
|
|
249
|
+
selector?: unknown;
|
|
250
|
+
captureScreenshot?: boolean;
|
|
251
|
+
}
|
|
252
|
+
interface ScreenshotStepOptions {
|
|
253
|
+
selector?: unknown;
|
|
254
|
+
name?: string;
|
|
255
|
+
}
|
|
256
|
+
interface StepRecorder {
|
|
257
|
+
runStep<A>(command: string, action: () => Promise<A>, opts?: StepRecordOptions): Promise<A>;
|
|
258
|
+
runScreenshotStep(command: string, action: () => Promise<Uint8Array>, opts?: ScreenshotStepOptions): Promise<Uint8Array>;
|
|
259
|
+
getSteps(): StepResult[];
|
|
260
|
+
/** Call-site stack captured synchronously when the most recent failed step was invoked. */
|
|
261
|
+
getLastFailureStack?(): string | undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
247
264
|
type TargetShell = "browser" | "capacitor" | "electron" | "electrobun";
|
|
248
265
|
type TargetEngine = "chromium" | "webkit" | "firefox" | "wkwebview" | "webview2" | "webkitgtk" | "android-webview" | "cef";
|
|
249
266
|
type TargetChannel = "bridge" | "cdp" | "webkit-inspector" | "native-ax";
|
|
@@ -398,6 +415,8 @@ declare class AndroidWebViewCdpChannel implements DomChannel {
|
|
|
398
415
|
private allocatedByUs;
|
|
399
416
|
private activeSocketName;
|
|
400
417
|
private cdp;
|
|
418
|
+
private readonly routes;
|
|
419
|
+
private enableInterception?;
|
|
401
420
|
constructor(options: AndroidWebViewCdpOptions);
|
|
402
421
|
private execAdb;
|
|
403
422
|
isConnected(): boolean;
|
|
@@ -410,6 +429,11 @@ declare class AndroidWebViewCdpChannel implements DomChannel {
|
|
|
410
429
|
scrollIntoView(selector: Selector): Promise<DomElementMatch | null>;
|
|
411
430
|
listTargets(): Promise<DomTargetInfo[]>;
|
|
412
431
|
selectTarget(targetId: string): Promise<void>;
|
|
432
|
+
private ensureInterception;
|
|
433
|
+
private addRoute;
|
|
434
|
+
mockNetwork(matcher: BrowserRouteMatcher, response: BrowserMockResponse): Promise<void>;
|
|
435
|
+
blockNetwork(matcher: BrowserRouteMatcher): Promise<void>;
|
|
436
|
+
clearNetworkMocks(): Promise<void>;
|
|
413
437
|
reload(): Promise<void>;
|
|
414
438
|
disconnect(): Promise<void>;
|
|
415
439
|
}
|
|
@@ -684,6 +708,8 @@ interface TestResult {
|
|
|
684
708
|
name: string;
|
|
685
709
|
platform: Platform;
|
|
686
710
|
status: "passed" | "failed" | "skipped";
|
|
711
|
+
modifier?: "skip" | "fixme";
|
|
712
|
+
skipReason?: string;
|
|
687
713
|
flaky?: boolean;
|
|
688
714
|
attempts?: number;
|
|
689
715
|
durationMs: number;
|
|
@@ -702,6 +728,8 @@ interface DirectCdpBrowserLaunchOptions {
|
|
|
702
728
|
warmBrowser?: boolean;
|
|
703
729
|
/** Isolation scope key for warm Chromium daemon (defaults to cwd hash). */
|
|
704
730
|
warmBrowserScope?: string;
|
|
731
|
+
/** Unpacked browser extension directories to load into Chromium. */
|
|
732
|
+
extensions?: string[];
|
|
705
733
|
/** Extra Chrome launch flags. */
|
|
706
734
|
args?: string[];
|
|
707
735
|
}
|
|
@@ -762,6 +790,8 @@ interface LightweightCdpDriverOptions {
|
|
|
762
790
|
virtualAuthenticator?: boolean | VirtualAuthenticatorOptions;
|
|
763
791
|
/** Optional Playwright-compatible storageState JSON path to preload into contexts. */
|
|
764
792
|
storageState?: string;
|
|
793
|
+
/** Emulate `prefers-color-scheme`, `prefers-reduced-motion`, `locale`, or `timezoneId` on every context. */
|
|
794
|
+
emulation?: BrowserEmulationOptions;
|
|
765
795
|
/** Injectable fetch & WebSocket factory for tests. */
|
|
766
796
|
fetchFn?: typeof fetch;
|
|
767
797
|
createWebSocket?: WebSocketFactory;
|
|
@@ -1404,131 +1434,6 @@ declare class PersonaAuthCache {
|
|
|
1404
1434
|
authenticate<T extends string = string, R extends string = string>(persona: PersonaDefinition<T, R>, ctx: FlowContext<T, R>): Promise<CachedPersonaState>;
|
|
1405
1435
|
}
|
|
1406
1436
|
|
|
1407
|
-
/** A deterministic action recorded from an `agent.act(goal)` execution. */
|
|
1408
|
-
type RecordedAction = {
|
|
1409
|
-
kind: "tap";
|
|
1410
|
-
selector: ExtendedSelector;
|
|
1411
|
-
} | {
|
|
1412
|
-
kind: "doubleTap";
|
|
1413
|
-
selector: ExtendedSelector;
|
|
1414
|
-
} | {
|
|
1415
|
-
kind: "longPress";
|
|
1416
|
-
selector: ExtendedSelector;
|
|
1417
|
-
} | {
|
|
1418
|
-
kind: "inputText";
|
|
1419
|
-
text: string;
|
|
1420
|
-
} | {
|
|
1421
|
-
kind: "pressKey";
|
|
1422
|
-
key: string;
|
|
1423
|
-
} | {
|
|
1424
|
-
kind: "scroll";
|
|
1425
|
-
direction: "up" | "down" | "left" | "right";
|
|
1426
|
-
} | {
|
|
1427
|
-
kind: "scrollUntilVisible";
|
|
1428
|
-
selector: ExtendedSelector;
|
|
1429
|
-
} | {
|
|
1430
|
-
kind: "openLink";
|
|
1431
|
-
url: string;
|
|
1432
|
-
};
|
|
1433
|
-
interface ReplayCacheEntry {
|
|
1434
|
-
schemaVersion: 1;
|
|
1435
|
-
key: string;
|
|
1436
|
-
goal: string;
|
|
1437
|
-
flowName: string;
|
|
1438
|
-
platform: string;
|
|
1439
|
-
actions: RecordedAction[];
|
|
1440
|
-
recordedAt: string;
|
|
1441
|
-
verifiedBy: string;
|
|
1442
|
-
}
|
|
1443
|
-
type ReplayCacheMode = "read-write" | "strict" | "off";
|
|
1444
|
-
type CacheWriteStatus = "saved" | "kept" | "unconfirmed" | "evicted" | "skipped";
|
|
1445
|
-
interface ReplayStepOutcome {
|
|
1446
|
-
goal: string;
|
|
1447
|
-
key: string;
|
|
1448
|
-
status: "replayed" | "handed-off" | "missed" | "live";
|
|
1449
|
-
writeStatus?: CacheWriteStatus;
|
|
1450
|
-
actionCount: number;
|
|
1451
|
-
error?: string;
|
|
1452
|
-
}
|
|
1453
|
-
interface ReplayCacheSummary {
|
|
1454
|
-
replayed: number;
|
|
1455
|
-
handedOff: number;
|
|
1456
|
-
missed: number;
|
|
1457
|
-
saved: number;
|
|
1458
|
-
evicted: number;
|
|
1459
|
-
unconfirmed: number;
|
|
1460
|
-
}
|
|
1461
|
-
/**
|
|
1462
|
-
* Pluggable agent executor called ONLY on cache miss or self-healing handoff.
|
|
1463
|
-
* Returns the deterministic list of actions it executed to achieve `goal`.
|
|
1464
|
-
*/
|
|
1465
|
-
interface AgentActExecutor {
|
|
1466
|
-
act(input: {
|
|
1467
|
-
goal: string;
|
|
1468
|
-
app: PromiseApp;
|
|
1469
|
-
handoffReason?: string;
|
|
1470
|
-
}): Promise<{
|
|
1471
|
-
actions: RecordedAction[];
|
|
1472
|
-
}>;
|
|
1473
|
-
}
|
|
1474
|
-
/** Compute a stable cache key for a `(flowName, platform, goal)` tuple. */
|
|
1475
|
-
declare function buildReplayCacheKey(flowName: string, platform: string, goal: string): string;
|
|
1476
|
-
/** Disk-backed replay cache store (default directory: `.spana/cache`). */
|
|
1477
|
-
declare class ReplayCacheStore {
|
|
1478
|
-
readonly cacheDir: string;
|
|
1479
|
-
constructor(cacheDir?: string);
|
|
1480
|
-
private filePath;
|
|
1481
|
-
get(key: string): ReplayCacheEntry | null;
|
|
1482
|
-
set(entry: ReplayCacheEntry): void;
|
|
1483
|
-
delete(key: string): boolean;
|
|
1484
|
-
}
|
|
1485
|
-
/** Execute a single recorded deterministic action against `PromiseApp`. */
|
|
1486
|
-
declare function replayRecordedAction(app: PromiseApp, action: RecordedAction): Promise<void>;
|
|
1487
|
-
interface ReplaySessionOptions {
|
|
1488
|
-
flowName: string;
|
|
1489
|
-
platform: string;
|
|
1490
|
-
app: PromiseApp;
|
|
1491
|
-
store?: ReplayCacheStore;
|
|
1492
|
-
mode?: ReplayCacheMode;
|
|
1493
|
-
executor?: AgentActExecutor;
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* Verified Replay Cache session inspired by `e2e-inc/e2e`:
|
|
1497
|
-
*
|
|
1498
|
-
* - On cache hit: replays deterministic `{ testID }` / `systemUI()` actions with ZERO LLM calls.
|
|
1499
|
-
* - In `strict` mode (`--strict-cache`): fails deterministically if a recording is missing or no longer matches.
|
|
1500
|
-
* - In `read-write` mode: hands off to `executor` on miss or mismatch (self-healing), and ONLY commits
|
|
1501
|
-
* new/healed recordings to `.spana/cache/` after `markVerified(verifierName)` is called by a real assertion!
|
|
1502
|
-
*/
|
|
1503
|
-
declare class ReplaySession {
|
|
1504
|
-
private readonly flowName;
|
|
1505
|
-
private readonly platform;
|
|
1506
|
-
private readonly app;
|
|
1507
|
-
private readonly store;
|
|
1508
|
-
private readonly mode;
|
|
1509
|
-
private readonly executor?;
|
|
1510
|
-
private pendingWrites;
|
|
1511
|
-
private replayedKeys;
|
|
1512
|
-
private outcomes;
|
|
1513
|
-
constructor(options: ReplaySessionOptions);
|
|
1514
|
-
/** Execute a natural-language goal using replay cache first, falling back to `executor`. */
|
|
1515
|
-
act(goal: string): Promise<ReplayStepOutcome>;
|
|
1516
|
-
private runLiveAndQueue;
|
|
1517
|
-
/**
|
|
1518
|
-
* Call when a real post-action assertion (`expect(...).toBeVisible()`, `toHaveText()`, etc.)
|
|
1519
|
-
* succeeds. Flushes all preceding pending recordings to disk in `read-write` mode.
|
|
1520
|
-
*/
|
|
1521
|
-
markVerified(verifierName: string): number;
|
|
1522
|
-
/**
|
|
1523
|
-
* Call when the flow attempt fails: evicts any replayed recordings involved in the
|
|
1524
|
-
* failure (in `read-write` mode) and discards unconfirmed recordings so broken paths
|
|
1525
|
-
* are never persisted.
|
|
1526
|
-
*/
|
|
1527
|
-
markFailed(): number;
|
|
1528
|
-
getOutcomes(): ReplayStepOutcome[];
|
|
1529
|
-
getSummary(): ReplayCacheSummary;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
1437
|
interface NativePngCompareResult {
|
|
1533
1438
|
match: boolean;
|
|
1534
1439
|
sizeMismatch: boolean;
|
|
@@ -1897,4 +1802,466 @@ declare class SpanaMcpServer {
|
|
|
1897
1802
|
runStdio(): Promise<void>;
|
|
1898
1803
|
}
|
|
1899
1804
|
|
|
1900
|
-
|
|
1805
|
+
interface CacheInspectEntry {
|
|
1806
|
+
key: string;
|
|
1807
|
+
filePath: string;
|
|
1808
|
+
flowName: string;
|
|
1809
|
+
platform: string;
|
|
1810
|
+
goal: string;
|
|
1811
|
+
actionCount: number;
|
|
1812
|
+
recordedAt: string;
|
|
1813
|
+
verifiedBy: string;
|
|
1814
|
+
}
|
|
1815
|
+
interface CacheInspectResult {
|
|
1816
|
+
cacheDir: string;
|
|
1817
|
+
exists: boolean;
|
|
1818
|
+
entryCount: number;
|
|
1819
|
+
entries: CacheInspectEntry[];
|
|
1820
|
+
}
|
|
1821
|
+
interface CacheClearResult {
|
|
1822
|
+
cacheDir: string;
|
|
1823
|
+
removedCount: number;
|
|
1824
|
+
removedKeys: string[];
|
|
1825
|
+
}
|
|
1826
|
+
/** Inspect all verified replay cache recordings in `cacheDir` (default: `.spana/cache`). */
|
|
1827
|
+
declare function inspectReplayCache(cacheDir?: string): CacheInspectResult;
|
|
1828
|
+
/** Clear all (or matching) replay cache entries from `cacheDir`. */
|
|
1829
|
+
declare function clearReplayCache(cacheDir?: string, opts?: {
|
|
1830
|
+
match?: string;
|
|
1831
|
+
}): CacheClearResult;
|
|
1832
|
+
declare function formatCacheInspectTable(result: CacheInspectResult): string;
|
|
1833
|
+
|
|
1834
|
+
/** Run a flow body with an active `StepRecorder` bound so standalone `step(name, fn)` calls record cleanly. */
|
|
1835
|
+
declare function withActiveStepRecorder<A>(recorder: StepRecorder, fn: () => Promise<A>): Promise<A>;
|
|
1836
|
+
/**
|
|
1837
|
+
* Group related actions & assertions inside a flow into a named step in reports and Trace Viewer.
|
|
1838
|
+
* Can be used standalone (`import { step } from "spana-test"`) or via `ctx.step(...)`.
|
|
1839
|
+
*/
|
|
1840
|
+
declare function step<A>(name: string, fn: () => Promise<A>): Promise<A>;
|
|
1841
|
+
interface SuiteConfig<R extends string = string> extends FlowConfig<R> {
|
|
1842
|
+
/** Hook executed once before the first flow in this suite runs. */
|
|
1843
|
+
beforeAll?: (ctx: FlowContext<any, R>) => Promise<void>;
|
|
1844
|
+
/** Hook executed before every flow in this suite. */
|
|
1845
|
+
beforeEach?: (ctx: FlowContext<any, R>) => Promise<void>;
|
|
1846
|
+
/** Hook executed after every flow in this suite (even on failure). */
|
|
1847
|
+
afterEach?: (ctx: FlowContext<any, R>) => Promise<void>;
|
|
1848
|
+
/** Hook executed once after the last flow in this suite finishes. */
|
|
1849
|
+
afterAll?: (ctx: FlowContext<any, R>) => Promise<void>;
|
|
1850
|
+
}
|
|
1851
|
+
interface SuiteBuilder<T extends string = string, R extends string = string> {
|
|
1852
|
+
flow(name: string, fn: FlowFn<T, R>): void;
|
|
1853
|
+
flow(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): void;
|
|
1854
|
+
skip(name: string, fn: FlowFn<T, R>): void;
|
|
1855
|
+
skip(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): void;
|
|
1856
|
+
only(name: string, fn: FlowFn<T, R>): void;
|
|
1857
|
+
only(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): void;
|
|
1858
|
+
fixme(name: string, fn: FlowFn<T, R>): void;
|
|
1859
|
+
fixme(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): void;
|
|
1860
|
+
beforeAll(fn: (ctx: FlowContext<T, R>) => Promise<void>): void;
|
|
1861
|
+
beforeEach(fn: (ctx: FlowContext<T, R>) => Promise<void>): void;
|
|
1862
|
+
afterEach(fn: (ctx: FlowContext<T, R>) => Promise<void>): void;
|
|
1863
|
+
afterAll(fn: (ctx: FlowContext<T, R>) => Promise<void>): void;
|
|
1864
|
+
suite(name: string, define: (nested: SuiteBuilder<T, R>) => void): void;
|
|
1865
|
+
suite(name: string, config: SuiteConfig<R>, define: (nested: SuiteBuilder<T, R>) => void): void;
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Group multiple related flows into a named suite with shared config, tags, nested suites,
|
|
1869
|
+
* and `beforeAll` / `beforeEach` / `afterEach` / `afterAll` lifecycle hooks.
|
|
1870
|
+
*
|
|
1871
|
+
* Export the returned `FlowDefinition[]` as the default export of a `.flow.ts` file:
|
|
1872
|
+
* ```ts
|
|
1873
|
+
* export default suite("Checkout", { tags: ["smoke"] }, (s) => {
|
|
1874
|
+
* s.beforeEach(async ({ app }) => { await app.openLink("/cart"); });
|
|
1875
|
+
* s.flow("applies promo code", async ({ app, expect }) => { ... });
|
|
1876
|
+
* });
|
|
1877
|
+
* ```
|
|
1878
|
+
*/
|
|
1879
|
+
declare function suite<T extends string = string, R extends string = string>(name: string, define: (s: SuiteBuilder<T, R>) => void): FlowDefinition<T, R>[];
|
|
1880
|
+
declare function suite<T extends string = string, R extends string = string>(name: string, config: SuiteConfig<R>, define: (s: SuiteBuilder<T, R>) => void): FlowDefinition<T, R>[];
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Argent-inspired live diagnostics & profiling utilities:
|
|
1884
|
+
* 1. `NetworkEventBuffer` — live ring buffer of HTTP/GraphQL/Fetch requests with status/error/URL filtering.
|
|
1885
|
+
* 2. `buildComponentTreeScript()` — inspect live React Fiber, Vue 3, and custom Web Component trees.
|
|
1886
|
+
* 3. `buildPerformanceProfileScript()` — capture Web Vitals (LCP, CLS, FCP, TTFB), navigation timing,
|
|
1887
|
+
* long tasks, resource breakdown, and V8 JS heap usage in a single evaluation.
|
|
1888
|
+
*/
|
|
1889
|
+
interface LiveNetworkEvent {
|
|
1890
|
+
requestId: string;
|
|
1891
|
+
url: string;
|
|
1892
|
+
method: string;
|
|
1893
|
+
resourceType?: string;
|
|
1894
|
+
startedAt: number;
|
|
1895
|
+
finishedAt?: number;
|
|
1896
|
+
durationMs?: number;
|
|
1897
|
+
status?: number;
|
|
1898
|
+
statusText?: string;
|
|
1899
|
+
mimeType?: string;
|
|
1900
|
+
failed?: boolean;
|
|
1901
|
+
errorText?: string;
|
|
1902
|
+
requestHeaders?: Record<string, string>;
|
|
1903
|
+
responseHeaders?: Record<string, string>;
|
|
1904
|
+
}
|
|
1905
|
+
interface NetworkEventFilter {
|
|
1906
|
+
urlIncludes?: string;
|
|
1907
|
+
method?: string;
|
|
1908
|
+
minStatus?: number;
|
|
1909
|
+
failedOnly?: boolean;
|
|
1910
|
+
limit?: number;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Bounded in-memory ring buffer capturing live network requests from CDP (`Network.*`)
|
|
1914
|
+
* or Playwright (`request` / `response` / `requestfailed`) events.
|
|
1915
|
+
*/
|
|
1916
|
+
declare class NetworkEventBuffer {
|
|
1917
|
+
private readonly maxEntries;
|
|
1918
|
+
private readonly events;
|
|
1919
|
+
private readonly byId;
|
|
1920
|
+
constructor(maxEntries?: number);
|
|
1921
|
+
recordRequest(input: {
|
|
1922
|
+
requestId: string;
|
|
1923
|
+
url: string;
|
|
1924
|
+
method: string;
|
|
1925
|
+
resourceType?: string;
|
|
1926
|
+
timestamp?: number;
|
|
1927
|
+
headers?: Record<string, string>;
|
|
1928
|
+
}): LiveNetworkEvent;
|
|
1929
|
+
recordResponse(input: {
|
|
1930
|
+
requestId: string;
|
|
1931
|
+
status: number;
|
|
1932
|
+
statusText?: string;
|
|
1933
|
+
mimeType?: string;
|
|
1934
|
+
timestamp?: number;
|
|
1935
|
+
headers?: Record<string, string>;
|
|
1936
|
+
url?: string;
|
|
1937
|
+
}): LiveNetworkEvent | undefined;
|
|
1938
|
+
recordFailure(input: {
|
|
1939
|
+
requestId: string;
|
|
1940
|
+
errorText: string;
|
|
1941
|
+
timestamp?: number;
|
|
1942
|
+
}): LiveNetworkEvent | undefined;
|
|
1943
|
+
query(filter?: NetworkEventFilter): LiveNetworkEvent[];
|
|
1944
|
+
clear(): void;
|
|
1945
|
+
get size(): number;
|
|
1946
|
+
}
|
|
1947
|
+
interface ComponentTreeNode {
|
|
1948
|
+
framework: "react" | "vue" | "web-component";
|
|
1949
|
+
name: string;
|
|
1950
|
+
testID?: string;
|
|
1951
|
+
props?: Record<string, unknown>;
|
|
1952
|
+
children: ComponentTreeNode[];
|
|
1953
|
+
}
|
|
1954
|
+
interface ComponentTreeReport {
|
|
1955
|
+
detectedFrameworks: Array<"react" | "vue" | "web-component">;
|
|
1956
|
+
nodeCount: number;
|
|
1957
|
+
roots: ComponentTreeNode[];
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Build a self-contained browser JS snippet that extracts the live React Fiber, Vue 3,
|
|
1961
|
+
* and Custom Element component tree with sanitized prop previews (Argent-inspired).
|
|
1962
|
+
*/
|
|
1963
|
+
declare function buildComponentTreeScript(opts?: {
|
|
1964
|
+
maxDepth?: number;
|
|
1965
|
+
maxNodes?: number;
|
|
1966
|
+
}): string;
|
|
1967
|
+
interface PerformanceProfileReport {
|
|
1968
|
+
url: string;
|
|
1969
|
+
timestamp: string;
|
|
1970
|
+
navigation?: {
|
|
1971
|
+
ttfbMs: number;
|
|
1972
|
+
domContentLoadedMs: number;
|
|
1973
|
+
loadEventMs: number;
|
|
1974
|
+
transferSizeBytes: number;
|
|
1975
|
+
};
|
|
1976
|
+
vitals: {
|
|
1977
|
+
fcpMs?: number;
|
|
1978
|
+
lcpMs?: number;
|
|
1979
|
+
cls?: number;
|
|
1980
|
+
};
|
|
1981
|
+
longTaskCount: number;
|
|
1982
|
+
longTaskTotalMs: number;
|
|
1983
|
+
resourceCount: number;
|
|
1984
|
+
slowestResources: Array<{
|
|
1985
|
+
name: string;
|
|
1986
|
+
initiatorType: string;
|
|
1987
|
+
durationMs: number;
|
|
1988
|
+
transferSize: number;
|
|
1989
|
+
}>;
|
|
1990
|
+
jsHeap?: {
|
|
1991
|
+
usedBytes: number;
|
|
1992
|
+
totalBytes: number;
|
|
1993
|
+
limitBytes: number;
|
|
1994
|
+
};
|
|
1995
|
+
domNodeCount: number;
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Build a self-contained browser JS snippet that collects Web Vitals (FCP/LCP/CLS),
|
|
1999
|
+
* Navigation Timing (TTFB/DCL/Load), Long Tasks, slowest resources, DOM size, and JS heap.
|
|
2000
|
+
*/
|
|
2001
|
+
declare function buildPerformanceProfileScript(): string;
|
|
2002
|
+
|
|
2003
|
+
interface RichTraceStep {
|
|
2004
|
+
index: number;
|
|
2005
|
+
command: string;
|
|
2006
|
+
status: "passed" | "failed";
|
|
2007
|
+
startedAtMs: number;
|
|
2008
|
+
durationMs: number;
|
|
2009
|
+
selector?: unknown;
|
|
2010
|
+
error?: string;
|
|
2011
|
+
/** Data URI (`data:image/png;base64,...`) or relative path to step screenshot. */
|
|
2012
|
+
screenshotDataUrl?: string;
|
|
2013
|
+
/** Optional DOM HTML snapshot captured at or near this step. */
|
|
2014
|
+
domSnapshot?: string;
|
|
2015
|
+
/** Optional ARIA accessibility tree snapshot. */
|
|
2016
|
+
ariaSnapshot?: string;
|
|
2017
|
+
}
|
|
2018
|
+
interface RichFlowTrace {
|
|
2019
|
+
schemaVersion: 1;
|
|
2020
|
+
flowName: string;
|
|
2021
|
+
platform: string;
|
|
2022
|
+
status: "passed" | "failed";
|
|
2023
|
+
startedAt: string;
|
|
2024
|
+
durationMs: number;
|
|
2025
|
+
viewport?: {
|
|
2026
|
+
width: number;
|
|
2027
|
+
height: number;
|
|
2028
|
+
};
|
|
2029
|
+
steps: RichTraceStep[];
|
|
2030
|
+
consoleLogs: BrowserConsoleLog[];
|
|
2031
|
+
jsErrors: BrowserJSError[];
|
|
2032
|
+
network: Array<{
|
|
2033
|
+
url: string;
|
|
2034
|
+
method: string;
|
|
2035
|
+
status?: number;
|
|
2036
|
+
durationMs?: number;
|
|
2037
|
+
failed?: boolean;
|
|
2038
|
+
errorText?: string;
|
|
2039
|
+
resourceType?: string;
|
|
2040
|
+
}>;
|
|
2041
|
+
domSnapshot?: string;
|
|
2042
|
+
ariaSnapshot?: string;
|
|
2043
|
+
error?: {
|
|
2044
|
+
message: string;
|
|
2045
|
+
stack?: string;
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
interface BuildRichTraceInput {
|
|
2049
|
+
flowName: string;
|
|
2050
|
+
platform: string;
|
|
2051
|
+
status: "passed" | "failed";
|
|
2052
|
+
startedAt?: string;
|
|
2053
|
+
durationMs: number;
|
|
2054
|
+
viewport?: {
|
|
2055
|
+
width: number;
|
|
2056
|
+
height: number;
|
|
2057
|
+
};
|
|
2058
|
+
steps: StepResult[];
|
|
2059
|
+
consoleLogs?: BrowserConsoleLog[];
|
|
2060
|
+
jsErrors?: BrowserJSError[];
|
|
2061
|
+
har?: BrowserHAR;
|
|
2062
|
+
liveNetwork?: LiveNetworkEvent[];
|
|
2063
|
+
domSnapshot?: string;
|
|
2064
|
+
ariaSnapshot?: string;
|
|
2065
|
+
error?: {
|
|
2066
|
+
message: string;
|
|
2067
|
+
stack?: string;
|
|
2068
|
+
};
|
|
2069
|
+
/** Embed step screenshots as base64 data URLs so `trace-viewer.html` is 100% standalone. Default: true. */
|
|
2070
|
+
inlineScreenshots?: boolean;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Assemble a Playwright-style `RichFlowTrace` combining per-step timings & screenshots,
|
|
2074
|
+
* DOM/ARIA snapshots, network waterfall entries, and console/JS errors.
|
|
2075
|
+
*/
|
|
2076
|
+
declare function buildRichFlowTrace(input: BuildRichTraceInput): RichFlowTrace;
|
|
2077
|
+
/**
|
|
2078
|
+
* Render a self-contained, zero-dependency interactive Playwright-style Trace Viewer HTML page
|
|
2079
|
+
* with step timeline scrubber, screenshot inspector, DOM/ARIA snapshots, network waterfall,
|
|
2080
|
+
* console logs, and JS error panels.
|
|
2081
|
+
*/
|
|
2082
|
+
declare function renderTraceViewerHtml(trace: RichFlowTrace): string;
|
|
2083
|
+
/**
|
|
2084
|
+
* Write both `trace.json` and interactive `trace-viewer.html` into `outputDir`.
|
|
2085
|
+
*/
|
|
2086
|
+
declare function writeRichTraceBundle(trace: RichFlowTrace, outputDir: string): {
|
|
2087
|
+
traceJsonPath: string;
|
|
2088
|
+
traceViewerHtmlPath: string;
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2091
|
+
interface NativeLogCaptureOptions {
|
|
2092
|
+
/** Maximum lines to return from Android logcat (default: 400). */
|
|
2093
|
+
maxLines?: number;
|
|
2094
|
+
/** Optional package name / process filter substring. */
|
|
2095
|
+
filter?: string;
|
|
2096
|
+
/** Command execution timeout in ms (default: 5_000). */
|
|
2097
|
+
timeoutMs?: number;
|
|
2098
|
+
/** Custom execFile runner (for deterministic unit tests). */
|
|
2099
|
+
execFileFn?: (cmd: string, args: string[], opts: {
|
|
2100
|
+
timeout: number;
|
|
2101
|
+
maxBuffer: number;
|
|
2102
|
+
}) => Promise<{
|
|
2103
|
+
stdout: string;
|
|
2104
|
+
stderr: string;
|
|
2105
|
+
}>;
|
|
2106
|
+
}
|
|
2107
|
+
interface IosCrashLogEntry {
|
|
2108
|
+
fileName: string;
|
|
2109
|
+
filePath: string;
|
|
2110
|
+
modifiedAt: string;
|
|
2111
|
+
preview: string;
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Capture recent Android device/emulator logcat lines (`adb -s <id> logcat -d -t <N>`).
|
|
2115
|
+
* Returns `null` if `adb` is unavailable or fails cleanly without throwing.
|
|
2116
|
+
*/
|
|
2117
|
+
declare function captureAndroidLogcat(deviceId?: string, opts?: NativeLogCaptureOptions): Promise<string | null>;
|
|
2118
|
+
/**
|
|
2119
|
+
* Collect recent iOS Simulator crash logs from `~/Library/Logs/DiagnosticReports`
|
|
2120
|
+
* (filtered by optional bundle/app name and `sinceMs` timestamp).
|
|
2121
|
+
*/
|
|
2122
|
+
declare function captureIosSimulatorCrashLogs(opts?: {
|
|
2123
|
+
bundleOrAppName?: string;
|
|
2124
|
+
sinceMs?: number;
|
|
2125
|
+
maxFiles?: number;
|
|
2126
|
+
reportsDir?: string;
|
|
2127
|
+
}): IosCrashLogEntry[];
|
|
2128
|
+
|
|
2129
|
+
interface BidiWebSocketLike {
|
|
2130
|
+
readonly readyState: number;
|
|
2131
|
+
send(data: string): void;
|
|
2132
|
+
close(): void;
|
|
2133
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
2134
|
+
}
|
|
2135
|
+
type BidiWebSocketFactory = (url: string) => BidiWebSocketLike;
|
|
2136
|
+
interface WebDriverBidiClientOptions {
|
|
2137
|
+
/** W3C WebDriver BiDi WebSocket URL (e.g. `ws://127.0.0.1:9222/session/<id>`). */
|
|
2138
|
+
webSocketUrl: string;
|
|
2139
|
+
/** Optional browsing context ID (auto-discovered via `browsingContext.getTree` if omitted). */
|
|
2140
|
+
contextId?: string;
|
|
2141
|
+
/** Command timeout in ms (default: 15_000). */
|
|
2142
|
+
commandTimeoutMs?: number;
|
|
2143
|
+
/** Custom WebSocket factory (for unit tests or custom transports). */
|
|
2144
|
+
createWebSocket?: BidiWebSocketFactory;
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Unwrap a W3C WebDriver BiDi `script.RemoteValue` into a plain JavaScript value.
|
|
2148
|
+
*/
|
|
2149
|
+
declare function deserializeBidiRemoteValue(remote: unknown): unknown;
|
|
2150
|
+
/**
|
|
2151
|
+
* Lightweight W3C WebDriver BiDi JSON-RPC over WebSocket client (works with Firefox BiDi,
|
|
2152
|
+
* ChromeDriver BiDi, GeckoDriver, and Safari/WebKit BiDi endpoints).
|
|
2153
|
+
*/
|
|
2154
|
+
declare class WebDriverBidiClient {
|
|
2155
|
+
private readonly webSocketUrl;
|
|
2156
|
+
private readonly commandTimeoutMs;
|
|
2157
|
+
private readonly createWebSocket;
|
|
2158
|
+
private ws;
|
|
2159
|
+
private nextId;
|
|
2160
|
+
private pending;
|
|
2161
|
+
private eventListeners;
|
|
2162
|
+
private activeContextId;
|
|
2163
|
+
constructor(options: WebDriverBidiClientOptions);
|
|
2164
|
+
get contextId(): string | undefined;
|
|
2165
|
+
isConnected(): boolean;
|
|
2166
|
+
connect(): Promise<void>;
|
|
2167
|
+
disconnect(): Promise<void>;
|
|
2168
|
+
send(method: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2169
|
+
onEvent(method: string, listener: (params: Record<string, unknown>) => void): () => void;
|
|
2170
|
+
subscribe(events: string[], contexts?: string[]): Promise<void>;
|
|
2171
|
+
navigate(url: string, wait?: "none" | "interactive" | "complete"): Promise<void>;
|
|
2172
|
+
reload(wait?: "none" | "interactive" | "complete"): Promise<void>;
|
|
2173
|
+
evaluate<T = unknown>(expression: string, awaitPromise?: boolean): Promise<T>;
|
|
2174
|
+
captureScreenshot(): Promise<Uint8Array>;
|
|
2175
|
+
private requireContextId;
|
|
2176
|
+
private handleMessage;
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Spana `DomChannel` adapter backed by W3C WebDriver BiDi (`script.evaluate`,
|
|
2180
|
+
* `browsingContext.reload`, `browsingContext.navigate`), enabling direct zero-Playwright
|
|
2181
|
+
* DOM queries, actionability waits, and storage injection on Firefox and BiDi browsers.
|
|
2182
|
+
*/
|
|
2183
|
+
declare class BidiDomChannel implements DomChannel {
|
|
2184
|
+
readonly kind: "bidi";
|
|
2185
|
+
readonly client: WebDriverBidiClient;
|
|
2186
|
+
constructor(options: WebDriverBidiClientOptions);
|
|
2187
|
+
isConnected(): boolean;
|
|
2188
|
+
connect(): Promise<void>;
|
|
2189
|
+
disconnect(): Promise<void>;
|
|
2190
|
+
getTargetInfo(): Promise<DomTargetInfo>;
|
|
2191
|
+
query(selector: Selector): Promise<DomElementMatch[]>;
|
|
2192
|
+
evaluate<T = unknown>(script: string | ((...args: any[]) => T), ...args: any[]): Promise<T>;
|
|
2193
|
+
waitForIdle(options?: DomIdleOptions): Promise<void>;
|
|
2194
|
+
scrollIntoView(selector: Selector): Promise<DomElementMatch | null>;
|
|
2195
|
+
tapDom(selector: Selector): Promise<boolean>;
|
|
2196
|
+
fillDom(selector: Selector, value: string, options?: DomFillOptions): Promise<boolean>;
|
|
2197
|
+
waitForSelector(selector: Selector, options?: DomWaitForSelectorOptions): Promise<DomElementMatch[]>;
|
|
2198
|
+
waitForHidden(selector: Selector, options?: DomWaitForHiddenOptions): Promise<boolean>;
|
|
2199
|
+
waitForMatch(selector: Selector, options: DomWaitForMatchOptions): Promise<DomWaitForMatchResult>;
|
|
2200
|
+
setStorage(entries: DomStorageEntries): Promise<void>;
|
|
2201
|
+
clearStorage(options?: DomClearStorageOptions): Promise<void>;
|
|
2202
|
+
reload(): Promise<void>;
|
|
2203
|
+
}
|
|
2204
|
+
declare function createBidiDomChannel(options: WebDriverBidiClientOptions): BidiDomChannel;
|
|
2205
|
+
|
|
2206
|
+
interface ResolvedBrowserExtension {
|
|
2207
|
+
/** Absolute path to the unpacked extension directory. */
|
|
2208
|
+
path: string;
|
|
2209
|
+
/** Name read from `manifest.json`. */
|
|
2210
|
+
name: string;
|
|
2211
|
+
/** Version read from `manifest.json`. */
|
|
2212
|
+
version: string;
|
|
2213
|
+
/** Manifest version (`2` or `3`). */
|
|
2214
|
+
manifestVersion: number;
|
|
2215
|
+
/** Optional popup HTML path from `action.default_popup` or `browser_action.default_popup`. */
|
|
2216
|
+
defaultPopup?: string;
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Validate and resolve unpacked Chromium browser extension paths by reading each folder's
|
|
2220
|
+
* `manifest.json`. Throws a clear error if a path is missing or invalid.
|
|
2221
|
+
*/
|
|
2222
|
+
declare function resolveBrowserExtensions(extensionPaths: string[], baseDir?: string): ResolvedBrowserExtension[];
|
|
2223
|
+
/**
|
|
2224
|
+
* Merge Chromium extension launch flags (`--disable-extensions-except=...`, `--load-extension=...`)
|
|
2225
|
+
* into a Chrome CLI args array, automatically stripping `--disable-extensions` when extensions
|
|
2226
|
+
* are present.
|
|
2227
|
+
*/
|
|
2228
|
+
declare function applyExtensionChromeArgs(baseArgs: string[], extensions: Array<string | ResolvedBrowserExtension>): string[];
|
|
2229
|
+
interface LoadedExtensionTarget {
|
|
2230
|
+
extensionId: string;
|
|
2231
|
+
targetId: string;
|
|
2232
|
+
type: string;
|
|
2233
|
+
url: string;
|
|
2234
|
+
title?: string;
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Query a running CDP browser (`Target.getTargets`) for loaded `chrome-extension://` targets
|
|
2238
|
+
* (background service workers, popup pages, options pages) and return their extension IDs.
|
|
2239
|
+
*/
|
|
2240
|
+
declare function getLoadedExtensions(cdp: {
|
|
2241
|
+
send<T = Record<string, unknown>>(method: string, params?: Record<string, unknown>): Promise<T>;
|
|
2242
|
+
}): Promise<LoadedExtensionTarget[]>;
|
|
2243
|
+
interface OAuthPopupFlowOptions {
|
|
2244
|
+
/** Trigger action on the opener page that opens the third-party OAuth / SSO popup tab. */
|
|
2245
|
+
trigger: () => Promise<unknown>;
|
|
2246
|
+
/** Interactions to run once switched into the OAuth popup tab. */
|
|
2247
|
+
inPopup: (app: PromiseApp) => Promise<void>;
|
|
2248
|
+
/** Max time in ms to wait for the popup tab to open (default: 10_000). */
|
|
2249
|
+
timeoutMs?: number;
|
|
2250
|
+
/** Poll interval in ms when watching `app.getTabIds()` (default: 100). */
|
|
2251
|
+
pollIntervalMs?: number;
|
|
2252
|
+
/** Automatically switch back to the original opener tab after `inPopup` finishes (default: true). */
|
|
2253
|
+
returnToOpener?: boolean;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Ergonomic multi-origin OAuth / SSO popup helper:
|
|
2257
|
+
* 1. Snapshots open tabs before calling `trigger()`.
|
|
2258
|
+
* 2. Waits for the newly opened popup tab to appear and switches to it.
|
|
2259
|
+
* 3. Runs `inPopup(app)` inside the third-party origin popup.
|
|
2260
|
+
* 4. Switches cleanly back to the original opener tab once the popup closes or completes.
|
|
2261
|
+
*/
|
|
2262
|
+
declare function runOAuthPopupFlow(app: PromiseApp, options: OAuthPopupFlowOptions): Promise<{
|
|
2263
|
+
popupTabId: string;
|
|
2264
|
+
openerTabIndex: number;
|
|
2265
|
+
}>;
|
|
2266
|
+
|
|
2267
|
+
export { AndroidWebViewCdpChannel, type AndroidWebViewCdpOptions, type ApiClient, type ApiClientOptions, type ApiRequestOptions, type ApiResponse, AppConfig, AppleWebInspectorClient, type AppliedFilterReport, type ApplyFiltersResult, type AttachNetworkCacheOptions, type AttachNetworkCacheResult, type Attachment, BidiDomChannel, type BidiWebSocketFactory, type BidiWebSocketLike, BrowserConsoleLog, BrowserEmulationOptions, BrowserHAR, BrowserJSError, BrowserMockResponse, BrowserName, BrowserRouteMatcher, type BuildRichTraceInput, type CacheClearResult, type CacheInspectEntry, type CacheInspectResult, type CachedNetworkEntry, type CachedPersonaState, type CdpChildSessionInfo, CdpDomChannel, type CdpDomChannelOptions, type CdpFrameOffsetResolver, type CdpScreencastLike, type CdpScreencastRecorderOptions, type ChangedFile, type CloudProvider, type CloudProviderHelper, type CodeLocation, type ComponentTreeNode, type ComponentTreeReport, type CreateFixturesOptions, DEFAULT_MAX_WORKERS_PER_PROCESS, DEFAULT_WARM_DAEMON_IDLE_TTL_MS, type DecisionBatchJudge, type DecisionBatchJudgeResult, type DecisionFilterOptions, type DecisionModelJudge, type DeterministicImpactFilterOptions, type DirectCdpBrowserHandle, type DirectCdpBrowserLaunchOptions, DomChannel, DomClearStorageOptions, DomElementMatch, DomFillOptions, DomIdleOptions, DomStorageEntries, DomTargetInfo, DomWaitForHiddenOptions, DomWaitForMatchOptions, DomWaitForMatchResult, DomWaitForSelectorOptions, ElectrobunAppConfig, type ElectrobunDriverOptions, type ElectrobunLaunchPlan, ElectrobunRenderer, type ElectronDriverOptions, Element, type ExtendedFlowConfig, ExtendedSelector, type ExtractedCodeFrame, type FailureCategory, type FilterCandidate, type FilterContext, type FilterDecisionOutput, type FilterUsage, type FixtureDefinition, type FixtureFn, type FixtureMap, FlowConfig, FlowContext, FlowDefinition, type FlowError, FlowFn, type FlowPlaybackTrace, type FlowResult, type GitChanges, type GitHubPrReporterOptions, type HostOS, type IosCrashLogEntry, type JsonRpcRequest, type JsonRpcResponse, type LightweightCdpDriverOptions, type LiveNetworkEvent, type LoadedExtensionTarget, type LogprobDecisionJudgeOptions, type McpContentBlock, type McpToolDefinition, type McpToolResult, type MultiProcessPoolOptions, type MultiProcessPoolResult, type NamedSetupDefinition, type NativeLogCaptureOptions, type NativePngCompareResult, type NativeXmlRawNode, type NetworkCacheMode, NetworkEventBuffer, type NetworkEventFilter, NetworkReplayCache, type NetworkReplayCacheOptions, type OAuthPopupFlowOptions, type OllamaDecisionJudgeOptions, type PathRule, type PathRuleFilterOptions, type PerformanceProfileReport, PersonaAuthCache, type PersonaDefinition, Platform, type PlaybackFrame, type PlaybackStepMarker, type PrelaunchedWebBrowser, type ProcessPartitionPlan, type ProcessShardCommand, type ProcessShardOutcome, PromiseApp, ProvConfig, type Reporter, type ResolvedBrowserExtension, type ResolvedElementResult, type RichFlowTrace, type RichTraceStep, type RunSummary, SPANA_MCP_TOOLS, type ScenarioStepResult, Selector, type SharedFlowQueueServer, SpanaBridgeChannel, type SpanaBridgeServerOptions, SpanaMcpServer, type SpanaMcpServerOptions, type StepResult, type StopRecordingOptions, type StopRecordingResult, type SuiteBuilder, type SuiteConfig, TARGET_CHANNEL_MATRIX, TapMode, type TargetChannel, type TargetDescriptor, type TargetEngine, type TargetShell, type TestFilter, UPLOAD_ATTACH_TIMEOUT_MS, type VideoRecorderHandle, VirtualAuthenticatorOptions, VirtualCredential, VirtualCredentialInput, VirtualCredentialStore, type WarmDaemonRecord, WebDriverBidiClient, type WebDriverBidiClientOptions, type WebInspectorListingPage, WebKitInspectorChannel, type WebKitInspectorOptions, allocateFreePort, applyExtensionChromeArgs, applyNamedSetup, applyTestFilters, assertPortAvailable, attachNetworkReplayCache, buildComponentTreeScript, buildFilterCandidates, buildFlowFileFromLines, buildNetworkCacheKey, buildPerformanceProfileScript, buildPlaybackTraceFromSteps, buildRichFlowTrace, captureAndroidLogcat, captureIosSimulatorCrashLogs, clearReplayCache, cloneIOSSimulator, collectGitChanges, comparePngNative, connectPlaywrightOverCDP, connectPlaywrightOverWS, createAndroidWebViewCdpChannel, createApiClient, createApiFixture, createBidiDomChannel, createCdpDomChannel, createCompositeDomChannel, createFlowWithFixtures, createGitHubPrReporter, createLogprobDecisionJudge, createOllamaDecisionJudge, createRemoteFlowClaimer, createSpanaBridgeChannel, createWebKitInspectorChannel, decisionFilter, decodeWebInspectorFrames, defaultDaemonStateDir, definePersona, defineSetup, deleteIOSSimulator, deserializeBidiRemoteValue, deterministicImpactFilter, domRectToScreenBounds, encodeWebInspectorPacket, ensureWarmBrowserDaemon, exportFramesToMp4, extractCodeFrame, extractDestructuredParamNames, findSimulatorWebInspectorSocket, findWebViewFrame, formatCacheInspectTable, formatCodeFrame, formatFilterSummary, formatGitHubPrMarkdown, formatSelectorCode, formatTargetMatrixTable, getHealthyWarmDaemon, getLoadedExtensions, getNativeAcceleratorPath, inspectReplayCache, invalidateWebViewFrameCache, isNativeAcceleratorActive, isOffscreenInViewport, isPortAvailable, launchDirectCdpBrowser, launchPlaywrightBrowser, listWarmDaemons, makeElectrobunDriver, makeElectronDriver, makeLightweightCdpDriver, orderFlowsLongestFirst, parseAndroidWebViewSockets, parseWebInspectorXmlFrame, partitionFlowsAcrossProcesses, pathRuleFilter, planProcessPool, probabilityFromTopLogprobs, reapIdleWarmDaemons, renderTraceViewerHtml, resolveBrowserExtensions, resolveElectrobunEngine, resolveElectrobunLaunchPlan, resolveElementAcrossChannels, resolveTargetDescriptor, resolveWebEngine, runMultiProcessPool, runOAuthPopupFlow, speculativelyPrelaunchWebBrowser, startAndroidVideoRecorder, startCdpScreencastRecorder, startIosSimulatorVideoRecorder, startSharedFlowQueueServer, step, stopAllWarmDaemons, stopWarmDaemon, suite, sweepOrphanedSpanaBrowsers, tokenizeXmlNative, updateWarmDaemonSession, withActiveStepRecorder, writeRichTraceBundle, writeWorkerProcessReport };
|