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
4bcd04ae
Commit
4bcd04ae
authored
Apr 29, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
奖品签收
parent
fbdde173
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
294 additions
and
697 deletions
+294
-697
RewardDetail.java
src/test/java/com/kjj/bean/answer/RewardDetail.java
+0
-35
AdminAuthorization.java
...est/java/com/kjj/cases/live/admin/AdminAuthorization.java
+12
-4
Agent.java
src/test/java/com/kjj/cases/live/agent/Agent.java
+106
-6
LiveAgent.java
src/test/java/com/kjj/cases/live/agent/LiveAgent.java
+0
-6
Lottery.java
src/test/java/com/kjj/cases/live/lottery/Lottery.java
+0
-74
LiveMaterial.java
src/test/java/com/kjj/cases/live/manager/LiveMaterial.java
+1
-0
Add.java
src/test/java/com/kjj/cases/live/manager/QuesReward/Add.java
+1
-1
Limited.java
src/test/java/com/kjj/cases/live/red/Limited.java
+100
-42
QuestionAwards.java
src/test/java/com/kjj/cases/live/red/QuestionAwards.java
+0
-478
Unlimited.java
src/test/java/com/kjj/cases/live/red/Unlimited.java
+72
-51
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+2
-0
No files found.
src/test/java/com/kjj/bean/answer/RewardDetail.java
deleted
100644 → 0
View file @
fbdde173
package
com
.
kjj
.
bean
.
answer
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
RewardDetail
{
private
String
quesConfId
;
private
String
quesType
;
private
RedDetail
redDetail
;
@Data
public
static
class
RedDetail
{
private
String
redConfId
;
private
int
showAmount
;
}
private
String
welfareDetail
;
private
int
quesRewardSeconds
;
private
String
quesRewardEndTime
;
private
int
rewardStatus
;
private
String
quesId
;
private
String
questionDetail
;
private
List
<
QuestionLists
>
questionList
;
@Data
public
static
class
QuestionLists
{
private
String
id
;
private
int
optionType
;
private
String
optionDetail
;
}
}
src/test/java/com/kjj/cases/live/admin/AdminAuthorization.java
View file @
4bcd04ae
...
...
@@ -14,11 +14,10 @@ public interface AdminAuthorization {
// 创建用户 并传到network里
network
.
agentCookies
.
put
(
"authKey"
,
ADMIN_KEY
);
System
.
out
.
println
(
"用户AUTH_KEY:"
+
ADMIN_KEY
);
}
/**
* 代理人授权
* 代理人
(yl)
授权
*/
default
void
agentAuth
(){
// 创建用户 并传到network里
...
...
@@ -26,6 +25,15 @@ public interface AdminAuthorization {
System
.
out
.
println
(
"用户AUTH_KEY:"
+
AUTH_KEY
);
}
/**
* 代理人(小疙瘩人寿)授权,ID:815
*/
default
void
agentAuth1
(){
// 创建用户 并传到network里
network
.
agentCookies
.
put
(
"authKey"
,
agentAuth
);
System
.
out
.
println
(
"用户AUTH_KEY:"
+
agentAuth
);
}
/**
* 访客A(志勇)授权,代理人指定中奖用户
*/
...
...
@@ -82,14 +90,14 @@ public interface AdminAuthorization {
}
/**
* 访客
H
(喜洋洋)授权
* 访客
I
(喜洋洋)授权
*/
default
void
visitorAuth8
()
{
network
.
agentCookies
.
put
(
"authKey"
,
VISITORKEY8
);
System
.
out
.
println
(
"用户AUTH_KEY:"
+
VISITORKEY8
);
}
/**
* 访客
I
(嘿保险)授权,ID:907
* 访客
H
(嘿保险)授权,ID:907
*/
default
void
visitorAuth9
()
{
network
.
agentCookies
.
put
(
"authKey"
,
VISITORKEY9
);
...
...
src/test/java/com/kjj/cases/live/agent/Agent.java
View file @
4bcd04ae
...
...
@@ -3,9 +3,9 @@ package com.kjj.cases.live.agent;
import
com.kjj.cases.live.admin.AdminAuthorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.ThreadSleepUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
...
...
@@ -13,13 +13,13 @@ import java.util.Map;
public
class
Agent
implements
AdminAuthorization
{
@BeforeClass
public
void
setUp
()
{
agentAuth
();
}
public
String
shareSign
;
public
String
shareSign1
;
public
String
token
;
@Test
(
description
=
"分享直播间"
,
priority
=
1
)
public
void
分享直播间
()
{
@Test
(
description
=
"代理人A分享直播间"
,
priority
=
1
)
public
void
代理人
A
分享直播间
()
{
agentAuth
();
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
1
);
...
...
@@ -30,4 +30,104 @@ public class Agent implements AdminAuthorization {
LiveConstants
.
setValue
(
LiveConstants
.
StringKeyEnum
.
shareSign
.
getKey
(),
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"代理人B分享直播间"
,
priority
=
2
)
public
void
代理人
B
分享直播间
()
{
agentAuth1
();
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
1
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
);
HashMap
data
=
signRes
.
jsonPath
().
getJsonObject
(
"data"
);
this
.
shareSign1
=
(
String
)
data
.
get
(
"shareSign"
);
System
.
out
.
println
(
shareSign1
);
Assert
.
assertNotNull
(
shareSign1
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客H关系绑定"
,
priority
=
3
)
public
void
访客
H
关系绑定
()
{
visitorAuth9
();
Map
<
String
,
Object
>
bindingParam
=
new
HashMap
<>();
bindingParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
bindingParam
.
put
(
"shareSign"
,
shareSign1
);
Response
bindingRes
=
network
.
postResponse
(
bindingParam
,
BasicConfig
.
MOBILE_binding
);
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"中奖任务邀请H绑定结果和绑定凭证"
,
priority
=
4
)
public
void
获取访客
H
绑定结果和绑定凭证
()
{
visitorAuth9
();
Map
<
String
,
Object
>
tokenParam
=
new
HashMap
<>();
tokenParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
tokenRes
=
network
.
getResponse
(
tokenParam
,
BasicConfig
.
MOBILE_Token
);
HashMap
data
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
this
.
token
=
(
String
)
data
.
get
(
"token"
);
System
.
out
.
println
(
token
);
Object
token
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
token
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"中奖任务邀请H根据绑定凭证发放抽奖码"
,
priority
=
5
)
public
void
中奖任务邀请
H
根据绑定凭证发放抽奖码
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
500
);
Map
<
String
,
Object
>
codeParam
=
new
HashMap
<>();
codeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
codeParam
.
put
(
"token"
,
token
);
Response
codeRes
=
network
.
getResponse
(
codeParam
,
BasicConfig
.
MOBILE_Code
);
boolean
success
=
codeRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
codeParam
,
BasicConfig
.
MOBILE_Code
,
"发放抽奖码失败"
,
codeRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客I关系绑定"
,
priority
=
6
)
public
void
访客
I
关系绑定
()
{
visitorAuth8
();
Map
<
String
,
Object
>
bindingParam
=
new
HashMap
<>();
bindingParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
bindingParam
.
put
(
"shareSign"
,
shareSign1
);
Response
bindingRes
=
network
.
postResponse
(
bindingParam
,
BasicConfig
.
MOBILE_binding
);
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"中奖任务邀请I绑定结果和绑定凭证"
,
priority
=
7
)
public
void
获取访客
I
绑定结果和绑定凭证
()
{
visitorAuth8
();
Map
<
String
,
Object
>
tokenParam
=
new
HashMap
<>();
tokenParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
tokenRes
=
network
.
getResponse
(
tokenParam
,
BasicConfig
.
MOBILE_Token
);
HashMap
data
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
this
.
token
=
(
String
)
data
.
get
(
"token"
);
System
.
out
.
println
(
token
);
Object
token
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
token
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"邀请I根据绑定凭证发放抽奖码"
,
priority
=
8
)
public
void
邀请
I
根据绑定凭证发放抽奖码
()
{
visitorAuth8
();
ThreadSleepUtils
.
sleep
(
500
);
Map
<
String
,
Object
>
codeParam
=
new
HashMap
<>();
codeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
codeParam
.
put
(
"token"
,
token
);
Response
codeRes
=
network
.
getResponse
(
codeParam
,
BasicConfig
.
MOBILE_Code
);
boolean
success
=
codeRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
codeParam
,
BasicConfig
.
MOBILE_Code
,
"发放抽奖码失败"
,
codeRes
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/agent/LiveAgent.java
View file @
4bcd04ae
...
...
@@ -580,12 +580,6 @@ public class LiveAgent implements AdminAuthorization {
}
}
\ No newline at end of file
src/test/java/com/kjj/cases/live/lottery/Lottery.java
View file @
4bcd04ae
...
...
@@ -1039,81 +1039,7 @@ public class Lottery implements AdminAuthorization {
throw
e
;
}
}
@Test
(
description
=
"代理人分享直播间"
,
priority
=
74
)
public
void
代理人分享直播间
()
{
agentAuth
();
ThreadSleepUtils
.
sleep
(
1000
);
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
2
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
);
HashMap
data
=
signRes
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
this
.
shareSign
=
(
String
)
data
.
get
(
"shareSign"
);
System
.
out
.
println
(
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客H关系绑定"
,
priority
=
75
)
public
void
访客
H
关系绑定
()
{
visitorAuth9
();
Map
<
String
,
Object
>
bindingParam
=
new
HashMap
<>();
bindingParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
bindingParam
.
put
(
"shareSign"
,
shareSign
);
Response
bindingRes
=
network
.
postResponse
(
bindingParam
,
BasicConfig
.
MOBILE_binding
);
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"中奖任务邀请H绑定结果和绑定凭证"
,
priority
=
76
)
public
void
获取访客
H
绑定结果和绑定凭证
()
{
visitorAuth9
();
Map
<
String
,
Object
>
tokenParam
=
new
HashMap
<>();
tokenParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
tokenRes
=
network
.
getResponse
(
tokenParam
,
BasicConfig
.
MOBILE_Token
);
HashMap
data
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
this
.
token
=
(
String
)
data
.
get
(
"token"
);
System
.
out
.
println
(
token
);
Object
token
=
tokenRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
token
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"中奖任务邀请H根据绑定凭证发放抽奖码"
,
priority
=
77
)
public
void
中奖任务邀请
H
根据绑定凭证发放抽奖码
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
500
);
Map
<
String
,
Object
>
codeParam
=
new
HashMap
<>();
codeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
codeParam
.
put
(
"token"
,
token
);
Response
codeRes
=
network
.
getResponse
(
codeParam
,
BasicConfig
.
MOBILE_Code
);
boolean
success
=
codeRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
codeParam
,
BasicConfig
.
MOBILE_Code
,
"发放抽奖码失败"
,
codeRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客H到场"
,
priority
=
78
)
public
void
访客
H
到场
()
{
visitorAuth9
();
Map
<
String
,
Object
>
connectSuccessParam
=
new
HashMap
<>();
connectSuccessParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
connectSuccessoRes
=
network
.
getResponse
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
);
boolean
success
=
connectSuccessoRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
,
"访客到场请求失败"
,
connectSuccessoRes
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/manager/LiveMaterial.java
View file @
4bcd04ae
...
...
@@ -220,6 +220,7 @@ public class LiveMaterial implements AdminAuthorization {
saveOrUpdateLinkParam
.
put
(
"companyId"
,
101
);
saveOrUpdateLinkParam
.
put
(
"resourceTitle"
,
"图文资料2"
);
saveOrUpdateLinkParam
.
put
(
"resourceButtonTitle"
,
"我要报名"
);
saveOrUpdateLinkParam
.
put
(
"outLinkType"
,
2
);
saveOrUpdateLinkParam
.
put
(
"outLink"
,
"http://www.baidu.com"
);
saveOrUpdateLinkParam
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615026240244.jpeg"
);
...
...
src/test/java/com/kjj/cases/live/manager/QuesReward/Add.java
View file @
4bcd04ae
...
...
@@ -236,7 +236,7 @@ public class Add implements AdminAuthorization {
add1Param
.
put
(
"questionConf"
,
bean1
);
add1Param
.
put
(
"redConf"
,
null
);
AddWelfareConf
welfareConf1
=
new
AddWelfareConf
();
welfareConf1
.
setWelfareId
(
19
0
);
welfareConf1
.
setWelfareId
(
19
1
);
welfareConf1
.
setNum
(
100
);
add1Param
.
put
(
"welfareConf"
,
welfareConf1
);
Response
add1Res
=
network
.
postResponse
(
add1Param
,
BasicConfig
.
MANAGER_add
);
...
...
src/test/java/com/kjj/cases/live/red/Limited.java
View file @
4bcd04ae
...
...
@@ -8,6 +8,7 @@ import com.kjj.config.BasicConfig;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.ThreadSleepUtils
;
import
freemarker.template.utility.DateUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
...
...
@@ -130,8 +131,11 @@ public class Limited implements AdminAuthorization {
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
String
liveId
=
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
());
params
.
put
(
"liveId"
,
liveId
);
String
quesConfId
=
this
.
quesConfId
.
get
(
0
).
getQuesConfId
();
params
.
put
(
"confId"
,
quesConfId
);
System
.
out
.
println
(
"liveId:"
+
liveId
+
",confId:"
+
quesConfId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
...
...
@@ -155,8 +159,8 @@ public class Limited implements AdminAuthorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"访客查询答题红包配置"
,
priority
=
7
)
public
void
访客查询答题红包配置
()
@Test
(
description
=
"访客
A
查询答题红包配置"
,
priority
=
7
)
public
void
访客
A
查询答题红包配置
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -173,8 +177,8 @@ public class Limited implements AdminAuthorization {
}
/*领取答题红包-错误选项*/
@Test
(
description
=
"领取答题红包-错误选项"
,
priority
=
8
)
public
void
领取答题红包
_
错误选项
()
@Test
(
description
=
"
访客
领取答题红包-错误选项"
,
priority
=
8
)
public
void
访客
领取答题红包
_
错误选项
()
{
visitorAuth2
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -208,7 +212,9 @@ public class Limited implements AdminAuthorization {
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
"访客A领取答题红包_答题正确 timestamp:"
+
new
Date
().
getTime
());
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -218,10 +224,11 @@ public class Limited implements AdminAuthorization {
public
void
查询用户
A
领取答题红包结果
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
3
000
);
ThreadSleepUtils
.
sleep
(
5
000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
rightanswer
.
getId
());
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
System
.
out
.
println
(
" 查询用户A领取答题红包结果 timestamp:"
+
new
Date
().
getTime
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
...
...
@@ -357,16 +364,21 @@ public class Limited implements AdminAuthorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"访客A查询
有奖答题
配置详情"
,
priority
=
18
)
public
void
访客
A
查询
有奖答题
配置详情
()
@Test
(
description
=
"访客A查询
第二轮红包
配置详情"
,
priority
=
18
)
public
void
访客
A
查询
第二轮红包
配置详情
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
1
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
System
.
out
.
println
(
list
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-访客A选择正确选项*/
...
...
@@ -402,9 +414,9 @@ public class Limited implements AdminAuthorization {
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
Object
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assert
True
(
amount
==
0
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
Assert
.
assert
Null
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -509,9 +521,9 @@ public class Limited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openR
esult"
);
System
.
out
.
println
(
openR
esult
);
Assert
.
assertTrue
(
openR
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.r
esult"
);
System
.
out
.
println
(
r
esult
);
Assert
.
assertTrue
(
r
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
...
...
@@ -520,8 +532,51 @@ public class Limited implements AdminAuthorization {
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"非指定团队用户领取有奖答题福利-答题正确"
,
priority
=
27
)
public
void
非指定团队用户领取有奖答题福利
()
{
visitorAuth8
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"查询非指定团队用户领取有奖答题结果"
,
priority
=
28
)
public
void
查询非指定团队用户领取有奖答题结果
()
{
visitorAuth8
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
3
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-黑名单用户选择正确选项*/
@Test
(
description
=
"黑名单用户领取有奖答题福利-答题正确"
,
priority
=
2
7
)
@Test
(
description
=
"黑名单用户领取有奖答题福利-答题正确"
,
priority
=
2
9
)
public
void
黑名单用户领取有奖答题福利
()
{
visitorAuth7
();
...
...
@@ -541,7 +596,7 @@ public class Limited implements AdminAuthorization {
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"查询黑名单用户领取有奖答题福利结果"
,
priority
=
28
)
@Test
(
description
=
"查询黑名单用户领取有奖答题福利结果"
,
priority
=
30
)
public
void
查询黑名单用户领取有奖答题福利结果
()
{
visitorAuth7
();
...
...
@@ -550,9 +605,9 @@ public class Limited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openR
esult"
);
System
.
out
.
println
(
openR
esult
);
Assert
.
assertTrue
(
openR
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.r
esult"
);
System
.
out
.
println
(
r
esult
);
Assert
.
assertTrue
(
r
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
...
...
@@ -563,7 +618,7 @@ public class Limited implements AdminAuthorization {
/*代理人领取有奖答题福利类型*/
@Test
(
description
=
"代理人领取有奖答题福利"
,
priority
=
29
)
@Test
(
description
=
"代理人领取有奖答题福利"
,
priority
=
31
)
public
void
代理人领取有奖答题福利
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -582,7 +637,7 @@ public class Limited implements AdminAuthorization {
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"查询代理人领取有奖答题福利结果"
,
priority
=
3
0
)
@Test
(
description
=
"查询代理人领取有奖答题福利结果"
,
priority
=
3
2
)
public
void
查询代理人领取有奖答题福利结果
()
{
agentAuth
();
...
...
@@ -602,7 +657,7 @@ public class Limited implements AdminAuthorization {
}
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第二轮答题福利"
,
priority
=
3
1
)
@Test
(
description
=
"上架第二轮答题福利"
,
priority
=
3
3
)
public
void
上架第二轮答题福利
()
{
adminAuth
();
...
...
@@ -618,7 +673,7 @@ public class Limited implements AdminAuthorization {
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第二轮答题福利"
,
priority
=
3
2
)
@Test
(
description
=
"发放第二轮答题福利"
,
priority
=
3
4
)
public
void
发放第二轮答题福利
()
{
adminAuth
();
...
...
@@ -632,22 +687,26 @@ public class Limited implements AdminAuthorization {
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第二轮答题福利"
,
priority
=
3
3
)
@Test
(
description
=
"访客查询第二轮答题福利"
,
priority
=
3
5
)
public
void
访客查询第二轮答题福利
()
{
visitorAuth
9
();
ThreadSleepUtils
.
sleep
(
5
00
);
visitorAuth
3
();
ThreadSleepUtils
.
sleep
(
30
00
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"访客A第二轮领取有奖答题福利-答题正确"
,
priority
=
3
4
)
@Test
(
description
=
"访客A第二轮领取有奖答题福利-答题正确"
,
priority
=
3
6
)
public
void
访客
A
第二轮领取有奖答题福利
()
{
visitorAuth3
();
...
...
@@ -658,27 +717,26 @@ public class Limited implements AdminAuthorization {
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertFalse
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"查询访客A第二轮有奖答题福利类型结果"
,
priority
=
3
5
)
@Test
(
description
=
"查询访客A第二轮有奖答题福利类型结果"
,
priority
=
3
7
)
public
void
查询访客
A
第二轮有奖答题福利类型结果
()
{
visitorAuth3
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
3
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
Result
=
response
.
jsonPath
().
getBoolean
(
"data.R
esult"
);
System
.
out
.
println
(
R
esult
);
Assert
.
assert
False
(
R
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.r
esult"
);
System
.
out
.
println
(
r
esult
);
Assert
.
assert
True
(
r
esult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
...
...
src/test/java/com/kjj/cases/live/red/QuestionAwards.java
deleted
100644 → 0
View file @
fbdde173
package
com
.
kjj
.
cases
.
live
.
red
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.answer.*
;
import
com.kjj.cases.live.admin.AdminAuthorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.ThreadSleepUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
QuestionAwards
implements
AdminAuthorization
{
public
String
confId_ques
;
public
String
confId_reward
;
public
String
wronganswer
;
public
String
rightanswer
;
private
QuseRewardList
.
QuesList
getRed
(
List
<
QuseRewardList
.
QuesList
>
lists
){
for
(
QuseRewardList
.
QuesList
ques
:
lists
)
{
if
(
ques
.
getRewardStatus
()==
0
){
return
ques
;
}
}
return
null
;
}
private
QuseRewardList
.
QuesList
getaward
(
List
<
QuseRewardList
.
QuesList
>
lists
){
for
(
QuseRewardList
.
QuesList
quesaward
:
lists
)
{
if
(
quesaward
.
getRewardStatus
()==
0
&&
quesaward
.
getQuesType
()==
2
){
return
quesaward
;
}
}
return
null
;
}
private
RewardDetail
.
QuestionLists
getwrongques
(
List
<
RewardDetail
.
QuestionLists
>
list
){
for
(
RewardDetail
.
QuestionLists
ques1
:
list
)
{
if
(
ques1
.
getOptionType
()==
2
){
return
ques1
;
}
}
return
null
;
}
private
RewardDetail
.
QuestionLists
getrightques
(
List
<
RewardDetail
.
QuestionLists
>
list
){
for
(
RewardDetail
.
QuestionLists
ques1
:
list
)
{
if
(
ques1
.
getOptionType
()==
1
){
return
ques1
;
}
}
return
null
;
}
/*主播端添加有奖答题-现金红包*/
@Test
(
description
=
"主播端添加有奖答题现金红包"
,
priority
=
1
)
public
void
主播端添加有奖答题现金红包
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"quesType"
,
"1"
);
AddAnswer
RedDetail
=
new
AddAnswer
();
RedDetail
.
setTotalAmount
(
100
);
RedDetail
.
setShowAmount
(
100
);
RedDetail
.
setTotalNum
(
3
);
params
.
put
(
"redDetail"
,
RedDetail
);
QuesConf
quesConf
=
new
QuesConf
();
quesConf
.
setQuestionDetail
(
"问题"
);
List
<
Option
>
optionlist
=
new
ArrayList
<>();
quesConf
.
setOptionList
(
optionlist
);
Option
option1
=
new
Option
();
option1
.
setOptionDetail
(
"正确"
);
option1
.
setOptionType
(
1
);
option1
.
setAnswerLen
(
2
);
optionlist
.
add
(
option1
);
Option
option2
=
new
Option
();
option2
.
setOptionDetail
(
"错误"
);
option2
.
setOptionType
(
2
);
option2
.
setAnswerLen
(
2
);
optionlist
.
add
(
option2
);
params
.
put
(
"questionConf"
,
quesConf
);
params
.
put
(
"confId"
,
""
);
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
System
.
out
.
println
(
"params = "
+
JSON
.
toJSONString
(
params
));
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesSaveOrUpdate
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesSaveOrUpdate
,
"主播端添加有奖答题现金红包失败"
,
response
.
body
().
asString
()));
}
/*主播端添加有奖答题-奖品奖励*/
@Test
(
description
=
"主播端添加有奖答题奖品奖励"
,
priority
=
2
)
public
void
主播端添加有奖答题奖品奖励
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"quesType"
,
"2"
);
WelfareDetail
welfareDetail
=
new
WelfareDetail
();
welfareDetail
.
setRewardId
(
"Kj22MTU0Mw"
);
welfareDetail
.
setRewardNum
(
"1"
);
params
.
put
(
"welfareDetail"
,
welfareDetail
);
QuesConf
quesConf
=
new
QuesConf
();
quesConf
.
setQuestionDetail
(
"盲盒锦鲤奖品"
);
List
<
Option
>
optionlist
=
new
ArrayList
<>();
quesConf
.
setOptionList
(
optionlist
);
Option
option1
=
new
Option
();
option1
.
setOptionDetail
(
"正确"
);
option1
.
setOptionType
(
1
);
option1
.
setAnswerLen
(
2
);
optionlist
.
add
(
option1
);
Option
option2
=
new
Option
();
option2
.
setOptionDetail
(
"错误1"
);
option2
.
setOptionType
(
2
);
option2
.
setAnswerLen
(
3
);
optionlist
.
add
(
option2
);
params
.
put
(
"questionConf"
,
quesConf
);
params
.
put
(
"confId"
,
""
);
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
System
.
out
.
println
(
"params = "
+
JSON
.
toJSONString
(
params
));
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesSaveOrUpdate
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesSaveOrUpdate
,
"主播端添加有奖答题现金红包失败"
,
response
.
body
().
asString
()));
}
/*查询主播端有奖答题列表*/
@Test
(
description
=
"查询主播端有奖答题列表"
,
priority
=
3
)
public
void
主播端有奖答题列表
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
50
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardList
);
QuseRewardList
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
QuseRewardList
.
class
);
QuseRewardList
.
QuesList
notPublishQues
=
getRed
(
Beans
.
getList
());
confId_ques
=
notPublishQues
.
getQuesConfId
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardList
,
"查询主播端有奖答题列表失败"
,
response
.
body
().
asString
()));
}
/*查询主播端未上架的有奖答题配置详情*/
@Test
(
description
=
"查询主播端有奖答题配置详情"
,
priority
=
4
)
public
void
查询主播端有奖答题配置详情
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
confId_ques
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
);
RewardGetDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardGetDetail
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题*/
@Test
(
description
=
"上架有奖答题查询"
,
priority
=
5
)
public
void
上架有奖答题
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
confId_ques
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
,
"上架答题红包失败"
,
response
.
body
().
asString
()));
}
/*主播端发放答题红包*/
@Test
(
description
=
"主播端发放普通红包"
,
priority
=
6
)
public
void
主播端发放普通红包
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
confId_ques
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
//访客端
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"查询访客端有奖答题配置详情"
,
priority
=
7
)
public
void
查询访客端有奖答题配置详情
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
RewardDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardDetail
.
class
);
RewardDetail
.
QuestionLists
WrongAnswer
=
getwrongques
(
Beans
.
getQuestionList
());
wronganswer
=
WrongAnswer
.
getId
();
RewardDetail
.
QuestionLists
RightAnswer
=
getrightques
(
Beans
.
getQuestionList
());
rightanswer
=
RightAnswer
.
getId
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-错误选项*/
@Test
(
description
=
"领取答题红包-错误选项"
,
priority
=
8
)
public
void
领取答题红包
()
{
visitorAuth2
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
params
.
put
(
"optionId"
,
wronganswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-访客A选择正确选项*/
@Test
(
description
=
"访客A领取答题红包-答题正确"
,
priority
=
9
)
public
void
访客
A
领取答题红包成功
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-访客B选择正确选项*/
@Test
(
description
=
"领取答题红包-访客B答题正确"
,
priority
=
10
)
public
void
访客
B
领取答题红包成功
()
{
visitorAuth7
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-黑名单用户选择正确选项*/
@Test
(
description
=
"领取答题红包-黑名单用户答题正确"
,
priority
=
11
)
public
void
黑名单用户领取答题红包成功
()
{
visitorAuth7
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*代理人领取答题红包*/
@Test
(
description
=
"代理人领取答题红包"
,
priority
=
12
)
public
void
代理人领取答题红包
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"领取答题红包结果"
,
priority
=
13
)
public
void
领取答题红包结果
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_ques
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
ParticipateInfo
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
ParticipateInfo
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
}
//*****************有奖答题福利类型*****************//
//*****************有奖答题福利类型*****************//
//*****************有奖答题福利类型*****************//
/*查询主播端有奖答题列表*/
@Test
(
description
=
"再次查询主播端有奖答题列表"
,
priority
=
14
)
public
void
再次查询主播端有奖答题列表
()
{
ThreadSleepUtils
.
sleep
(
70000
);
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
50
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardList
);
QuseRewardList
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
QuseRewardList
.
class
);
QuseRewardList
.
QuesList
notPublishQues
=
getaward
(
Beans
.
getList
());
confId_ques
=
notPublishQues
.
getQuesConfId
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardList
,
"查询主播端有奖答题列表失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架答题为福利"
,
priority
=
15
)
public
void
上架答题为福利
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
confId_ques
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
,
"上架答题红包失败"
,
response
.
body
().
asString
()));
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"主播端发放福利类型的有奖答题"
,
priority
=
16
)
public
void
主播端发放福利类型的有奖答题
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
confId_ques
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
data
));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"查询访客端有奖答题-福利类型的配置详情"
,
priority
=
17
)
public
void
查询访客端有奖答题福利类型配置详情
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
RewardDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardDetail
.
class
);
confId_reward
=
Beans
.
getQuesConfId
();
RewardDetail
.
QuestionLists
WrongAnswer
=
getwrongques
(
Beans
.
getQuestionList
());
wronganswer
=
WrongAnswer
.
getId
();
RewardDetail
.
QuestionLists
RightAnswer
=
getrightques
(
Beans
.
getQuestionList
());
rightanswer
=
RightAnswer
.
getId
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-错误选项*/
@Test
(
description
=
"领取有奖答题福利类型-错误选项"
,
priority
=
18
)
public
void
领取有奖答题福利类型选择错误
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
params
.
put
(
"optionId"
,
wronganswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"领取有奖答题福利类型-答题正确"
,
priority
=
19
)
public
void
领取有奖答题福利类型
()
{
visitorAuth2
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"领取有奖答题福利类型-访客A答题正确"
,
priority
=
20
)
public
void
访客
A
领取有奖答题福利类型
()
{
visitorAuth3
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-黑名单用户选择正确选项*/
@Test
(
description
=
"领取有奖答题福利类型-访客B答题正确"
,
priority
=
21
)
public
void
访客
B
领取有奖答题福利类型
()
{
visitorAuth7
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*代理人领取有奖答题福利类型*/
@Test
(
description
=
"代理人领取有奖答题福利类型"
,
priority
=
22
)
public
void
代理人领取有奖答题福利类型
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
params
.
put
(
"optionId"
,
rightanswer
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
AnswerQues
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
AnswerQues
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"领取有奖答题福利类型结果"
,
priority
=
23
)
public
void
领取有奖答题福利类型结果
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
confId_reward
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
ParticipateInfo
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
ParticipateInfo
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
));
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/red/Unlimited.java
View file @
4bcd04ae
...
...
@@ -13,16 +13,14 @@ import io.restassured.response.Response;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
public
class
Unlimited
implements
AdminAuthorization
{
private
List
<
QuseRewardList
.
QuesList
>
quesConfId
;
private
List
<
QuestionList
.
question
>
wronganswer
;
private
List
<
QuestionList
.
question
>
rightanswer
;
private
QuestionList
.
question
wronganswer
;
private
QuestionList
.
question
rightanswer
;
/*查询主播端有奖答题列表*/
@Test
(
description
=
"查询主播端有奖答题列表"
,
priority
=
1
)
...
...
@@ -41,8 +39,8 @@ public class Unlimited implements AdminAuthorization {
}
/*查询主播端未上架的有奖答题配置详情*/
@Test
(
description
=
"查询第三轮答题现金红包"
,
priority
=
2
)
public
void
查询第三轮答题现金红包
()
@Test
(
description
=
"
主播端
查询第三轮答题现金红包"
,
priority
=
2
)
public
void
主播端
查询第三轮答题现金红包
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -86,8 +84,8 @@ public class Unlimited implements AdminAuthorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"访客
查询
答题红包配置"
,
priority
=
5
)
public
void
访客
查询
答题红包配置
()
@Test
(
description
=
"访客
A查询第三轮
答题红包配置"
,
priority
=
5
)
public
void
访客
A
查询第三轮
答题红包配置
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -95,28 +93,32 @@ public class Unlimited implements AdminAuthorization {
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
this
.
wronganswer
=
list
;
this
.
rightanswer
=
list
;
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
System
.
out
.
println
(
list
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-错误选项*/
@Test
(
description
=
"领取答题红包-错误选项"
,
priority
=
6
)
public
void
领取答题红包
_
错误选项
()
@Test
(
description
=
"
访客
领取答题红包-错误选项"
,
priority
=
6
)
public
void
访客
领取答题红包
_
错误选项
()
{
visitorAuth2
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
wronganswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
2
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
wronganswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -128,15 +130,16 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"
领取答题红包
失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"
答题
失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -171,15 +174,17 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
...
...
@@ -212,15 +217,17 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
()
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
...
...
@@ -239,7 +246,7 @@ public class Unlimited implements AdminAuthorization {
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"
答题失败
"
,
response
.
body
().
asString
()));
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"
领取异常
"
,
response
.
body
().
asString
()));
...
...
@@ -247,8 +254,8 @@ public class Unlimited implements AdminAuthorization {
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第
一
轮答题福利"
,
priority
=
13
)
public
void
上架第
一
轮答题福利
()
@Test
(
description
=
"上架第
三
轮答题福利"
,
priority
=
13
)
public
void
上架第
三
轮答题福利
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
100000
);
...
...
@@ -262,8 +269,8 @@ public class Unlimited implements AdminAuthorization {
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第
一
轮答题福利"
,
priority
=
14
)
public
void
发放第
一
轮答题福利
()
@Test
(
description
=
"发放第
三
轮答题福利"
,
priority
=
14
)
public
void
发放第
三
轮答题福利
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
3000
);
...
...
@@ -276,16 +283,21 @@ public class Unlimited implements AdminAuthorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第
一
轮答题福利"
,
priority
=
15
)
public
void
访客查询第
一
轮答题福利
()
@Test
(
description
=
"访客查询第
三
轮答题福利"
,
priority
=
15
)
public
void
访客查询第
三
轮答题福利
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
System
.
out
.
println
(
list
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询第三轮福利失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -297,30 +309,39 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
5
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
wronganswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
2
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
wronganswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"领取有奖答题福利类型-访客A答题正确"
,
priority
=
1
5
)
@Test
(
description
=
"领取有奖答题福利类型-访客A答题正确"
,
priority
=
1
7
)
public
void
访客
A
领取有奖答题福利类型
()
{
visitorAuth3
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
5
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"
领取答题红包
失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"
答题
失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询访客A领取有奖答题福利结果"
,
priority
=
1
6
)
@Test
(
description
=
"查询访客A领取有奖答题福利结果"
,
priority
=
1
8
)
public
void
查询访客
A
领取有奖答题福利结果
()
{
visitorAuth3
();
...
...
@@ -329,13 +350,13 @@ public class Unlimited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openR
esult"
);
System
.
out
.
println
(
openR
esult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果
失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.r
esult"
);
System
.
out
.
println
(
r
esult
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题
失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"
查询答题红包结果失败
"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
welfareStatus
==
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"
领取异常
"
,
response
.
body
().
asString
()));
}
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
4bcd04ae
...
...
@@ -12,6 +12,8 @@ public class BasicConfig {
public
static
String
ADMIN_KEY
=
"LEH7epeHVDJWzhZ6DiexTHnsy28ubjrAPGJYU3yPhwb8v3QC3S7b3s2kv18XVBS3CMLT1cmiLu1BdrrC3xbx1EHzWNbcL"
;
// 直播代理人 (艳玲)
public
static
String
AUTH_KEY
=
"LEH7epeHVDJWzhZ6DiexTHnfZY2NrKorVWS9R85xTeuUZzyc2boHSYWYU56ttSUbcAb9ngEb3LJBB3qZ7a9eCkEoPV5yu"
;
// 直播代理人 (小疙瘩人寿)
public
static
String
agentAuth
=
"LEH7epeHVDJWzhZ6DiexTHnsaPwVcYuMTJoYBwNRVTjB7uoajfndh6tsKxDJtDvxrpqcVjD3AUENBnMSmqdPjtjyZrTG8"
;
//直播访客 (志勇)
public
static
String
VISITORKEY
=
"zFNkBc7JtvLPL6ifAfXbcgYH7WruadyTs58VQNVezBEHURWFkb861yA3TQfkngLojnBnDenawiYNbNADYRdv1vFcDi"
;
//直播访客 (茶仔)
...
...
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