Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
龚小红
oto
Commits
bfc1d5f3
Commit
bfc1d5f3
authored
Aug 18, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210818-xmc' into 'master'
新增访客/代理人直播结束页部分用例 See merge request test-group/kejiji!101
parents
431db287
7302f1ab
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
408 additions
and
1 deletion
+408
-1
LiveList.java
src/test/java/com/kjj/bean/whoSawMe/LiveList.java
+9
-0
ResourceList.java
src/test/java/com/kjj/bean/whoSawMe/ResourceList.java
+12
-0
WelfareList.java
src/test/java/com/kjj/bean/whoSawMe/WelfareList.java
+12
-0
Agent.java
src/test/java/com/kjj/cases/live/agent/Agent.java
+4
-0
LiveLater.java
src/test/java/com/kjj/cases/live/agent/LiveLater.java
+24
-0
LiveVisitors.java
src/test/java/com/kjj/cases/live/anchor/LiveVisitors.java
+13
-0
AfterLive.java
src/test/java/com/kjj/cases/live/customer/AfterLive.java
+64
-0
PersonalPage.java
src/test/java/com/kjj/cases/live/customer/PersonalPage.java
+216
-0
Lottery.java
src/test/java/com/kjj/cases/live/lottery/Lottery.java
+4
-0
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+22
-0
IdMakeUtil.java
src/test/java/com/kjj/utils/IdMakeUtil.java
+17
-1
liveTestNG.xml
src/test/liveTestNG.xml
+11
-0
No files found.
src/test/java/com/kjj/bean/whoSawMe/LiveList.java
0 → 100644
View file @
bfc1d5f3
package
com
.
kjj
.
bean
.
whoSawMe
;
import
lombok.Data
;
@Data
public
class
LiveList
{
private
String
liveId
;
private
boolean
hasPlayBack
;
}
src/test/java/com/kjj/bean/whoSawMe/ResourceList.java
0 → 100644
View file @
bfc1d5f3
package
com
.
kjj
.
bean
.
whoSawMe
;
import
lombok.Data
;
@Data
public
class
ResourceList
{
private
String
id
;
private
int
type
;
private
String
recordId
;
private
String
liveId
;
private
String
companyName
;
}
src/test/java/com/kjj/bean/whoSawMe/WelfareList.java
0 → 100644
View file @
bfc1d5f3
package
com
.
kjj
.
bean
.
whoSawMe
;
import
lombok.Data
;
@Data
public
class
WelfareList
{
private
long
receiveDate
;
private
String
id
;
private
int
type
;
private
String
recordId
;
private
String
liveId
;
}
src/test/java/com/kjj/cases/live/agent/Agent.java
View file @
bfc1d5f3
...
@@ -33,6 +33,7 @@ public class Agent implements Authorization {
...
@@ -33,6 +33,7 @@ public class Agent implements Authorization {
public
String
jobNumber
;
public
String
jobNumber
;
public
String
teamName
;
public
String
teamName
;
public
String
sellerName
;
public
String
sellerName
;
public
static
String
encodeAgentId
;
@BeforeClass
@BeforeClass
public
void
setUp
()
{
agentAuth
();
}
public
void
setUp
()
{
agentAuth
();
}
...
@@ -44,6 +45,8 @@ public class Agent implements Authorization {
...
@@ -44,6 +45,8 @@ public class Agent implements Authorization {
System
.
out
.
println
(
response
.
body
().
asString
());
System
.
out
.
println
(
response
.
body
().
asString
());
Object
jobNumber
=
response
.
jsonPath
().
getJsonObject
(
"data.jobNumber"
);
Object
jobNumber
=
response
.
jsonPath
().
getJsonObject
(
"data.jobNumber"
);
Assert
.
assertNotNull
(
jobNumber
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_userInfo1
,
"用户非代理人"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
jobNumber
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_userInfo1
,
"用户非代理人"
,
response
.
body
().
asString
()));
encodeAgentId
=
response
.
jsonPath
().
getString
(
"data.agentId"
);
}
}
...
@@ -448,6 +451,7 @@ public class Agent implements Authorization {
...
@@ -448,6 +451,7 @@ public class Agent implements Authorization {
params
.
put
(
"shortType"
,
2
);
params
.
put
(
"shortType"
,
2
);
Response
response
=
null
;
Response
response
=
null
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
ThreadSleepUtils
.
sleep
(
1000
);
response
=
network
.
postResponse
(
params
,
MOBILE_getShortUrl
);
response
=
network
.
postResponse
(
params
,
MOBILE_getShortUrl
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
...
...
src/test/java/com/kjj/cases/live/agent/LiveLater.java
View file @
bfc1d5f3
...
@@ -327,4 +327,28 @@ public class LiveLater implements Authorization {
...
@@ -327,4 +327,28 @@ public class LiveLater implements Authorization {
System
.
out
.
println
(
clueList
);
System
.
out
.
println
(
clueList
);
Assert
.
assertNotNull
(
clueList
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_clueChanceList
,
"跟进机会获取失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
clueList
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_clueChanceList
,
"跟进机会获取失败"
,
response
.
body
().
asString
()));
}
}
// 直播结束页
@Test
(
description
=
"本场直播线索统计"
,
priority
=
19
)
public
void
本场直播线索统计
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
null
;
int
liveStatus
;
try
{
for
(
int
i
=
0
;
i
<
10
;
i
++){
response
=
network
.
getResponse
(
params
,
BasicConfig
.
AGENT_liveEnd
);
liveStatus
=
response
.
jsonPath
().
getInt
(
"data.liveStatus"
);
System
.
out
.
println
(
liveStatus
);
if
(
liveStatus
==
5
)
break
;
}
System
.
out
.
println
(
response
.
body
().
asString
());
int
lotteryCount
=
response
.
jsonPath
().
getInt
(
"data.lotteryCount"
);
int
submitFormCount
=
response
.
jsonPath
().
getInt
(
"data.submitFormCount"
);
Assert
.
assertTrue
(
lotteryCount
>
0
,
network
.
message
(
params
,
BasicConfig
.
AGENT_liveEnd
,
"直播内中奖用户数错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
submitFormCount
>
0
,
network
.
message
(
params
,
BasicConfig
.
AGENT_liveEnd
,
"直播内提交表单用户数错误"
,
response
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
}
}
}
src/test/java/com/kjj/cases/live/anchor/LiveVisitors.java
View file @
bfc1d5f3
...
@@ -26,6 +26,7 @@ public class LiveVisitors implements Authorization
...
@@ -26,6 +26,7 @@ public class LiveVisitors implements Authorization
public
String
confId_free
;
public
String
confId_free
;
public
String
id
;
public
String
id
;
public
List
<
ResourcePushList
>
PushList
;
public
List
<
ResourcePushList
>
PushList
;
public
static
String
resourceReceiveRecordId
;
/*助播端端权益列表*/
/*助播端端权益列表*/
@Test
(
description
=
"助播端权益列表"
,
priority
=
1
)
@Test
(
description
=
"助播端权益列表"
,
priority
=
1
)
...
@@ -168,6 +169,8 @@ public class LiveVisitors implements Authorization
...
@@ -168,6 +169,8 @@ public class LiveVisitors implements Authorization
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_Link
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_Link
);
boolean
invite
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
invite
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
invite
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Link
,
"领取免费领资料失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
invite
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Link
,
"领取免费领资料失败"
,
response
.
body
().
asString
()));
resourceReceiveRecordId
=
response
.
jsonPath
().
getString
(
"data"
);
}
}
/*访客端链接小程序资料-查询*/
/*访客端链接小程序资料-查询*/
...
@@ -366,4 +369,14 @@ public class LiveVisitors implements Authorization
...
@@ -366,4 +369,14 @@ public class LiveVisitors implements Authorization
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
ANCHOR_agreeStatus
,
"客跟进机会同意状态为false"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
ANCHOR_agreeStatus
,
"客跟进机会同意状态为false"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客端获取直播间实时数据"
,
priority
=
23
)
public
void
访客端获取直播间实时数据
(){
Map
<
String
,
Object
>
clueInfoDataPar
=
new
HashMap
<>();
clueInfoDataPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
clueInfoDataRes
=
network
.
getResponse
(
clueInfoDataPar
,
BasicConfig
.
USER_clueInfoData
);
Assert
.
assertTrue
(
clueInfoDataRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
clueInfoDataPar
,
BasicConfig
.
USER_clueInfoData
,
"接口调用失败"
,
clueInfoDataRes
.
body
().
asString
()));
Object
data
=
clueInfoDataRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
clueInfoDataPar
,
BasicConfig
.
USER_clueInfoData
,
"获取直播间实时数据失败"
,
clueInfoDataRes
.
body
().
asString
()));
}
}
}
src/test/java/com/kjj/cases/live/customer/AfterLive.java
0 → 100644
View file @
bfc1d5f3
package
com
.
kjj
.
cases
.
live
.
customer
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.live.agent.Agent
;
import
com.kjj.cases.live.lottery.Lottery
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
AfterLive
implements
Authorization
{
private
Map
<
String
,
Object
>
params
;
private
String
encodeLiveId
;
@BeforeClass
public
void
SetUp
(){
visitorAuth
();
}
// 获取访客直播结束页样式
@Test
(
description
=
"获取访客直播结束页样式"
,
priority
=
1
)
public
void
获取访客直播结束页样式
(){
encodeLiveId
=
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
());
// 获取直播ID
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
encodeLiveId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_liveEnd
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_liveEnd
,
"接口调用失败"
,
response
.
body
().
asString
()));
System
.
out
.
println
(
response
.
body
().
asString
());
String
welfareName
=
response
.
jsonPath
().
getString
(
"data.welfareName"
);
Assert
.
assertEquals
(
welfareName
,
Lottery
.
welfareName
,
network
.
message
(
params
,
BasicConfig
.
USER_liveEnd
,
"展示奖品名称与实际中奖不符"
,
response
.
body
().
asString
()));
}
// 查询访客预约状态
@Test
(
description
=
"查询访客预约状态"
,
priority
=
2
)
public
void
查询访客预约状态
(){
params
.
clear
();
params
.
put
(
"bizId"
,
encodeLiveId
);
params
.
put
(
"bizType"
,
3
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_Appointment
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_Appointment
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
USER_Appointment
,
"返回预约状态失败"
,
response
.
body
().
asString
()));
}
// 获取代理人二维码信息
@Test
(
description
=
"获取代理人二维码信息"
,
priority
=
3
)
public
void
获取代理人二维码信息
()
{
params
.
clear
();
params
.
put
(
"agentId"
,
Agent
.
encodeAgentId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_getAgentQrCode
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_getAgentQrCode
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
pollingResult
=
response
.
jsonPath
().
getInt
(
"data.pollingResult"
);
while
(
pollingResult
==
2
){
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_getAgentQrCode
);
pollingResult
=
response
.
jsonPath
().
getInt
(
"data.pollingResult"
);
}
Object
syntheticAvatar
=
response
.
jsonPath
().
getJsonObject
(
"data.syntheticAvatar"
);
Assert
.
assertNotNull
(
syntheticAvatar
,
network
.
message
(
params
,
BasicConfig
.
USER_getAgentQrCode
,
"轮训代理人二维码失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/customer/PersonalPage.java
0 → 100644
View file @
bfc1d5f3
package
com
.
kjj
.
cases
.
live
.
customer
;
import
com.kjj.bean.whoSawMe.LiveList
;
import
com.kjj.bean.whoSawMe.ResourceList
;
import
com.kjj.bean.whoSawMe.WelfareList
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.live.anchor.LiveVisitors
;
import
com.kjj.cases.live.lottery.Lottery
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.IdMakeUtil
;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
PersonalPage
implements
Authorization
{
private
Map
<
String
,
Object
>
params
;
private
String
companyName
;
// 最近观看公司名称
private
String
encodeCompanyId
;
// 加密的公司id
private
String
welfareRecordId
;
// 福利领取记录id
private
String
sourceRecordId
;
// 资料领取记录id
@BeforeClass
public
void
setUp
(){
visitorAuth
();
BaseUtils
.
ssoLogin
();
}
// 个人首页
@Test
(
description
=
"访客查看我的福利"
,
priority
=
4
)
public
void
访客查看我的福利
()
{
params
=
new
HashMap
<>();
params
.
put
(
"pageSize"
,
10
);
params
.
put
(
"pageIndex"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_welfareList
);
System
.
out
.
println
(
"访客福利列表:"
+
response
.
body
().
asString
());
List
<
WelfareList
>
welfareLists
=
JsonUtil
.
parseResponseToPageBean
(
response
,
WelfareList
.
class
);
// WelfareList welfareList = welfareLists.get(0);
// Assert.assertEquals(welfareList.getLiveId(), LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_welfareList, "最新福利对应直播id不正确", response.body().asString()));
Map
<
String
,
Object
>
getLotteryDetailPar
=
new
HashMap
<>();
getLotteryDetailPar
.
put
(
"confId"
,
Lottery
.
lotteryConfId
);
Response
getLotteryDetailRes
=
network
.
getResponse
(
getLotteryDetailPar
,
BasicConfig
.
USER_findLottryDetail
);
welfareRecordId
=
getLotteryDetailRes
.
jsonPath
().
getString
(
"data.recordId"
);
Assert
.
assertNotNull
(
welfareRecordId
,
network
.
message
(
getLotteryDetailPar
,
BasicConfig
.
USER_findLottryDetail
,
"获取福利领取记录id获取失败"
,
getLotteryDetailRes
.
body
().
asString
()));
// Assert.assertEquals(welfareList.getRecordId(), welfareRecordId, network.message(params, BasicConfig.USER_welfareList, "最新福利对应领取记录id不正确", response.body().asString()));
boolean
hasRecord
=
false
;
for
(
WelfareList
welfareList
:
welfareLists
){
if
(
welfareList
.
getLiveId
().
equals
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()))){
System
.
out
.
println
(
"本场直播获得福利有:"
+
welfareList
);
if
(
welfareList
.
getRecordId
().
equals
(
welfareRecordId
)){
hasRecord
=
true
;
}
}
}
Assert
.
assertTrue
(
hasRecord
,
network
.
message
(
params
,
BasicConfig
.
USER_welfareList
,
"上场直播有抽奖福利未记录"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查看我的资料"
,
priority
=
5
)
public
void
访客查看我的资料
()
{
System
.
out
.
println
(
"params:"
+
params
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_resourceList
);
System
.
out
.
println
(
"访客资料列表: "
+
response
.
body
().
asString
());
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_resourceList
,
"接口调用失败"
,
response
.
body
().
asString
()));
List
<
ResourceList
>
resourceLists
=
JsonUtil
.
parseResponseToPageBean
(
response
,
ResourceList
.
class
);
ResourceList
resourceList
=
resourceLists
.
get
(
0
);
sourceRecordId
=
resourceList
.
getRecordId
();
Assert
.
assertEquals
(
sourceRecordId
,
LiveVisitors
.
resourceReceiveRecordId
,
network
.
message
(
params
,
BasicConfig
.
USER_resourceList
,
"资料领取记录id不正确"
,
response
.
body
().
asString
()));
String
liveId
=
resourceList
.
getLiveId
();
Assert
.
assertEquals
(
liveId
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
network
.
message
(
params
,
BasicConfig
.
USER_resourceList
,
"资料领取直播id不正确"
,
response
.
body
().
asString
()));
companyName
=
resourceList
.
getCompanyName
();
// 获取领取资料的公司名称
}
@Test
(
description
=
"获取访客最近观看的公司"
,
priority
=
6
)
public
void
获取访客最近观看的公司
()
{
// 管理后台根据公司名称查询公司id
Map
<
String
,
Object
>
searchCompanyPar
=
new
HashMap
<>();
searchCompanyPar
.
put
(
"companyName"
,
companyName
);
Response
searchCompanyRes
=
network
.
getResponse
(
searchCompanyPar
,
BasicConfig
.
MANAGER_searchCompany
);
Assert
.
assertTrue
(
searchCompanyRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
searchCompanyPar
,
BasicConfig
.
MANAGER_searchCompany
,
"接口调用失败"
,
searchCompanyRes
.
body
().
asString
()));
long
companyId
=
searchCompanyRes
.
jsonPath
().
getInt
(
"data[0].id"
);
// 加密公司id
String
companyIdEncode
=
IdMakeUtil
.
managerEncodingId
(
companyId
);
Response
response
=
network
.
getResponse
(
BasicConfig
.
USER_lastCompany
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
USER_lastCompany
,
"接口请求失败"
,
response
.
body
().
asString
()));
encodeCompanyId
=
response
.
jsonPath
().
getString
(
"data.companyId"
);
Assert
.
assertEquals
(
encodeCompanyId
,
companyIdEncode
,
network
.
message
(
BasicConfig
.
USER_lastCompany
,
"访客最近观看公司id错误"
,
response
.
body
().
asString
()));
}
// 访客主页视角
@Test
(
description
=
"访客视角查看公司详情"
,
priority
=
7
)
public
void
访客视角查看公司详情
(){
params
.
clear
();
params
.
put
(
"companyId"
,
encodeCompanyId
);
Response
getCompanyDetailRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_getCompanyInfo
);
Assert
.
assertTrue
(
getCompanyDetailRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_getCompanyInfo
,
"接口请求失败"
,
getCompanyDetailRes
.
body
().
asString
()));
Object
data
=
getCompanyDetailRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
USER_getCompanyInfo
,
"查看公司详情失败"
,
getCompanyDetailRes
.
body
().
asString
()));
}
@Test
(
description
=
"查看公司直播列表"
,
priority
=
8
)
public
void
查看公司直播列表
(){
// 访客端查看公司正在直播列表
params
.
clear
();
params
.
put
(
"companyId"
,
encodeCompanyId
);
params
.
put
(
"searchType"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
liveOnListRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_getLiveList
);
Assert
.
assertTrue
(
liveOnListRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_getLiveList
,
"接口请求失败"
,
liveOnListRes
.
body
().
asString
()));
boolean
hasLiveOn
=
true
;
try
{
List
liveList
=
liveOnListRes
.
jsonPath
().
getList
(
"data.list"
);
if
(
liveList
.
size
()
==
0
){
hasLiveOn
=
false
;
}
Assert
.
assertTrue
(
hasLiveOn
,
network
.
message
(
params
,
BasicConfig
.
USER_getLiveList
,
"公司无未结束直播"
,
liveOnListRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
System
.
out
.
println
(
"接口返回数据为空"
);
e
.
printStackTrace
();
}
}
@Test
(
description
=
"获取公司已结束直播列表"
,
priority
=
9
)
public
void
获取公司已结束直播列表
()
{
params
.
clear
();
params
.
put
(
"companyId"
,
encodeCompanyId
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
liveOffListRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_getLiveOverList
);
Assert
.
assertTrue
(
liveOffListRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_getLiveOverList
,
"接口请求失败"
,
liveOffListRes
.
body
().
asString
()));
try
{
List
<
LiveList
>
liveLists
=
JsonUtil
.
parseResponseToPageBean
(
liveOffListRes
,
LiveList
.
class
);
LiveList
liveList
=
liveLists
.
get
(
0
);
String
liveId
=
liveList
.
getLiveId
();
Assert
.
assertEquals
(
liveId
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
network
.
message
(
params
,
BasicConfig
.
USER_getLiveOverList
,
"最近一场直播id错误"
,
liveOffListRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
@Test
(
description
=
"获取公司首页分享信息"
,
priority
=
10
)
public
void
获取公司首页分享信息
()
{
params
.
clear
();
params
.
put
(
"companyId"
,
encodeCompanyId
);
Response
companyShareInfoRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_companyShareInfo
);
Assert
.
assertTrue
(
companyShareInfoRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_companyShareInfo
,
"接口请求失败"
,
companyShareInfoRes
.
body
().
asString
()));
Object
data
=
companyShareInfoRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
USER_companyShareInfo
,
"生成分享卡片失败"
,
companyShareInfoRes
.
body
().
asString
()));
}
/*
精彩视频
*/
@Test
(
description
=
"精彩视频包含代理人卡片信息"
,
priority
=
11
)
public
void
精彩视频包含代理人卡片信息
()
{
params
.
clear
();
params
.
put
(
"companyId"
,
encodeCompanyId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_videoAgentCard
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_videoAgentCard
,
"接口请求失败"
,
response
.
body
().
asString
()));
try
{
String
agentName
=
response
.
jsonPath
().
getString
(
"data.name"
);
Assert
.
assertEquals
(
agentName
,
"线索员"
,
network
.
message
(
params
,
BasicConfig
.
USER_videoAgentCard
,
"代理人id错误"
,
response
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
}
@Test
(
description
=
"获取公司最近一场直播中直播"
,
priority
=
12
)
public
void
获取公司最近一场直播中直播
()
{
Response
getLivingRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_companyLiving
);
Assert
.
assertTrue
(
getLivingRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_companyLiving
,
"接口请求失败"
,
getLivingRes
.
body
().
asString
()));
Object
data
=
getLivingRes
.
jsonPath
().
getJsonObject
(
"data"
);
if
(
data
==
null
){
System
.
out
.
println
(
"无正在直播中直播"
);}
else
{
System
.
out
.
println
(
data
);}
}
@Test
(
description
=
"查看福利详情"
,
priority
=
13
)
public
void
查看福利详情
()
{
params
.
clear
();
params
.
put
(
"recordId"
,
welfareRecordId
);
Response
welfareDetailRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_welfareDetail
);
Assert
.
assertTrue
(
welfareDetailRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_welfareDetail
,
"接口请求失败"
,
welfareDetailRes
.
body
().
asString
()));
try
{
String
confId
=
welfareDetailRes
.
jsonPath
().
getString
(
"data.confId"
);
String
liveId
=
welfareDetailRes
.
jsonPath
().
getString
(
"data.liveId"
);
Assert
.
assertEquals
(
confId
,
Lottery
.
lotteryConfId
,
network
.
message
(
params
,
BasicConfig
.
USER_welfareDetail
,
"福利配置id错误"
,
welfareDetailRes
.
body
().
asString
()));
Assert
.
assertEquals
(
liveId
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
network
.
message
(
params
,
BasicConfig
.
USER_welfareDetail
,
"福利记录对应直播id错误"
,
welfareDetailRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
}
@Test
(
description
=
"查看资料详情"
,
priority
=
14
)
public
void
查看资料详情
()
{
params
.
clear
();
params
.
put
(
"recordId"
,
sourceRecordId
);
Response
resourceDetailRes
=
network
.
getResponse
(
params
,
BasicConfig
.
USER_sourceDetail
);
Assert
.
assertTrue
(
resourceDetailRes
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
params
,
BasicConfig
.
USER_sourceDetail
,
"接口请求失败"
,
resourceDetailRes
.
body
().
asString
()));
try
{
String
liveId
=
resourceDetailRes
.
jsonPath
().
getString
(
"data.liveId"
);
Assert
.
assertEquals
(
liveId
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
}
}
src/test/java/com/kjj/cases/live/lottery/Lottery.java
View file @
bfc1d5f3
...
@@ -20,6 +20,8 @@ public class Lottery implements Authorization {
...
@@ -20,6 +20,8 @@ public class Lottery implements Authorization {
public
List
<
ConfIdList
>
List_ConfId
;
public
List
<
ConfIdList
>
List_ConfId
;
public
String
shareSign
;
public
String
shareSign
;
public
static
String
welfareName
;
public
static
String
lotteryConfId
;
@Test
(
description
=
"代理人抽奖活动弹层福利列表"
,
priority
=
1
)
@Test
(
description
=
"代理人抽奖活动弹层福利列表"
,
priority
=
1
)
public
void
抽奖活动弹层福利列表
()
{
public
void
抽奖活动弹层福利列表
()
{
...
@@ -103,6 +105,8 @@ public class Lottery implements Authorization {
...
@@ -103,6 +105,8 @@ public class Lottery implements Authorization {
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
infoParam
,
BasicConfig
.
USER_info
,
"获取正在抽奖的福利失败"
,
infoRes
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
infoParam
,
BasicConfig
.
USER_info
,
"获取正在抽奖的福利失败"
,
infoRes
.
body
().
asString
()));
welfareName
=
infoRes
.
jsonPath
().
getString
(
"data.welfareName"
);
lotteryConfId
=
infoRes
.
jsonPath
().
getString
(
"data.confId"
);
}
}
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
bfc1d5f3
...
@@ -330,6 +330,24 @@ public class BasicConfig {
...
@@ -330,6 +330,24 @@ public class BasicConfig {
public
static
final
String
USER_savePoster
=
MOBILE_HOST
+
"/kjy/live/user/share/savePoster"
;
public
static
final
String
USER_savePoster
=
MOBILE_HOST
+
"/kjy/live/user/share/savePoster"
;
public
static
final
String
USER_myCount
=
MOBILE_HOST
+
"/kjy/live/user/lottery/myCount"
;
public
static
final
String
USER_myCount
=
MOBILE_HOST
+
"/kjy/live/user/lottery/myCount"
;
public
static
final
String
USER_wxIdAllList
=
HOST
+
"/kjy/mp/msg/config/live/user/wxIdAllList"
;
public
static
final
String
USER_wxIdAllList
=
HOST
+
"/kjy/mp/msg/config/live/user/wxIdAllList"
;
public
static
final
String
USER_Appointment
=
MOBILE_HOST
+
"/kjy/live/user/appointment/find"
;
public
static
final
String
USER_clueInfoData
=
MOBILE_HOST
+
"/clue/info/data"
;
public
static
final
String
USER_getAgentQrCode
=
MOBILE_HOST
+
"/kjy/live/agent/getAgentQrCode"
;
public
static
final
String
USER_findLottryDetail
=
MOBILE_HOST
+
"/kjy/live/user/lottery/findDetailByConfId"
;
// 直播结束
public
static
final
String
USER_liveEnd
=
MOBILE_HOST
+
"/kjy/live/user/liveEnd"
;
// *************** 个人主页 ***************
public
static
final
String
USER_welfareList
=
MOBILE_HOST
+
"/kjy/live/user/welfare/getList"
;
public
static
final
String
USER_resourceList
=
MOBILE_HOST
+
"/kjy/live/user/resource/getResourceList"
;
public
static
final
String
USER_lastCompany
=
MOBILE_HOST
+
"/kjy/live/user/index/latest"
;
public
static
final
String
USER_getCompanyInfo
=
MOBILE_HOST
+
"/kjy/live/company/getLiveInfo"
;
public
static
final
String
USER_getLiveList
=
MOBILE_HOST
+
"/kjy/live/company/userLiveList"
;
public
static
final
String
USER_companyShareInfo
=
MOBILE_HOST
+
"/kjy/live/company/getHomeShareInfo"
;
public
static
final
String
USER_getLiveOverList
=
MOBILE_HOST
+
"/kjy/live/company/userLiveEndList"
;
public
static
final
String
USER_videoAgentCard
=
MOBILE_HOST
+
"/kjy/live/card/user/video"
;
public
static
final
String
USER_companyLiving
=
MOBILE_HOST
+
"/kjy/live/company/living"
;
public
static
final
String
USER_welfareDetail
=
MOBILE_HOST
+
"/kjy/live/user/welfare/findDetailByRecordId"
;
public
static
final
String
USER_sourceDetail
=
MOBILE_HOST
+
"/kjy/live/user/resource/findDetailByRecordId"
;
// *************** 直播管理端 ***************
// *************** 直播管理端 ***************
public
static
final
String
MANAGER_saveAndUpdate_0
=
MANAGER_HOST
+
"/kjy/manager/live/pre/conf/saveAndUpdate"
;
public
static
final
String
MANAGER_saveAndUpdate_0
=
MANAGER_HOST
+
"/kjy/manager/live/pre/conf/saveAndUpdate"
;
...
@@ -436,6 +454,9 @@ public class BasicConfig {
...
@@ -436,6 +454,9 @@ public class BasicConfig {
public
static
final
String
MOBILE_clueList
=
MOBILE_HOST
+
"/kjy/live/agent/clue/list"
;
public
static
final
String
MOBILE_clueList
=
MOBILE_HOST
+
"/kjy/live/agent/clue/list"
;
public
static
final
String
MOBILE_livingClueStatistic
=
MOBILE_HOST
+
"/kjy/live/agent/clue/livingClueStatistic"
;
public
static
final
String
MOBILE_livingClueStatistic
=
MOBILE_HOST
+
"/kjy/live/agent/clue/livingClueStatistic"
;
//直播结束页
public
static
final
String
AGENT_liveEnd
=
MOBILE_HOST
+
"/kjy/live/agent/liveEnd"
;
//排行榜
//排行榜
public
static
final
String
MOBILE_allRewardList
=
MOBILE_HOST
+
"/kjy/live/reward/allRewardList"
;
public
static
final
String
MOBILE_allRewardList
=
MOBILE_HOST
+
"/kjy/live/reward/allRewardList"
;
public
static
final
String
MOBILE_companyTotalData
=
MOBILE_HOST
+
"/kjy/live/team/companyTotalData"
;
public
static
final
String
MOBILE_companyTotalData
=
MOBILE_HOST
+
"/kjy/live/team/companyTotalData"
;
...
@@ -1031,4 +1052,5 @@ public class BasicConfig {
...
@@ -1031,4 +1052,5 @@ public class BasicConfig {
public
static
final
String
MANAGER_activityName
=
MANAGER_HOST
+
"/kjy/manager/interact/solution/activityName"
;
public
static
final
String
MANAGER_activityName
=
MANAGER_HOST
+
"/kjy/manager/interact/solution/activityName"
;
public
static
final
String
MANAGER_deleteInteract
=
MANAGER_HOST
+
"/kjy/manager/interact/article/delete"
;
public
static
final
String
MANAGER_deleteInteract
=
MANAGER_HOST
+
"/kjy/manager/interact/article/delete"
;
public
static
final
String
MANAGER_deleteActivity
=
MANAGER_HOST
+
"/kjy/manager/interact/solution/delete"
;
public
static
final
String
MANAGER_deleteActivity
=
MANAGER_HOST
+
"/kjy/manager/interact/solution/delete"
;
public
static
final
String
MANAGER_searchCompany
=
MANAGER_HOST
+
"/kjy/manager/live/company/search"
;
}
}
src/test/java/com/kjj/utils/IdMakeUtil.java
View file @
bfc1d5f3
package
com
.
kjj
.
utils
;
package
com
.
kjj
.
utils
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
io.restassured.response.Response
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.testng.Assert
;
import
java.util.Base64
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* Created by dugq on 2019-10-23.
* Created by dugq on 2019-10-23.
...
@@ -16,7 +22,7 @@ import java.util.Base64;
...
@@ -16,7 +22,7 @@ import java.util.Base64;
* base64加密效率: 加密 1 - 2千万 1s以内完成
* base64加密效率: 加密 1 - 2千万 1s以内完成
*/
*/
public
class
IdMakeUtil
{
public
class
IdMakeUtil
implements
Authorization
{
private
static
final
Base64
.
Encoder
encoder
=
Base64
.
getEncoder
();
private
static
final
Base64
.
Encoder
encoder
=
Base64
.
getEncoder
();
private
static
final
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
private
static
final
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
...
@@ -46,5 +52,15 @@ public class IdMakeUtil {
...
@@ -46,5 +52,15 @@ public class IdMakeUtil {
}
}
}
}
public
static
String
managerEncodingId
(
long
id
)
{
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
ids
=
new
HashMap
<>();
ids
.
put
(
"code"
,
id
);
Response
encodeIdRes
=
network
.
getResponse
(
ids
,
BasicConfig
.
MANAGER_ID_ENCODE
);
String
encodeId
=
encodeIdRes
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
encodeId
,
network
.
message
(
ids
,
BasicConfig
.
MANAGER_ID_ENCODE
,
"加密id失败"
,
encodeIdRes
.
body
().
asString
()));
return
encodeId
;
}
}
}
src/test/liveTestNG.xml
View file @
bfc1d5f3
...
@@ -207,5 +207,16 @@
...
@@ -207,5 +207,16 @@
<class
name=
"com.kjj.cases.live.agent.Customer"
/>
<class
name=
"com.kjj.cases.live.agent.Customer"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"访客端直播结束页"
>
<classes>
<class
name=
"com.kjj.cases.live.customer.AfterLive"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"访客端个人主页"
>
<classes>
<class
name=
"com.kjj.cases.live.customer.PersonalPage"
/>
</classes>
</test>
</suite>
</suite>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment