Skip to content

Commit 20ce466

Browse files
author
Devecor
committed
Add file test case
1 parent 754dba8 commit 20ce466

6 files changed

Lines changed: 78 additions & 0 deletions

File tree

test/code_manager/course_action.robot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ${Select Course Input} xpath: //div[@class="cb-card"]/descendant:
1515

1616
${Can Not Add Course Alert} xpath: //div[@role="alert"]/descendant::p[contains(text(), "未登陆用户不能创建课程")]
1717

18+
${Default Course Name} glibc
19+
20+
1821
*** Keywords ***
1922
Click Add Course Button
2023
Click Button ${Add Course Button}
@@ -97,3 +100,9 @@ Delete Course
97100
Click Element ${Select Course Input}
98101
Page Should Not Contain Element xpath: //div[@class="el-scrollbar"]/descendant::li[span="${Course Name}"]
99102
Click Element ${Select Course Input}
103+
104+
Add Default Course
105+
Add Course ${Default Course Name}
106+
107+
Delete Default Course
108+
Delete Course ${Default Course Name}

test/code_manager/login_action.robot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ${Login Dialog} xpath: //div[@class="el-dialog__wrapper" and
1515
${User Name Input} xpath: //input[@placeholder="用户名/邮箱/手机号"]
1616
${User Password Input} xpath: //div/input[@type="password"]
1717

18+
${Default User Name} devecor
19+
${Default User Password} t
20+
1821

1922
*** Keywords ***
2023
Open Login Dialog
@@ -76,3 +79,6 @@ Logout
7679
Wait Until Element Is Not Visible ${Logout Button} 0.5s
7780
${Is Login} = Is Login
7881
Run Keyword If ${Is Login} Fail "Logout failed"
82+
83+
Login With Default User
84+
Login ${Default User Name} ${Default User Password}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
*** Settings ***
2+
Library SeleniumLibrary
3+
Library String
4+
5+
*** Variables ***
6+
${Add File Button} xpath: //div/button[@title="新增文件"]
7+
${Confirm To Add File Button} xpath: //div[@class="el-message-box"]/descendant::button[contains(./span/text(), "确定")]
8+
${Add File Input} xpath: //div[@class="el-message-box"]/descendant::div[@class="el-input"]/input
9+
10+
*** Keywords ***
11+
Click Add File Button
12+
Mouse Down ${Add File Button}
13+
Mouse Up ${Add File Button}
14+
15+
Input File Name
16+
[Arguments] ${File Name}
17+
Input Text ${Add File Input} ${File Name}
18+
19+
Confirm To Add File
20+
Click Button ${Confirm To Add File Button}
21+
Wait Until Element Is Not Visible ${Confirm To Add File Button} 1s
22+
23+
File Should Be Added
24+
[Arguments] ${File Name}
25+
@{Name} = Get Regexp Matches ${File Name} ^[^.]+
26+
Wait Until Page Contains Element
27+
... xpath: //tbody/descendant::div[contains(span, "${Name}[0]")]
28+
... 0.5s
29+
... ${File Name} should be added, but it not be
30+
31+
Add File
32+
[Arguments] ${File Name}
33+
Mouse Down ${Add File Button}
34+
Mouse Up ${Add File Button}
35+
Input Text ${Add File Input} ${File Name}
36+
Click Button ${Confirm To Add File Button}
37+
Wait Until Element Is Not Visible ${Confirm To Add File Button} 1s
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*** Settings ***
2+
Resource user_file_action.robot
3+
Resource login_action.robot
4+
Resource course_action.robot
5+
6+
*** Variables ***
7+
${File Name} tcp.h
8+
9+
*** Test Cases ***
10+
Add File Before Login
11+
[Tags] normal
12+
Click Add File Button
13+
Input File Name ${File Name}
14+
Confirm To Add File
15+
File Should Be Added ${File Name}
16+
17+
Add File After Login
18+
[Tags] normal main
19+
[Setup] Run Keywords
20+
... Login With Default User AND
21+
... Add Default Course
22+
Click Add File Button
23+
Input File Name ${File Name}
24+
Confirm To Add File
25+
File Should Be Added ${File Name}
26+
[Teardown] Delete Default Course

0 commit comments

Comments
 (0)