@allwright.dev/core 0.1.24 → 0.1.25
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 +5 -0
- package/dist/bootstrap.js +1 -1
- package/dist/locator.d.ts +3 -2
- package/dist/locator.js +3 -0
- package/dist/mobile.d.ts +5 -1
- package/dist/mobile.js +51 -2
- package/dist/page.d.ts +3 -2
- package/dist/page.js +5 -0
- package/dist/types.d.ts +19 -2
- package/package.json +1 -1
- package/proto/core/v1/context.proto +2 -0
package/README.md
CHANGED
|
@@ -20,6 +20,9 @@ await page.click(
|
|
|
20
20
|
await browser.close();
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
Web clicks accept `{ button: "left" | "middle" | "right", clickCount: 1 | 2 | 3 }`.
|
|
24
|
+
Use `page.dblclick(selector)` or `locator.dblclick()` for the common double-click case.
|
|
25
|
+
|
|
23
26
|
Register a typed hook before an action that opens a tab, then wait for its
|
|
24
27
|
typed result afterward:
|
|
25
28
|
|
|
@@ -123,3 +126,5 @@ const box = await page.locator('button').boundingBox(); // { x, y, width, height
|
|
|
123
126
|
Element reads also have page methods such as `page.inputValue(selector, options)` and accept `timeoutMs`. Reads use the first locator match and work in frame pages. `inputValue` reads the live property of an input, textarea, or select. `selectedOptions` supports native selects (including multiple selections) and ARIA combobox/listbox options marked `aria-selected="true"`. `selectedText` returns the textbox's selected substring, an empty string for a caret, or `null` for input types without selection support. `isChecked` supports native checkbox/radio and ARIA checked controls; ARIA mixed state returns false.
|
|
124
127
|
|
|
125
128
|
Missing attributes return `null` (an empty attribute remains `""`). Bounding boxes use CSS pixels relative to the page/frame viewport and return `null` for hidden or zero-area elements. Missing elements and incompatible control types raise errors. Use `textContent()` for raw text or `innerText()` for rendered text.
|
|
129
|
+
|
|
130
|
+
`NativeApp` and `NativeAppLocator` expose `inputValue`, `isChecked`, `getAttribute`, and `boundingBox` on Android, iOS, macOS, and Windows. Native attributes are platform accessibility/UI Automation properties, and native boxes use platform screen coordinates. Selected-option and selected-text reads remain web-only.
|
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.25";
|
|
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
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { WebLocatorBuilders, type LocatorFilterOptions } from "./web-locators.js";
|
|
2
|
-
import type { BoundingBox, CapturedOption, CommandOptions, HighlightOptions, Locator, LocatorInfo, Page, PressOptions, WaitForSelectorOptions } from "./types.js";
|
|
2
|
+
import type { BoundingBox, CapturedOption, ClickOptions, CommandOptions, HighlightOptions, Locator, LocatorInfo, Page, PressOptions, WaitForSelectorOptions } from "./types.js";
|
|
3
3
|
export declare class LocatorImpl extends WebLocatorBuilders implements Locator {
|
|
4
4
|
readonly page: Page;
|
|
5
5
|
readonly selector: string;
|
|
6
6
|
constructor(input: LocatorInfo);
|
|
7
7
|
frame(options?: CommandOptions): Promise<Page>;
|
|
8
8
|
Frame(options?: CommandOptions): Promise<Page>;
|
|
9
|
-
click(options?:
|
|
9
|
+
click(options?: ClickOptions): Promise<void>;
|
|
10
|
+
dblclick(options?: Omit<ClickOptions, "clickCount">): Promise<void>;
|
|
10
11
|
count(options?: CommandOptions): Promise<number>;
|
|
11
12
|
highlight(options?: HighlightOptions): Promise<void>;
|
|
12
13
|
focus(options?: CommandOptions): Promise<void>;
|
package/dist/locator.js
CHANGED
|
@@ -13,6 +13,9 @@ export class LocatorImpl extends WebLocatorBuilders {
|
|
|
13
13
|
async click(options = {}) {
|
|
14
14
|
return this.page.click(this.selector, options);
|
|
15
15
|
}
|
|
16
|
+
async dblclick(options = {}) {
|
|
17
|
+
return this.page.dblclick(this.selector, options);
|
|
18
|
+
}
|
|
16
19
|
async count(options = {}) {
|
|
17
20
|
return this.page.count(this.selector, options);
|
|
18
21
|
}
|
package/dist/mobile.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RoleOptions, type TextMatcher, type TextOptions } from "./web-locators.js";
|
|
2
|
-
import type { AccessibilitySnapshotOptions, CommandOptions, Hook, HookType, MobileSurfaceNamespace, NativeApp, NativeAppLocator, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
|
|
2
|
+
import type { AccessibilitySnapshotOptions, BoundingBox, CommandOptions, Hook, HookType, MobileSurfaceNamespace, NativeApp, NativeAppLocator, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
|
|
3
3
|
export declare class NativeAppImpl implements NativeApp {
|
|
4
4
|
#private;
|
|
5
5
|
readonly sessionId: string;
|
|
@@ -21,6 +21,10 @@ export declare class NativeAppImpl implements NativeApp {
|
|
|
21
21
|
press(selector: string, key: string, options?: PressOptions): Promise<void>;
|
|
22
22
|
textContent(selector: string, options?: CommandOptions): Promise<string | null>;
|
|
23
23
|
innerText(selector: string, options?: CommandOptions): Promise<string>;
|
|
24
|
+
inputValue(selector: string, options?: CommandOptions): Promise<string>;
|
|
25
|
+
isChecked(selector: string, options?: CommandOptions): Promise<boolean>;
|
|
26
|
+
getAttribute(selector: string, name: string, options?: CommandOptions): Promise<string | null>;
|
|
27
|
+
boundingBox(selector: string, options?: CommandOptions): Promise<BoundingBox | null>;
|
|
24
28
|
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<void>;
|
|
25
29
|
accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
|
|
26
30
|
screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
|
package/dist/mobile.js
CHANGED
|
@@ -94,7 +94,7 @@ export class NativeAppImpl {
|
|
|
94
94
|
setMobileFileChooserFiles: {
|
|
95
95
|
fileChooserId,
|
|
96
96
|
fileIds,
|
|
97
|
-
retryOptions:
|
|
97
|
+
retryOptions: options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : undefined,
|
|
98
98
|
},
|
|
99
99
|
});
|
|
100
100
|
while (true) {
|
|
@@ -235,7 +235,7 @@ export class NativeAppImpl {
|
|
|
235
235
|
throw new Error(event.error.message);
|
|
236
236
|
if (event.closed) {
|
|
237
237
|
handle.closed = true;
|
|
238
|
-
throw new Error(`
|
|
238
|
+
throw new Error(`native app session ${this.sessionId} closed while opening deep link`);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -348,6 +348,18 @@ export class NativeAppImpl {
|
|
|
348
348
|
async innerText(selector, options = {}) {
|
|
349
349
|
return (await this.#readText(selector, options, false)).text;
|
|
350
350
|
}
|
|
351
|
+
async inputValue(selector, options = {}) {
|
|
352
|
+
return (await this.#capture("CAPTURE_KIND_INPUT_VALUE", selector, "", options)).value ?? "";
|
|
353
|
+
}
|
|
354
|
+
async isChecked(selector, options = {}) {
|
|
355
|
+
return (await this.#capture("CAPTURE_KIND_CHECKED", selector, "", options)).checked ?? false;
|
|
356
|
+
}
|
|
357
|
+
async getAttribute(selector, name, options = {}) {
|
|
358
|
+
return (await this.#capture("CAPTURE_KIND_ATTRIBUTE", selector, name, options)).value ?? null;
|
|
359
|
+
}
|
|
360
|
+
async boundingBox(selector, options = {}) {
|
|
361
|
+
return (await this.#capture("CAPTURE_KIND_BOUNDING_BOX", selector, "", options)).boundingBox ?? null;
|
|
362
|
+
}
|
|
351
363
|
async waitForSelector(selector, options = {}) {
|
|
352
364
|
const handle = await this.#getHandle();
|
|
353
365
|
this.#ensureOpen(handle);
|
|
@@ -449,6 +461,31 @@ export class NativeAppImpl {
|
|
|
449
461
|
throw new Error(`android app session ${this.sessionId} is closed`);
|
|
450
462
|
}
|
|
451
463
|
}
|
|
464
|
+
async #capture(kind, selector, attributeName, options) {
|
|
465
|
+
const handle = await this.#getHandle();
|
|
466
|
+
this.#ensureOpen(handle);
|
|
467
|
+
handle.stream.write({
|
|
468
|
+
surfaceSessionId: this.#surfaceSessionId,
|
|
469
|
+
contextSessionId: this.sessionId,
|
|
470
|
+
capture: {
|
|
471
|
+
kind,
|
|
472
|
+
cssSelector: normalizeMobileSelectorForTransport(selector),
|
|
473
|
+
attributeName,
|
|
474
|
+
retryOptions: options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : undefined,
|
|
475
|
+
},
|
|
476
|
+
});
|
|
477
|
+
while (true) {
|
|
478
|
+
const event = await handle.queue.next();
|
|
479
|
+
if (event.captureResolved)
|
|
480
|
+
return event.captureResolved;
|
|
481
|
+
if (event.error?.message)
|
|
482
|
+
throw new Error(event.error.message);
|
|
483
|
+
if (event.closed) {
|
|
484
|
+
handle.closed = true;
|
|
485
|
+
throw new Error(`native app session ${this.sessionId} closed while capturing element state`);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
452
489
|
async #readText(selector, options, textContent) {
|
|
453
490
|
const handle = await this.#getHandle();
|
|
454
491
|
this.#ensureOpen(handle);
|
|
@@ -558,6 +595,18 @@ class NativeAppLocatorImpl {
|
|
|
558
595
|
async innerText(options = {}) {
|
|
559
596
|
return this.page.innerText(this.selector, options);
|
|
560
597
|
}
|
|
598
|
+
async inputValue(options = {}) {
|
|
599
|
+
return this.page.inputValue(this.selector, options);
|
|
600
|
+
}
|
|
601
|
+
async isChecked(options = {}) {
|
|
602
|
+
return this.page.isChecked(this.selector, options);
|
|
603
|
+
}
|
|
604
|
+
async getAttribute(name, options = {}) {
|
|
605
|
+
return this.page.getAttribute(this.selector, name, options);
|
|
606
|
+
}
|
|
607
|
+
async boundingBox(options = {}) {
|
|
608
|
+
return this.page.boundingBox(this.selector, options);
|
|
609
|
+
}
|
|
561
610
|
async waitFor(options = {}) {
|
|
562
611
|
return this.page.waitForSelector(this.selector, options);
|
|
563
612
|
}
|
package/dist/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebLocatorBuilders, type LocatorFilterOptions } from "./web-locators.js";
|
|
2
|
-
import type { BoundingBox, CapturedOption, AccessibilitySnapshotOptions, CommandOptions, FileChooser, Download, HighlightOptions, Hook, HookType, Locator, Page, PageInfo, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
|
|
2
|
+
import type { BoundingBox, CapturedOption, AccessibilitySnapshotOptions, ClickOptions, CommandOptions, FileChooser, Download, HighlightOptions, Hook, HookType, Locator, Page, PageInfo, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
|
|
3
3
|
export declare class PageImpl extends WebLocatorBuilders implements Page {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(input: PageInfo & {
|
|
@@ -14,7 +14,8 @@ export declare class PageImpl extends WebLocatorBuilders implements Page {
|
|
|
14
14
|
saveDownload(downloadId: string, path: string, options?: CommandOptions): Promise<void>;
|
|
15
15
|
locator(selector: string, options?: LocatorFilterOptions): Locator;
|
|
16
16
|
goto(url: string, options?: CommandOptions): Promise<void>;
|
|
17
|
-
click(selector: string, options?:
|
|
17
|
+
click(selector: string, options?: ClickOptions): Promise<void>;
|
|
18
|
+
dblclick(selector: string, options?: Omit<ClickOptions, "clickCount">): Promise<void>;
|
|
18
19
|
count(selector: string, options?: CommandOptions): Promise<number>;
|
|
19
20
|
highlight(selector: string, options?: HighlightOptions): Promise<void>;
|
|
20
21
|
focus(selector: string, options?: CommandOptions): Promise<void>;
|
package/dist/page.js
CHANGED
|
@@ -291,6 +291,8 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
291
291
|
contextSessionId: this.sessionId,
|
|
292
292
|
clickElement: {
|
|
293
293
|
cssSelector: transportSelector,
|
|
294
|
+
button: options.button,
|
|
295
|
+
clickCount: options.clickCount,
|
|
294
296
|
retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
|
|
295
297
|
},
|
|
296
298
|
});
|
|
@@ -308,6 +310,9 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
308
310
|
}
|
|
309
311
|
}
|
|
310
312
|
}
|
|
313
|
+
async dblclick(selector, options = {}) {
|
|
314
|
+
return this.click(selector, { ...options, clickCount: 2 });
|
|
315
|
+
}
|
|
311
316
|
async count(selector, options = {}) {
|
|
312
317
|
const handle = await this.#getHandle();
|
|
313
318
|
this.#ensureOpen(handle);
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export type BrowserKind = "chromium" | "firefox";
|
|
|
9
9
|
export interface CommandOptions {
|
|
10
10
|
timeoutMs?: number;
|
|
11
11
|
}
|
|
12
|
+
export type MouseButton = "left" | "middle" | "right";
|
|
13
|
+
export interface ClickOptions extends CommandOptions {
|
|
14
|
+
button?: MouseButton;
|
|
15
|
+
clickCount?: 1 | 2 | 3;
|
|
16
|
+
}
|
|
12
17
|
export interface AccessibilitySnapshotOptions extends CommandOptions {
|
|
13
18
|
format?: "json" | "yaml";
|
|
14
19
|
mode?: "default" | "ai" | "autoexpect" | "codegen";
|
|
@@ -155,7 +160,8 @@ export interface Page extends PageInfo, WebLocators {
|
|
|
155
160
|
locator(selector: string, options?: LocatorFilterOptions): Locator;
|
|
156
161
|
goto(url: string, options?: CommandOptions): Promise<void>;
|
|
157
162
|
navigate(url: string, options?: CommandOptions): Promise<void>;
|
|
158
|
-
click(selector: string, options?:
|
|
163
|
+
click(selector: string, options?: ClickOptions): Promise<void>;
|
|
164
|
+
dblclick(selector: string, options?: Omit<ClickOptions, "clickCount">): Promise<void>;
|
|
159
165
|
count(selector: string, options?: CommandOptions): Promise<number>;
|
|
160
166
|
highlight(selector: string, options?: HighlightOptions): Promise<void>;
|
|
161
167
|
focus(selector: string, options?: CommandOptions): Promise<void>;
|
|
@@ -193,6 +199,10 @@ export interface NativeAppLocator {
|
|
|
193
199
|
press(key: string, options?: PressOptions): Promise<void>;
|
|
194
200
|
textContent(options?: CommandOptions): Promise<string | null>;
|
|
195
201
|
innerText(options?: CommandOptions): Promise<string>;
|
|
202
|
+
inputValue(options?: CommandOptions): Promise<string>;
|
|
203
|
+
isChecked(options?: CommandOptions): Promise<boolean>;
|
|
204
|
+
getAttribute(name: string, options?: CommandOptions): Promise<string | null>;
|
|
205
|
+
boundingBox(options?: CommandOptions): Promise<BoundingBox | null>;
|
|
196
206
|
waitFor(options?: WaitForSelectorOptions): Promise<void>;
|
|
197
207
|
locator(selector: string): NativeAppLocator;
|
|
198
208
|
getByRole(role: string, options?: RoleOptions): NativeAppLocator;
|
|
@@ -217,6 +227,10 @@ export interface NativeApp {
|
|
|
217
227
|
press(selector: string, key: string, options?: PressOptions): Promise<void>;
|
|
218
228
|
textContent(selector: string, options?: CommandOptions): Promise<string | null>;
|
|
219
229
|
innerText(selector: string, options?: CommandOptions): Promise<string>;
|
|
230
|
+
inputValue(selector: string, options?: CommandOptions): Promise<string>;
|
|
231
|
+
isChecked(selector: string, options?: CommandOptions): Promise<boolean>;
|
|
232
|
+
getAttribute(selector: string, name: string, options?: CommandOptions): Promise<string | null>;
|
|
233
|
+
boundingBox(selector: string, options?: CommandOptions): Promise<BoundingBox | null>;
|
|
220
234
|
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<void>;
|
|
221
235
|
screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
|
|
222
236
|
registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
|
|
@@ -306,7 +320,8 @@ export interface Locator extends WebLocators {
|
|
|
306
320
|
last(): Locator;
|
|
307
321
|
readonly page: Page;
|
|
308
322
|
readonly selector: string;
|
|
309
|
-
click(options?:
|
|
323
|
+
click(options?: ClickOptions): Promise<void>;
|
|
324
|
+
dblclick(options?: Omit<ClickOptions, "clickCount">): Promise<void>;
|
|
310
325
|
count(options?: CommandOptions): Promise<number>;
|
|
311
326
|
highlight(options?: HighlightOptions): Promise<void>;
|
|
312
327
|
focus(options?: CommandOptions): Promise<void>;
|
|
@@ -832,6 +847,8 @@ export interface ClickRequest {
|
|
|
832
847
|
contextSessionId: string;
|
|
833
848
|
clickElement: {
|
|
834
849
|
cssSelector: string;
|
|
850
|
+
button?: MouseButton;
|
|
851
|
+
clickCount?: number;
|
|
835
852
|
retryOptions?: {
|
|
836
853
|
timeoutMs?: number;
|
|
837
854
|
};
|
package/package.json
CHANGED
|
@@ -170,6 +170,8 @@ message NavigatePageCommand {
|
|
|
170
170
|
message ClickElementCommand {
|
|
171
171
|
string css_selector = 1;
|
|
172
172
|
optional CommandRetryOptions retry_options = 2;
|
|
173
|
+
optional string button = 3;
|
|
174
|
+
optional uint32 click_count = 4;
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
message CountElementsCommand {
|