@autifyhq/aximo-cli 0.3.0 → 0.5.0

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.
Files changed (91) hide show
  1. package/README.md +129 -35
  2. package/dist/cli.js +1 -0
  3. package/dist/commands/case/case.test.js +34 -0
  4. package/dist/commands/case/delete.d.ts +20 -0
  5. package/dist/commands/case/delete.js +39 -0
  6. package/dist/commands/case/index.js +1 -0
  7. package/dist/commands/device/device-config.d.ts +14 -0
  8. package/dist/commands/device/device-config.js +46 -0
  9. package/dist/commands/device/device-config.test.d.ts +1 -0
  10. package/dist/commands/device/device-config.test.js +56 -0
  11. package/dist/commands/device/doctor.d.ts +14 -0
  12. package/dist/commands/device/doctor.js +155 -29
  13. package/dist/commands/device/doctor.test.js +69 -3
  14. package/dist/commands/device/paths.d.ts +1 -0
  15. package/dist/commands/device/paths.js +3 -0
  16. package/dist/commands/device/register.d.ts +2 -0
  17. package/dist/commands/device/register.js +50 -32
  18. package/dist/commands/device/register.test.d.ts +1 -0
  19. package/dist/commands/device/register.test.js +95 -0
  20. package/dist/commands/device/unregister.d.ts +5 -3
  21. package/dist/commands/device/unregister.js +32 -33
  22. package/dist/commands/device/unregister.test.d.ts +1 -0
  23. package/dist/commands/device/unregister.test.js +73 -0
  24. package/dist/commands/mcp/server.test.js +2 -1
  25. package/dist/commands/mcp/tools.js +11 -0
  26. package/dist/commands/mcp/tools.test.js +12 -0
  27. package/dist/commands/mobile/connect-core.d.ts +12 -0
  28. package/dist/commands/mobile/connect-core.js +74 -0
  29. package/dist/commands/mobile/connect.d.ts +9 -0
  30. package/dist/commands/mobile/connect.js +35 -0
  31. package/dist/commands/mobile/connect.test.d.ts +1 -0
  32. package/dist/commands/mobile/connect.test.js +87 -0
  33. package/dist/commands/mobile/doctor.d.ts +28 -0
  34. package/dist/commands/mobile/doctor.js +143 -0
  35. package/dist/commands/mobile/index.d.ts +2 -0
  36. package/dist/commands/mobile/index.js +15 -0
  37. package/dist/commands/mobile/list.d.ts +10 -0
  38. package/dist/commands/mobile/list.js +30 -0
  39. package/dist/commands/mobile/paths.d.ts +14 -0
  40. package/dist/commands/mobile/paths.js +71 -0
  41. package/dist/commands/mobile/register-core.d.ts +19 -0
  42. package/dist/commands/mobile/register-core.js +46 -0
  43. package/dist/commands/mobile/register.d.ts +32 -0
  44. package/dist/commands/mobile/register.js +51 -0
  45. package/dist/commands/mobile/register.test.d.ts +1 -0
  46. package/dist/commands/mobile/register.test.js +60 -0
  47. package/dist/commands/mobile/setup.d.ts +27 -0
  48. package/dist/commands/mobile/setup.js +100 -0
  49. package/dist/commands/mobile/setup.test.d.ts +1 -0
  50. package/dist/commands/mobile/setup.test.js +49 -0
  51. package/dist/commands/mobile/unregister.d.ts +14 -0
  52. package/dist/commands/mobile/unregister.js +37 -0
  53. package/dist/commands/schema.js +22 -0
  54. package/dist/commands/session/create.d.ts +5 -0
  55. package/dist/commands/session/create.js +6 -0
  56. package/dist/desktop-server/setup-tls.test.d.ts +1 -0
  57. package/dist/desktop-server/setup-tls.test.js +83 -0
  58. package/dist/desktop-server/setup.d.ts +17 -0
  59. package/dist/desktop-server/setup.js +53 -1
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.js +3 -0
  62. package/dist/mobile-control/appium-controller.d.ts +39 -0
  63. package/dist/mobile-control/appium-controller.js +367 -0
  64. package/dist/mobile-control/appium-controller.test.d.ts +1 -0
  65. package/dist/mobile-control/appium-controller.test.js +252 -0
  66. package/dist/mobile-control/appium-import.d.ts +7 -0
  67. package/dist/mobile-control/appium-import.js +6 -0
  68. package/dist/mobile-control/appium-import.test.d.ts +1 -0
  69. package/dist/mobile-control/appium-import.test.js +9 -0
  70. package/dist/mobile-control/appium-server.d.ts +30 -0
  71. package/dist/mobile-control/appium-server.js +110 -0
  72. package/dist/mobile-control/appium-server.test.d.ts +1 -0
  73. package/dist/mobile-control/appium-server.test.js +108 -0
  74. package/dist/mobile-control/controller.d.ts +22 -0
  75. package/dist/mobile-control/controller.js +1 -0
  76. package/dist/mobile-control/devices.d.ts +21 -0
  77. package/dist/mobile-control/devices.js +99 -0
  78. package/dist/mobile-control/devices.test.d.ts +1 -0
  79. package/dist/mobile-control/devices.test.js +35 -0
  80. package/dist/mobile-control/exec.d.ts +6 -0
  81. package/dist/mobile-control/exec.js +13 -0
  82. package/dist/mobile-control/tunnel.d.ts +11 -0
  83. package/dist/mobile-control/tunnel.js +152 -0
  84. package/dist/mobile-control/tunnel.test.d.ts +1 -0
  85. package/dist/mobile-control/tunnel.test.js +155 -0
  86. package/dist/mobile-control/webdriver.d.ts +31 -0
  87. package/dist/mobile-control/webdriver.js +137 -0
  88. package/dist/mobile-control/webdriver.test.d.ts +1 -0
  89. package/dist/mobile-control/webdriver.test.js +45 -0
  90. package/dist/types.d.ts +4 -0
  91. package/package.json +3 -1
@@ -0,0 +1,45 @@
1
+ import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
2
+ import { http, HttpResponse, server } from "../test-utils.js";
3
+ import { ELEMENT_KEY, fetchTransport, WebDriverSession } from "./webdriver.js";
4
+ const BASE = "http://127.0.0.1:4723";
5
+ beforeAll(() => server.listen());
6
+ afterEach(() => server.resetHandlers());
7
+ afterAll(() => server.close());
8
+ describe("fetchTransport", () => {
9
+ it("returns the WebDriver value on success", async () => {
10
+ server.use(http.get(`${BASE}/session/s1/screenshot`, () => HttpResponse.json({ value: "AAA" })));
11
+ const t = fetchTransport(BASE);
12
+ await expect(t.request("GET", "/session/s1/screenshot")).resolves.toBe("AAA");
13
+ });
14
+ it("maps a WebDriver value.error to a thrown Error", async () => {
15
+ server.use(http.post(`${BASE}/session`, () => HttpResponse.json({ value: { error: "session not created", message: "no device" } }, { status: 500 })));
16
+ const t = fetchTransport(BASE);
17
+ await expect(t.request("POST", "/session", {})).rejects.toThrow(/session not created: no device/);
18
+ });
19
+ it("maps a non-2xx response without a structured error to a thrown Error", async () => {
20
+ server.use(http.get(`${BASE}/status`, () => new HttpResponse("boom", { status: 502 })));
21
+ const t = fetchTransport(BASE);
22
+ await expect(t.request("GET", "/status")).rejects.toThrow(/failed/);
23
+ });
24
+ });
25
+ describe("WebDriverSession", () => {
26
+ it("creates a session and decodes screenshots from base64", async () => {
27
+ const png = Buffer.from([0x89, 0x50, 0x4e, 0x47]).toString("base64");
28
+ server.use(http.post(`${BASE}/session`, () => HttpResponse.json({ value: { sessionId: "abc" } })), http.get(`${BASE}/session/abc/screenshot`, () => HttpResponse.json({ value: png })));
29
+ const s = new WebDriverSession(fetchTransport(BASE));
30
+ expect(await s.createSession({ platformName: "Android" })).toBe("abc");
31
+ expect(s.id).toBe("abc");
32
+ const shot = await s.screenshot();
33
+ expect(shot.equals(Buffer.from([0x89, 0x50, 0x4e, 0x47]))).toBe(true);
34
+ });
35
+ it("unwraps element references from findElement", async () => {
36
+ server.use(http.post(`${BASE}/session`, () => HttpResponse.json({ value: { sessionId: "abc" } })), http.post(`${BASE}/session/abc/element`, () => HttpResponse.json({ value: { [ELEMENT_KEY]: "el-7" } })));
37
+ const s = new WebDriverSession(fetchTransport(BASE));
38
+ await s.createSession({});
39
+ await expect(s.findElement("accessibility id", "Login")).resolves.toBe("el-7");
40
+ });
41
+ it("throws when calling session endpoints before the session opens", async () => {
42
+ const s = new WebDriverSession(fetchTransport(BASE));
43
+ await expect(s.screenshot()).rejects.toThrow(/session is not open/);
44
+ });
45
+ });
package/dist/types.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface CreateSessionInput {
37
37
  uploadType?: FileType | undefined;
38
38
  appName?: string | undefined;
39
39
  bundleId?: string | undefined;
40
+ userDeviceId?: string | undefined;
40
41
  }
41
42
  export interface CreateSessionResult {
42
43
  success: boolean;
@@ -133,6 +134,9 @@ export interface CreateCaseResult {
133
134
  success: boolean;
134
135
  caseId: string;
135
136
  }
137
+ export interface DeleteCaseResult {
138
+ success: boolean;
139
+ }
136
140
  export interface CreatePlanInput {
137
141
  projectId: string;
138
142
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autifyhq/aximo-cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Autify Aximo Command Line Interface (CLI)",
5
5
  "keywords": [
6
6
  "autify",
@@ -37,7 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@modelcontextprotocol/sdk": "^1.29.0",
40
+ "appium": "^3.5.2",
40
41
  "citty": "0.2.2",
42
+ "socket.io-client": "^4.8.1",
41
43
  "ws": "^8.18.0",
42
44
  "zod": "^3.25.76"
43
45
  },