@autifyhq/aximo-cli 0.4.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.
- package/README.md +98 -34
- package/dist/cli.js +1 -0
- package/dist/commands/device/device-config.d.ts +14 -0
- package/dist/commands/device/device-config.js +46 -0
- package/dist/commands/device/device-config.test.d.ts +1 -0
- package/dist/commands/device/device-config.test.js +56 -0
- package/dist/commands/device/doctor.d.ts +13 -0
- package/dist/commands/device/doctor.js +142 -25
- package/dist/commands/device/doctor.test.js +61 -1
- package/dist/commands/device/register.d.ts +2 -0
- package/dist/commands/device/register.js +50 -32
- package/dist/commands/device/register.test.d.ts +1 -0
- package/dist/commands/device/register.test.js +95 -0
- package/dist/commands/device/unregister.d.ts +5 -3
- package/dist/commands/device/unregister.js +32 -33
- package/dist/commands/device/unregister.test.d.ts +1 -0
- package/dist/commands/device/unregister.test.js +73 -0
- package/dist/commands/mobile/connect-core.d.ts +12 -0
- package/dist/commands/mobile/connect-core.js +74 -0
- package/dist/commands/mobile/connect.d.ts +9 -0
- package/dist/commands/mobile/connect.js +35 -0
- package/dist/commands/mobile/connect.test.d.ts +1 -0
- package/dist/commands/mobile/connect.test.js +87 -0
- package/dist/commands/mobile/doctor.d.ts +28 -0
- package/dist/commands/mobile/doctor.js +143 -0
- package/dist/commands/mobile/index.d.ts +2 -0
- package/dist/commands/mobile/index.js +15 -0
- package/dist/commands/mobile/list.d.ts +10 -0
- package/dist/commands/mobile/list.js +30 -0
- package/dist/commands/mobile/paths.d.ts +14 -0
- package/dist/commands/mobile/paths.js +71 -0
- package/dist/commands/mobile/register-core.d.ts +19 -0
- package/dist/commands/mobile/register-core.js +46 -0
- package/dist/commands/mobile/register.d.ts +32 -0
- package/dist/commands/mobile/register.js +51 -0
- package/dist/commands/mobile/register.test.d.ts +1 -0
- package/dist/commands/mobile/register.test.js +60 -0
- package/dist/commands/mobile/setup.d.ts +27 -0
- package/dist/commands/mobile/setup.js +100 -0
- package/dist/commands/mobile/setup.test.d.ts +1 -0
- package/dist/commands/mobile/setup.test.js +49 -0
- package/dist/commands/mobile/unregister.d.ts +14 -0
- package/dist/commands/mobile/unregister.js +37 -0
- package/dist/commands/schema.js +22 -0
- package/dist/commands/session/create.d.ts +5 -0
- package/dist/commands/session/create.js +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mobile-control/appium-controller.d.ts +39 -0
- package/dist/mobile-control/appium-controller.js +367 -0
- package/dist/mobile-control/appium-controller.test.d.ts +1 -0
- package/dist/mobile-control/appium-controller.test.js +252 -0
- package/dist/mobile-control/appium-import.d.ts +7 -0
- package/dist/mobile-control/appium-import.js +6 -0
- package/dist/mobile-control/appium-import.test.d.ts +1 -0
- package/dist/mobile-control/appium-import.test.js +9 -0
- package/dist/mobile-control/appium-server.d.ts +30 -0
- package/dist/mobile-control/appium-server.js +110 -0
- package/dist/mobile-control/appium-server.test.d.ts +1 -0
- package/dist/mobile-control/appium-server.test.js +108 -0
- package/dist/mobile-control/controller.d.ts +22 -0
- package/dist/mobile-control/controller.js +1 -0
- package/dist/mobile-control/devices.d.ts +21 -0
- package/dist/mobile-control/devices.js +99 -0
- package/dist/mobile-control/devices.test.d.ts +1 -0
- package/dist/mobile-control/devices.test.js +35 -0
- package/dist/mobile-control/exec.d.ts +6 -0
- package/dist/mobile-control/exec.js +13 -0
- package/dist/mobile-control/tunnel.d.ts +11 -0
- package/dist/mobile-control/tunnel.js +152 -0
- package/dist/mobile-control/tunnel.test.d.ts +1 -0
- package/dist/mobile-control/tunnel.test.js +155 -0
- package/dist/mobile-control/webdriver.d.ts +31 -0
- package/dist/mobile-control/webdriver.js +137 -0
- package/dist/mobile-control/webdriver.test.d.ts +1 -0
- package/dist/mobile-control/webdriver.test.js +45 -0
- package/dist/types.d.ts +1 -0
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autifyhq/aximo-cli",
|
|
3
|
-
"version": "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
|
},
|