Skip to content

Commit c3d763f

Browse files
authored
feat: add demo for .aiTap (#34)
1 parent 5ac2d1c commit c3d763f

File tree

4 files changed

+478
-280
lines changed

4 files changed

+478
-280
lines changed

playwright-demo/e2e/todo-mvc-en.spec.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@ test.beforeEach(async ({ page }) => {
55
await page.goto("https://todomvc.com/examples/react/dist/");
66
});
77

8-
test("ai todo - English Prompt", async ({ ai, aiQuery, aiAssert }) => {
8+
test("ai todo - English Prompt", async ({ ai, aiQuery, aiAssert, aiTap }) => {
9+
// .ai - general AI operation method
910
await ai(
10-
"Input 'Study JS today' in the task box input and press the Enter key"
11+
"Input 'Learn JS today' in the task box input and press the Enter key"
1112
);
1213
await ai(
13-
"Input 'Study Rust tomorrow' in the task box input and press the Enter key"
14+
"Input 'Learn Rust tomorrow' in the task box input and press the Enter key"
1415
);
1516
await ai(
16-
"Input 'Study AI the day after tomorrow' in the task box input and press the Enter key"
17+
"Input 'Learn AI the day after tomorrow' in the task box input and press the Enter key"
1718
);
1819
await ai(
1920
"Move the mouse to the second item in the task list and click the delete button on the right of the second task"
2021
);
21-
await ai("Click the check button on the left of the second task");
22-
await ai("Click the 'completed' status button below the task list");
22+
23+
// .aiTap - specify the operation type
24+
await aiTap("the check button on the left of the second task");
25+
await aiTap("the 'completed' status button below the task list");
2326

2427
const list = await aiQuery("string[], the complete task list");
2528

playwright-demo/e2e/todo-mvc-zh.spec.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ test.beforeEach(async ({ page }) => {
55
await page.goto("https://todomvc.com/examples/react/dist/");
66
});
77

8-
test("ai todo - Chinese Prompt", async ({ ai, aiQuery, aiAssert }) => {
8+
test("ai todo - Chinese Prompt", async ({ ai, aiQuery, aiAssert, aiTap }) => {
9+
// .ai - 通用 AI 操作方法
910
await ai("在任务框 input 输入 今天学习 JS,按回车键");
1011
await ai("在任务框 input 输入 明天学习 Rust,按回车键");
1112
await ai("在任务框 input 输入后天学习 AI,按回车键");
1213
await ai("将鼠标移动到任务列表中的第二项,点击第二项任务右边的删除按钮");
13-
await ai("点击第二条任务左边的勾选按钮");
14-
await ai("点击任务列表下面的 completed 状态按钮");
14+
15+
// .aiTap - 指定操作类型
16+
await aiTap("第二条任务左边的勾选按钮");
17+
await aiTap("任务列表下面的 completed 状态按钮");
1518

1619
const list = await aiQuery("string[], 完整的任务列表");
1720
expect(list.length).toEqual(1);

0 commit comments

Comments
 (0)