2025-03-25 22:45:05 +08:00
|
|
|
import { describe, it, vi } from 'vitest';
|
2025-03-26 18:59:50 +08:00
|
|
|
import { AndroidAgent } from '../../src';
|
2025-03-25 22:45:05 +08:00
|
|
|
import { launchPage } from './utils';
|
|
|
|
|
|
|
|
vi.setConfig({
|
|
|
|
testTimeout: 90 * 1000,
|
|
|
|
});
|
|
|
|
|
|
|
|
const DEVICE_ID = process.env.ANDROID_DEVICE_ID;
|
|
|
|
|
|
|
|
describe(
|
|
|
|
'android integration',
|
|
|
|
async () => {
|
|
|
|
await it('Android settings page demo for scroll', async () => {
|
|
|
|
const page = await launchPage({
|
|
|
|
deviceId: DEVICE_ID,
|
|
|
|
app: {
|
|
|
|
pkg: 'com.android.settings',
|
|
|
|
activity: '.Settings',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const agent = new AndroidAgent(page);
|
2025-03-26 11:39:39 +08:00
|
|
|
|
|
|
|
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');
|
2025-03-25 22:45:05 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
360 * 1000,
|
|
|
|
);
|