@allwright.dev/core 0.1.22 → 0.1.23

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
@@ -53,6 +53,11 @@ the Allwright server is remote. Android apps support the same `fileChooser` and
53
53
 
54
54
  Runnable examples live in [examples/web-basic.ts](./examples/web-basic.ts), [examples/android-basic.ts](./examples/android-basic.ts), and [examples/ios-basic.ts](./examples/ios-basic.ts).
55
55
 
56
+ Android, iOS, and macOS applications implement the shared `NativeApp` and
57
+ `NativeAppLocator` interfaces. Platform-specific type names such as
58
+ `MobileAndroidApp`, `MobileIosLocator`, and `DesktopMacLocator` remain exported
59
+ as aliases for compatibility and platform-oriented annotations.
60
+
56
61
  Shared config files are stack-agnostic and can live in `allwright.config.yaml` or `allwright.config.json`.
57
62
  The shared schema lives at the repo root in `allwright.schema.json`.
58
63
 
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.22";
15
+ const DEFAULT_RELEASE_VERSION = "0.1.23";
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/desktop.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createBrowserSessionHandle, getRuntime } from "./runtime.js";
2
- import { MobileAndroidAppImpl } from "./mobile.js";
2
+ import { NativeAppImpl } from "./mobile.js";
3
3
  function retryOptions(timeoutMs) {
4
4
  return timeoutMs === undefined ? undefined : { timeoutMs };
5
5
  }
@@ -17,7 +17,7 @@ class DesktopMacImpl {
17
17
  this.runtime = runtime;
18
18
  this.stream = stream;
19
19
  this.queue = queue;
20
- this.#currentApp = new MobileAndroidAppImpl(runtime, surfaceSessionId, initialAppSessionId);
20
+ this.#currentApp = new NativeAppImpl(runtime, surfaceSessionId, initialAppSessionId);
21
21
  }
22
22
  app() {
23
23
  return this.#currentApp;
@@ -35,7 +35,7 @@ class DesktopMacImpl {
35
35
  while (true) {
36
36
  const event = await this.queue.next();
37
37
  if (event.desktopAppLaunched?.appSessionId) {
38
- this.#currentApp = new MobileAndroidAppImpl(this.runtime, this.surfaceSessionId, event.desktopAppLaunched.appSessionId);
38
+ this.#currentApp = new NativeAppImpl(this.runtime, this.surfaceSessionId, event.desktopAppLaunched.appSessionId);
39
39
  return this.#currentApp;
40
40
  }
41
41
  if (event.error?.message)
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { PageImpl } from "./page.js";
6
6
  import { setServerAddr, shutdown } from "./runtime.js";
7
7
  import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, Dialog, FileChooser, Download, HookType, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
8
8
  export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown };
9
- export type { CapturedOption, BoundingBox, AccessibilitySnapshotOptions, AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, Hook, HookType, Dialog, FileChooser, Download, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, MobileIosConnectOptions, MobileIosDevice, MobileIosLaunchOptions, MobileIosLocator, MobileIosApp, Locator, LocatorInfo, MobileSurfaceNamespace, DesktopMacApp, DesktopMacConnectOptions, DesktopMacDesktop, DesktopMacLaunchOptions, DesktopMacLocator, DesktopSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
9
+ export type { CapturedOption, BoundingBox, AccessibilitySnapshotOptions, AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, Hook, HookType, Dialog, FileChooser, Download, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, NativeApp, NativeAppLocator, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, MobileIosConnectOptions, MobileIosDevice, MobileIosLaunchOptions, MobileIosLocator, MobileIosApp, Locator, LocatorInfo, MobileSurfaceNamespace, DesktopMacApp, DesktopMacConnectOptions, DesktopMacDesktop, DesktopMacLaunchOptions, DesktopMacLocator, DesktopSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
10
10
  export declare const chromium: BrowserType;
11
11
  export declare const firefox: BrowserType;
12
12
  export declare const hooks: {
package/dist/mobile.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { type RoleOptions, type TextMatcher, type TextOptions } from "./web-locators.js";
2
- import type { AccessibilitySnapshotOptions, CommandOptions, Hook, HookType, MobileAndroidLocator, MobileAndroidApp, MobileSurfaceNamespace, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
3
- export declare class MobileAndroidAppImpl implements MobileAndroidApp {
2
+ import type { AccessibilitySnapshotOptions, CommandOptions, Hook, HookType, MobileSurfaceNamespace, NativeApp, NativeAppLocator, PressOptions, RuntimeClient, ScreenshotOptions, WaitForSelectorOptions } from "./types.js";
3
+ export declare class NativeAppImpl implements NativeApp {
4
4
  #private;
5
5
  readonly sessionId: string;
6
6
  constructor(runtime: RuntimeClient, surfaceSessionId: string, sessionId: string);
7
- locator(selector: string): MobileAndroidLocator;
8
- getByRole(role: string, options?: RoleOptions): MobileAndroidLocator;
9
- getByText(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
10
- getByLabel(text: TextMatcher, options?: TextOptions): MobileAndroidLocator;
11
- getByTestId(text: TextMatcher): MobileAndroidLocator;
7
+ locator(selector: string): NativeAppLocator;
8
+ getByRole(role: string, options?: RoleOptions): NativeAppLocator;
9
+ getByText(text: TextMatcher, options?: TextOptions): NativeAppLocator;
10
+ getByLabel(text: TextMatcher, options?: TextOptions): NativeAppLocator;
11
+ getByTestId(text: TextMatcher): NativeAppLocator;
12
12
  registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
13
13
  setChooserFiles(fileChooserId: string, files: string[], options: CommandOptions): Promise<void>;
14
14
  saveMobileDownload(downloadId: string, path: string, options: CommandOptions): Promise<void>;
package/dist/mobile.js CHANGED
@@ -7,7 +7,7 @@ import { semanticSelector } from "./web-locators.js";
7
7
  function retryOptions(timeoutMs) {
8
8
  return timeoutMs ? { timeoutMs } : undefined;
9
9
  }
10
- export class MobileAndroidAppImpl {
10
+ export class NativeAppImpl {
11
11
  sessionId;
12
12
  #runtime;
13
13
  #surfaceSessionId;
@@ -18,7 +18,7 @@ export class MobileAndroidAppImpl {
18
18
  this.#surfaceSessionId = surfaceSessionId;
19
19
  }
20
20
  locator(selector) {
21
- return new MobileAndroidLocatorImpl(this, normalizeMobileSelectorForTransport(selector));
21
+ return new NativeAppLocatorImpl(this, normalizeMobileSelectorForTransport(selector));
22
22
  }
23
23
  getByRole(role, options = {}) {
24
24
  return this.locator(semanticSelector({ ...options, kind: "role", role }));
@@ -34,7 +34,7 @@ export class MobileAndroidAppImpl {
34
34
  }
35
35
  async registerHook(type) {
36
36
  if (type.name !== "fileChooser" && type.name !== "download") {
37
- throw new Error(`hook type ${type.name} is not supported by Android apps`);
37
+ throw new Error(`hook type ${type.name} is not supported by native apps`);
38
38
  }
39
39
  const handle = await this.#getHandle();
40
40
  this.#ensureOpen(handle);
@@ -530,7 +530,7 @@ class MobileDownloadImpl {
530
530
  await this.page.saveMobileDownload(this.id, path, options);
531
531
  }
532
532
  }
533
- class MobileAndroidLocatorImpl {
533
+ class NativeAppLocatorImpl {
534
534
  page;
535
535
  selector;
536
536
  constructor(page, selector) {
@@ -562,7 +562,7 @@ class MobileAndroidLocatorImpl {
562
562
  return this.page.waitForSelector(this.selector, options);
563
563
  }
564
564
  locator(selector) {
565
- return new MobileAndroidLocatorImpl(this.page, chainMobileSelectorForTransport(this.selector, selector));
565
+ return new NativeAppLocatorImpl(this.page, chainMobileSelectorForTransport(this.selector, selector));
566
566
  }
567
567
  getByRole(role, options = {}) {
568
568
  return this.locator(semanticSelector({ ...options, kind: "role", role }));
@@ -591,7 +591,7 @@ class MobileAndroidDeviceImpl {
591
591
  this.runtime = runtime;
592
592
  this.#stream = stream;
593
593
  this.#queue = queue;
594
- this.#currentApp = new MobileAndroidAppImpl(runtime, surfaceSessionId, initialAppSessionId);
594
+ this.#currentApp = new NativeAppImpl(runtime, surfaceSessionId, initialAppSessionId);
595
595
  }
596
596
  app() {
597
597
  return this.#currentApp;
@@ -613,7 +613,7 @@ class MobileAndroidDeviceImpl {
613
613
  while (true) {
614
614
  const event = await this.#queue.next();
615
615
  if (event.appLaunched?.appSessionId) {
616
- this.#currentApp = new MobileAndroidAppImpl(this.runtime, this.surfaceSessionId, event.appLaunched.appSessionId);
616
+ this.#currentApp = new NativeAppImpl(this.runtime, this.surfaceSessionId, event.appLaunched.appSessionId);
617
617
  return this.#currentApp;
618
618
  }
619
619
  if (event.error?.message) {
@@ -645,7 +645,7 @@ class MobileIosDeviceImpl {
645
645
  this.runtime = runtime;
646
646
  this.#stream = stream;
647
647
  this.#queue = queue;
648
- this.#currentApp = new MobileAndroidAppImpl(runtime, surfaceSessionId, initialAppSessionId);
648
+ this.#currentApp = new NativeAppImpl(runtime, surfaceSessionId, initialAppSessionId);
649
649
  }
650
650
  app() { return this.#currentApp; }
651
651
  initialApp() { return this.#currentApp; }
@@ -663,7 +663,7 @@ class MobileIosDeviceImpl {
663
663
  while (true) {
664
664
  const event = await this.#queue.next();
665
665
  if (event.appLaunched?.appSessionId) {
666
- this.#currentApp = new MobileAndroidAppImpl(this.runtime, this.surfaceSessionId, event.appLaunched.appSessionId);
666
+ this.#currentApp = new NativeAppImpl(this.runtime, this.surfaceSessionId, event.appLaunched.appSessionId);
667
667
  return this.#currentApp;
668
668
  }
669
669
  if (event.error?.message)
package/dist/types.d.ts CHANGED
@@ -119,13 +119,13 @@ export interface Dialog {
119
119
  }
120
120
  export interface FileChooser {
121
121
  readonly id: string;
122
- readonly page: Page | MobileAndroidApp;
122
+ readonly page: Page | NativeApp;
123
123
  isMultiple(): boolean;
124
124
  setFiles(files: string | string[], options?: CommandOptions): Promise<void>;
125
125
  }
126
126
  export interface Download {
127
127
  readonly id: string;
128
- readonly page: Page | MobileAndroidApp;
128
+ readonly page: Page | NativeApp;
129
129
  readonly url: string;
130
130
  readonly suggestedFilename: string;
131
131
  saveAs(path: string, options?: CommandOptions): Promise<void>;
@@ -183,8 +183,8 @@ export interface MobileAndroidLaunchOptions {
183
183
  stopBeforeLaunch?: boolean;
184
184
  timeoutMs?: number;
185
185
  }
186
- export interface MobileAndroidLocator {
187
- readonly page: MobileAndroidApp;
186
+ export interface NativeAppLocator {
187
+ readonly page: NativeApp;
188
188
  readonly selector: string;
189
189
  click(options?: CommandOptions): Promise<void>;
190
190
  count(options?: CommandOptions): Promise<number>;
@@ -194,22 +194,22 @@ export interface MobileAndroidLocator {
194
194
  textContent(options?: CommandOptions): Promise<string | null>;
195
195
  innerText(options?: CommandOptions): Promise<string>;
196
196
  waitFor(options?: WaitForSelectorOptions): Promise<void>;
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;
197
+ locator(selector: string): NativeAppLocator;
198
+ getByRole(role: string, options?: RoleOptions): NativeAppLocator;
199
+ getByText(text: TextMatcher, options?: TextOptions): NativeAppLocator;
200
+ getByLabel(text: TextMatcher, options?: TextOptions): NativeAppLocator;
201
+ getByTestId(text: TextMatcher): NativeAppLocator;
202
202
  }
203
- export interface MobileAndroidApp {
203
+ export interface NativeApp {
204
204
  accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
205
205
  readonly sessionId: string;
206
206
  goto(url: string, options?: CommandOptions): Promise<void>;
207
207
  navigate(url: string, options?: CommandOptions): Promise<void>;
208
- locator(selector: string): MobileAndroidLocator;
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;
208
+ locator(selector: string): NativeAppLocator;
209
+ getByRole(role: string, options?: RoleOptions): NativeAppLocator;
210
+ getByText(text: TextMatcher, options?: TextOptions): NativeAppLocator;
211
+ getByLabel(text: TextMatcher, options?: TextOptions): NativeAppLocator;
212
+ getByTestId(text: TextMatcher): NativeAppLocator;
213
213
  click(selector: string, options?: CommandOptions): Promise<void>;
214
214
  count(selector: string, options?: CommandOptions): Promise<number>;
215
215
  focus(selector: string, options?: CommandOptions): Promise<void>;
@@ -221,6 +221,8 @@ export interface MobileAndroidApp {
221
221
  screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
222
222
  registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
223
223
  }
224
+ export type MobileAndroidLocator = NativeAppLocator;
225
+ export type MobileAndroidApp = NativeApp;
224
226
  export interface MobileAndroidDevice {
225
227
  readonly sessionId: string;
226
228
  app(): MobileAndroidApp;
@@ -239,8 +241,8 @@ export interface MobileIosLaunchOptions {
239
241
  stopBeforeLaunch?: boolean;
240
242
  timeoutMs?: number;
241
243
  }
242
- export type MobileIosLocator = MobileAndroidLocator;
243
- export type MobileIosApp = MobileAndroidApp;
244
+ export type MobileIosLocator = NativeAppLocator;
245
+ export type MobileIosApp = NativeApp;
244
246
  export interface MobileIosDevice {
245
247
  readonly sessionId: string;
246
248
  app(): MobileIosApp;
@@ -264,8 +266,8 @@ export interface DesktopMacLaunchOptions {
264
266
  terminateRunning?: boolean;
265
267
  timeoutMs?: number;
266
268
  }
267
- export type DesktopMacApp = MobileAndroidApp;
268
- export type DesktopMacLocator = MobileAndroidLocator;
269
+ export type DesktopMacApp = NativeApp;
270
+ export type DesktopMacLocator = NativeAppLocator;
269
271
  export interface DesktopMacDesktop {
270
272
  readonly sessionId: string;
271
273
  app(): DesktopMacApp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",