@autifyhq/aximo-cli 0.10.0 → 0.10.1

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.
@@ -63,6 +63,9 @@ export class AppiumController {
63
63
  "appium:noReset": true,
64
64
  "appium:autoLaunch": false,
65
65
  "appium:newCommandTimeout": 0,
66
+ // ColorOS-family devices (OPPO/Realme/OnePlus) block the hidden-api-policy
67
+ // write; warn and continue instead of failing session creation (GEN-2741).
68
+ "appium:ignoreHiddenApiPolicyError": true,
66
69
  ...mjpeg,
67
70
  };
68
71
  }
@@ -106,6 +106,7 @@ describe("AppiumController session capabilities", () => {
106
106
  expect(c["appium:noReset"]).toBe(true);
107
107
  expect(c["appium:autoLaunch"]).toBe(false);
108
108
  expect(c["appium:newCommandTimeout"]).toBe(0);
109
+ expect(c["appium:ignoreHiddenApiPolicyError"]).toBe(true);
109
110
  });
110
111
  it("sends iOS XCUITest caps", async () => {
111
112
  const { controller, calls } = makeController("ios");
@@ -114,6 +115,8 @@ describe("AppiumController session capabilities", () => {
114
115
  expect(c["platformName"]).toBe("iOS");
115
116
  expect(c["appium:automationName"]).toBe("XCUITest");
116
117
  expect(c["appium:newCommandTimeout"]).toBe(0);
118
+ // Android-only workaround; an unknown appium:* cap can fail XCUITest session creation.
119
+ expect(c).not.toHaveProperty("appium:ignoreHiddenApiPolicyError");
117
120
  });
118
121
  it("creates the session lazily and only once", async () => {
119
122
  const { controller, calls } = makeController("android");
@@ -102,7 +102,13 @@ export function registerHandlers(socket, controller, installApp, stream) {
102
102
  }
103
103
  void handler(args)
104
104
  .then((result) => ack?.(result))
105
- .catch((err) => ack?.(fail(err)));
105
+ .catch((err) => {
106
+ const failure = fail(err);
107
+ // The server may collapse this ack into a generic error; the terminal
108
+ // is the only place the device-side cause is guaranteed to be visible.
109
+ console.error(`Command "${event}" failed: ${failure.error}`);
110
+ ack?.(failure);
111
+ });
106
112
  });
107
113
  };
108
114
  on("ping", async () => ok());
@@ -49,6 +49,23 @@ describe("registerHandlers", () => {
49
49
  expect(Buffer.isBuffer(result)).toBe(true);
50
50
  expect(result.equals(Buffer.from([1, 2, 3]))).toBe(true);
51
51
  });
52
+ it("a throwing handler acks the failure and logs it to the terminal", async () => {
53
+ const logSpy = vi.spyOn(console, "error").mockImplementation(() => { });
54
+ try {
55
+ const screenshot = vi.fn(async () => {
56
+ throw new Error("Hidden API policy cannot be enabled");
57
+ });
58
+ const socket = wire(stubController({ screenshot }));
59
+ await expect(socket.emit("screenshot", {})).resolves.toEqual({
60
+ ok: false,
61
+ error: "Hidden API policy cannot be enabled",
62
+ });
63
+ expect(logSpy).toHaveBeenCalledWith('Command "screenshot" failed: Hidden API policy cannot be enabled');
64
+ }
65
+ finally {
66
+ logSpy.mockRestore();
67
+ }
68
+ });
52
69
  it("tap forwards coordinates and acks ok", async () => {
53
70
  const tap = vi.fn(async () => { });
54
71
  const socket = wire(stubController({ tap }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autifyhq/aximo-cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Autify Aximo Command Line Interface (CLI)",
5
5
  "keywords": [
6
6
  "autify",