Skip to content

Commit 0fe7be9

Browse files
committed
feat: 增强版TodoApp + 10场景蓝本(优先级/搜索/排序/删除确认/全选/重复检测)
- todo_app.py: 新增优先级(High/Medium/Low彩色标签)、搜索过滤、排序(名称/优先级/状态)、编辑(双击/按钮)、删除确认弹窗、重复检测、全选/取消全选、字符数限制、Urgent统计。初始数据5条 - testpilot.json: 10场景蓝本覆盖所有新功能,description含预期页面变化
1 parent e091474 commit 0fe7be9

2 files changed

Lines changed: 564 additions & 47 deletions

File tree

todo-demo/testpilot.json

Lines changed: 201 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"app_name": "TodoApp",
3-
"description": "PyQt5待办事项应用完整测试。验证添加、标记完成、删除、清空已完成、空输入提示等核心功能。初始数据3条:Buy milk、Read book、Exercise",
3+
"description": "PyQt5增强版待办事项应用测试。验证优先级、搜索过滤、排序、删除确认、全选、重复检测、空输入提示等功能。初始数据5条:Buy milk(High)、Read book(Medium)、Exercise(Low)、Write report(High)、Call dentist(Medium)",
44
"platform": "desktop",
55
"base_url": "",
66
"window_title": "TodoApp",
@@ -13,163 +13,317 @@
1313
"scenarios": [
1414
{
1515
"name": "初始状态验证",
16-
"description": "验证应用启动后的初始数据和统计",
16+
"description": "验证应用启动后的初始数据(5条)、优先级标签和统计栏(含Urgent计数)",
1717
"steps": [
1818
{
1919
"action": "screenshot",
20-
"description": "应用启动后的初始状态"
20+
"description": "应用启动后的初始状态,应显示5条待办,每条带优先级标签[H]/[M]/[L]"
2121
},
2222
{
2323
"action": "assert_text",
24-
"expected": "Total: 3",
25-
"description": "验证底部统计栏显示初始有3条待办"
24+
"expected": "Total: 5",
25+
"description": "验证底部统计栏显示初始有5条待办"
26+
},
27+
{
28+
"action": "assert_text",
29+
"expected": "Urgent: 2",
30+
"description": "验证底部统计栏显示2条高优先级未完成(Buy milk和Write report)"
2631
},
2732
{
2833
"action": "assert_text",
2934
"expected": "Buy milk",
30-
"description": "验证列表区域包含初始数据Buy milk"
35+
"description": "验证列表包含初始数据Buy milk"
3136
},
3237
{
3338
"action": "assert_text",
34-
"expected": "Pending: 3",
35-
"description": "验证底部统计栏显示3条都是未完成状态"
39+
"expected": "Write report",
40+
"description": "验证列表包含初始数据Write report"
3641
}
3742
]
3843
},
3944
{
40-
"name": "添加待办事项",
41-
"description": "在输入框输入新待办并点Add添加,验证列表和统计更新",
45+
"name": "添加High优先级待办",
46+
"description": "选择High优先级后添加新待办,验证列表更新和Urgent计数+1",
4247
"steps": [
48+
{
49+
"action": "click",
50+
"target": "name:High",
51+
"description": "点击输入框右侧的优先级下拉框,当前显示Medium,点击后选择High选项。下拉框位于输入框和Add按钮之间"
52+
},
53+
{
54+
"action": "wait",
55+
"value": "300",
56+
"description": "等待下拉选择完成"
57+
},
4358
{
4459
"action": "fill",
4560
"target": "name:输入待办事项...",
46-
"value": "Learn Python",
47-
"description": "在页面顶部标题下方、包含'输入待办事项...'占位符文字的输入框中输入"
61+
"value": "Fix critical bug",
62+
"description": "在页面中部包含'输入待办事项...'占位符的输入框中输入。输入后文字会替换占位符"
4863
},
4964
{
5065
"action": "click",
5166
"target": "name:Add",
52-
"description": "点击输入框右侧的蓝色Add按钮"
67+
"description": "点击输入框行最右侧的蓝色Add按钮,点击后列表新增一行'○ [H] Fix critical bug',底部Total变为6,Urgent变为3"
5368
},
5469
{
5570
"action": "wait",
5671
"value": "500",
5772
"description": "等待列表刷新"
5873
},
74+
{
75+
"action": "assert_text",
76+
"expected": "Total: 6",
77+
"description": "验证底部统计栏总数从5变为6"
78+
},
79+
{
80+
"action": "assert_text",
81+
"expected": "Fix critical bug",
82+
"description": "验证列表中出现新添加的Fix critical bug"
83+
},
84+
{
85+
"action": "assert_text",
86+
"expected": "Urgent: 3",
87+
"description": "验证Urgent计数从2变为3(新增了一条High优先级)"
88+
}
89+
]
90+
},
91+
{
92+
"name": "搜索过滤功能",
93+
"description": "在搜索框输入关键词,验证列表实时过滤只显示匹配项,并显示过滤状态提示",
94+
"steps": [
95+
{
96+
"action": "fill",
97+
"target": "name:Search...",
98+
"value": "book",
99+
"description": "在页面顶部标题下方、黄色背景的搜索框(含Search...占位符)中输入book,输入后列表实时过滤只显示包含book的项(Read book),搜索框下方出现'Showing 1 of 6 items'"
100+
},
101+
{
102+
"action": "wait",
103+
"value": "500",
104+
"description": "等待过滤结果显示"
105+
},
59106
{
60107
"action": "screenshot",
61-
"description": "添加Learn Python后的列表"
108+
"description": "搜索book后的过滤结果,应只显示Read book一项"
62109
},
63110
{
64111
"action": "assert_text",
65-
"expected": "Total: 4",
66-
"description": "验证底部统计栏总数从3变为4"
112+
"expected": "Showing 1 of 6",
113+
"description": "验证过滤状态提示显示'Showing 1 of 6 items'"
67114
},
68115
{
69116
"action": "assert_text",
70-
"expected": "Learn Python",
71-
"description": "验证列表中出现新添加的Learn Python"
117+
"expected": "Read book",
118+
"description": "验证过滤后列表只显示Read book"
119+
},
120+
{
121+
"action": "fill",
122+
"target": "name:Search...",
123+
"value": "",
124+
"description": "清空搜索框,清空后列表恢复显示全部6条,过滤状态提示消失"
125+
},
126+
{
127+
"action": "wait",
128+
"value": "500",
129+
"description": "等待列表恢复"
130+
},
131+
{
132+
"action": "assert_text",
133+
"expected": "Total: 6",
134+
"description": "验证清空搜索后统计栏仍显示6条(数据未丢失)"
72135
}
73136
]
74137
},
75138
{
76-
"name": "标记完成",
77-
"description": "先点击选中Buy milk列表项,再点Toggle Done标记完成,验证Done计数变为1",
139+
"name": "标记完成与Urgent更新",
140+
"description": "选中Buy milk并标记完成,验证Done计数+1且Urgent计数-1(Buy milk是High优先级)",
78141
"steps": [
79142
{
80143
"action": "click",
81144
"target": "name:Buy milk",
82-
"description": "点击列表区域中包含Buy milk文字的那一行,使其高亮选中"
145+
"description": "点击列表区域中包含Buy milk文字的那一行(显示为红色[H]标签),使其高亮选中"
83146
},
84147
{
85148
"action": "click",
86149
"target": "name:Toggle Done",
87-
"description": "点击列表下方左侧的绿色Toggle Done按钮"
150+
"description": "点击列表下方第一行左侧的绿色Toggle Done按钮,点击后Buy milk行文字变灰并显示✓标记,Done变为1,Urgent从3变为2"
88151
},
89152
{
90153
"action": "wait",
91154
"value": "500",
92155
"description": "等待状态刷新"
93156
},
94-
{
95-
"action": "screenshot",
96-
"description": "Buy milk标记完成后的状态"
97-
},
98157
{
99158
"action": "assert_text",
100159
"expected": "Done: 1",
101160
"description": "验证底部统计栏已完成数变为1"
161+
},
162+
{
163+
"action": "assert_text",
164+
"expected": "Urgent: 2",
165+
"description": "验证Urgent从3降为2(Buy milk是High优先级,完成后不计入Urgent)"
166+
},
167+
{
168+
"action": "screenshot",
169+
"description": "Buy milk标记完成后,该行变灰带✓,Urgent降为2"
102170
}
103171
]
104172
},
105173
{
106-
"name": "删除待办",
107-
"description": "选中Read book后点Delete删除,验证总数减少",
174+
"name": "排序功能",
175+
"description": "使用排序下拉框按Priority排序,验证列表重新排序",
108176
"steps": [
109177
{
110178
"action": "click",
111-
"target": "name:Read book",
112-
"description": "点击列表区域中包含Read book文字的那一行,使其高亮选中"
179+
"target": "name:Sort: Default",
180+
"description": "点击搜索框右侧的排序下拉框(当前显示Sort: Default),点击后展开排序选项"
181+
},
182+
{
183+
"action": "click",
184+
"target": "name:Sort: Priority",
185+
"description": "在展开的下拉列表中点击Sort: Priority选项,点击后列表重新排序:High在前,Medium居中,Low在后"
186+
},
187+
{
188+
"action": "wait",
189+
"value": "500",
190+
"description": "等待排序完成"
191+
},
192+
{
193+
"action": "screenshot",
194+
"description": "按优先级排序后的列表"
195+
}
196+
]
197+
},
198+
{
199+
"name": "删除待办(含确认弹窗)",
200+
"description": "选中Exercise后点Delete,弹出确认对话框,点Yes确认删除",
201+
"steps": [
202+
{
203+
"action": "click",
204+
"target": "name:Exercise",
205+
"description": "点击列表区域中包含Exercise文字的那一行(绿色[L]标签),使其高亮选中"
113206
},
114207
{
115208
"action": "click",
116209
"target": "name:Delete",
117-
"description": "点击列表下方中间的红色Delete按钮"
210+
"description": "点击列表下方第一行右侧的红色Delete按钮,点击后弹出确认对话框询问是否删除"
118211
},
119212
{
120213
"action": "wait",
121214
"value": "500",
122-
"description": "等待列表刷新"
215+
"description": "等待确认弹窗出现"
123216
},
124217
{
125218
"action": "screenshot",
126-
"description": "删除Read book后的列表"
219+
"description": "删除确认弹窗"
220+
},
221+
{
222+
"action": "click",
223+
"target": "name:Yes",
224+
"description": "点击确认弹窗中的Yes按钮确认删除,弹窗关闭,Exercise从列表消失,Total从6变为5"
225+
},
226+
{
227+
"action": "wait",
228+
"value": "500",
229+
"description": "等待列表刷新"
127230
},
128231
{
129232
"action": "assert_text",
130-
"expected": "Total: 3",
131-
"description": "验证底部统计栏总数从4变为3"
233+
"expected": "Total: 5",
234+
"description": "验证总数从6变为5(删除了Exercise)"
132235
}
133236
]
134237
},
135238
{
136-
"name": "清空已完成",
137-
"description": "点Clear Done清除所有已完成项(Buy milk),验证总数和Done计数",
239+
"name": "重复添加检测",
240+
"description": "尝试添加已存在的待办项,验证弹出重复警告",
138241
"steps": [
242+
{
243+
"action": "fill",
244+
"target": "name:输入待办事项...",
245+
"value": "Read book",
246+
"description": "在输入框中输入已存在的'Read book',准备测试重复检测"
247+
},
139248
{
140249
"action": "click",
141-
"target": "name:Clear Done",
142-
"description": "点击列表下方右侧的灰色Clear Done按钮"
250+
"target": "name:Add",
251+
"description": "点击蓝色Add按钮,因为Read book已存在,会弹出警告'Duplicate item: Read book'"
143252
},
144253
{
145254
"action": "wait",
146255
"value": "500",
147-
"description": "等待列表刷新"
256+
"description": "等待重复警告弹窗出现"
148257
},
149258
{
150259
"action": "screenshot",
151-
"description": "清空已完成项后的列表"
260+
"description": "重复添加时的警告弹窗"
261+
}
262+
]
263+
},
264+
{
265+
"name": "全选标记完成",
266+
"description": "点击Select All将所有待办标记为已完成,验证Done等于Total,Urgent变为0",
267+
"steps": [
268+
{
269+
"action": "click",
270+
"target": "name:Select All",
271+
"description": "点击列表下方第二行右侧的蓝色Select All按钮,点击后所有项变为已完成(显示✓和灰色),Done等于Total,Urgent变为0"
272+
},
273+
{
274+
"action": "wait",
275+
"value": "500",
276+
"description": "等待状态刷新"
277+
},
278+
{
279+
"action": "assert_text",
280+
"expected": "Done: 5",
281+
"description": "验证Done数等于总数5(全部已完成)"
152282
},
153283
{
154284
"action": "assert_text",
155-
"expected": "Total: 2",
156-
"description": "验证底部统计栏总数从3变为2(清除了已完成的Buy milk)"
285+
"expected": "Urgent: 0",
286+
"description": "验证Urgent变为0(所有High优先级都已完成)"
287+
},
288+
{
289+
"action": "screenshot",
290+
"description": "全选完成后,所有项显示✓,Done=5,Urgent=0"
291+
}
292+
]
293+
},
294+
{
295+
"name": "清空已完成项",
296+
"description": "点Clear Done清除全部已完成项,列表变空",
297+
"steps": [
298+
{
299+
"action": "click",
300+
"target": "name:Clear Done",
301+
"description": "点击列表下方第二行左侧的灰色Clear Done按钮,点击后所有已完成项被移除,列表变空,Total变为0"
302+
},
303+
{
304+
"action": "wait",
305+
"value": "500",
306+
"description": "等待列表刷新"
157307
},
158308
{
159309
"action": "assert_text",
160-
"expected": "Done: 0",
161-
"description": "验证底部统计栏已完成数回到0"
310+
"expected": "Total: 0",
311+
"description": "验证清空后总数为0"
312+
},
313+
{
314+
"action": "screenshot",
315+
"description": "清空后的空列表状态"
162316
}
163317
]
164318
},
165319
{
166320
"name": "空输入验证",
167-
"description": "不输入任何内容直接点Add,验证弹出警告提示",
321+
"description": "列表为空时,不输入内容直接点Add,验证弹出警告",
168322
"steps": [
169323
{
170324
"action": "click",
171325
"target": "name:Add",
172-
"description": "不输入任何内容,直接点击输入框右侧的蓝色Add按钮"
326+
"description": "不输入任何内容,直接点击蓝色Add按钮,弹出警告'Please enter a todo item'"
173327
},
174328
{
175329
"action": "wait",

0 commit comments

Comments
 (0)