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
ed82dbf8
Commit
ed82dbf8
authored
Sep 24, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加砸金蛋玩法的接口用例
parent
a3a8dcdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1068 additions
and
0 deletions
+1068
-0
GoldenEgg.java
src/test/java/com/kjj/cases/live/treasure/GoldenEgg.java
+1068
-0
No files found.
src/test/java/com/kjj/cases/live/treasure/GoldenEgg.java
0 → 100644
View file @
ed82dbf8
package
com
.
kjj
.
cases
.
live
.
treasure
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.kjj.bean.manager.TreasureAward
;
import
com.kjj.bean.manager.TreasureCode
;
import
com.kjj.bean.manager.TreasureRed
;
import
com.kjj.bean.manager.WelfareList
;
import
com.kjj.cases.admin.Authorization
;
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.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
public
class
GoldenEgg
implements
Authorization
{
@BeforeClass
public
void
setUp
()
{
ssoLogin
();
}
public
String
ConfId
;
public
String
shareSign
;
public
JSONObject
treasureConf
;
public
String
interactConfId
;
/**
* 添加代理人绑定关系
*/
@Test
(
description
=
"代理人绑定"
,
priority
=
1
)
public
void
代理人绑定
()
{
agentAuth
();
Map
<
String
,
Object
>
bindingParam
=
new
HashMap
<>();
bindingParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
bindingRes
=
network
.
postResponse
(
bindingParam
,
BasicConfig
.
MOBILE_binding
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
/**
* 裂变宝箱配置
*/
public
List
<
WelfareList
>
id
;
@Test
(
description
=
"代理人A分享直播间"
,
priority
=
2
)
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
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_sign
);
String
data
=
signRes
.
jsonPath
().
getString
(
"data"
);
this
.
shareSign
=
data
;
System
.
out
.
println
(
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_sign
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"代理人A与访客A邀请关系绑定"
,
priority
=
3
)
public
void
代理人
A
与访客
A
邀请关系绑定
()
{
visitorAuth
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客A获取绑定结果和绑定凭证"
,
priority
=
4
)
public
void
访客
A
获取绑定结果和绑定凭证
()
{
visitorAuth
();
sleep
(
2000
);
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
);
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
System
.
out
.
println
(
type
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"查询配置奖品列表"
,
priority
=
5
)
public
void
查询配置奖品列表
()
{
Map
<
String
,
Object
>
getListParam
=
new
HashMap
<>();
getListParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
getListParam
.
put
(
"companyId"
,
101
);
getListParam
.
put
(
"pageIndex"
,
1
);
getListParam
.
put
(
"pageSize"
,
20
);
getListParam
.
put
(
"welfareType"
,
6
);
Response
response
=
network
.
getResponse
(
getListParam
,
BasicConfig
.
MANAGER_getList4Admin
);
System
.
out
.
println
(
response
.
body
().
asString
());
List
<
WelfareList
>
list
=
JsonUtil
.
parseResponseToPageBean
(
response
,
WelfareList
.
class
);
this
.
id
=
list
;
Assert
.
assertNotNull
(
list
,
network
.
message
(
getListParam
,
BasicConfig
.
MANAGER_getList4Admin
,
"查询奖品列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"创建砸金蛋配置"
,
priority
=
6
)
public
void
创建砸金蛋配置
()
{
Map
<
String
,
Object
>
saveParam
=
new
HashMap
<>();
saveParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
saveParam
.
put
(
"openCondition"
,
1
);
saveParam
.
put
(
"treasureConfId"
,
null
);
TreasureAward
treasureAward
=
new
TreasureAward
();
treasureAward
.
setWelfareId
(
id
.
get
(
0
).
getId
());
treasureAward
.
setAwardName
(
"砸金蛋实物奖品"
);
treasureAward
.
setTreasureProbability
(
10000
);
treasureAward
.
setTreasureType
(
3
);
treasureAward
.
setRuleType
(
1
);
treasureAward
.
setTotalNum
(
1
);
treasureAward
.
setWinLimitCount
(
1
);
saveParam
.
put
(
"treasureAward"
,
treasureAward
);
TreasureRed
treasureRed
=
new
TreasureRed
();
treasureRed
.
setRedTotalAmount
(
100
);
treasureRed
.
setFixedNum
(
100
);
treasureRed
.
setRuleType
(
1
);
treasureRed
.
setTotalNum
(
1
);
treasureRed
.
setTreasureProbability
(
0
);
treasureRed
.
setTreasureType
(
2
);
saveParam
.
put
(
"treasureRed"
,
treasureRed
);
TreasureCode
treasureCode
=
new
TreasureCode
();
treasureCode
.
setFixedNum
(
5
);
treasureCode
.
setRuleType
(
1
);
treasureCode
.
setTreasureProbability
(
0
);
treasureCode
.
setTreasureType
(
1
);
saveParam
.
put
(
"treasureCode"
,
treasureCode
);
saveParam
.
put
(
"treasurePeriod"
,
1
);
Response
response
=
network
.
postResponse
(
saveParam
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
saveParam
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
,
"新增砸金蛋配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询砸金蛋配置详情"
,
priority
=
7
)
public
void
查询砸金蛋配置详情
()
{
Map
<
String
,
Object
>
confDetailParam
=
new
HashMap
<>();
confDetailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
Integer
openCondition
=
response
.
jsonPath
().
getInt
(
"data.openCondition"
);
Assert
.
assertTrue
(
openCondition
>
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"查询砸金蛋配置详情失败"
,
response
.
body
().
asString
()));
treasureConf
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data"
)));
}
@Test
(
description
=
"开启砸金蛋配置"
,
priority
=
8
)
public
void
开启砸金蛋配置
()
{
Map
<
String
,
Object
>
switchStatusParam
=
new
HashMap
<>();
switchStatusParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
switchStatusParam
.
put
(
"confStatus"
,
1
);
Response
response
=
network
.
postResponse
(
switchStatusParam
,
BasicConfig
.
MANAGER_goldenEgg_switchStatus
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
switchStatusParam
,
BasicConfig
.
MANAGER_goldenEgg_switchStatus
,
"开启砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询砸金蛋配置状态"
,
priority
=
9
)
public
void
查询宝箱配置状态
()
{
Map
<
String
,
Object
>
statusParam
=
new
HashMap
<>();
statusParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
statusParam
,
BasicConfig
.
MANAGER_getConfDetail
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
goldenEggTreasureConfStatus
=
response
.
jsonPath
().
getBoolean
(
"data.goldenEggTreasureConfStatus"
);
boolean
goldenEggTreasureConfBuildStatus
=
response
.
jsonPath
().
getBoolean
(
"data.goldenEggTreasureConfBuildStatus"
);
Assert
.
assertTrue
(
goldenEggTreasureConfStatus
,
network
.
message
(
statusParam
,
BasicConfig
.
MANAGER_getConfDetail
,
"砸金蛋未配置"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
goldenEggTreasureConfBuildStatus
,
network
.
message
(
statusParam
,
BasicConfig
.
MANAGER_getConfDetail
,
"砸金蛋未开启"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询砸金蛋配置数据"
,
priority
=
10
)
public
void
查询砸金蛋配置数据
()
{
visitorAuth
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
getLiveAwardListParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
getLiveAwardListParam
,
BasicConfig
.
MOBILE_allLottery
);
System
.
out
.
println
(
response
.
body
().
asString
());
try
{
int
on
=
response
.
jsonPath
().
getInt
(
"data.on"
);
String
confStr
=
Integer
.
toBinaryString
(
on
);
char
confStatus
=
confStr
.
charAt
(
confStr
.
length
()-
4
);
Assert
.
assertEquals
(
confStatus
,
'1'
,
network
.
message
(
getLiveAwardListParam
,
BasicConfig
.
MOBILE_allLottery
,
"砸金蛋开关未开启"
,
response
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
getLiveAwardListParam
,
BasicConfig
.
MANAGER_skGoodsSwitchDetail
,
"砸金蛋开关未开启"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"查询直播前砸金蛋配置详情"
,
priority
=
11
)
public
void
查询直播前砸金蛋配置详情
()
{
sleep
(
2000
);
Map
<
String
,
Object
>
detailParam
=
new
HashMap
<>();
detailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
detailParam
,
BasicConfig
.
MOBILE_goldenEgg_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
HashMap
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
this
.
ConfId
=(
String
)
data
.
get
(
"treasureConfId"
);
Assert
.
assertNotNull
(
ConfId
,
network
.
message
(
detailParam
,
BasicConfig
.
MOBILE_goldenEgg_detail
,
"查询砸金蛋配置详情失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取跑马灯数据"
,
priority
=
12
)
public
void
获取跑马灯数据
()
{
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_list
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
size
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_list
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人A与访客A邀请关系绑定"
,
priority
=
13
)
public
void
代理人
A
与访客
G
邀请关系绑定
()
{
visitorAuth7
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客A获取绑定结果和绑定凭证"
,
priority
=
14
)
public
void
访客
G
获取绑定结果和绑定凭证
()
{
visitorAuth7
();
sleep
(
2000
);
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
);
System
.
out
.
println
(
tokenRes
.
body
().
asString
());
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"黑名单用户仅不可砸中实物"
,
priority
=
15
)
public
void
黑名单用户仅不可砸中实物
()
{
visitorAuth7
();
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"第1个访客A砸金蛋砸出实物"
,
priority
=
16
)
public
void
第
1
个访客
A
砸金蛋砸出实物
()
{
visitorAuth
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
3
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
interactConfId
=
response
.
jsonPath
().
getString
(
"data.award.interactConfId"
);
}
@Test
(
description
=
"代理人A与访客B邀请关系绑定"
,
priority
=
17
)
public
void
代理人
A
与访客
B
邀请关系绑定
()
{
visitorAuth7
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客B获取绑定结果和绑定凭证"
,
priority
=
18
)
public
void
访客
B
获取绑定结果和绑定凭证
()
{
visitorAuth7
();
sleep
(
2000
);
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
);
System
.
out
.
println
(
tokenRes
.
body
().
asString
());
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第2个访客B砸金蛋砸出抽奖码"
,
priority
=
19
)
public
void
第
2
个访客
B
砸金蛋砸出抽奖码
()
{
visitorAuth2
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"增加实物奖品数量"
,
priority
=
20
)
public
void
增加实物奖品数量
()
{
JSONObject
treasureAward
=
treasureConf
.
getJSONObject
(
"treasureAward"
);
treasureAward
.
put
(
"totalNum"
,
2
);
//-1无限制,1限制1次
Response
response
=
network
.
postResponse
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
);
System
.
out
.
println
(
treasureConf
.
toJSONString
());
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
,
"增加实物奖品数量失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"实物奖品增加后数量变化"
,
priority
=
21
)
public
void
实物奖品增加后数量变化
()
{
Map
<
String
,
Object
>
confDetailParam
=
new
HashMap
<>();
confDetailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
totalNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.totalNum"
);
int
receivingNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receivingNum"
);
int
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receiveNum"
);
Assert
.
assertEquals
(
totalNum
,
2
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品总数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivingNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品进行中数量错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品已领取错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人A与访客C邀请关系绑定"
,
priority
=
22
)
public
void
代理人
A
与访客
C
邀请关系绑定
()
{
visitorAuth3
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客C获取绑定结果和绑定凭证"
,
priority
=
23
)
public
void
访客
C
获取绑定结果和绑定凭证
()
{
visitorAuth3
();
sleep
(
2000
);
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
);
System
.
out
.
println
(
tokenRes
.
body
().
asString
());
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第3个访客C砸金蛋砸出实物"
,
priority
=
24
)
public
void
第
3
个访客
C
砸金蛋砸出实物
()
{
visitorAuth3
();
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
3
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"减少实物奖品数量"
,
priority
=
25
)
public
void
减少实物奖品数量
()
{
JSONObject
treasureAward
=
treasureConf
.
getJSONObject
(
"treasureAward"
);
treasureAward
.
put
(
"totalNum"
,
1
);
//-1无限制,1限制1次
Response
response
=
network
.
postResponse
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
,
"减少实物奖品数量成功"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"第3个访客C砸金蛋超时"
,
priority
=
26
)
public
void
第
3
个访客
C
砸金蛋超时
()
{
visitorAuth3
();
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"treasureConfId"
,
treasureConf
.
get
(
"treasureConfId"
));
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
,
"砸金蛋超时设置失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
param
.
put
(
"treasureConfId"
,
ConfId
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
response
=
network
.
postResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_reset
);
System
.
out
.
println
(
response
.
body
().
asString
());
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_reset
,
"砸金蛋超时重置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"第3个访客C超时后重新砸蛋砸出实物奖品"
,
priority
=
27
)
public
void
第
3
个访客
C
超时后重新砸蛋砸出实物奖品
()
{
visitorAuth3
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
3
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"第3个访客C再次砸金蛋超时"
,
priority
=
28
)
public
void
第
3
个访客
C
再次砸金蛋超时
()
{
visitorAuth3
();
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"treasureConfId"
,
treasureConf
.
get
(
"treasureConfId"
));
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
,
"砸金蛋超时设置失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_reset
);
System
.
out
.
println
(
response
.
body
().
asString
());
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
treasureConf
,
BasicConfig
.
MOBILE_goldenEgg_reset
,
"砸金蛋超时重置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人A与访客D邀请关系绑定"
,
priority
=
29
)
public
void
代理人
A
与访客
D
邀请关系绑定
()
{
visitorAuth4
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客D获取绑定结果和绑定凭证"
,
priority
=
30
)
public
void
访客
D
获取绑定结果和绑定凭证
()
{
visitorAuth4
();
ThreadSleepUtils
.
sleep
(
2000
);
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
);
System
.
out
.
println
(
tokenRes
.
body
().
asString
());
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第3个用户再次超时后访客D砸蛋砸出实物奖品"
,
priority
=
31
)
public
void
第
3
个用户再次超时后访客
D
砸蛋砸出实物奖品
()
{
visitorAuth4
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
3
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人A与访客E邀请关系绑定"
,
priority
=
32
)
public
void
代理人
A
与访客
E
邀请关系绑定
()
{
visitorAuth5
();
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
);
System
.
out
.
println
(
bindingRes
.
body
().
asString
());
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_binding
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客E获取绑定结果和绑定凭证"
,
priority
=
33
)
public
void
访客
E
获取绑定结果和绑定凭证
()
{
visitorAuth5
();
ThreadSleepUtils
.
sleep
(
2000
);
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
);
System
.
out
.
println
(
tokenRes
.
body
().
asString
());
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第5个用户E砸蛋砸出抽奖码"
,
priority
=
34
)
public
void
第
5
个用户
E
砸蛋砸出抽奖码
()
{
visitorAuth5
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客A获取分享加密串"
,
priority
=
35
)
public
void
访客
A
获取分享加密串
()
{
visitorAuth
();
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
15
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_sign
);
System
.
out
.
println
(
signRes
.
body
().
asString
());
String
data
=
signRes
.
jsonPath
().
getString
(
"data"
);
this
.
shareSign
=
data
;
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_sign
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"访客E与访客A邀请关系绑定"
,
priority
=
36
)
public
void
访客
F
与访客
A
邀请关系绑定
()
{
visitorAuth6
();
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
=
"访客E获取绑定结果和绑定凭证"
,
priority
=
37
)
public
void
访客
F
获取绑定结果和绑定凭证
()
{
visitorAuth6
();
ThreadSleepUtils
.
sleep
(
2000
);
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
);
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
System
.
out
.
println
(
type
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"修改实物奖品数量为无限制"
,
priority
=
38
)
public
void
修改实物奖品数量为无限制
()
{
JSONObject
treasureAward
=
treasureConf
.
getJSONObject
(
"treasureAward"
);
treasureAward
.
put
(
"totalNum"
,-
1
);
treasureAward
.
put
(
"ruleType"
,
2
);
Response
response
=
network
.
postResponse
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
,
"修改实物奖品为无限制失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"第5个访客F砸蛋砸出实物奖品"
,
priority
=
39
)
public
void
第
5
个访客
F
砸蛋砸出实物奖品
()
{
visitorAuth6
();
sleep
(
5000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
3
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改红包概率为100%"
,
priority
=
40
)
public
void
修改红包概率为
100
()
{
JSONObject
treasureAward
=
treasureConf
.
getJSONObject
(
"treasureAward"
);
JSONObject
treasureRed
=
treasureConf
.
getJSONObject
(
"treasureRed"
);
treasureAward
.
put
(
"treasureProbability"
,
0
);
treasureRed
.
put
(
"treasureProbability"
,
10000
);
Response
response
=
network
.
postResponse
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
treasureConf
,
BasicConfig
.
MANAGER_goldenEgg_saveOrUpdate
,
"修改红包概率失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"黑名单用户G砸金蛋超时"
,
priority
=
41
)
public
void
黑名单用户
G
砸金蛋超时
()
{
visitorAuth7
();
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"treasureConfId"
,
treasureConf
.
get
(
"treasureConfId"
));
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_oldenEggTimeOut
,
"砸金蛋超时设置失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
param
.
put
(
"treasureConfId"
,
ConfId
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
response
=
network
.
postResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_reset
);
System
.
out
.
println
(
response
.
body
().
asString
());
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_reset
,
"砸金蛋超时重置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"黑名单用户G超时后仅能砸出抽奖码"
,
priority
=
42
)
public
void
黑名单用户
G
超时后仅能砸出抽奖码
()
{
visitorAuth7
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客I与访客A邀请关系绑定"
,
priority
=
43
)
public
void
访客
I
与访客
A
邀请关系绑定
()
{
visitorAuth8
();
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
=
"访客F获取绑定结果和绑定凭证"
,
priority
=
44
)
public
void
访客
I
获取绑定结果和绑定凭证
()
{
visitorAuth8
();
ThreadSleepUtils
.
sleep
(
2000
);
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
);
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
System
.
out
.
println
(
type
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第6个访客F砸出红包"
,
priority
=
45
)
public
void
第
6
个访客
F
砸出红包
()
{
visitorAuth8
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
2
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客H与访客A邀请关系绑定"
,
priority
=
46
)
public
void
访客
H
与访客
A
邀请关系绑定
()
{
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
=
47
)
public
void
访客
H
获取绑定结果和绑定凭证
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
2000
);
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
);
Integer
type
=
tokenRes
.
jsonPath
().
getInt
(
"data.type"
);
System
.
out
.
println
(
type
);
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
@Test
(
description
=
"第7个访客H砸出抽奖码"
,
priority
=
48
)
public
void
第
7
个访客
H
砸出抽奖码
()
{
visitorAuth9
();
sleep
(
2000
);
Map
<
String
,
Object
>
chooseAwardParam
=
new
HashMap
<>();
chooseAwardParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
chooseAwardParam
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
postResponse
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
chooseAwardParam
,
BasicConfig
.
MOBILE_goldenEgg_open
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
sleep
(
2000
);
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
treasureType
=
response
.
jsonPath
().
getInt
(
"data.treasureType"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
5
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
treasureType
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
0
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"砸金蛋失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"砸金蛋进行中数量变化"
,
priority
=
49
)
public
void
砸金蛋进行中数量变化
()
{
Map
<
String
,
Object
>
confDetailParam
=
new
HashMap
<>();
confDetailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
totalNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.totalNum"
);
int
receivingNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receivingNum"
);
int
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receiveNum"
);
Assert
.
assertEquals
(
totalNum
,-
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品总数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivingNum
,
3
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品进行中数量错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品已领取错误"
,
response
.
body
().
asString
()));
totalNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.totalNum"
);
receivingNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.receivingNum"
);
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.receiveNum"
);
Assert
.
assertEquals
(
totalNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品总数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivingNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品进行中数量错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品已领取错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"用户B给用户A助力"
,
priority
=
50
)
public
void
用户
B
给用户
A
助力
()
{
visitorAuth2
();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareType"
,
15
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MOBILE_popupDetail
);
System
.
out
.
println
(
response
.
body
().
asString
());
Object
degreePopup
=
response
.
jsonPath
().
getJsonObject
(
"data.degreePopup"
);
Assert
.
assertNotNull
(
degreePopup
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_popupDetail
,
"授权及助力弹窗为空"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareSign"
,
shareSign
);
Params
.
put
(
"shareType"
,
15
);
Params
.
put
(
"confId"
,
ConfId
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MOBILE_assist
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_assist
,
"用户B给用户H助力失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客A实物兑奖成功"
,
priority
=
51
)
public
void
访客
A
实物兑奖成功
()
{
visitorAuth
();
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
2
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"实物兑奖失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"邀请头像数量错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客B获取分享加密串"
,
priority
=
52
)
public
void
访客
B
获取分享加密串
()
{
visitorAuth2
();
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
15
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_sign
);
String
data
=
signRes
.
jsonPath
().
getString
(
"data"
);
this
.
shareSign
=
data
;
System
.
out
.
println
(
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_sign
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"用户C给用户B助力"
,
priority
=
53
)
public
void
用户
C
给用户
B
助力
()
{
visitorAuth3
();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareType"
,
15
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MOBILE_popupDetail
);
System
.
out
.
println
(
response
.
body
().
asString
());
Object
degreePopup
=
response
.
jsonPath
().
getJsonObject
(
"data.degreePopup"
);
Assert
.
assertNotNull
(
degreePopup
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_popupDetail
,
"授权及助力弹窗为空"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareSign"
,
shareSign
);
Params
.
put
(
"shareType"
,
15
);
Params
.
put
(
"confId"
,
ConfId
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MOBILE_assist
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_assist
,
"用户B给用户H助力失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客B抽奖码兑奖成功"
,
priority
=
54
)
public
void
访客
B
抽奖码兑奖成功
()
{
visitorAuth2
();
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
2
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"实物兑奖失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"邀请头像数量错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客F获取分享加密串"
,
priority
=
55
)
public
void
访客
F
获取分享加密串
()
{
visitorAuth8
();
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
15
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_sign
);
String
data
=
signRes
.
jsonPath
().
getString
(
"data"
);
this
.
shareSign
=
data
;
System
.
out
.
println
(
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_sign
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"用户D给用户F助力"
,
priority
=
56
)
public
void
用户
D
给用户
F
助力
()
{
visitorAuth5
();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareType"
,
15
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MOBILE_popupDetail
);
System
.
out
.
println
(
response
.
body
().
asString
());
Object
degreePopup
=
response
.
jsonPath
().
getJsonObject
(
"data.degreePopup"
);
Assert
.
assertNotNull
(
degreePopup
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_popupDetail
,
"授权及助力弹窗为空"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Params
.
put
(
"shareSign"
,
shareSign
);
Params
.
put
(
"shareType"
,
15
);
Params
.
put
(
"confId"
,
ConfId
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MOBILE_assist
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MOBILE_assist
,
"用户B给用户H助力失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客F红包兑奖成功"
,
priority
=
57
)
public
void
访客
F
红包兑奖成功
()
{
visitorAuth8
();
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
param
.
put
(
"treasureConfId"
,
ConfId
);
Response
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
receiveStatus
=
response
.
jsonPath
().
getInt
(
"data.receiveStatus"
);
int
helperList
=
response
.
jsonPath
().
getInt
(
"data.helperList.size()"
);
Assert
.
assertEquals
(
receiveStatus
,
2
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"实物兑奖失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
helperList
,
1
,
network
.
message
(
param
,
BasicConfig
.
MOBILE_goldenEgg_joinInfo
,
"邀请头像数量错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"砸金蛋已领取数量变化"
,
priority
=
58
)
public
void
砸金蛋已领取数量变化
()
{
Map
<
String
,
Object
>
confDetailParam
=
new
HashMap
<>();
confDetailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
totalNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.totalNum"
);
int
receivingNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receivingNum"
);
int
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.treasureAward.receiveNum"
);
Assert
.
assertEquals
(
totalNum
,-
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品总数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivingNum
,
2
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品进行中数量错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品已领取错误"
,
response
.
body
().
asString
()));
totalNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.totalNum"
);
receivingNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.receivingNum"
);
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.treasureRed.receiveNum"
);
Assert
.
assertEquals
(
totalNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品总数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivingNum
,
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品进行中数量错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
1
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_goldenEgg_detail
,
"实物奖品已领取错误"
,
response
.
body
().
asString
()));
}
// @Test(description = "查询用户是否未提交收货地址", priority = 59)
// public void 查询用户是否未提交收货地址() {
// visitorAuth();
// ThreadSleepUtils.sleep(1000);
// Map<String, Object> locationResultParam = new HashMap<>();
// locationResultParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// locationResultParam.put("scene", 1);
// Response locationResultRes = network.getResponse(locationResultParam, BasicConfig.USER_locationResult);
// System.out.println(locationResultRes.body().asString());
// Object winnerRegion = locationResultRes.jsonPath().getJsonObject("data.winnerRegion");
// Assert.assertNull(winnerRegion, network.message(locationResultParam, BasicConfig.USER_locationResult, "查询用户是否提交收货地址失败", locationResultRes.body().asString()));
// }
//
// @Test(description = "提交收货地址", priority = 60)
// public void 提交收货地址() {
// visitorAuth();
// Map<String, Object> submitInfoParam = new HashMap<>();
// submitInfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// submitInfoParam.put("confId", interactConfId);
// submitInfoParam.put("winnerName", "中奖人");
// submitInfoParam.put("winnerName", "浙江省杭州市");
// submitInfoParam.put("location", "西湖区数娱大厦");
// submitInfoParam.put("phoneNum", "13498765432");
// Response submitInfoRes = network.postResponse(submitInfoParam, BasicConfig.USER_submitInfo);
// System.out.println(submitInfoRes.body().asString());
// Boolean result = submitInfoRes.jsonPath().getBoolean("success");
// Assert.assertTrue(result, network.message(submitInfoParam, BasicConfig.USER_submitInfo, "提交姓名失败", submitInfoRes.body().asString()));
// ThreadSleepUtils.sleep(3000);
// }
//
// @Test(description = "查询用户是否提交收货地址", priority = 61)
// public void 查询用户是否提交收货地址() {
// visitorAuth();
// ThreadSleepUtils.sleep(1000);
// Map<String, Object> locationResultParam = new HashMap<>();
// locationResultParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// locationResultParam.put("scene", 1);
// Response locationResultRes = network.getResponse(locationResultParam, BasicConfig.USER_locationResult);
// System.out.println(locationResultRes.body().asString());
// Object winnerRegion = locationResultRes.jsonPath().getJsonObject("data.winnerRegion");
// Assert.assertNotNull(winnerRegion, network.message(locationResultParam, BasicConfig.USER_locationResult, "查询用户是否提交收货地址失败", locationResultRes.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