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
7770ed57
Commit
7770ed57
authored
Aug 31, 2021
by
郭姣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代理人参与有奖答题,有奖答题优化接口配置修改
parent
bd342f46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
0 deletions
+169
-0
Answer.java
src/test/java/com/kjj/cases/live/answer/Answer.java
+169
-0
No files found.
src/test/java/com/kjj/cases/live/answer/Answer.java
View file @
7770ed57
...
...
@@ -1130,5 +1130,174 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题-红包*/
@Test
(
description
=
"上架第四轮有奖答题红包"
,
priority
=
60
)
public
void
上架第四轮有奖答题红包
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
100000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
6
).
getQuesConfId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
,
"上架答题红包失败"
,
response
.
body
().
asString
()));
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第四轮有奖答题红包"
,
priority
=
61
)
public
void
发放第四轮有奖答题红包
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
6
).
getQuesConfId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人查询第四轮有奖答题红包"
,
priority
=
62
)
public
void
代理人查询第四轮有奖答题红包
()
{
agentAuth
();
ThreadSleepUtils
.
sleep
(
3000
);
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
);
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
()));
//校验该题目是否允许邀请,0为不支持
System
.
out
.
println
(
response
);
boolean
supportInvite
=
response
.
jsonPath
().
getBoolean
(
"data.supportInvite"
);
System
.
out
.
println
(
supportInvite
);
Assert
.
assertFalse
(
supportInvite
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"不支持邀请配置有误"
,
response
.
body
().
asString
()));
}
/*代理人领取答题红包*/
@Test
(
description
=
"代理人领取第四轮答题现金红包"
,
priority
=
63
)
public
void
代理人领取第四轮答题现金红包
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
6
).
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
=
64
)
public
void
代理人领取第四轮答题红包结果
()
{
agentAuth
();
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
(
6
).
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
()));
Object
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNotNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第四轮答题福利"
,
priority
=
65
)
public
void
上架第四轮答题福利
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
100000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
7
).
getQuesConfId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
,
"上架答题红包失败"
,
response
.
body
().
asString
()));
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第四轮答题福利"
,
priority
=
66
)
public
void
发放第四轮答题福利
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
7
).
getQuesConfId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第四轮答题福利"
,
priority
=
67
)
public
void
代理人查询第四轮答题福利
()
{
adminAuth
();
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
);
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
()));
//校验该题目是否允许邀请,0为不支持
System
.
out
.
println
(
response
);
boolean
supportInvite
=
response
.
jsonPath
().
getBoolean
(
"data.supportInvite"
);
System
.
out
.
println
(
supportInvite
);
Assert
.
assertFalse
(
supportInvite
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"不支持邀请配置有误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人第四轮领取答题福利-答题正确"
,
priority
=
68
)
public
void
代理人第四轮领取答题福利
(){
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
7
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
System
.
out
.
println
(
response
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询代理人第四轮有奖答题福利类型结果"
,
priority
=
69
)
public
void
查询代理人第四轮有奖答题福利类型结果
(){
//验证管理后台配置实物奖品允许代理人参与并获奖
agentAuth
();
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
(
7
).
getQuesConfId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
System
.
out
.
println
(
response
);
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
==
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
}
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