@allwright.dev/core 0.1.18 → 0.1.20

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 CHANGED
@@ -104,7 +104,7 @@ const value = await page.locator('input, textarea').inputValue();
104
104
  const options = await page.locator('select').selectedOptions(); // [{ value, label, index }]
105
105
  const selectedText = await page.locator('textarea').selectedText();
106
106
  const checked = await page.locator('input[type=checkbox]').isChecked();
107
- const text = await page.locator('h1').innerText(); // { selector, text, note }
107
+ const text = await page.locator('h1').innerText(); // string
108
108
  const attribute = await page.locator('a').getAttribute('href');
109
109
  const box = await page.locator('button').boundingBox(); // { x, y, width, height }
110
110
  ```
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.18";
15
+ const DEFAULT_RELEASE_VERSION = "0.1.20";
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,27 +1,27 @@
1
1
  import { WebLocatorBuilders, type LocatorFilterOptions } from "./web-locators.js";
2
- import type { BoundingBox, CapturedOption, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, LocatorInfo, Page, PressOptions, PressResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
2
+ import type { BoundingBox, CapturedOption, 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?: CommandOptions): Promise<ClickResult>;
10
- count(options?: CommandOptions): Promise<CountResult>;
11
- highlight(options?: HighlightOptions): Promise<HighlightResult>;
12
- focus(options?: CommandOptions): Promise<ElementResult>;
13
- fill(value: string, options?: CommandOptions): Promise<FillResult>;
14
- hover(options?: CommandOptions): Promise<ElementResult>;
15
- press(key: string, options?: PressOptions): Promise<PressResult>;
9
+ click(options?: CommandOptions): Promise<void>;
10
+ count(options?: CommandOptions): Promise<number>;
11
+ highlight(options?: HighlightOptions): Promise<void>;
12
+ focus(options?: CommandOptions): Promise<void>;
13
+ fill(value: string, options?: CommandOptions): Promise<void>;
14
+ hover(options?: CommandOptions): Promise<void>;
15
+ press(key: string, options?: PressOptions): Promise<void>;
16
16
  inputValue(options?: CommandOptions): Promise<string>;
17
17
  selectedOptions(options?: CommandOptions): Promise<CapturedOption[]>;
18
18
  selectedText(options?: CommandOptions): Promise<string | null>;
19
19
  isChecked(options?: CommandOptions): Promise<boolean>;
20
20
  getAttribute(name: string, options?: CommandOptions): Promise<string | null>;
21
21
  boundingBox(options?: CommandOptions): Promise<BoundingBox | null>;
22
- textContent(options?: CommandOptions): Promise<TextResult>;
23
- innerText(options?: CommandOptions): Promise<TextResult>;
24
- waitFor(options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
22
+ textContent(options?: CommandOptions): Promise<string | null>;
23
+ innerText(options?: CommandOptions): Promise<string>;
24
+ waitFor(options?: WaitForSelectorOptions): Promise<void>;
25
25
  not(other: Locator): Locator;
26
26
  filter(options?: LocatorFilterOptions): Locator;
27
27
  nth(index: number): Locator;
package/dist/mobile.js CHANGED
@@ -3,6 +3,7 @@ import { open, rename, unlink, writeFile } from "node:fs/promises";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { basename } from "node:path";
5
5
  import { chainMobileSelectorForTransport, normalizeMobileSelectorForTransport } from "./mobileSelectors.js";
6
+ import { semanticSelector } from "./web-locators.js";
6
7
  function retryOptions(timeoutMs) {
7
8
  return timeoutMs ? { timeoutMs } : undefined;
8
9
  }
@@ -19,6 +20,18 @@ class MobileAndroidAppImpl {
19
20
  locator(selector) {
20
21
  return new MobileAndroidLocatorImpl(this, normalizeMobileSelectorForTransport(selector));
21
22
  }
23
+ getByRole(role, options = {}) {
24
+ return this.locator(semanticSelector({ ...options, kind: "role", role }));
25
+ }
26
+ getByText(text, options = {}) {
27
+ return this.locator(semanticSelector({ ...options, kind: "text", text }));
28
+ }
29
+ getByLabel(text, options = {}) {
30
+ return this.locator(semanticSelector({ ...options, kind: "label", text }));
31
+ }
32
+ getByTestId(text) {
33
+ return this.locator(semanticSelector({ kind: "testId", text }));
34
+ }
22
35
  async registerHook(type) {
23
36
  if (type.name !== "fileChooser" && type.name !== "download") {
24
37
  throw new Error(`hook type ${type.name} is not supported by Android apps`);
@@ -191,11 +204,7 @@ class MobileAndroidAppImpl {
191
204
  while (true) {
192
205
  const event = await handle.queue.next();
193
206
  if (event.elementClicked) {
194
- return {
195
- selector: event.elementClicked.cssSelector ?? "",
196
- note: event.elementClicked.note ?? "",
197
- bidiSessionId: event.elementClicked.bidiSessionId ?? "",
198
- };
207
+ return;
199
208
  }
200
209
  if (event.error?.message) {
201
210
  throw new Error(event.error.message);
@@ -206,6 +215,30 @@ class MobileAndroidAppImpl {
206
215
  }
207
216
  }
208
217
  }
218
+ async goto(url, options = {}) {
219
+ return this.navigate(url, options);
220
+ }
221
+ async navigate(url, options = {}) {
222
+ const handle = await this.#getHandle();
223
+ this.#ensureOpen(handle);
224
+ handle.stream.write({
225
+ surfaceSessionId: this.#surfaceSessionId,
226
+ contextSessionId: this.sessionId,
227
+ navigate: { url, retryOptions: retryOptions(options.timeoutMs) },
228
+ });
229
+ while (true) {
230
+ const event = await handle.queue.next();
231
+ if (event.navigated) {
232
+ return;
233
+ }
234
+ if (event.error?.message)
235
+ throw new Error(event.error.message);
236
+ if (event.closed) {
237
+ handle.closed = true;
238
+ throw new Error(`mobile app session ${this.sessionId} closed while opening deep link`);
239
+ }
240
+ }
241
+ }
209
242
  async count(selector, options = {}) {
210
243
  const handle = await this.#getHandle();
211
244
  this.#ensureOpen(handle);
@@ -220,11 +253,7 @@ class MobileAndroidAppImpl {
220
253
  while (true) {
221
254
  const event = await handle.queue.next();
222
255
  if (event.elementCounted) {
223
- return {
224
- selector: event.elementCounted.cssSelector ?? "",
225
- count: event.elementCounted.count ?? 0,
226
- note: event.elementCounted.note ?? "",
227
- };
256
+ return event.elementCounted.count ?? 0;
228
257
  }
229
258
  if (event.error?.message) {
230
259
  throw new Error(event.error.message);
@@ -249,10 +278,7 @@ class MobileAndroidAppImpl {
249
278
  while (true) {
250
279
  const event = await handle.queue.next();
251
280
  if (event.elementFocused) {
252
- return {
253
- selector: event.elementFocused.cssSelector ?? "",
254
- note: event.elementFocused.note ?? "",
255
- };
281
+ return;
256
282
  }
257
283
  if (event.error?.message) {
258
284
  throw new Error(event.error.message);
@@ -278,11 +304,7 @@ class MobileAndroidAppImpl {
278
304
  while (true) {
279
305
  const event = await handle.queue.next();
280
306
  if (event.elementFilled) {
281
- return {
282
- selector: event.elementFilled.cssSelector ?? "",
283
- value: event.elementFilled.value ?? "",
284
- note: event.elementFilled.note ?? "",
285
- };
307
+ return;
286
308
  }
287
309
  if (event.error?.message) {
288
310
  throw new Error(event.error.message);
@@ -309,11 +331,7 @@ class MobileAndroidAppImpl {
309
331
  while (true) {
310
332
  const event = await handle.queue.next();
311
333
  if (event.keyPressed) {
312
- return {
313
- selector: event.keyPressed.cssSelector ?? "",
314
- key: event.keyPressed.key ?? "",
315
- note: event.keyPressed.note ?? "",
316
- };
334
+ return;
317
335
  }
318
336
  if (event.error?.message) {
319
337
  throw new Error(event.error.message);
@@ -325,10 +343,10 @@ class MobileAndroidAppImpl {
325
343
  }
326
344
  }
327
345
  async textContent(selector, options = {}) {
328
- return this.#readText(selector, options, true);
346
+ return (await this.#readText(selector, options, true)).text;
329
347
  }
330
348
  async innerText(selector, options = {}) {
331
- return this.#readText(selector, options, false);
349
+ return (await this.#readText(selector, options, false)).text;
332
350
  }
333
351
  async waitForSelector(selector, options = {}) {
334
352
  const handle = await this.#getHandle();
@@ -345,11 +363,7 @@ class MobileAndroidAppImpl {
345
363
  while (true) {
346
364
  const event = await handle.queue.next();
347
365
  if (event.selectorWaitSatisfied) {
348
- return {
349
- selector: event.selectorWaitSatisfied.cssSelector ?? "",
350
- visible: event.selectorWaitSatisfied.visible ?? false,
351
- note: event.selectorWaitSatisfied.note ?? "",
352
- };
366
+ return;
353
367
  }
354
368
  if (event.error?.message) {
355
369
  throw new Error(event.error.message);
@@ -413,7 +427,7 @@ class MobileAndroidAppImpl {
413
427
  if (options.path) {
414
428
  await writeFile(options.path, screenshot.pngData);
415
429
  }
416
- return screenshot;
430
+ return screenshot.pngData;
417
431
  }
418
432
  if (event.error?.message) {
419
433
  throw new Error(event.error.message);
@@ -550,6 +564,18 @@ class MobileAndroidLocatorImpl {
550
564
  locator(selector) {
551
565
  return new MobileAndroidLocatorImpl(this.page, chainMobileSelectorForTransport(this.selector, selector));
552
566
  }
567
+ getByRole(role, options = {}) {
568
+ return this.locator(semanticSelector({ ...options, kind: "role", role }));
569
+ }
570
+ getByText(text, options = {}) {
571
+ return this.locator(semanticSelector({ ...options, kind: "text", text }));
572
+ }
573
+ getByLabel(text, options = {}) {
574
+ return this.locator(semanticSelector({ ...options, kind: "label", text }));
575
+ }
576
+ getByTestId(text) {
577
+ return this.locator(semanticSelector({ kind: "testId", text }));
578
+ }
553
579
  }
554
580
  class MobileAndroidDeviceImpl {
555
581
  sessionId;
@@ -30,7 +30,7 @@ const UIAUTOMATOR_SELECTOR_KEYS = new Set([
30
30
  "index",
31
31
  "instance",
32
32
  ]);
33
- const SELECTOR_PREFIXES = ["xpath=", "xpath:", "css=", "css:", "uia=", "uia:"];
33
+ const SELECTOR_PREFIXES = ["xpath=", "xpath:", "css=", "css:", "uia=", "uia:", "aw=", "aw:"];
34
34
  function decodeSelectorBody(body) {
35
35
  const candidate = body.trim();
36
36
  if (candidate.startsWith("\"") && candidate.endsWith("\"")) {
@@ -54,6 +54,9 @@ function parseExplicitSelectorPrefix(selector) {
54
54
  if (lowered.startsWith("uia=") || lowered.startsWith("uia:")) {
55
55
  return { flavor: "uia", prefixLength: 4 };
56
56
  }
57
+ if (lowered.startsWith("aw=") || lowered.startsWith("aw:")) {
58
+ return { flavor: "aw", prefixLength: 3 };
59
+ }
57
60
  return null;
58
61
  }
59
62
  function findJsonStringEnd(value) {
@@ -149,6 +152,9 @@ export function normalizeMobileSelectorForTransport(selector) {
149
152
  if (!trimmed) {
150
153
  return "";
151
154
  }
155
+ if (/^ref[=:]/i.test(trimmed)) {
156
+ return `ref=${decodeSelectorBody(trimmed.slice(4))}`;
157
+ }
152
158
  if (isNormalizedTransportSelector(trimmed)) {
153
159
  return trimmed;
154
160
  }
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, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, FileChooser, Download, HighlightOptions, HighlightResult, Hook, HookType, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
2
+ import type { BoundingBox, CapturedOption, AccessibilitySnapshotOptions, 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 & {
@@ -13,14 +13,14 @@ export declare class PageImpl extends WebLocatorBuilders implements Page {
13
13
  setFileChooserFiles(fileChooserId: string, files: string[], options?: CommandOptions): Promise<void>;
14
14
  saveDownload(downloadId: string, path: string, options?: CommandOptions): Promise<void>;
15
15
  locator(selector: string, options?: LocatorFilterOptions): Locator;
16
- goto(url: string, options?: CommandOptions): Promise<NavigateResult>;
17
- click(selector: string, options?: CommandOptions): Promise<ClickResult>;
18
- count(selector: string, options?: CommandOptions): Promise<CountResult>;
19
- highlight(selector: string, options?: HighlightOptions): Promise<HighlightResult>;
20
- focus(selector: string, options?: CommandOptions): Promise<ElementResult>;
21
- fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
22
- hover(selector: string, options?: CommandOptions): Promise<ElementResult>;
23
- press(selector: string, key: string, options?: PressOptions): Promise<PressResult>;
16
+ goto(url: string, options?: CommandOptions): Promise<void>;
17
+ click(selector: string, options?: CommandOptions): Promise<void>;
18
+ count(selector: string, options?: CommandOptions): Promise<number>;
19
+ highlight(selector: string, options?: HighlightOptions): Promise<void>;
20
+ focus(selector: string, options?: CommandOptions): Promise<void>;
21
+ fill(selector: string, value: string, options?: CommandOptions): Promise<void>;
22
+ hover(selector: string, options?: CommandOptions): Promise<void>;
23
+ press(selector: string, key: string, options?: PressOptions): Promise<void>;
24
24
  url(options?: CommandOptions): Promise<string>;
25
25
  inputValue(selector: string, options?: CommandOptions): Promise<string>;
26
26
  selectedOptions(selector: string, options?: CommandOptions): Promise<CapturedOption[]>;
@@ -28,15 +28,15 @@ export declare class PageImpl extends WebLocatorBuilders implements Page {
28
28
  isChecked(selector: string, options?: CommandOptions): Promise<boolean>;
29
29
  getAttribute(selector: string, name: string, options?: CommandOptions): Promise<string | null>;
30
30
  boundingBox(selector: string, options?: CommandOptions): Promise<BoundingBox | null>;
31
- textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
32
- innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
33
- waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
31
+ textContent(selector: string, options?: CommandOptions): Promise<string | null>;
32
+ innerText(selector: string, options?: CommandOptions): Promise<string>;
33
+ waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<void>;
34
34
  accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
35
- screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
35
+ screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
36
36
  close(): Promise<void>;
37
37
  ping(message?: string): Promise<string>;
38
38
  pageInfo(): PageInfo;
39
- navigate(url: string, options?: CommandOptions): Promise<NavigateResult>;
39
+ navigate(url: string, options?: CommandOptions): Promise<void>;
40
40
  dispose(): void;
41
41
  }
42
42
  export declare class FileChooserImpl implements FileChooser {
package/dist/page.js CHANGED
@@ -278,14 +278,7 @@ export class PageImpl extends WebLocatorBuilders {
278
278
  throw new Error(`page session ${this.sessionId} closed while navigating`);
279
279
  }
280
280
  if (navigated && injection) {
281
- return {
282
- url: navigated.url ?? "",
283
- note: navigated.note ?? "",
284
- bidiSessionId: injection.bidiSessionId ?? "",
285
- mapperTargetId: injection.mapperTargetId ?? "",
286
- mapperSessionId: injection.mapperSessionId ?? "",
287
- packageVersion: injection.packageVersion ?? "",
288
- };
281
+ return;
289
282
  }
290
283
  }
291
284
  }
@@ -304,11 +297,7 @@ export class PageImpl extends WebLocatorBuilders {
304
297
  while (true) {
305
298
  const event = await handle.queue.next();
306
299
  if (event.elementClicked) {
307
- return {
308
- selector: event.elementClicked.cssSelector ?? "",
309
- note: event.elementClicked.note ?? "",
310
- bidiSessionId: event.elementClicked.bidiSessionId ?? "",
311
- };
300
+ return;
312
301
  }
313
302
  if (event.error?.message) {
314
303
  throw formatActionError("click", event.error.message, selector);
@@ -334,11 +323,7 @@ export class PageImpl extends WebLocatorBuilders {
334
323
  while (true) {
335
324
  const event = await handle.queue.next();
336
325
  if (event.elementCounted) {
337
- return {
338
- selector: event.elementCounted.cssSelector ?? "",
339
- count: event.elementCounted.count ?? 0,
340
- note: event.elementCounted.note ?? "",
341
- };
326
+ return event.elementCounted.count ?? 0;
342
327
  }
343
328
  if (event.error?.message) {
344
329
  throw formatActionError("count elements", event.error.message, selector);
@@ -365,11 +350,7 @@ export class PageImpl extends WebLocatorBuilders {
365
350
  while (true) {
366
351
  const event = await handle.queue.next();
367
352
  if (event.elementsHighlighted) {
368
- return {
369
- selector: event.elementsHighlighted.cssSelector ?? "",
370
- count: event.elementsHighlighted.count ?? 0,
371
- note: event.elementsHighlighted.note ?? "",
372
- };
353
+ return;
373
354
  }
374
355
  if (event.error?.message) {
375
356
  throw formatActionError("highlight elements", event.error.message, selector);
@@ -395,10 +376,7 @@ export class PageImpl extends WebLocatorBuilders {
395
376
  while (true) {
396
377
  const event = await handle.queue.next();
397
378
  if (event.elementFocused) {
398
- return {
399
- selector: event.elementFocused.cssSelector ?? "",
400
- note: event.elementFocused.note ?? "",
401
- };
379
+ return;
402
380
  }
403
381
  if (event.error?.message) {
404
382
  throw formatActionError("focus", event.error.message, selector);
@@ -425,11 +403,7 @@ export class PageImpl extends WebLocatorBuilders {
425
403
  while (true) {
426
404
  const event = await handle.queue.next();
427
405
  if (event.elementFilled) {
428
- return {
429
- selector: event.elementFilled.cssSelector ?? "",
430
- value: event.elementFilled.value ?? "",
431
- note: event.elementFilled.note ?? "",
432
- };
406
+ return;
433
407
  }
434
408
  if (event.error?.message) {
435
409
  throw formatActionError("fill", event.error.message, selector);
@@ -455,10 +429,7 @@ export class PageImpl extends WebLocatorBuilders {
455
429
  while (true) {
456
430
  const event = await handle.queue.next();
457
431
  if (event.elementHovered) {
458
- return {
459
- selector: event.elementHovered.cssSelector ?? "",
460
- note: event.elementHovered.note ?? "",
461
- };
432
+ return;
462
433
  }
463
434
  if (event.error?.message) {
464
435
  throw formatActionError("hover", event.error.message, selector);
@@ -486,11 +457,7 @@ export class PageImpl extends WebLocatorBuilders {
486
457
  while (true) {
487
458
  const event = await handle.queue.next();
488
459
  if (event.keyPressed) {
489
- return {
490
- selector: event.keyPressed.cssSelector ?? "",
491
- key: event.keyPressed.key ?? "",
492
- note: event.keyPressed.note ?? "",
493
- };
460
+ return;
494
461
  }
495
462
  if (event.error?.message) {
496
463
  throw formatActionError("press key", event.error.message, selector);
@@ -548,10 +515,10 @@ export class PageImpl extends WebLocatorBuilders {
548
515
  return r.boundingBox ?? null;
549
516
  }
550
517
  async textContent(selector, options = {}) {
551
- return this.#readText(selector, options, true);
518
+ return (await this.#readText(selector, options, true)).text;
552
519
  }
553
520
  async innerText(selector, options = {}) {
554
- return this.#readText(selector, options, false);
521
+ return (await this.#readText(selector, options, false)).text;
555
522
  }
556
523
  async waitForSelector(selector, options = {}) {
557
524
  const handle = await this.#getHandle();
@@ -569,11 +536,7 @@ export class PageImpl extends WebLocatorBuilders {
569
536
  while (true) {
570
537
  const event = await handle.queue.next();
571
538
  if (event.selectorWaitSatisfied) {
572
- return {
573
- selector: event.selectorWaitSatisfied.cssSelector ?? "",
574
- visible: event.selectorWaitSatisfied.visible ?? false,
575
- note: event.selectorWaitSatisfied.note ?? "",
576
- };
539
+ return;
577
540
  }
578
541
  if (event.error?.message) {
579
542
  throw formatActionError("wait for selector", event.error.message, selector);
@@ -637,7 +600,7 @@ export class PageImpl extends WebLocatorBuilders {
637
600
  if (options.path) {
638
601
  await writeFile(options.path, screenshot.pngData);
639
602
  }
640
- return screenshot;
603
+ return screenshot.pngData;
641
604
  }
642
605
  if (event.error?.message) {
643
606
  throw formatActionError("screenshot", event.error.message);
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { WebLocators, LocatorFilterOptions } from "./web-locators.js";
1
+ import type { WebLocators, LocatorFilterOptions, RoleOptions, TextMatcher, TextOptions } from "./web-locators.js";
2
2
  import grpc from "@grpc/grpc-js";
3
3
  export { AllwrightError } from "./errors.js";
4
4
  export interface LaunchOptions {
@@ -153,19 +153,19 @@ export interface Page extends PageInfo, WebLocators {
153
153
  registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
154
154
  accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
155
155
  locator(selector: string, options?: LocatorFilterOptions): Locator;
156
- goto(url: string, options?: CommandOptions): Promise<NavigateResult>;
157
- navigate(url: string, options?: CommandOptions): Promise<NavigateResult>;
158
- click(selector: string, options?: CommandOptions): Promise<ClickResult>;
159
- count(selector: string, options?: CommandOptions): Promise<CountResult>;
160
- highlight(selector: string, options?: HighlightOptions): Promise<HighlightResult>;
161
- focus(selector: string, options?: CommandOptions): Promise<ElementResult>;
162
- fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
163
- hover(selector: string, options?: CommandOptions): Promise<ElementResult>;
164
- press(selector: string, key: string, options?: PressOptions): Promise<PressResult>;
165
- textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
166
- innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
167
- waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
168
- screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
156
+ goto(url: string, options?: CommandOptions): Promise<void>;
157
+ navigate(url: string, options?: CommandOptions): Promise<void>;
158
+ click(selector: string, options?: CommandOptions): Promise<void>;
159
+ count(selector: string, options?: CommandOptions): Promise<number>;
160
+ highlight(selector: string, options?: HighlightOptions): Promise<void>;
161
+ focus(selector: string, options?: CommandOptions): Promise<void>;
162
+ fill(selector: string, value: string, options?: CommandOptions): Promise<void>;
163
+ hover(selector: string, options?: CommandOptions): Promise<void>;
164
+ press(selector: string, key: string, options?: PressOptions): Promise<void>;
165
+ textContent(selector: string, options?: CommandOptions): Promise<string | null>;
166
+ innerText(selector: string, options?: CommandOptions): Promise<string>;
167
+ waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<void>;
168
+ screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
169
169
  close(): Promise<void>;
170
170
  ping(message?: string): Promise<string>;
171
171
  pageInfo(): PageInfo;
@@ -186,29 +186,39 @@ export interface MobileAndroidLaunchOptions {
186
186
  export interface MobileAndroidLocator {
187
187
  readonly page: MobileAndroidApp;
188
188
  readonly selector: string;
189
- click(options?: CommandOptions): Promise<ClickResult>;
190
- count(options?: CommandOptions): Promise<CountResult>;
191
- focus(options?: CommandOptions): Promise<ElementResult>;
192
- fill(value: string, options?: CommandOptions): Promise<FillResult>;
193
- press(key: string, options?: PressOptions): Promise<PressResult>;
194
- textContent(options?: CommandOptions): Promise<TextResult>;
195
- innerText(options?: CommandOptions): Promise<TextResult>;
196
- waitFor(options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
189
+ click(options?: CommandOptions): Promise<void>;
190
+ count(options?: CommandOptions): Promise<number>;
191
+ focus(options?: CommandOptions): Promise<void>;
192
+ fill(value: string, options?: CommandOptions): Promise<void>;
193
+ press(key: string, options?: PressOptions): Promise<void>;
194
+ textContent(options?: CommandOptions): Promise<string | null>;
195
+ innerText(options?: CommandOptions): Promise<string>;
196
+ waitFor(options?: WaitForSelectorOptions): Promise<void>;
197
197
  locator(selector: string): MobileAndroidLocator;
198
+ getByRole(role: string, options?: RoleOptions): MobileAndroidLocator;
199
+ getByText(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
200
+ getByLabel(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
201
+ getByTestId(text: TextMatcher): MobileAndroidLocator;
198
202
  }
199
203
  export interface MobileAndroidApp {
200
204
  accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
201
205
  readonly sessionId: string;
206
+ goto(url: string, options?: CommandOptions): Promise<void>;
207
+ navigate(url: string, options?: CommandOptions): Promise<void>;
202
208
  locator(selector: string): MobileAndroidLocator;
203
- click(selector: string, options?: CommandOptions): Promise<ClickResult>;
204
- count(selector: string, options?: CommandOptions): Promise<CountResult>;
205
- focus(selector: string, options?: CommandOptions): Promise<ElementResult>;
206
- fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
207
- press(selector: string, key: string, options?: PressOptions): Promise<PressResult>;
208
- textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
209
- innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
210
- waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
211
- screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
209
+ getByRole(role: string, options?: RoleOptions): MobileAndroidLocator;
210
+ getByText(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
211
+ getByLabel(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
212
+ getByTestId(text: TextMatcher): MobileAndroidLocator;
213
+ click(selector: string, options?: CommandOptions): Promise<void>;
214
+ count(selector: string, options?: CommandOptions): Promise<number>;
215
+ focus(selector: string, options?: CommandOptions): Promise<void>;
216
+ fill(selector: string, value: string, options?: CommandOptions): Promise<void>;
217
+ press(selector: string, key: string, options?: PressOptions): Promise<void>;
218
+ textContent(selector: string, options?: CommandOptions): Promise<string | null>;
219
+ innerText(selector: string, options?: CommandOptions): Promise<string>;
220
+ waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<void>;
221
+ screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
212
222
  registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
213
223
  }
214
224
  export interface MobileAndroidDevice {
@@ -261,16 +271,16 @@ export interface Locator extends WebLocators {
261
271
  last(): Locator;
262
272
  readonly page: Page;
263
273
  readonly selector: string;
264
- click(options?: CommandOptions): Promise<ClickResult>;
265
- count(options?: CommandOptions): Promise<CountResult>;
266
- highlight(options?: HighlightOptions): Promise<HighlightResult>;
267
- focus(options?: CommandOptions): Promise<ElementResult>;
268
- fill(value: string, options?: CommandOptions): Promise<FillResult>;
269
- hover(options?: CommandOptions): Promise<ElementResult>;
270
- press(key: string, options?: PressOptions): Promise<PressResult>;
271
- textContent(options?: CommandOptions): Promise<TextResult>;
272
- innerText(options?: CommandOptions): Promise<TextResult>;
273
- waitFor(options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
274
+ click(options?: CommandOptions): Promise<void>;
275
+ count(options?: CommandOptions): Promise<number>;
276
+ highlight(options?: HighlightOptions): Promise<void>;
277
+ focus(options?: CommandOptions): Promise<void>;
278
+ fill(value: string, options?: CommandOptions): Promise<void>;
279
+ hover(options?: CommandOptions): Promise<void>;
280
+ press(key: string, options?: PressOptions): Promise<void>;
281
+ textContent(options?: CommandOptions): Promise<string | null>;
282
+ innerText(options?: CommandOptions): Promise<string>;
283
+ waitFor(options?: WaitForSelectorOptions): Promise<void>;
274
284
  locator(selector: string, options?: LocatorFilterOptions): Locator;
275
285
  }
276
286
  export interface AllwrightConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",