midscene/packages/android/tests/ai/setting.test.ts
Leyang bc645c3d0c
refactor: android api (#521)
* refactor: android api

* refactor: update the Android agent and device connection logic

* refactor: enhance Android agent to accept options for device connection

* fix: type error

* feat: use first device when no deviceId pass

* fix: import from agent.ts

* fix: click after clearInput

* fix: click before clearInput
2025-04-03 10:28:40 +08:00

27 lines
796 B
TypeScript

import { describe, it, vi } from 'vitest';
import { agentFromAdbDevice, getConnectedDevices } from '../../src';
vi.setConfig({
testTimeout: 90 * 1000,
});
describe(
'android integration',
async () => {
await it('Android settings page demo for scroll', async () => {
const devices = await getConnectedDevices();
const agent = await agentFromAdbDevice(devices[0].udid);
await agent.launch('com.android.settings/.Settings');
await agent.aiAction('scroll list to bottom');
await agent.aiAction('open "More settings"');
await agent.aiAction('scroll list to bottom');
await agent.aiAction('scroll list to top');
await agent.aiAction('swipe down one screen');
await agent.aiAction('swipe up one screen');
});
},
360 * 1000,
);