Skip to content

Commit 170cb7d

Browse files
committed
modify AutoItDemo
modify test Cases can both run on Mac or Windows
1 parent 4ea6e3b commit 170cb7d

File tree

7 files changed

+99
-216
lines changed

7 files changed

+99
-216
lines changed

AutoItDemo/demo/index.html

Lines changed: 0 additions & 62 deletions
This file was deleted.

AutoItDemo/demo/text.rar

-72 Bytes
Binary file not shown.

AutoItDemo/demo/text2.rar

-72 Bytes
Binary file not shown.

AutoItDemo/demo/updown.html

Lines changed: 0 additions & 65 deletions
This file was deleted.

AutoItDemo/tests/resource.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
*** Settings ***
22
Library Selenium2Library
33
Library AutoItLibrary
4+
Library OperatingSystem
45

56
*** Keywords ***
67
打开网页
7-
Comment log ${CURDIR}
8-
${url} Set Variable ${CURDIR}/../demo/index.html
9-
Comment ${url} Evaluate '${url}'.replace('\\','\\\\')
10-
open browser ${url} gc
8+
Open Browser http://localhost:8000/updown/ ie
119

1210
关闭网页
1311
Close All Browsers
@@ -21,3 +19,7 @@ Library AutoItLibrary
2119
Control CLICK ${EMPTY} ${EMPTY} Button1
2220
Comment Win Close ${title}
2321
[Return] ${ret}
22+
23+
判断平台
24+
${sys} Evaluate sys.platform == 'darwin' sys
25+
Pass Execution If '${sys}'=='True' Mac系统不支持该案例

AutoItDemo/tests/testsuite-alert.txt

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
*** Settings ***
2-
Test Teardown 关闭网页
3-
Library AutoItLibrary
4-
Resource resource.txt
5-
6-
*** Test Cases ***
7-
处理对话框
8-
打开网页
9-
click button pay
10-
${mes} confirm action
11-
sleep 2s
12-
Choose Cancel On Next Confirmation
13-
click button paycon
14-
${mes} confirm action
15-
sleep 2s
16-
Choose Ok On Next Confirmation
17-
click button paycon
18-
${mes} confirm action
19-
sleep 2s
20-
21-
处理对话框AutoIt
22-
打开网页
23-
click button pay
24-
${mes} 关闭对话框 来自网页的消息
25-
sleep 3s
26-
click button paycon
27-
${mes} 关闭对话框 来自网页的消息
28-
sleep 2s
1+
*** Settings ***
2+
Test Setup 打开网页
3+
Test Teardown 关闭网页
4+
Library AutoItLibrary
5+
Resource resource.txt
6+
7+
*** Test Cases ***
8+
处理对话框
9+
Click Button pay
10+
Sleep 2s
11+
${mes} Confirm Action
12+
Sleep 2s
13+
Choose Cancel On Next Confirmation
14+
click button paycon
15+
Sleep 2s
16+
${mes} Confirm Action
17+
Sleep 2s
18+
${confirm} Get Element Attribute r@innerText
19+
Choose Ok On Next Confirmation
20+
Click Button paycon
21+
Sleep 2s
22+
${mes} Confirm Action
23+
Sleep 2s
24+
${confirm} Get Element Attribute r@innerText
25+
26+
处理对话框AutoIt
27+
判断平台
28+
Click Button pay
29+
${mes} 关闭对话框 来自网页的消息
30+
Sleep 3s
31+
Click Button paycon
32+
${mes} 关闭对话框 来自网页的消息
33+
Sleep 2s
34+
${confirm} Get Element Attribute r@innerText

AutoItDemo/tests/testsuite-updown.txt

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,59 @@
1-
*** Settings ***
2-
Test Teardown 关闭网页
3-
Library AutoItLibrary
4-
Resource resource.txt
5-
6-
*** Test Cases ***
7-
upload-case
8-
打开网页
9-
Choose File file ${CURDIR}\\..\\demo\\text.rar
10-
sleep 5
11-
12-
upload-autoit
13-
打开网页
14-
sleep 5
15-
${TITLE} Get Title
16-
${cx} Get Horizontal Position choose
17-
${cy} Get Vertical Position choose
18-
Comment mouse move ${cx} ${cy}
19-
${conx} control Get Pos X \ \ Internet Explorer_Server1
20-
${cony} control Get Pos Y \ \ Internet Explorer_Server1
21-
Comment mouse move ${conx} ${cony}
22-
${ix} win Get Pos X ${TITLE}
23-
${iy} win Get Pos Y ${TITLE}
24-
${mx} Evaluate int(${cx})+int(${ix})+int(${conx})+18
25-
${my} Evaluate int(${cy})+int(${iy})+int(${cony})+38
26-
sleep 2
27-
Comment mouse move ${mx} ${my}
28-
Mouse Click LEFT ${mx} ${my}
29-
Win Wait 选择要加载的文件 \ 20
30-
Win Activate 选择要加载的文件
31-
Control Set Text \ \ Edit1 ${CURDIR}\\..\\demo\\text.rar
32-
sleep 2
33-
Control Click \ \ Button1
34-
sleep 3
35-
36-
download-case
37-
打开网页
38-
sleep 3s
39-
click link 下载测试
40-
sleep 3s
41-
win wait 文件下载 \ 15
42-
Win Activate 文件下载
43-
Control Click \ \ Button2
44-
sleep 3s
45-
win wait 另存为 \ 15
46-
Win Activate 另存为
47-
Control Set Text \ \ Edit1 ${CURDIR}\\..\\demo\\text2.rar
48-
Control Click \ \ Button1
49-
sleep 3s
50-
${confirm} Win Exists 确认另存为
51-
runkeyword if ${confirm}==1 Win Activate 确认另存为
52-
runkeyword if ${confirm}==1 Control Click \ \ Button1
53-
sleep 4s
54-
win wait 下载完毕
55-
Win Activate 下载完毕
56-
Win Close 下载完毕
57-
sleep 2s
1+
*** Settings ***
2+
Test Setup 打开网页
3+
Test Teardown 关闭网页
4+
Library AutoItLibrary
5+
Resource resource.txt
6+
7+
*** Test Cases ***
8+
upload-case
9+
Choose File file ${CURDIR}${/}text.rar
10+
${file} Get Value file
11+
Sleep 3s
12+
13+
upload-autoit
14+
判断平台
15+
Sleep 5
16+
${TITLE} Get Title
17+
${cx} Get Horizontal Position choose
18+
${cy} Get Vertical Position choose
19+
Comment mouse move ${cx} ${cy}
20+
${conx} control Get Pos X \ \ Internet Explorer_Server1
21+
${cony} control Get Pos Y \ \ Internet Explorer_Server1
22+
Comment mouse move ${conx} ${cony}
23+
${ix} win Get Pos X ${TITLE}
24+
${iy} win Get Pos Y ${TITLE}
25+
${mx} Evaluate int(${cx})+int(${ix})+int(${conx})+18
26+
${my} Evaluate int(${cy})+int(${iy})+int(${cony})+38
27+
Sleep 2
28+
Comment mouse move ${mx} ${my}
29+
Mouse Click LEFT ${mx} ${my}
30+
Win Wait 选择要加载的文件 \ 20
31+
Win Activate 选择要加载的文件
32+
Control Set Text \ \ Edit1 ${CURDIR}${/}text.rar
33+
Sleep 2
34+
Control Click \ \ Button1
35+
Sleep 3
36+
${filepath} Get Element Attribute r@innerText
37+
38+
download-case
39+
判断平台
40+
Sleep 3s
41+
Click Link 下载测试
42+
Sleep 3s
43+
Win Wait 文件下载 \ 15
44+
Win Activate 文件下载
45+
Control Click \ \ Button2
46+
Sleep 3s
47+
Win Wait 另存为 \ 15
48+
Win Activate 另存为
49+
Control Set Text \ \ Edit1 ${CURDIR}${/}text2.rar
50+
Control Click \ \ Button1
51+
Sleep 3s
52+
${confirm} Win Exists 确认另存为
53+
Run Keyword If ${confirm}==1 Win Activate 确认另存为
54+
Run Keyword If ${confirm}==1 Control Click \ \ Button1
55+
Sleep 4s
56+
Win Wait 下载完毕
57+
Win Activate 下载完毕
58+
Win Close 下载完毕
59+
Sleep 2s

0 commit comments

Comments
 (0)