@allwright.dev/core 0.1.11 → 0.1.13
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/README.md +16 -0
- package/dist/bootstrap.js +1 -1
- package/dist/locator.d.ts +2 -0
- package/dist/locator.js +2 -0
- package/dist/page.d.ts +1 -0
- package/dist/page.js +17 -0
- package/dist/types.d.ts +16 -1
- package/package.json +1 -1
- package/proto/core/v1/context.proto +2 -0
- package/proto/surfaces/web/v1/web.proto +9 -0
package/README.md
CHANGED
|
@@ -79,3 +79,19 @@ suites:
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
The TypeScript package exports `findConfigFile()`, `loadConfigFile()`, `resolveConfig()`, and `launchConfiguredBrowser()` so runner packages can consume the same config model without inventing language-specific config files.
|
|
82
|
+
|
|
83
|
+
### Iframes
|
|
84
|
+
|
|
85
|
+
An iframe resolves to a normal `Page`, including nested and cross-origin frames:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const frame = await page.locator("#checkout-frame").Frame({ timeoutMs: 10_000 });
|
|
89
|
+
await frame.locator("input[name=email]").fill("buyer@example.com");
|
|
90
|
+
const nested = await frame.locator("iframe").frame({ timeoutMs: 5_000 });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`Frame()` and `frame()` are aliases. The timeout covers finding exactly one iframe,
|
|
94
|
+
resolving its browsing context, and waiting for a fully loaded document with 200 ms
|
|
95
|
+
without DOM mutations. The default is 10 seconds. Closing the frame page releases
|
|
96
|
+
its session; it does not remove the iframe or close the parent tab. Resolve a new
|
|
97
|
+
frame page after the iframe is replaced.
|
package/dist/bootstrap.js
CHANGED
|
@@ -12,7 +12,7 @@ const ALLWRIGHT_HOME_ENV_VAR = "ALLWRIGHT_HOME";
|
|
|
12
12
|
const ALLWRIGHT_REPOSITORY_ENV_VAR = "ALLWRIGHT_REPOSITORY";
|
|
13
13
|
const ALLWRIGHT_VERSION_ENV_VAR = "ALLWRIGHT_VERSION";
|
|
14
14
|
const DEFAULT_RELEASE_REPOSITORY = "allwright-dev/allwright";
|
|
15
|
-
const DEFAULT_RELEASE_VERSION = "0.1.
|
|
15
|
+
const DEFAULT_RELEASE_VERSION = "0.1.13";
|
|
16
16
|
const STARTUP_TIMEOUT_MS = 20_000;
|
|
17
17
|
const PING_TIMEOUT_MS = 1_000;
|
|
18
18
|
const PROTO_ROOT = fileURLToPath(new URL("../proto/", import.meta.url));
|
package/dist/locator.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare class LocatorImpl extends WebLocatorBuilders implements Locator {
|
|
|
4
4
|
readonly page: Page;
|
|
5
5
|
readonly selector: string;
|
|
6
6
|
constructor(input: LocatorInfo);
|
|
7
|
+
frame(options?: CommandOptions): Promise<Page>;
|
|
8
|
+
Frame(options?: CommandOptions): Promise<Page>;
|
|
7
9
|
click(options?: CommandOptions): Promise<ClickResult>;
|
|
8
10
|
count(options?: CommandOptions): Promise<CountResult>;
|
|
9
11
|
highlight(options?: HighlightOptions): Promise<HighlightResult>;
|
package/dist/locator.js
CHANGED
|
@@ -8,6 +8,8 @@ export class LocatorImpl extends WebLocatorBuilders {
|
|
|
8
8
|
this.page = input.page;
|
|
9
9
|
this.selector = input.selector;
|
|
10
10
|
}
|
|
11
|
+
frame(options = {}) { return this.page.frame(this.selector, options); }
|
|
12
|
+
Frame(options = {}) { return this.frame(options); }
|
|
11
13
|
async click(options = {}) {
|
|
12
14
|
return this.page.click(this.selector, options);
|
|
13
15
|
}
|
package/dist/page.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class PageImpl extends WebLocatorBuilders implements Page {
|
|
|
8
8
|
});
|
|
9
9
|
readonly sessionId: string;
|
|
10
10
|
readonly browserSessionId: string;
|
|
11
|
+
frame(selector: string, options?: CommandOptions): Promise<Page>;
|
|
11
12
|
registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
|
|
12
13
|
setFileChooserFiles(fileChooserId: string, files: string[], options?: CommandOptions): Promise<void>;
|
|
13
14
|
saveDownload(downloadId: string, path: string, options?: CommandOptions): Promise<void>;
|
package/dist/page.js
CHANGED
|
@@ -24,6 +24,23 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
24
24
|
}
|
|
25
25
|
sessionId;
|
|
26
26
|
browserSessionId;
|
|
27
|
+
async frame(selector, options = {}) {
|
|
28
|
+
const handle = await this.#getHandle();
|
|
29
|
+
this.#ensureOpen(handle);
|
|
30
|
+
handle.stream.write({ surfaceSessionId: this.browserSessionId, contextSessionId: this.sessionId,
|
|
31
|
+
resolveFrame: { cssSelector: normalizeSelectorForTransport(selector), retryOptions: options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : undefined } });
|
|
32
|
+
while (true) {
|
|
33
|
+
const event = await handle.queue.next();
|
|
34
|
+
if (event.frameResolved?.contextSessionId)
|
|
35
|
+
return this.#createPage(event.frameResolved.contextSessionId);
|
|
36
|
+
if (event.error?.message)
|
|
37
|
+
throw formatActionError("resolve frame", event.error.message, selector);
|
|
38
|
+
if (event.closed) {
|
|
39
|
+
handle.closed = true;
|
|
40
|
+
throw new Error("page closed while resolving frame");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
27
44
|
async registerHook(type) {
|
|
28
45
|
if (type.name !== "newPage" && type.name !== "fileChooser" && type.name !== "download") {
|
|
29
46
|
throw formatActionError("register hook", `unsupported hook type: ${type.name}`);
|
package/dist/types.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ export interface Browser extends BrowserInfo {
|
|
|
133
133
|
browserInfo(): BrowserInfo;
|
|
134
134
|
}
|
|
135
135
|
export interface Page extends PageInfo, WebLocators {
|
|
136
|
+
frame(selector: string, options?: CommandOptions): Promise<Page>;
|
|
136
137
|
registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
|
|
137
138
|
accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
|
|
138
139
|
locator(selector: string, options?: LocatorFilterOptions): Locator;
|
|
@@ -206,6 +207,8 @@ export interface MobileSurfaceNamespace {
|
|
|
206
207
|
};
|
|
207
208
|
}
|
|
208
209
|
export interface Locator extends WebLocators {
|
|
210
|
+
frame(options?: CommandOptions): Promise<Page>;
|
|
211
|
+
Frame(options?: CommandOptions): Promise<Page>;
|
|
209
212
|
not(other: Locator): Locator;
|
|
210
213
|
filter(options?: LocatorFilterOptions): Locator;
|
|
211
214
|
nth(index: number): Locator;
|
|
@@ -374,6 +377,9 @@ export interface SurfaceSessionEvent {
|
|
|
374
377
|
};
|
|
375
378
|
}
|
|
376
379
|
export interface ContextSessionEvent {
|
|
380
|
+
frameResolved?: {
|
|
381
|
+
contextSessionId?: string;
|
|
382
|
+
};
|
|
377
383
|
accessibilitySnapshotCaptured?: {
|
|
378
384
|
snapshot?: string;
|
|
379
385
|
format?: string;
|
|
@@ -809,7 +815,16 @@ export interface CloseContextRequest {
|
|
|
809
815
|
close: Record<string, never>;
|
|
810
816
|
}
|
|
811
817
|
export type SurfaceSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenContextRequest | ConnectMobileRequest | LaunchAppRequest | SurfacePingRequest | CloseSurfaceRequest;
|
|
812
|
-
export type ContextSessionRequest =
|
|
818
|
+
export type ContextSessionRequest = {
|
|
819
|
+
surfaceSessionId: string;
|
|
820
|
+
contextSessionId: string;
|
|
821
|
+
resolveFrame: {
|
|
822
|
+
cssSelector: string;
|
|
823
|
+
retryOptions?: {
|
|
824
|
+
timeoutMs: number;
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
} | ContextPingRequest | RegisterHookRequest | WaitForHookRequest | SetFileChooserFilesRequest | SaveDownloadRequest | UploadFileChunkRequest | ReadFileChunkRequest | SetMobileFileChooserFilesRequest | SaveMobileDownloadRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | AccessibilitySnapshotRequest | ScreenshotRequest | CloseContextRequest;
|
|
813
828
|
export type SurfaceSessionStream = grpc.ClientDuplexStream<SurfaceSessionRequest, SurfaceSessionEvent>;
|
|
814
829
|
export type ContextSessionStream = grpc.ClientDuplexStream<ContextSessionRequest, ContextSessionEvent>;
|
|
815
830
|
export interface EngineServiceClientShape {
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ message ContextSessionCommand {
|
|
|
37
37
|
ReadFileChunkCommand read_file_chunk = 23;
|
|
38
38
|
SetMobileFileChooserFilesCommand set_mobile_file_chooser_files = 24;
|
|
39
39
|
SaveMobileDownloadCommand save_mobile_download = 25;
|
|
40
|
+
ResolveFrameCommand resolve_frame = 26;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -76,6 +77,7 @@ message ContextSessionEvent {
|
|
|
76
77
|
FileChunkEvent file_chunk = 25;
|
|
77
78
|
MobileFileChooserFilesSetEvent mobile_file_chooser_files_set = 26;
|
|
78
79
|
MobileDownloadSavedEvent mobile_download_saved = 27;
|
|
80
|
+
FrameResolvedEvent frame_resolved = 28;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -88,3 +88,12 @@ message DownloadSavedEvent {
|
|
|
88
88
|
uint64 size = 4;
|
|
89
89
|
string note = 5;
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
// Resolve an iframe locator to a page after its document has loaded and settled.
|
|
93
|
+
message ResolveFrameCommand {
|
|
94
|
+
string css_selector = 1;
|
|
95
|
+
optional CommandRetryOptions retry_options = 2;
|
|
96
|
+
}
|
|
97
|
+
message FrameResolvedEvent {
|
|
98
|
+
string context_session_id = 1;
|
|
99
|
+
}
|