Skip to content

Mobile MCP: let AI agents drive your iOS and Android apps. MCP server for simulators, emulators and real devices. Works with Claude Code, Codex, Cursor and any MCP client.

test: test android orientation change

gmegidish7261c7b90f91
diff --git a/test/android.ts b/test/android.ts
index a7dc0cf..53262ea 100644
--- a/test/android.ts
+++ b/test/android.ts
@@ -111,4 +111,29 @@ describe("android", () => {
const processes2 = await android.listRunningProcesses();
assert.ok(!processes2.includes("com.android.chrome"));
});
+
+ it("should handle orientation changes", async function() {
+ hasOneAndroidDevice || this.skip();
+
+ // assume we start in portrait
+ const originalOrientation = await android.getOrientation();
+ assert.equal(originalOrientation, "portrait");
+ const screenSize1 = await android.getScreenSize();
+
+ // set to landscape
+ await android.setOrientation("landscape");
+ await new Promise(resolve => setTimeout(resolve, 1500));
+ const orientation = await android.getOrientation();
+ assert.equal(orientation, "landscape");
+ const screenSize2 = await android.getScreenSize();
+
+ // set to portrait
+ await android.setOrientation("portrait");
+ await new Promise(resolve => setTimeout(resolve, 1500));
+ const orientation2 = await android.getOrientation();
+ assert.equal(orientation2, "portrait");
+
+ // screen size should not have changed
+ assert.deepEqual(screenSize1, screenSize2);
+ });
});