Skip to content

Commit 8b13e1d

Browse files
authored
feat: add ai action context for android (#37)
1 parent aa4d4a7 commit 8b13e1d

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

android-demo/demo-run-yaml.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Promise.resolve(
88
const page = new AndroidDevice(devices[0].udid);
99

1010
// 👀 init Midscene agent
11-
const agent = new AndroidAgent(page);
11+
const agent = new AndroidAgent(page,{
12+
aiActionContext:
13+
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
14+
});
1215
await page.connect();
1316
await page.launch('https://www.ebay.com');
1417

android-demo/demo.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Promise.resolve(
88
const page = new AndroidDevice(devices[0].udid);
99

1010
// 👀 init Midscene agent
11-
const agent = new AndroidAgent(page);
11+
const agent = new AndroidAgent(page,{
12+
aiActionContext:
13+
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
14+
});
1215
await page.connect();
1316
await page.launch('https://www.ebay.com');
1417

android-with-vitest-demo/tests/setting.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ describe(
1111
async () => {
1212
await it('Android settings page demo for scroll', async () => {
1313
const devices = await getConnectedDevices();
14-
const agent = await agentFromAdbDevice(devices[0].udid);
14+
const agent = await agentFromAdbDevice(devices[0].udid,{
15+
aiActionContext:
16+
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
17+
});
1518

1619
await agent.launch('com.android.settings/.Settings');
1720

android-with-vitest-demo/tests/todo.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ describe('Test todo list', () => {
1616
beforeAll(async () => {
1717
const devices = await getConnectedDevices();
1818
const page = new AndroidDevice(devices[0].udid);
19-
agent = new AndroidAgent(page);
19+
agent = new AndroidAgent(page,{
20+
aiActionContext:
21+
'If any location, permission, user agreement, etc. popup, click agree. If login page pops up, close it.',
22+
});
2023
await page.connect();
2124
await page.launch(pageUrl);
2225
await sleep(3000);

0 commit comments

Comments
 (0)