Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
selenium-meeting
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
mry
selenium-meeting
Commits
368a9aec
提交
368a9aec
authored
12月 13, 2021
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(CRUD测试):完成了基本的增删改查功能的测试
上级
9fb80da0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
92 行增加
和
31 行删除
+92
-31
ConferenceActive.java
...om/tykj/selenium/conferenceRoomTest/ConferenceActive.java
+91
-31
testng.xml
testng.xml
+1
-0
没有找到文件。
src/main/java/com/tykj/selenium/conferenceRoomTest/ConferenceActive.java
浏览文件 @
368a9aec
...
@@ -57,13 +57,13 @@ public class ConferenceActive {
...
@@ -57,13 +57,13 @@ public class ConferenceActive {
}
}
//精准查询人数/会议室规模
//精准查询人数/会议室规模
private
void
extracted
(
String
s
,
String
s
cale
)
{
private
void
extracted
(
String
s
,
String
s
s
)
{
String
test
;
String
test
;
WebElement
tbody
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"
));
WebElement
tbody
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"
));
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
for
(
WebElement
row
:
rows
)
{
for
(
WebElement
row
:
rows
)
{
String
text
=
row
.
findElement
(
By
.
cssSelector
(
s
)).
getText
();
String
text
=
row
.
findElement
(
By
.
cssSelector
(
s
)).
getText
();
if
(
s
cale
.
equals
(
text
))
{
if
(
s
s
.
equals
(
text
))
{
test
=
"查询成功"
;
test
=
"查询成功"
;
}
else
{
}
else
{
test
=
"查询失败"
;
test
=
"查询失败"
;
...
@@ -72,6 +72,7 @@ public class ConferenceActive {
...
@@ -72,6 +72,7 @@ public class ConferenceActive {
}
}
}
}
//登录
public
void
login
(
String
username
,
String
password
)
{
public
void
login
(
String
username
,
String
password
)
{
//todo 这个系统暂时没有登录的功能
//todo 这个系统暂时没有登录的功能
}
}
...
@@ -86,6 +87,32 @@ public class ConferenceActive {
...
@@ -86,6 +87,32 @@ public class ConferenceActive {
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[1]/div/ul/li/ul/li[1]/div/span[2]"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[1]/div/ul/li/ul/li[1]/div/span[2]"
)).
click
();
}
}
@Test
(
description
=
"验证重置按钮"
)
public
void
resetTest
()
{
try
{
String
test
;
meetManager
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
clear
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
sendKeys
(
"100"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[2]/span"
)).
click
();
WebElement
tbody
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"
));
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
int
size
=
rows
.
size
();
if
(
size
==
6
)
{
test
=
"重置成功"
;
}
else
{
test
=
"重置失败"
;
}
Assert
.
assertEquals
(
"重置成功"
,
test
);
}
catch
(
Exception
|
Error
e
)
{
file
();
Assert
.
fail
(
e
.
getMessage
());
}
}
//按会议室名称模糊查询
//按会议室名称模糊查询
@Test
(
description
=
"会议室模糊查询"
)
@Test
(
description
=
"会议室模糊查询"
)
public
void
findMeetName
()
{
public
void
findMeetName
()
{
...
@@ -101,14 +128,14 @@ public class ConferenceActive {
...
@@ -101,14 +128,14 @@ public class ConferenceActive {
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
for
(
WebElement
row
:
rows
)
{
for
(
WebElement
row
:
rows
)
{
String
text
=
row
.
findElement
(
By
.
cssSelector
(
".el-table_2_column_9.el-table__cell"
)).
getText
();
String
text
=
row
.
findElement
(
By
.
cssSelector
(
".el-table_2_column_9.el-table__cell"
)).
getText
();
if
(
text
.
indexOf
(
"G"
)
!=(-
1
))
{
if
(
text
.
indexOf
(
"G"
)
!=
(-
1
))
{
test
=
"查询成功"
;
test
=
"查询成功"
;
}
else
{
}
else
{
test
=
"查询失败"
;
test
=
"查询失败"
;
}
}
Assert
.
assertEquals
(
"查询成功"
,
test
);
Assert
.
assertEquals
(
"查询成功"
,
test
);
}
}
}
catch
(
Exception
|
Error
e
)
{
}
catch
(
Exception
|
Error
e
)
{
file
();
file
();
Assert
.
fail
(
e
.
getMessage
());
Assert
.
fail
(
e
.
getMessage
());
}
}
...
@@ -116,7 +143,7 @@ public class ConferenceActive {
...
@@ -116,7 +143,7 @@ public class ConferenceActive {
//按容纳人数精准查询
//按容纳人数精准查询
@Test
(
description
=
"容纳人数精准查询"
)
@Test
(
description
=
"容纳人数精准查询"
)
public
void
findNumberMeet
(){
public
void
findNumberMeet
()
{
try
{
try
{
String
test
;
String
test
;
meetManager
();
meetManager
();
...
@@ -126,7 +153,7 @@ public class ConferenceActive {
...
@@ -126,7 +153,7 @@ public class ConferenceActive {
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
sendKeys
(
"130"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
sendKeys
(
"130"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
)).
click
();
extracted
(
".el-table_2_column_12.el-table__cell"
,
"130"
);
extracted
(
".el-table_2_column_12.el-table__cell"
,
"130"
);
}
catch
(
Exception
|
Error
e
)
{
}
catch
(
Exception
|
Error
e
)
{
file
();
file
();
Assert
.
fail
(
e
.
getMessage
());
Assert
.
fail
(
e
.
getMessage
());
}
}
...
@@ -134,23 +161,65 @@ public class ConferenceActive {
...
@@ -134,23 +161,65 @@ public class ConferenceActive {
@Test
(
description
=
"按照会议室规模查询"
)
@Test
(
description
=
"按照会议室规模查询"
)
public
void
findScaleMeet
()
{
public
void
findScaleMeet
()
{
meetManager
();
try
{
WebElement
find
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
));
meetManager
();
WebElement
find
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
));
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[1]/span"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[1]/span"
)).
click
();
find
.
click
();
find
.
click
();
extracted
(
".el-table_2_column_11.el-table__cell"
,
"小型会议室"
);
extracted
(
".el-table_2_column_11.el-table__cell"
,
"小型会议室"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[2]/span"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[2]/span"
)).
click
();
find
.
click
();
find
.
click
();
extracted
(
".el-table_2_column_11.el-table__cell"
,
"中型会议室"
);
extracted
(
".el-table_2_column_11.el-table__cell"
,
"中型会议室"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[3]/span"
)).
click
();
find
.
click
();
extracted
(
".el-table_2_column_11.el-table__cell"
,
"大型会议室"
);
}
catch
(
Exception
|
Error
e
)
{
file
();
Assert
.
fail
(
e
.
getMessage
());
}
}
@Test
(
description
=
"所有条件查询会议室"
)
public
void
findMeet
()
{
try
{
String
test
;
meetManager
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input"
)).
clear
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input"
)).
sendKeys
(
"G"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
clear
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input"
)).
sendKeys
(
"130"
);
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[2]/span"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"
)).
click
();
WebElement
tbody
=
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"
));
List
<
WebElement
>
rows
=
tbody
.
findElements
(
By
.
className
(
"el-table__row"
));
for
(
WebElement
row
:
rows
)
{
String
name
=
row
.
findElement
(
By
.
cssSelector
(
".el-table_2_column_9.el-table__cell"
)).
getText
();
System
.
out
.
println
(
name
);
String
number
=
row
.
findElement
(
By
.
cssSelector
(
".el-table_2_column_12.el-table__cell"
)).
getText
();
System
.
out
.
println
(
number
);
String
scale
=
row
.
findElement
(
By
.
cssSelector
(
".el-table_2_column_11.el-table__cell"
)).
getText
();
System
.
out
.
println
(
scale
);
if
(
name
.
indexOf
(
"G"
)
!=
(-
1
)
&&
"130"
.
equals
(
number
)
&&
"中型会议室"
.
equals
(
scale
))
{
test
=
"查询成功"
;
}
else
{
test
=
"查询失败"
;
}
Assert
.
assertEquals
(
"查询成功"
,
test
);
}
}
catch
(
Exception
|
Error
e
)
{
file
();
Assert
.
fail
(
e
.
getMessage
());
}
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input"
)).
click
();
webDriver
.
findElement
(
By
.
xpath
(
"/html/body/div[2]/div[1]/div[1]/ul/li[3]/span"
)).
click
();
find
.
click
();
extracted
(
".el-table_2_column_11.el-table__cell"
,
"大型会议室"
);
}
}
//新增会议室
//新增会议室
...
@@ -205,15 +274,6 @@ public class ConferenceActive {
...
@@ -205,15 +274,6 @@ public class ConferenceActive {
}
}
}
}
// @Test
// public void insertNoNumber(){
// meetManager();
// //点击新增
// webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click();
// extracted("去q1","去q2","-");
//
// }
//修改会议室
//修改会议室
@Test
(
description
=
"会议室信息修改成功测试"
)
@Test
(
description
=
"会议室信息修改成功测试"
)
public
void
updateMeet
()
{
public
void
updateMeet
()
{
...
...
testng.xml
浏览文件 @
368a9aec
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<classes>
<classes>
<class
name=
"com.tykj.selenium.conferenceRoomTest.ConferenceActive"
/>
<class
name=
"com.tykj.selenium.conferenceRoomTest.ConferenceActive"
/>
<methods>
<methods>
<include
name=
"resetTest"
/>
<include
name=
"findMeetName"
/>
<include
name=
"findMeetName"
/>
<include
name=
"findNumberMeet"
/>
<include
name=
"findNumberMeet"
/>
<include
name=
"findScaleMeet"
/>
<include
name=
"findScaleMeet"
/>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论