@vostride/agent-qa-web 0.2.2 → 0.2.4

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { Page, LaunchOptions, BrowserContextOptions, Locator } from 'playwright-core';
2
- import { PlatformAdapter, OperationCaptureSupport, PlatformConfig, LiveStreamCapability, RecordingCapability, ObserveOptions, ActionsFor, ExecuteOptions, ActionResult, ConsoleLogEntry, NetworkLogEntry, InterimNode, Action, AccessibilityViolation } from '@vostride/agent-qa-runner';
1
+ import { Page, Locator } from 'playwright-core';
2
+ import { PlatformAdapter, OperationCaptureSupport, PlatformConfig, LiveStreamCapability, RecordingCapability, ActionsFor, ExecuteOptions, ActionResult, ConsoleLogEntry, NetworkLogEntry, InterimNode, Action, AccessibilityViolation } from '@vostride/agent-qa-runner';
3
3
  import { ScreenState } from '@vostride/agent-qa-schema';
4
4
 
5
5
  interface WebPlatformAdapterOptions {
@@ -16,6 +16,7 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
16
16
  private epoch;
17
17
  private pageLogBuffers;
18
18
  private logCaptureConfig;
19
+ private navigationTimeoutMs;
19
20
  private disconnected;
20
21
  private intentionalClose;
21
22
  private armedRoutes;
@@ -38,34 +39,13 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
38
39
  private operationCapture;
39
40
  operationCaptureSupport: OperationCaptureSupport | undefined;
40
41
  setup(config: PlatformConfig): Promise<void>;
41
- /**
42
- * 403 D-05/LIVE-01: the Chromium screencast producer, or ABSENT when this adapter cannot stream.
43
- *
44
- * Absence means "no continuous stream", not "no preview": since 428-05 the composition's
45
- * `liveStreamFor` wraps this adapter's `screenshot()` in the labelled 1 s snapshot producer, both
46
- * as the fallback behind a screencast that fails to start and as the whole preview on a
47
- * non-Chromium target. The two gates here (Chromium only, and a page to stream) stay exactly as
48
- * they are, so the absence stays honest.
49
- *
50
- * SCOPE (428 D-18, closes WIN #273): the screencast shows the page the test is acting on. Both
51
- * page-switch sites (`tab new`, `tab switch`) go through `setActivePage`, which re-binds the
52
- * running screencast to the new page INSIDE this same capability object: no stop, no re-register,
53
- * no stream end, so a subscriber only sees the picture change. Start, stop and re-bind run on one
54
- * serialised chain. A popup or a closing tab never changes `this.page` in this adapter, so the
55
- * preview already shows the acting page in those cases.
56
- */
57
42
  get liveStream(): LiveStreamCapability | undefined;
58
- /** Run `step` after every earlier start, stop and re-bind has settled (428 D-18). */
43
+ /** Run `step` after every earlier start, stop and re-bind has settled. */
59
44
  private onScreencastChain;
60
45
  /** Stop and detach the current CDP session, best-effort, and forget its tokens and keepalive. */
61
46
  private detachScreencast;
62
47
  /** Wire `cdp`'s screencast frames to `onFrame`; shared by `start` and `rebindScreencast`. */
63
48
  private attachScreencast;
64
- /**
65
- * The one place the page the test acts on changes (428 D-18). Recording keeps following its
66
- * starting page through the revision counter (424 reconciliation 25(d)); the live screencast,
67
- * when running, re-binds to the new page on the serialised chain.
68
- */
69
49
  private setActivePage;
70
50
  /**
71
51
  * Move the running screencast onto `this.page` without its subscribers noticing: the old session
@@ -74,16 +54,7 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
74
54
  * unknown. Best-effort throughout; it never throws into a step.
75
55
  */
76
56
  private rebindScreencast;
77
- /**
78
- * 428 D-12's second half: the screencast was withdrawn while the browser is still up (its CDP
79
- * session detached or unusable), which only this capability can see. Detected when a keepalive
80
- * capture or a re-bind's start rejects on the active session; the capability then serves the
81
- * labelled 1 s snapshot preview of the current page through the same `onFrame`, until `stop()`,
82
- * `cleanup()` or a successful re-bind. The declared kind stays `cdp-screencast`; the frames carry
83
- * `kind: 'snapshot'`, which is what labels the preview. Runs on the serialised chain.
84
- */
85
57
  private handleScreencastWithdrawn;
86
- /** While the snapshot fallback runs, try the screencast again every SCREENCAST_RECOVERY_MS (428 WR-08). */
87
58
  private armScreencastRecovery;
88
59
  private clearScreencastRecovery;
89
60
  private browserIsLive;
@@ -91,29 +62,21 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
91
62
  private clearKeepalive;
92
63
  /** (Re-)arm the quiet-page keepalive for `cdp`; every screencast frame pushes it back. */
93
64
  private armKeepalive;
94
- /**
95
- * 428 D-15: a fresh capture on the same CDP session, emitted as a frame with no ack token (the ack
96
- * path drops ids it never minted a token for). A capture that rejects emits nothing. While the
97
- * capability is started under a live browser, a session that then fails a trivial probe too is a
98
- * withdrawn screencast (D-12, see `handleScreencastWithdrawn`); one that still answers only had a
99
- * bad moment, such as a cross-process navigation, and re-arms (428 WR-08). One that never settles
100
- * emits nothing and arms nothing, which is the honest amber.
101
- */
102
65
  private fireKeepalive;
103
66
  /** Whether `cdp` still answers a command that cannot fail on a usable session. */
104
67
  private sessionAnswers;
105
68
  get recording(): RecordingCapability | undefined;
106
69
  cleanup(): Promise<void>;
107
70
  get isBrowserDisconnected(): boolean;
108
- observe(options?: ObserveOptions): Promise<ScreenState>;
71
+ observe(): Promise<ScreenState>;
109
72
  private observeDocument;
110
73
  execute(action: ActionsFor<'web'>, options?: ExecuteOptions): Promise<ActionResult>;
74
+ private stopLoading;
111
75
  private executeWithErrorResult;
112
76
  screenshot(): Promise<Buffer | undefined>;
113
77
  getPage(): Page | null;
114
78
  drainConsoleLogs(level?: string): ConsoleLogEntry[];
115
79
  drainNetworkLogs(urlPattern?: string): NetworkLogEntry[];
116
- /** 439 D-04: a completed download's bytes held in memory, by its sha256. */
117
80
  readDownloadBytes(sha256: string): Uint8Array | undefined;
118
81
  peekNetworkLogs(urlPattern?: string): NetworkLogEntry[];
119
82
  private attachLogListeners;
@@ -121,67 +84,10 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
121
84
  private executeAction;
122
85
  }
123
86
 
124
- declare class FarmWebAdapter implements PlatformAdapter<'web'> {
125
- readonly platform: "web";
126
- private browser;
127
- private context;
128
- private page;
129
- private lastRefs;
130
- private epoch;
131
- private sessionUrl;
132
- private sessionId;
133
- private testFailed;
134
- private exitHandler;
135
- private credentials;
136
- private pageLogBuffers;
137
- private logCaptureConfig;
138
- private armedRoutes;
139
- private pendingDialogArm;
140
- private recordingCapability;
141
- private recordingConfig;
142
- setup(config: PlatformConfig): Promise<void>;
143
- get recording(): RecordingCapability | undefined;
144
- cleanup(): Promise<void>;
145
- observe(options?: ObserveOptions): Promise<ScreenState>;
146
- private observeDocument;
147
- execute(action: ActionsFor<'web'>): Promise<ActionResult>;
148
- screenshot(): Promise<Buffer | undefined>;
149
- getPage(): Page | null;
150
- markFailed(): void;
151
- getSessionUrl(): string | undefined;
152
- getSessionId(): string | undefined;
153
- drainConsoleLogs(level?: string): ConsoleLogEntry[];
154
- drainNetworkLogs(urlPattern?: string): NetworkLogEntry[];
155
- peekNetworkLogs(urlPattern?: string): NetworkLogEntry[];
156
- private attachLogListeners;
157
- private resolveTabTargetAsync;
158
- private executeAction;
159
- }
160
-
161
- /**
162
- * Parse a Playwright ARIA snapshot into platform-neutral runner interim nodes.
163
- *
164
- * Emits nodes in document order with role/name/attributes and a `parentIndex`
165
- * derived from indentation depth: the nearest kept entry among the line's true
166
- * ancestors; a dropped line still bounds its subtree (438 gap round, CR-02). A line
167
- * whose role is not kept never becomes a node: its quoted name and inline text fold
168
- * into the nearest kept entry among the line's true ancestors (438 D-02, the row
169
- * text), and a kept content line's own inline text becomes its `text`. Playwright
170
- * ai-mode `[ref=eN]` annotations are captured into an index-aligned `nativeRefs`
171
- * array (adapter-private native handles) and are never written into the node. Accepts both ai-mode (annotated) and default-mode
172
- * (unannotated) snapshot text.
173
- *
174
- * No ref minting and no tree rendering happen here — the shared runner builder
175
- * owns both (D-01/D-02/D-03).
176
- */
177
87
  declare function parseAriaSnapshot(ariaTree: string): {
178
88
  nodes: InterimNode[];
179
89
  nativeRefs: (string | undefined)[];
180
90
  };
181
- declare function observePage(page: Page, options?: {
182
- filterSelector?: string;
183
- extractDom?: boolean;
184
- }): Promise<ScreenState>;
185
91
 
186
92
  type RefMap = Record<string, {
187
93
  nativeRef: string;
@@ -195,16 +101,6 @@ type RefMap = Record<string, {
195
101
  height: number;
196
102
  };
197
103
  }>;
198
- interface WebAdapterConfig extends PlatformConfig {
199
- launchOptions?: LaunchOptions;
200
- contextOptions?: BrowserContextOptions;
201
- filterSelector?: string;
202
- }
203
- interface SnapshotResult {
204
- tree: string;
205
- refs: RefMap;
206
- elementCount: number;
207
- }
208
104
 
209
105
  /** Resolves a ref to the aria-ref locator of the element observed under it; never by position. */
210
106
  declare class ElementResolver {
@@ -246,10 +142,4 @@ interface AccessibilityOptions {
246
142
  }
247
143
  declare function runAccessibilityCheck(page: Page, options?: AccessibilityOptions): Promise<AccessibilityViolation[]>;
248
144
 
249
- interface ExtractDomOptions {
250
- maxDepth?: number;
251
- maxTextLen?: number;
252
- }
253
- declare function extractDom(page: Page, opts?: ExtractDomOptions): Promise<string | undefined>;
254
-
255
- export { type AccessibilityOptions, ActionValidationError, ElementResolver, type ExtractDomOptions, FarmWebAdapter, type RefMap, type SmartWaitOptions, type SnapshotResult, type ValidationResult, type WebAdapterConfig, WebPlatformAdapter, extractDom, observePage, parseAriaSnapshot, runAccessibilityCheck, validateAction, waitForPageReady };
145
+ export { type AccessibilityOptions, ActionValidationError, ElementResolver, type RefMap, type SmartWaitOptions, type ValidationResult, WebPlatformAdapter, parseAriaSnapshot, runAccessibilityCheck, validateAction, waitForPageReady };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Page, LaunchOptions, BrowserContextOptions, Locator } from 'playwright-core';
2
- import { PlatformAdapter, OperationCaptureSupport, PlatformConfig, LiveStreamCapability, RecordingCapability, ObserveOptions, ActionsFor, ExecuteOptions, ActionResult, ConsoleLogEntry, NetworkLogEntry, InterimNode, Action, AccessibilityViolation } from '@vostride/agent-qa-runner';
1
+ import { Page, Locator } from 'playwright-core';
2
+ import { PlatformAdapter, OperationCaptureSupport, PlatformConfig, LiveStreamCapability, RecordingCapability, ActionsFor, ExecuteOptions, ActionResult, ConsoleLogEntry, NetworkLogEntry, InterimNode, Action, AccessibilityViolation } from '@vostride/agent-qa-runner';
3
3
  import { ScreenState } from '@vostride/agent-qa-schema';
4
4
 
5
5
  interface WebPlatformAdapterOptions {
@@ -16,6 +16,7 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
16
16
  private epoch;
17
17
  private pageLogBuffers;
18
18
  private logCaptureConfig;
19
+ private navigationTimeoutMs;
19
20
  private disconnected;
20
21
  private intentionalClose;
21
22
  private armedRoutes;
@@ -38,34 +39,13 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
38
39
  private operationCapture;
39
40
  operationCaptureSupport: OperationCaptureSupport | undefined;
40
41
  setup(config: PlatformConfig): Promise<void>;
41
- /**
42
- * 403 D-05/LIVE-01: the Chromium screencast producer, or ABSENT when this adapter cannot stream.
43
- *
44
- * Absence means "no continuous stream", not "no preview": since 428-05 the composition's
45
- * `liveStreamFor` wraps this adapter's `screenshot()` in the labelled 1 s snapshot producer, both
46
- * as the fallback behind a screencast that fails to start and as the whole preview on a
47
- * non-Chromium target. The two gates here (Chromium only, and a page to stream) stay exactly as
48
- * they are, so the absence stays honest.
49
- *
50
- * SCOPE (428 D-18, closes WIN #273): the screencast shows the page the test is acting on. Both
51
- * page-switch sites (`tab new`, `tab switch`) go through `setActivePage`, which re-binds the
52
- * running screencast to the new page INSIDE this same capability object: no stop, no re-register,
53
- * no stream end, so a subscriber only sees the picture change. Start, stop and re-bind run on one
54
- * serialised chain. A popup or a closing tab never changes `this.page` in this adapter, so the
55
- * preview already shows the acting page in those cases.
56
- */
57
42
  get liveStream(): LiveStreamCapability | undefined;
58
- /** Run `step` after every earlier start, stop and re-bind has settled (428 D-18). */
43
+ /** Run `step` after every earlier start, stop and re-bind has settled. */
59
44
  private onScreencastChain;
60
45
  /** Stop and detach the current CDP session, best-effort, and forget its tokens and keepalive. */
61
46
  private detachScreencast;
62
47
  /** Wire `cdp`'s screencast frames to `onFrame`; shared by `start` and `rebindScreencast`. */
63
48
  private attachScreencast;
64
- /**
65
- * The one place the page the test acts on changes (428 D-18). Recording keeps following its
66
- * starting page through the revision counter (424 reconciliation 25(d)); the live screencast,
67
- * when running, re-binds to the new page on the serialised chain.
68
- */
69
49
  private setActivePage;
70
50
  /**
71
51
  * Move the running screencast onto `this.page` without its subscribers noticing: the old session
@@ -74,16 +54,7 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
74
54
  * unknown. Best-effort throughout; it never throws into a step.
75
55
  */
76
56
  private rebindScreencast;
77
- /**
78
- * 428 D-12's second half: the screencast was withdrawn while the browser is still up (its CDP
79
- * session detached or unusable), which only this capability can see. Detected when a keepalive
80
- * capture or a re-bind's start rejects on the active session; the capability then serves the
81
- * labelled 1 s snapshot preview of the current page through the same `onFrame`, until `stop()`,
82
- * `cleanup()` or a successful re-bind. The declared kind stays `cdp-screencast`; the frames carry
83
- * `kind: 'snapshot'`, which is what labels the preview. Runs on the serialised chain.
84
- */
85
57
  private handleScreencastWithdrawn;
86
- /** While the snapshot fallback runs, try the screencast again every SCREENCAST_RECOVERY_MS (428 WR-08). */
87
58
  private armScreencastRecovery;
88
59
  private clearScreencastRecovery;
89
60
  private browserIsLive;
@@ -91,29 +62,21 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
91
62
  private clearKeepalive;
92
63
  /** (Re-)arm the quiet-page keepalive for `cdp`; every screencast frame pushes it back. */
93
64
  private armKeepalive;
94
- /**
95
- * 428 D-15: a fresh capture on the same CDP session, emitted as a frame with no ack token (the ack
96
- * path drops ids it never minted a token for). A capture that rejects emits nothing. While the
97
- * capability is started under a live browser, a session that then fails a trivial probe too is a
98
- * withdrawn screencast (D-12, see `handleScreencastWithdrawn`); one that still answers only had a
99
- * bad moment, such as a cross-process navigation, and re-arms (428 WR-08). One that never settles
100
- * emits nothing and arms nothing, which is the honest amber.
101
- */
102
65
  private fireKeepalive;
103
66
  /** Whether `cdp` still answers a command that cannot fail on a usable session. */
104
67
  private sessionAnswers;
105
68
  get recording(): RecordingCapability | undefined;
106
69
  cleanup(): Promise<void>;
107
70
  get isBrowserDisconnected(): boolean;
108
- observe(options?: ObserveOptions): Promise<ScreenState>;
71
+ observe(): Promise<ScreenState>;
109
72
  private observeDocument;
110
73
  execute(action: ActionsFor<'web'>, options?: ExecuteOptions): Promise<ActionResult>;
74
+ private stopLoading;
111
75
  private executeWithErrorResult;
112
76
  screenshot(): Promise<Buffer | undefined>;
113
77
  getPage(): Page | null;
114
78
  drainConsoleLogs(level?: string): ConsoleLogEntry[];
115
79
  drainNetworkLogs(urlPattern?: string): NetworkLogEntry[];
116
- /** 439 D-04: a completed download's bytes held in memory, by its sha256. */
117
80
  readDownloadBytes(sha256: string): Uint8Array | undefined;
118
81
  peekNetworkLogs(urlPattern?: string): NetworkLogEntry[];
119
82
  private attachLogListeners;
@@ -121,67 +84,10 @@ declare class WebPlatformAdapter implements PlatformAdapter<'web'> {
121
84
  private executeAction;
122
85
  }
123
86
 
124
- declare class FarmWebAdapter implements PlatformAdapter<'web'> {
125
- readonly platform: "web";
126
- private browser;
127
- private context;
128
- private page;
129
- private lastRefs;
130
- private epoch;
131
- private sessionUrl;
132
- private sessionId;
133
- private testFailed;
134
- private exitHandler;
135
- private credentials;
136
- private pageLogBuffers;
137
- private logCaptureConfig;
138
- private armedRoutes;
139
- private pendingDialogArm;
140
- private recordingCapability;
141
- private recordingConfig;
142
- setup(config: PlatformConfig): Promise<void>;
143
- get recording(): RecordingCapability | undefined;
144
- cleanup(): Promise<void>;
145
- observe(options?: ObserveOptions): Promise<ScreenState>;
146
- private observeDocument;
147
- execute(action: ActionsFor<'web'>): Promise<ActionResult>;
148
- screenshot(): Promise<Buffer | undefined>;
149
- getPage(): Page | null;
150
- markFailed(): void;
151
- getSessionUrl(): string | undefined;
152
- getSessionId(): string | undefined;
153
- drainConsoleLogs(level?: string): ConsoleLogEntry[];
154
- drainNetworkLogs(urlPattern?: string): NetworkLogEntry[];
155
- peekNetworkLogs(urlPattern?: string): NetworkLogEntry[];
156
- private attachLogListeners;
157
- private resolveTabTargetAsync;
158
- private executeAction;
159
- }
160
-
161
- /**
162
- * Parse a Playwright ARIA snapshot into platform-neutral runner interim nodes.
163
- *
164
- * Emits nodes in document order with role/name/attributes and a `parentIndex`
165
- * derived from indentation depth: the nearest kept entry among the line's true
166
- * ancestors; a dropped line still bounds its subtree (438 gap round, CR-02). A line
167
- * whose role is not kept never becomes a node: its quoted name and inline text fold
168
- * into the nearest kept entry among the line's true ancestors (438 D-02, the row
169
- * text), and a kept content line's own inline text becomes its `text`. Playwright
170
- * ai-mode `[ref=eN]` annotations are captured into an index-aligned `nativeRefs`
171
- * array (adapter-private native handles) and are never written into the node. Accepts both ai-mode (annotated) and default-mode
172
- * (unannotated) snapshot text.
173
- *
174
- * No ref minting and no tree rendering happen here — the shared runner builder
175
- * owns both (D-01/D-02/D-03).
176
- */
177
87
  declare function parseAriaSnapshot(ariaTree: string): {
178
88
  nodes: InterimNode[];
179
89
  nativeRefs: (string | undefined)[];
180
90
  };
181
- declare function observePage(page: Page, options?: {
182
- filterSelector?: string;
183
- extractDom?: boolean;
184
- }): Promise<ScreenState>;
185
91
 
186
92
  type RefMap = Record<string, {
187
93
  nativeRef: string;
@@ -195,16 +101,6 @@ type RefMap = Record<string, {
195
101
  height: number;
196
102
  };
197
103
  }>;
198
- interface WebAdapterConfig extends PlatformConfig {
199
- launchOptions?: LaunchOptions;
200
- contextOptions?: BrowserContextOptions;
201
- filterSelector?: string;
202
- }
203
- interface SnapshotResult {
204
- tree: string;
205
- refs: RefMap;
206
- elementCount: number;
207
- }
208
104
 
209
105
  /** Resolves a ref to the aria-ref locator of the element observed under it; never by position. */
210
106
  declare class ElementResolver {
@@ -246,10 +142,4 @@ interface AccessibilityOptions {
246
142
  }
247
143
  declare function runAccessibilityCheck(page: Page, options?: AccessibilityOptions): Promise<AccessibilityViolation[]>;
248
144
 
249
- interface ExtractDomOptions {
250
- maxDepth?: number;
251
- maxTextLen?: number;
252
- }
253
- declare function extractDom(page: Page, opts?: ExtractDomOptions): Promise<string | undefined>;
254
-
255
- export { type AccessibilityOptions, ActionValidationError, ElementResolver, type ExtractDomOptions, FarmWebAdapter, type RefMap, type SmartWaitOptions, type SnapshotResult, type ValidationResult, type WebAdapterConfig, WebPlatformAdapter, extractDom, observePage, parseAriaSnapshot, runAccessibilityCheck, validateAction, waitForPageReady };
145
+ export { type AccessibilityOptions, ActionValidationError, ElementResolver, type RefMap, type SmartWaitOptions, type ValidationResult, WebPlatformAdapter, parseAriaSnapshot, runAccessibilityCheck, validateAction, waitForPageReady };