@allwright.dev/core 0.1.23 → 0.1.24

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
@@ -51,11 +51,17 @@ Paths passed to `setFiles` and `saveAs` belong to the test process, even when
51
51
  the Allwright server is remote. Android apps support the same `fileChooser` and
52
52
  `download` hook shape; Android `newPage` hooks are not applicable.
53
53
 
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
-
56
- Android, iOS, and macOS applications implement the shared `NativeApp` and
54
+ Runnable examples cover every implemented surface:
55
+ [Web](./examples/web-basic.ts), [Android](./examples/android-basic.ts),
56
+ [iOS](./examples/ios-basic.ts), [macOS](./examples/macos-basic.ts), and
57
+ [Windows](./examples/windows-basic.ts). The desktop examples default to
58
+ Calculator on macOS and Notepad on Windows and accept `ALLWRIGHT_MAC_APP_ID`
59
+ or `ALLWRIGHT_WINDOWS_APP_ID`.
60
+
61
+ Android, iOS, macOS, and Windows applications implement the shared `NativeApp` and
57
62
  `NativeAppLocator` interfaces. Platform-specific type names such as
58
- `MobileAndroidApp`, `MobileIosLocator`, and `DesktopMacLocator` remain exported
63
+ `MobileAndroidApp`, `MobileIosLocator`, `DesktopMacLocator`, and
64
+ `DesktopWindowsLocator` remain exported
59
65
  as aliases for compatibility and platform-oriented annotations.
60
66
 
61
67
  Shared config files are stack-agnostic and can live in `allwright.config.yaml` or `allwright.config.json`.
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.23";
15
+ const DEFAULT_RELEASE_VERSION = "0.1.24";
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
@@ -9,14 +9,16 @@ class DesktopMacImpl {
9
9
  runtime;
10
10
  stream;
11
11
  queue;
12
+ platformLabel;
12
13
  #closed = false;
13
14
  #currentApp;
14
- constructor(sessionId, surfaceSessionId, runtime, stream, queue, initialAppSessionId) {
15
+ constructor(sessionId, surfaceSessionId, runtime, stream, queue, initialAppSessionId, platformLabel = "macOS") {
15
16
  this.sessionId = sessionId;
16
17
  this.surfaceSessionId = surfaceSessionId;
17
18
  this.runtime = runtime;
18
19
  this.stream = stream;
19
20
  this.queue = queue;
21
+ this.platformLabel = platformLabel;
20
22
  this.#currentApp = new NativeAppImpl(runtime, surfaceSessionId, initialAppSessionId);
21
23
  }
22
24
  app() {
@@ -24,7 +26,7 @@ class DesktopMacImpl {
24
26
  }
25
27
  async launch(options) {
26
28
  if (this.#closed)
27
- throw new Error(`macOS desktop session ${this.sessionId} is closed`);
29
+ throw new Error(`${this.platformLabel} desktop session ${this.sessionId} is closed`);
28
30
  this.stream.write({
29
31
  launchDesktopApp: {
30
32
  appId: options.appId,
@@ -42,7 +44,7 @@ class DesktopMacImpl {
42
44
  throw new Error(event.error.message);
43
45
  if (event.closed) {
44
46
  this.#closed = true;
45
- throw new Error(`macOS desktop session ${this.sessionId} closed while launching app`);
47
+ throw new Error(`${this.platformLabel} desktop session ${this.sessionId} closed while launching app`);
46
48
  }
47
49
  }
48
50
  }
@@ -61,7 +63,28 @@ class DesktopMacSurfaceImpl {
61
63
  while (true) {
62
64
  const event = await queue.next();
63
65
  if (event.desktopConnected?.initialAppSessionId) {
64
- return new DesktopMacImpl(event.desktopConnected.desktopSessionId ?? event.sessionId ?? "", event.sessionId ?? "", runtime, stream, queue, event.desktopConnected.initialAppSessionId);
66
+ return new DesktopMacImpl(event.desktopConnected.desktopSessionId ?? event.sessionId ?? "", event.sessionId ?? "", runtime, stream, queue, event.desktopConnected.initialAppSessionId, "macOS");
67
+ }
68
+ if (event.error?.message)
69
+ throw new Error(event.error.message);
70
+ }
71
+ }
72
+ }
73
+ class DesktopWindowsSurfaceImpl {
74
+ async connect(options = {}) {
75
+ const runtime = await getRuntime();
76
+ const { stream, queue } = await createBrowserSessionHandle(runtime);
77
+ stream.write({
78
+ connectDesktop: {
79
+ platform: 2,
80
+ agentEndpoint: options.agentEndpoint,
81
+ retryOptions: retryOptions(options.timeoutMs),
82
+ },
83
+ });
84
+ while (true) {
85
+ const event = await queue.next();
86
+ if (event.desktopConnected?.initialAppSessionId) {
87
+ return new DesktopMacImpl(event.desktopConnected.desktopSessionId ?? event.sessionId ?? "", event.sessionId ?? "", runtime, stream, queue, event.desktopConnected.initialAppSessionId, "Windows");
65
88
  }
66
89
  if (event.error?.message)
67
90
  throw new Error(event.error.message);
@@ -70,4 +93,5 @@ class DesktopMacSurfaceImpl {
70
93
  }
71
94
  export const desktop = {
72
95
  mac: new DesktopMacSurfaceImpl(),
96
+ windows: new DesktopWindowsSurfaceImpl(),
73
97
  };
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, 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";
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, DesktopWindowsApp, DesktopWindowsConnectOptions, DesktopWindowsDesktop, DesktopWindowsLaunchOptions, DesktopWindowsLocator, 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/types.d.ts CHANGED
@@ -273,10 +273,22 @@ export interface DesktopMacDesktop {
273
273
  app(): DesktopMacApp;
274
274
  launch(options: DesktopMacLaunchOptions): Promise<DesktopMacApp>;
275
275
  }
276
+ export type DesktopWindowsConnectOptions = DesktopMacConnectOptions;
277
+ export type DesktopWindowsLaunchOptions = DesktopMacLaunchOptions;
278
+ export type DesktopWindowsApp = NativeApp;
279
+ export type DesktopWindowsLocator = NativeAppLocator;
280
+ export interface DesktopWindowsDesktop {
281
+ readonly sessionId: string;
282
+ app(): DesktopWindowsApp;
283
+ launch(options: DesktopWindowsLaunchOptions): Promise<DesktopWindowsApp>;
284
+ }
276
285
  export interface DesktopSurfaceNamespace {
277
286
  mac: {
278
287
  connect(options?: DesktopMacConnectOptions): Promise<DesktopMacDesktop>;
279
288
  };
289
+ windows: {
290
+ connect(options?: DesktopWindowsConnectOptions): Promise<DesktopWindowsDesktop>;
291
+ };
280
292
  }
281
293
  export interface Locator extends WebLocators {
282
294
  inputValue(options?: CommandOptions): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",