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
2accc348
Commit
2accc348
authored
Jul 28, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2021072702-gxh' into 'master'
2021072702 gxh See merge request test-group/kejiji!82
parents
80696635
28aab9aa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
879 additions
and
99 deletions
+879
-99
Gift.java
src/test/java/com/kjj/bean/marketTools/Gift.java
+1
-1
LotteryTable.java
src/test/java/com/kjj/bean/marketTools/LotteryTable.java
+11
-0
PrizeDetail.java
src/test/java/com/kjj/bean/marketTools/PrizeDetail.java
+16
-0
Visitor.java
src/test/java/com/kjj/bean/marketTools/Visitor.java
+10
-0
Authorization.java
src/test/java/com/kjj/cases/admin/Authorization.java
+15
-4
ArticalPersonCard.java
.../java/com/kjj/cases/assistant/card/ArticalPersonCard.java
+2
-5
PersonCard.java
src/test/java/com/kjj/cases/assistant/card/PersonCard.java
+3
-4
GameLottery.java
...java/com/kjj/cases/assistant/markettools/GameLottery.java
+674
-0
GreetingCrad.java
...ava/com/kjj/cases/assistant/markettools/GreetingCrad.java
+118
-78
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+23
-5
wechatTestNG.xml
src/test/wechatTestNG.xml
+6
-2
No files found.
src/test/java/com/kjj/bean/
gift
/Gift.java
→
src/test/java/com/kjj/bean/
marketTools
/Gift.java
View file @
2accc348
package
com
.
kjj
.
bean
.
gift
;
package
com
.
kjj
.
bean
.
marketTools
;
import
lombok.Data
;
...
...
src/test/java/com/kjj/bean/marketTools/LotteryTable.java
0 → 100644
View file @
2accc348
package
com
.
kjj
.
bean
.
marketTools
;
import
lombok.Data
;
@Data
public
class
LotteryTable
{
private
int
id
;
private
String
title
;
private
int
status
;
private
int
publicly
;
}
src/test/java/com/kjj/bean/marketTools/PrizeDetail.java
0 → 100644
View file @
2accc348
package
com
.
kjj
.
bean
.
marketTools
;
import
lombok.Data
;
import
java.util.ArrayList
;
@Data
public
class
PrizeDetail
{
private
int
customPrizeRate
;
private
int
customPrizeType
;
private
String
activityCustomPrizeId
;
private
String
prizeImg
;
private
String
prizeName
;
private
int
totalStock
;
private
ArrayList
<
String
>
winnerIds
;
}
src/test/java/com/kjj/bean/marketTools/Visitor.java
0 → 100644
View file @
2accc348
package
com
.
kjj
.
bean
.
marketTools
;
import
lombok.Data
;
@Data
public
class
Visitor
{
private
String
avatar
;
private
String
visitorId
;
private
String
visitorNickname
;
}
src/test/java/com/kjj/cases/admin/Authorization.java
View file @
2accc348
...
...
@@ -32,12 +32,23 @@ public interface Authorization {
}
// 获取访客tku
// 获取访客tku
:Su Yi
default
void
userTku
()
{
AGENT_TKU
=
BaseUtils
.
createTku
();
VISITOR_TKU
=
BaseUtils
.
getTku
(
VISITOR_USERID
);
network
.
agentCookies
.
put
(
"tku"
,
VISITOR_TKU
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR_TKU
);
String
tku
=
BaseUtils
.
getTku
(
VISITOR_USERID
);
network
.
agentCookies
.
put
(
"tku"
,
tku
);
System
.
out
.
println
(
"访客tku:"
+
tku
);
}
// 获取访客tku:请勿打扰
default
void
userTku1
()
{
network
.
agentCookies
.
put
(
"tku"
,
VISITOR1_TKU
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR1_TKU
);
}
// 获取访客tku:小雪人
default
void
userTku2
()
{
network
.
agentCookies
.
put
(
"tku"
,
VISITOR1_TKU
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR1_TKU
);
}
/**
...
...
src/test/java/com/kjj/cases/assistant/card/ArticalPersonCard.java
View file @
2accc348
...
...
@@ -271,8 +271,8 @@ public class ArticalPersonCard implements Authorization {
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
SELLERCARD_GETSELLERPROMOTEINFO
,
"
获取专业解读列表有误
"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
SELLERCARD_GETSELLERPROMOTEINFO
,
"
获取专业解读列表有误
"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
SELLERCARD_GETSELLERPROMOTEINFO
,
"
接口返回失败
"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
SELLERCARD_GETSELLERPROMOTEINFO
,
"
返回数据为空
"
,
response
.
body
().
asString
()));
}
// 获取互动区-专业解读
...
...
@@ -323,7 +323,4 @@ public class ArticalPersonCard implements Authorization {
String
desc
=
response
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
desc
,
"OK"
,
network
.
message
(
params
,
CHECKUNREAD
,
"访客-获取私信有误"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/card/PersonCard.java
View file @
2accc348
...
...
@@ -235,11 +235,11 @@ public class PersonCard implements Authorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"page"
,
"seller_card"
);
params
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
Response
response
=
network
.
getResponse
(
params
,
G
REETING_getTipsByPage
);
Response
response
=
network
.
getResponse
(
params
,
G
ETTIPSBYPAGE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
G
REETING_getTipsByPage
,
"接口返回失败状态"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
G
REETING_getTipsByPage
,
"返回数据为空"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
G
ETTIPSBYPAGE
,
"接口返回失败状态"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
G
ETTIPSBYPAGE
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取客户投保案例模块"
,
priority
=
11
)
//priorty 方法执行优先级
...
...
@@ -892,5 +892,4 @@ public class PersonCard implements Authorization {
Assert
.
assertEquals
(
guideType
,
0
,
network
.
message
(
SELLERCARD_CARDGUIDE
,
"引导类型错误"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/markettools/GameLottery.java
0 → 100644
View file @
2accc348
package
com
.
kjj
.
cases
.
assistant
.
markettools
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.marketTools.LotteryTable
;
import
com.kjj.bean.marketTools.PrizeDetail
;
import
com.kjj.bean.marketTools.Visitor
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.NetworkUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.*
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
public
class
GameLottery
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
String
lotteryId
;
//抽奖模板id
public
String
scid
;
//指定中奖-抽奖scid
public
String
id
;
//抽奖重定向地址id
public
Visitor
visitor
;
//指定中奖的客户
public
String
activityConfId
;
//指定中奖-抽奖活动配置id
public
String
rateConfId
;
//概率中奖-抽奖活动配置id
public
String
rateScid
;
//概率中奖-抽奖scid
public
String
winnerId
;
//抽奖活动配置id
public
String
activityCustomPrizeId
;
//配置生效的奖品id
public
String
orderId
;
//订单id
public
String
visitTableId
;
//订单id
public
int
remainingTimes
;
//剩余抽奖次数
public
String
winningRecodeId
;
//中奖记录id
@BeforeClass
public
void
setUp
(){
BaseUtils
.
ssoLogin
();
}
@Test
(
description
=
"代理人_获取抽奖活动重定向地址id"
,
priority
=
1
)
public
void
代理人
_
获取抽奖活动重定向地址
id
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentType"
,
"game_template"
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
MANAGER_searchTemplateList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_searchTemplateList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
MANAGER_searchTemplateList
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
lId
=
0
;
List
<
LotteryTable
>
templateList
=
JsonUtil
.
parseResponsePathToListBean
(
response
,
"data.list"
,
LotteryTable
.
class
);
for
(
LotteryTable
template:
templateList
)
{
if
(
template
.
getStatus
()==
2
&&
template
.
getPublicly
()
==
1
){
lId
=
template
.
getId
();
break
;
}
}
if
(
lId
==
0
){
System
.
out
.
println
(
"抽奖转盘列表没有已上架的公有的抽奖模板"
);
return
;
}
params
.
clear
();
params
.
put
(
"id"
,
lId
);
response
=
network
.
getResponse
(
params
,
MANAGER_getTemplateDetail
);
String
activityUrl
=
response
.
jsonPath
().
getString
(
"data.activityUrl"
);
id
=
activityUrl
.
substring
(
activityUrl
.
indexOf
(
"id"
)+
3
);
System
.
out
.
println
(
id
);
}
@Test
(
description
=
"代理人_获取抽奖模板列表"
,
priority
=
2
)
public
void
代理人
_
获取抽奖模板列表
(){
agentTku
();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_templatePageList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_templatePageList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_templatePageList
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
LOTTERRY_templatePageList
,
"抽奖模板列表为空"
,
response
.
body
().
asString
()));
lotteryId
=
response
.
jsonPath
().
getString
(
"data.list.get(0).id"
);
}
@Test
(
description
=
"代理人_根据page获取当前页面的Tips"
,
priority
=
3
)
public
void
代理人
_
根据
page
获取当前页面的
Tips
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"page"
,
"game_lottery"
);
Response
response
=
network
.
getResponse
(
params
,
GETTIPSBYPAGE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GETTIPSBYPAGE
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GETTIPSBYPAGE
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"是否能访问抽奖工具"
,
priority
=
4
)
public
void
代理人
_
是否能访问抽奖工具
(){
Response
response
=
network
.
getResponse
(
LOTTERRY_check
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
LOTTERRY_check
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
LOTTERRY_check
,
"返回不能访问"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取抽奖详情页"
,
priority
=
5
)
public
void
代理人
_
获取抽奖详情页
()
{
//根据ContentId获取Scid
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentId"
,
lotteryId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
scid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
scid
,
network
.
message
(
params
,
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
response
=
network
.
getResponse
(
params
,
GREETING_H5INFO
);
String
id
=
response
.
jsonPath
().
getString
(
"data.id"
);
Assert
.
assertEquals
(
lotteryId
,
id
,
network
.
message
(
params
,
GREETING_H5INFO
,
"获取贺卡页面失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取次数及奖品信息"
,
priority
=
6
)
public
void
代理人
_
获取次数及奖品信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"id"
,
id
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getElements
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getElements
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getElements
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取抽奖配置"
,
priority
=
7
)
public
void
代理人
_
获取抽奖配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getConfDetail
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getConfDetail
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getConfDetail
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_编辑指定中奖"
,
priority
=
8
)
public
void
代理人
_
编辑指定中奖
(){
//获取客户列表
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"visitorNickname"
,
""
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_customerList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_customerList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_customerList
,
"返回数据为空"
,
response
.
body
().
asString
()));
if
(
response
.
jsonPath
().
getInt
(
"data.list.size()"
)<
1
){
System
.
out
.
println
(
"客户列表为空"
);
}
//选择"Su Yi"
List
<
Visitor
>
visitorList
=
JsonUtil
.
parseResponsePathToListBean
(
response
,
"data.list"
,
Visitor
.
class
);
for
(
Visitor
item:
visitorList
)
{
if
(
item
.
getVisitorNickname
().
equals
(
"Su Yi"
)){
visitor
=
item
;
break
;
}
}
//指定"Su Yi"中奖
ArrayList
<
Visitor
>
visitorListChoose
=
new
ArrayList
<
Visitor
>();
System
.
out
.
println
(
visitor
.
toString
());
visitorListChoose
.
add
(
visitor
);
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"winners"
,
visitorListChoose
);
System
.
out
.
println
(
params
.
toString
());
response
=
network
.
postResponse
(
params
,
LOTTERRY_addWinnersEn
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_addWinnersEn
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_addWinnersEn
,
"返回数据为空"
,
response
.
body
().
asString
()));
winnerId
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).winnerId"
);
System
.
out
.
println
(
"winnerId:"
+
winnerId
);
}
@Test
(
description
=
"代理人_保存抽奖配置"
,
priority
=
9
)
public
void
代理人
_
保存抽奖配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
//指定客户列表
ArrayList
<
String
>
visitorList
=
new
ArrayList
<
String
>();
visitorList
.
add
(
winnerId
);
//奖品详情
PrizeDetail
prizeDetail
=
new
PrizeDetail
();
prizeDetail
.
setPrizeImg
(
"https://yun.duiba.com.cn/kjj-prize-nodeimages/76242998-4c8f-4e1e-b321-697289fc28a9.png"
);
prizeDetail
.
setPrizeName
(
"抱枕"
);
prizeDetail
.
setCustomPrizeRate
(
0
);
prizeDetail
.
setCustomPrizeType
(
1
);
prizeDetail
.
setTotalStock
(
1
);
prizeDetail
.
setWinnerIds
(
visitorList
);
//转换奖品列表
ArrayList
<
PrizeDetail
>
prizeDetails
=
new
ArrayList
<
PrizeDetail
>();
prizeDetails
.
add
(
prizeDetail
);
//奖品列表
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageTitle"
,
"来抽奖吧"
);
params
.
put
(
"prizeDetails"
,
prizeDetails
);
System
.
out
.
println
(
JSON
.
toJSONString
(
params
));
Response
response
=
network
.
postResponse
(
params
,
LOTTERRY_saveOrUpdateConf
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
activityConfId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
activityConfId
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_查询抽奖配置"
,
priority
=
10
)
public
void
代理人
_
查询抽奖配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getConf
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
prizeName
=
response
.
jsonPath
().
getString
(
"data.prizeDetails.get(0).prizeName"
);
String
theWinner
=
response
.
jsonPath
().
getString
(
"data.prizeDetails.get(0).winners.get(0).winnerId"
);
Assert
.
assertEquals
(
prizeName
,
"抱枕"
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"奖品错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
theWinner
,
winnerId
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"指定中奖的客户错误"
,
response
.
body
().
asString
()));
activityCustomPrizeId
=
response
.
jsonPath
().
getString
(
"data.prizeDetails.get(0).activityCustomPrizeId"
);
System
.
out
.
println
(
activityCustomPrizeId
);
}
@Test
(
description
=
"代理人_修改奖品"
,
priority
=
11
)
public
void
代理人
_
修改奖品
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
//指定客户列表
ArrayList
<
String
>
visitorList
=
new
ArrayList
<
String
>();
visitorList
.
add
(
winnerId
);
//奖品详情
PrizeDetail
prizeDetail
=
new
PrizeDetail
();
prizeDetail
.
setActivityCustomPrizeId
(
activityCustomPrizeId
);
prizeDetail
.
setPrizeImg
(
"https://yun.duiba.com.cn/kjj-prize-nodeimages/bottle_.png"
);
prizeDetail
.
setPrizeName
(
"杯子"
);
prizeDetail
.
setCustomPrizeRate
(
0
);
prizeDetail
.
setCustomPrizeType
(
1
);
prizeDetail
.
setTotalStock
(
1
);
prizeDetail
.
setWinnerIds
(
visitorList
);
//奖品列表
ArrayList
<
PrizeDetail
>
prizeDetails
=
new
ArrayList
<
PrizeDetail
>();
prizeDetails
.
add
(
prizeDetail
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
params
.
put
(
"pageTitle"
,
"快来抽大奖吧"
);
params
.
put
(
"prizeDetails"
,
prizeDetails
);
Response
response
=
network
.
postResponse
(
params
,
LOTTERRY_saveOrUpdateConf
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
data
,
activityConfId
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"返回抽奖配置id错误"
,
response
.
body
().
asString
()));
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getConf
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
result
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
result
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
pageTitle
=
response
.
jsonPath
().
getString
(
"data.pageTitle"
);
String
prizeName
=
response
.
jsonPath
().
getString
(
"data.prizeDetails.get(0).prizeName"
);
Assert
.
assertEquals
(
prizeName
,
"杯子"
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"奖品错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
pageTitle
,
"快来抽大奖吧"
,
network
.
message
(
params
,
LOTTERRY_getConf
,
"指定中奖的客户错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取分享信息"
,
priority
=
12
)
public
void
代理人
_
获取分享信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getH5ShareInfo
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getH5ShareInfo
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getH5ShareInfo
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_打开抽奖链接"
,
priority
=
13
)
public
void
访客
_
打开抽奖链接
(){
//切换为访客-请勿打扰
userTku1
();
//添加访问记录
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"bizNo"
,
activityConfId
);
params
.
put
(
"from"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
CONTENT_READ
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
CONTENT_READ
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
CONTENT_READ
,
"获取访问贺卡记录失败"
,
response
.
body
().
asString
()));
visitTableId
=
response
.
jsonPath
().
getString
(
"data.visitId"
);
//获取抽奖转盘信息
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
response
=
network
.
getResponse
(
params
,
GREETING_H5INFO
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_H5INFO
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_H5INFO
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//获取抽奖次数
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"id"
,
id
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getElements
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getElements
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getElements
,
"返回数据为空"
,
response
.
body
().
asString
()));
remainingTimes
=
response
.
jsonPath
().
getInt
(
"data.remainingTimes"
);
System
.
out
.
println
(
remainingTimes
);
System
.
out
.
println
(
response
.
body
().
asString
());
}
@Test
(
description
=
"访客_非指定客户不能中奖"
,
priority
=
14
)
public
void
访客
_
非指定客户不能中奖
(){
//抽奖
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
params
.
put
(
"id"
,
id
);
Response
response
=
network
.
postResponse
(
params
,
LOTTERRY_gdoJoin
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
orderId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
orderId
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"返回抽奖订单号为空"
,
response
.
body
().
asString
()));
//获取抽奖结果
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"orderId"
,
orderId
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getOrderStatus
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//未中奖
int
state
=
response
.
jsonPath
().
getInt
(
"data.state"
);
int
prizeType
=
response
.
jsonPath
().
getInt
(
"data.prizeType"
);
Assert
.
assertTrue
(
state
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"订单出奖状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeType
==
1
||
prizeType
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"抽奖结果错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_指定客户中奖"
,
priority
=
15
)
public
void
访客
_
指定客户中奖
(){
//切换为Su Yi
userTku
();
//添加访问记录
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"bizNo"
,
activityConfId
);
params
.
put
(
"from"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
CONTENT_READ
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
CONTENT_READ
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
CONTENT_READ
,
"获取访问贺卡记录失败"
,
response
.
body
().
asString
()));
visitTableId
=
response
.
jsonPath
().
getString
(
"data.visitId"
);
//抽奖
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
params
.
put
(
"id"
,
id
);
response
=
network
.
postResponse
(
params
,
LOTTERRY_gdoJoin
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
orderId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
orderId
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"返回抽奖订单号为空"
,
response
.
body
().
asString
()));
//获取抽奖结果
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"orderId"
,
orderId
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getOrderStatus
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//中奖
int
state
=
response
.
jsonPath
().
getInt
(
"data.state"
);
int
prizeType
=
response
.
jsonPath
().
getInt
(
"data.prizeType"
);
winningRecodeId
=
response
.
jsonPath
().
getString
(
"data.winningRecodeId"
);
Assert
.
assertTrue
(
state
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"订单出奖状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeType
==
3
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"抽奖结果错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_根据订单ID获取中奖记录"
,
priority
=
16
)
public
void
访客
_
根据订单
ID
获取中奖记录
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"winningRecodeId"
,
winningRecodeId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getRecordById
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getRecordById
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getRecordById
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
prizeName
=
response
.
jsonPath
().
getString
(
"data.prizeName"
);
Assert
.
assertEquals
(
prizeName
,
"杯子"
,
network
.
message
(
params
,
LOTTERRY_getRecordById
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_获取抽奖代理人信息"
,
priority
=
17
)
public
void
访客
_
获取抽奖代理人信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getSellerCard
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getSellerCard
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getSellerCard
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
wxName
=
response
.
jsonPath
().
getString
(
"data.wxName"
);
Assert
.
assertEquals
(
wxName
,
"吉吉"
,
network
.
message
(
params
,
LOTTERRY_getSellerCard
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_提交中奖信息"
,
priority
=
18
)
public
void
访客
_
提交中奖信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"visitTableId"
,
visitTableId
);
params
.
put
(
"visitorName"
,
"苏逸"
);
params
.
put
(
"visitorPhone"
,
"13512345678"
);
params
.
put
(
"winningRecodeId"
,
winningRecodeId
);
Response
response
=
network
.
postResponse
(
params
,
LOTTERRY_commitWinnerInfo
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_commitWinnerInfo
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
LOTTERRY_commitWinnerInfo
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_创建概率中奖抽奖活动"
,
priority
=
19
)
public
void
代理人
_
创建概率中奖抽奖活动
(){
agentTku
();
//根据ContentId获取Scid
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentId"
,
lotteryId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
rateScid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
rateScid
,
network
.
message
(
params
,
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
params
.
clear
();
//指定客户列表-空列表
ArrayList
<
String
>
visitorList
=
new
ArrayList
<
String
>();
//奖品详情
PrizeDetail
prizeDetail
=
new
PrizeDetail
();
prizeDetail
.
setPrizeImg
(
"https://yun.duiba.com.cn/kjj-prize-nodeimages/76242998-4c8f-4e1e-b321-697289fc28a9.png"
);
prizeDetail
.
setPrizeName
(
"抱枕"
);
prizeDetail
.
setCustomPrizeRate
(
100
);
prizeDetail
.
setCustomPrizeType
(
2
);
prizeDetail
.
setTotalStock
(
1
);
prizeDetail
.
setWinnerIds
(
visitorList
);
//转换奖品列表
ArrayList
<
PrizeDetail
>
prizeDetails
=
new
ArrayList
<
PrizeDetail
>();
prizeDetails
.
add
(
prizeDetail
);
//奖品列表
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"pageTitle"
,
"来抽奖吧"
);
params
.
put
(
"prizeDetails"
,
prizeDetails
);
System
.
out
.
println
(
JSON
.
toJSONString
(
params
));
response
=
network
.
postResponse
(
params
,
LOTTERRY_saveOrUpdateConf
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
rateConfId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
rateConfId
,
network
.
message
(
params
,
LOTTERRY_saveOrUpdateConf
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_第一个客户中奖"
,
priority
=
20
)
public
void
访客
_
第一个客户中奖
(){
//切换为Su Yi
userTku
();
//添加访问记录
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"bizNo"
,
rateConfId
);
params
.
put
(
"from"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
CONTENT_READ
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
CONTENT_READ
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
CONTENT_READ
,
"获取访问贺卡记录失败"
,
response
.
body
().
asString
()));
//抽奖
params
.
clear
();
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"activityConfId"
,
rateConfId
);
params
.
put
(
"id"
,
id
);
response
=
network
.
postResponse
(
params
,
LOTTERRY_gdoJoin
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
orderId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
orderId
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"返回抽奖订单号为空"
,
response
.
body
().
asString
()));
//获取抽奖结果
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"orderId"
,
orderId
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getOrderStatus
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//中奖
int
state
=
response
.
jsonPath
().
getInt
(
"data.state"
);
int
prizeType
=
response
.
jsonPath
().
getInt
(
"data.prizeType"
);
Assert
.
assertTrue
(
state
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"订单出奖状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeType
==
6
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"抽奖结果错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_第二个客户未中奖"
,
priority
=
21
)
public
void
访客
_
第二个客户未中奖
(){
//切换为请勿打扰
userTku1
();
//添加访问记录
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"bizNo"
,
rateConfId
);
params
.
put
(
"from"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
CONTENT_READ
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
CONTENT_READ
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
CONTENT_READ
,
"获取访问贺卡记录失败"
,
response
.
body
().
asString
()));
//抽奖
params
.
clear
();
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"activityConfId"
,
rateConfId
);
params
.
put
(
"id"
,
id
);
response
=
network
.
postResponse
(
params
,
LOTTERRY_gdoJoin
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
orderId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
orderId
,
network
.
message
(
params
,
LOTTERRY_gdoJoin
,
"返回抽奖订单号为空"
,
response
.
body
().
asString
()));
//获取抽奖结果
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"orderId"
,
orderId
);
response
=
network
.
getResponse
(
params
,
LOTTERRY_getOrderStatus
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//中奖
int
state
=
response
.
jsonPath
().
getInt
(
"data.state"
);
int
prizeType
=
response
.
jsonPath
().
getInt
(
"data.prizeType"
);
Assert
.
assertTrue
(
state
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"订单出奖状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeType
==
1
||
prizeType
==
2
,
network
.
message
(
params
,
LOTTERRY_getOrderStatus
,
"抽奖结果错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_查询发起抽奖列表"
,
priority
=
22
)
public
void
代理人
_
查询发起抽奖列表
(){
//切换为代理人
agentTku
();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_confPageList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_confPageList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_confPageList
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
LOTTERRY_confPageList
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取指定中奖抽奖活动的参与人列表"
,
priority
=
23
)
public
void
代理人
_
获取指定中奖抽奖活动
_
参与人列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getDrawRecord
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
==
2
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取指定中奖抽奖活动的中奖人列表(已领奖)"
,
priority
=
24
)
public
void
代理人
_
获取指定中奖抽奖活动
_
中奖人已领奖列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"activityConfId"
,
activityConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getDrawWinningRecord
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
int
prizeState
=
response
.
jsonPath
().
getInt
(
"data.list.get(0).prizeState"
);
Assert
.
assertTrue
(
size
==
1
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeState
==
1
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取概率中奖抽奖活动的参与人列表"
,
priority
=
25
)
public
void
代理人
_
获取概率中奖抽奖活动的参与人列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"activityConfId"
,
rateConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getDrawRecord
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
==
2
,
network
.
message
(
params
,
LOTTERRY_getDrawRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取概率中奖抽奖活动的中奖人列表(未领奖)"
,
priority
=
26
)
public
void
代理人
_
获取概率中奖抽奖活动
_
中奖人未领奖列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"scid"
,
rateScid
);
params
.
put
(
"activityConfId"
,
rateConfId
);
Response
response
=
network
.
getResponse
(
params
,
LOTTERRY_getDrawWinningRecord
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
int
prizeState
=
response
.
jsonPath
().
getInt
(
"data.list.get(0).prizeState"
);
Assert
.
assertTrue
(
size
==
1
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
prizeState
==
0
,
network
.
message
(
params
,
LOTTERRY_getDrawWinningRecord
,
"中奖奖品名称错误"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/markettools/
g
reetingCrad.java
→
src/test/java/com/kjj/cases/assistant/markettools/
G
reetingCrad.java
View file @
2accc348
package
com
.
kjj
.
cases
.
assistant
.
markettools
;
import
com.kjj.bean.
gift
.Gift
;
import
com.kjj.bean.
marketTools
.Gift
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.NetworkUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
...
...
@@ -17,7 +16,7 @@ import java.util.Map;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
public
class
g
reetingCrad
implements
Authorization
{
public
class
G
reetingCrad
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
String
greetingCardId
;
// 红包贺卡的contentId
public
String
confId
;
// 红包贺卡配置的confId
...
...
@@ -34,9 +33,8 @@ public class greetingCrad implements Authorization{
agentTku
();
}
@Test
(
description
=
"营销工具聚合页内容"
,
priority
=
1
)
public
void
营销工具聚合页内容
(){
sleep
(
5000
);
@Test
(
description
=
"代理人_营销工具聚合页内容"
,
priority
=
1
)
public
void
代理人
_
营销工具聚合页内容
(){
Response
response
=
network
.
getResponse
(
GREETING_getMarketingToolArea
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
...
...
@@ -51,8 +49,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
templateList
>
0
,
network
.
message
(
GREETING_getMarketingToolArea
,
"抽奖列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取趣味测试列表"
,
priority
=
2
)
public
void
获取趣味测试列表
(){
@Test
(
description
=
"
代理人_
获取趣味测试列表"
,
priority
=
2
)
public
void
代理人
_
获取趣味测试列表
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageSize"
,
5
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_answerPageList
);
...
...
@@ -65,8 +63,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
answerPageList
>
0
,
network
.
message
(
params
,
GREETING_answerPageList
,
"趣味测试列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取代理人vip信息"
,
priority
=
3
)
public
void
获取代理人
vip
信息
(){
@Test
(
description
=
"
代理人_
获取代理人vip信息"
,
priority
=
3
)
public
void
代理人
_
获取代理人
vip
信息
(){
Response
response
=
network
.
getResponse
(
GREETING_getSellerVipInfo
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
...
...
@@ -77,8 +75,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
isVip
,
network
.
message
(
GREETING_getSellerVipInfo
,
"代理人不是vip用户"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"检查访客登录信息"
,
priority
=
4
)
public
void
检查访客登录信息
(){
@Test
(
description
=
"
代理人_
检查访客登录信息"
,
priority
=
4
)
public
void
代理人
_
检查访客登录信息
(){
Response
response
=
network
.
getResponse
(
GREETING_checkVisitor
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
...
@@ -86,8 +84,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
GREETING_checkVisitor
,
"返回数据为失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取贺卡首页banner"
,
priority
=
5
)
public
void
获取贺卡首页
banner
(){
@Test
(
description
=
"
代理人_
获取贺卡首页banner"
,
priority
=
5
)
public
void
代理人
_
获取贺卡首页
banner
(){
Response
response
=
network
.
getResponse
(
GREETING_banner
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
...
...
@@ -98,8 +96,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
GREETING_banner
,
"贺卡列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取转发数量最高的贺卡"
,
priority
=
6
)
public
void
获取转发数量最高的贺卡
(){
@Test
(
description
=
"
代理人_
获取转发数量最高的贺卡"
,
priority
=
6
)
public
void
代理人
_
获取转发数量最高的贺卡
(){
Response
response
=
network
.
getResponse
(
GREETING_allForward
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
...
...
@@ -113,19 +111,19 @@ public class greetingCrad implements Authorization{
greetingCardGiftId
=
response
.
jsonPath
().
getString
(
"data.get(1).id"
);
}
@Test
(
description
=
"根据page获取当前页面的Tips"
,
priority
=
7
)
public
void
根据
page
获取当前页面的
Tips
(){
@Test
(
description
=
"
代理人_
根据page获取当前页面的Tips"
,
priority
=
7
)
public
void
代理人
_
根据
page
获取当前页面的
Tips
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"page"
,
"greeting_card"
);
Response
response
=
network
.
getResponse
(
params
,
G
REETING_getTipsByPage
);
Response
response
=
network
.
getResponse
(
params
,
G
ETTIPSBYPAGE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
G
REETING_getTipsByPage
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
G
REETING_getTipsByPage
,
"返回数据为空"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
G
ETTIPSBYPAGE
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
G
ETTIPSBYPAGE
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"按类型查询标签"
,
priority
=
8
)
public
void
按类型查询标签
(){
@Test
(
description
=
"
代理人_
按类型查询标签"
,
priority
=
8
)
public
void
代理人
_
按类型查询标签
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"tagType"
,
"greeting_card"
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_findByType
);
...
...
@@ -138,8 +136,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
GREETING_findByType
,
"贺卡列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取当前用户关注公众号类型"
,
priority
=
9
)
public
void
获取当前用户关注公众号类型
(){
@Test
(
description
=
"
代理人_
获取当前用户关注公众号类型"
,
priority
=
9
)
public
void
代理人
_
获取当前用户关注公众号类型
(){
Response
response
=
network
.
getResponse
(
GREETING_oaSubscribeType
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
int
data
=
response
.
jsonPath
().
getInt
(
"data"
);
...
...
@@ -147,8 +145,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
data
,
2
,
network
.
message
(
GREETING_oaSubscribeType
,
"返回数据错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取更多贺卡列表"
,
priority
=
10
)
public
void
获取更多贺卡列表
(){
@Test
(
description
=
"
代理人_
获取更多贺卡列表"
,
priority
=
10
)
public
void
代理人
_
获取更多贺卡列表
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
"1"
);
params
.
put
(
"pageSize"
,
"10"
);
...
...
@@ -164,8 +162,8 @@ public class greetingCrad implements Authorization{
}
//获取贺卡详情页
@Test
(
description
=
"获取贺卡详情页"
,
priority
=
11
)
public
void
获取贺卡详情页
()
{
@Test
(
description
=
"
代理人_
获取贺卡详情页"
,
priority
=
11
)
public
void
代理人
_
获取贺卡详情页
()
{
//根据ContentId获取Scid
sleep
(
5000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -181,8 +179,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
greetingCardId
,
id
,
network
.
message
(
params
,
GREETING_H5INFO
,
"获取贺卡页面失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"贺卡是否可以正常访问"
,
priority
=
12
)
public
void
贺卡是否可以正常访问
()
{
@Test
(
description
=
"
代理人_
贺卡是否可以正常访问"
,
priority
=
12
)
public
void
代理人
_
贺卡是否可以正常访问
()
{
Response
response
=
network
.
getResponse
(
GREETING_check
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
...
@@ -190,8 +188,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
GREETING_check
,
"返回数据为失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取贺卡预览"
,
priority
=
13
)
public
void
获取贺卡预览
()
{
@Test
(
description
=
"
代理人_
获取贺卡预览"
,
priority
=
13
)
public
void
代理人
_
获取贺卡预览
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_preView
);
...
...
@@ -206,8 +204,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
sellerSignature
,
"吉吉"
,
network
.
message
(
GREETING_preView
,
"贺卡分享者不是吉吉"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"红包功能是否开启"
,
priority
=
14
)
public
void
红包功能是否开启
()
{
@Test
(
description
=
"
代理人_
红包功能是否开启"
,
priority
=
14
)
public
void
代理人
_
红包功能是否开启
()
{
Response
response
=
network
.
getResponse
(
GREETING_isRedpackEnable
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
...
@@ -215,8 +213,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
GREETING_isRedpackEnable
,
"返回数据为失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"判断当前用户是否是代理人自己"
,
priority
=
15
)
public
void
判断当前用户是否是代理人自己
()
{
@Test
(
description
=
"
代理人_
判断当前用户是否是代理人自己"
,
priority
=
15
)
public
void
代理人
_
判断当前用户是否是代理人自己
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_self
);
...
...
@@ -226,8 +224,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_self
,
"返回数据为失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取销售名片"
,
priority
=
16
)
public
void
获取销售名片
()
{
@Test
(
description
=
"
代理人_
获取销售名片"
,
priority
=
16
)
public
void
代理人
_
获取销售名片
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_getInfoByScid
);
...
...
@@ -242,8 +240,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
sellerName
,
"吉吉"
,
network
.
message
(
params
,
GREETING_getInfoByScid
,
"用户不是吉吉"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取代理人是否超过次数限制"
,
priority
=
17
)
public
void
获取代理人是否超过次数限制
()
{
@Test
(
description
=
"
代理人_
获取代理人是否超过次数限制"
,
priority
=
17
)
public
void
代理人
_
获取代理人是否超过次数限制
()
{
Response
response
=
network
.
getResponse
(
GREETING_checkLimit
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
...
@@ -251,8 +249,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertFalse
(
data
,
network
.
message
(
GREETING_checkLimit
,
"返回数据为失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取更多精彩贺卡"
,
priority
=
18
)
public
void
获取更多精彩贺卡
()
{
@Test
(
description
=
"
代理人_
获取更多精彩贺卡"
,
priority
=
18
)
public
void
代理人
_
获取更多精彩贺卡
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_more
);
...
...
@@ -262,8 +260,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_more
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"保存默认的贺卡"
,
priority
=
19
)
public
void
保存默认的贺卡
(){
@Test
(
description
=
"
代理人_
保存默认的贺卡"
,
priority
=
19
)
public
void
代理人
_
保存默认的贺卡
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"createSource"
,
1
);
...
...
@@ -274,8 +272,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertNotNull
(
confId
,
network
.
message
(
params
,
GREETING_saveDefault
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取H5分享信息"
,
priority
=
20
)
public
void
获取
H5
分享信息
(){
@Test
(
description
=
"
代理人_
获取H5分享信息"
,
priority
=
20
)
public
void
代理人
_
获取
H5
分享信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"v"
,
System
.
currentTimeMillis
());
params
.
put
(
"confId"
,
confId
);
...
...
@@ -289,8 +287,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
nickName
,
"吉吉"
,
network
.
message
(
params
,
GREETING_H5SHARE
,
"分享者信息错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人获取红包配置详情"
,
priority
=
21
)
public
void
代理人获取红包配置详情
(){
@Test
(
description
=
"代理人
_
获取红包配置详情"
,
priority
=
21
)
public
void
代理人
_
获取红包配置详情
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_redPacketDetail
);
...
...
@@ -305,8 +303,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertFalse
(
hasGiftConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"贺卡配置生效"
,
priority
=
22
)
public
void
贺卡配置生效
(){
@Test
(
description
=
"
代理人_
贺卡配置生效"
,
priority
=
22
)
public
void
代理人
_
贺卡配置生效
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_effective
);
...
...
@@ -316,8 +314,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_effective
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取祝福语列表"
,
priority
=
23
)
public
void
获取祝福语列表
(){
@Test
(
description
=
"
代理人_
获取祝福语列表"
,
priority
=
23
)
public
void
代理人
_
获取祝福语列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_spareBlessWordList
);
...
...
@@ -330,8 +328,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
GREETING_list
,
"祝福语列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取奖品配置信息"
,
priority
=
24
)
public
void
获取奖品配置信息
(){
@Test
(
description
=
"
代理人_
获取奖品配置信息"
,
priority
=
24
)
public
void
代理人
_
获取奖品配置信息
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_detail
);
...
...
@@ -344,8 +342,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
id
,
null
,
network
.
message
(
params
,
GREETING_list
,
"奖品信息配置错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取奖品列表"
,
priority
=
25
)
public
void
获取奖品列表
(){
@Test
(
description
=
"
代理人_
获取奖品列表"
,
priority
=
25
)
public
void
代理人
_
获取奖品列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
25
);
...
...
@@ -363,8 +361,8 @@ public class greetingCrad implements Authorization{
}
@Test
(
description
=
"修改贺卡内容及添加礼物"
,
priority
=
26
)
public
void
修改贺卡内容及添加礼物
(){
@Test
(
description
=
"
代理人_
修改贺卡内容及添加礼物"
,
priority
=
26
)
public
void
代理人
_
修改贺卡内容及添加礼物
(){
//修改称呼、祝福语、签名、分享文案
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"blessImageUrl"
,
""
);
...
...
@@ -434,8 +432,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertEquals
(
giftName
,
gift
.
getGiftName
(),
network
.
message
(
params
,
GREETING_preView
,
"分享文案-副标题修改失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"删除贺卡中的礼物"
,
priority
=
27
)
public
void
删除贺卡中的礼物
(){
@Test
(
description
=
"
代理人_
删除贺卡中的礼物"
,
priority
=
27
)
public
void
代理人
_
删除贺卡中的礼物
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_delete
);
...
...
@@ -456,8 +454,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertFalse
(
hasConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"塞红包"
,
priority
=
28
)
public
void
塞红包
(){
@Test
(
description
=
"
代理人_
塞红包"
,
priority
=
28
)
public
void
代理人
_
塞红包
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"confId"
,
confId
);
...
...
@@ -485,8 +483,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
hasConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"红包配置信息错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改礼物编辑状态"
,
priority
=
29
)
public
void
修改礼物编辑状态
(){
@Test
(
description
=
"
代理人_
修改礼物编辑状态"
,
priority
=
29
)
public
void
代理人
_
修改礼物编辑状态
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_editState
);
...
...
@@ -496,8 +494,8 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_editState
,
"修改礼物编辑状态失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取贺卡海报相关配置"
,
priority
=
30
)
public
void
获取贺卡海报相关配置
(){
@Test
(
description
=
"
代理人_
获取贺卡海报相关配置"
,
priority
=
30
)
public
void
代理人
_
获取贺卡海报相关配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
String
redirectUrl
=
HOST
+
"/kjy/mp/greeting?scid="
+
scid
+
"&confId="
+
confId
+
"&access_source=53"
;
redirectUrl
.
replace
(
":"
,
"%3A"
);
...
...
@@ -597,7 +595,7 @@ public class greetingCrad implements Authorization{
params
.
clear
();
params
.
put
(
"confId"
,
giftConfId
);
params
.
put
(
"giftId"
,
giftId
);
params
.
put
(
"totalNum"
,
3
);
params
.
put
(
"totalNum"
,
1
);
response
=
network
.
postResponse
(
params
,
GREETING_save
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
response
.
body
().
asString
());
...
...
@@ -657,7 +655,45 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
GREETING_receive
,
"领取礼物失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取已发出贺卡记录"
,
priority
=
35
)
@Test
(
description
=
"访客_礼物被领取完领取失败"
,
priority
=
35
)
public
void
访客
_
礼物被领取完领取失败
(){
//切换为访客
userTku1
();
//查看阅读记录
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
giftScid
);
params
.
put
(
"bizNo"
,
giftConfId
);
params
.
put
(
"from"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
CONTENT_READ
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
CONTENT_READ
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
CONTENT_READ
,
"获取访问贺卡记录失败"
,
response
.
body
().
asString
()));
//打开贺卡
params
.
clear
();
params
.
put
(
"scid"
,
giftScid
);
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
getResponse
(
params
,
GREETING_view
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_view
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_view
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//领取礼物
params
.
clear
();
params
.
put
(
"scid"
,
giftScid
);
params
.
put
(
"phone"
,
"13412341234"
);
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
postResponse
(
params
,
GREETING_receive
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_receive
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
GREETING_receive
,
"领取礼物失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取已发出贺卡记录"
,
priority
=
36
)
public
void
代理人
_
获取已发出贺卡记录
(){
//切换为代理人
agentTku
();
...
...
@@ -672,7 +708,7 @@ public class greetingCrad implements Authorization{
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_confList
,
"返回记录为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取已发出贺卡详情"
,
priority
=
3
6
)
@Test
(
description
=
"代理人_获取已发出贺卡详情"
,
priority
=
3
7
)
public
void
代理人
_
获取已发出贺卡详情
(){
//切换为代理人
agentTku
();
...
...
@@ -701,11 +737,11 @@ public class greetingCrad implements Authorization{
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.receiveNum"
);
giftReceiveNum
=
response
.
jsonPath
().
getInt
(
"data.giftReceiveNum"
);
Assert
.
assertEquals
(
receiveNum
,
1
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"打开贺卡人数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receiveNum
,
2
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"打开贺卡人数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
giftReceiveNum
,
1
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"领取礼物人数错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取收下贺卡用户列表"
,
priority
=
3
7
)
@Test
(
description
=
"代理人_获取收下贺卡用户列表"
,
priority
=
3
8
)
public
void
代理人
_
获取收下贺卡用户列表
(){
//红包贺卡-已收下贺卡
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -722,9 +758,18 @@ public class greetingCrad implements Authorization{
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertEquals
(
size
,
1
,
network
.
message
(
params
,
GREETING_receiveList
,
"打开贺卡人数列表错误"
,
response
.
body
().
asString
()));
//礼物贺卡-已收下贺卡
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
getResponse
(
params
,
GREETING_receiveList
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_receiveList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_receiveList
,
"返回数据为空"
,
response
.
body
().
asString
()));
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertEquals
(
size
,
2
,
network
.
message
(
params
,
GREETING_receiveList
,
"打开贺卡人数列表错误"
,
response
.
body
().
asString
()));
//礼物贺卡-已领取礼物
params
.
put
(
"type"
,
1
);
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
getResponse
(
params
,
GREETING_receiveList
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
...
...
@@ -734,9 +779,4 @@ public class greetingCrad implements Authorization{
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertEquals
(
size
,
1
,
network
.
message
(
params
,
GREETING_receiveList
,
"领取礼物人数列表错误"
,
response
.
body
().
asString
()));
}
@AfterClass
public
void
teardown
(){
apiCount
+=
37
;
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
2accc348
...
...
@@ -69,13 +69,13 @@ public class BasicConfig {
//***********************************************************************
// 基础线代理人 TKU,sid:2991
public
static
String
AGENT_TKU
=
"T3gM31f18jCFEcfTyJdjfJAfSjDmKNMHfH7CvpLDC6UCLbai6Pc41VyJK3bXHe1wg7Hb5FGFZheeLvHjbE"
;
// 基础线访客 TKU
// 基础线访客 TKU
---"请勿打扰"
public
static
String
VISITOR_TKU
=
"T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV"
;
// 基础线访客(小雪人) TKU
public
static
String
VISITOR1_TKU
=
"T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPMspUQD6pVEn2FNMefM2nieKPicXG9c1tDg8qtN"
;
// 访客的sids
public
static
final
String
sids
=
"Kj21MjMwNTU"
;
// 访客的userId(固定)
// 访客的userId(固定)
--"Su Yi"
public
static
final
int
VISITOR_USERID
=
4425
;
// 客集云公众号的oaSourceId(固定)
public
static
final
String
OASOURCE_ID
=
"gh_3b9884c7b0ee"
;
...
...
@@ -405,8 +405,6 @@ public class BasicConfig {
public
static
final
String
MOBILE_clueList
=
MOBILE_HOST
+
"/kjy/live/agent/clue/list"
;
public
static
final
String
MOBILE_livingClueStatistic
=
MOBILE_HOST
+
"/kjy/live/agent/clue/livingClueStatistic"
;
//排行榜
public
static
final
String
MOBILE_allRewardList
=
MOBILE_HOST
+
"/kjy/live/reward/allRewardList"
;
public
static
final
String
MOBILE_companyTotalData
=
MOBILE_HOST
+
"/kjy/live/team/companyTotalData"
;
...
...
@@ -788,7 +786,7 @@ public class BasicConfig {
public
static
final
String
GREETING_confList
=
HOST
+
"/kjy/mp/greeting/conf/list"
;
public
static
final
String
GREETING_H5SHARE
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/h5share"
;
public
static
final
String
GREETING_H5INFO
=
ACTIVITY_HOST
+
"/kjy/mp/content/h5info"
;
public
static
final
String
GREETING_
getTipsByPage
=
HOST
+
"/kjy/mp/tips/getTipsByPage
"
;
public
static
final
String
GREETING_
SAVEDEFAULT
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/saveDefault
"
;
public
static
final
String
GREETING_getMarketingToolArea
=
HOST
+
"/kjy/mp/home/getMarketingToolArea"
;
public
static
final
String
GREETING_answerPageList
=
HOST
+
"/kjy/mp/game/answerPageList"
;
public
static
final
String
GREETING_getSellerVipInfo
=
HOST
+
"/kjy/mp/seller/getSellerVipInfo"
;
...
...
@@ -821,6 +819,24 @@ public class BasicConfig {
public
static
final
String
GREETING_receiveDetail
=
HOST
+
"/kjy/mp/greeting/conf/detail"
;
public
static
final
String
GREETING_receiveList
=
HOST
+
"/kjy/mp/greeting/conf/receiveList"
;
//*********************抽奖转盘************************
public
static
final
String
LOTTERRY_templatePageList
=
HOST
+
"/kjy/mp/game/templatePageList"
;
public
static
final
String
LOTTERRY_check
=
HOST
+
"/kjy/mp/game/check"
;
public
static
final
String
LOTTERRY_getElements
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/getElements"
;
public
static
final
String
LOTTERRY_getConfDetail
=
HOST
+
"/kjy/mp/game/getConfDetail"
;
public
static
final
String
LOTTERRY_customerList
=
HOST
+
"/kjy/mp/seller/customer/list"
;
public
static
final
String
LOTTERRY_addWinnersEn
=
HOST
+
"/kjy/mp/game/addWinnersEn"
;
public
static
final
String
LOTTERRY_saveOrUpdateConf
=
HOST
+
"/kjy/mp/game/saveOrUpdateConf"
;
public
static
final
String
LOTTERRY_getConf
=
HOST
+
"/kjy/mp/game/getConf"
;
public
static
final
String
LOTTERRY_getH5ShareInfo
=
HOST
+
"/kjy/mp/game/getH5ShareInfo"
;
public
static
final
String
LOTTERRY_gdoJoin
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/doJoin"
;
public
static
final
String
LOTTERRY_getOrderStatus
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/getOrderStatus"
;
public
static
final
String
LOTTERRY_getRecordById
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/getRecordById"
;
public
static
final
String
LOTTERRY_commitWinnerInfo
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/commitWinnerInfo"
;
public
static
final
String
LOTTERRY_getSellerCard
=
ACTIVITY_HOST
+
"/kjy/mp/lottery/getSellerCard"
;
public
static
final
String
LOTTERRY_confPageList
=
HOST
+
"/kjy/mp/game/confPageList"
;
public
static
final
String
LOTTERRY_getDrawRecord
=
HOST
+
"/kjy/mp/game/getDrawRecord"
;
public
static
final
String
LOTTERRY_getDrawWinningRecord
=
HOST
+
"/kjy/mp/game/getDrawWinningRecord"
;
// *************** 管理后台 ***************
public
static
final
String
SSO_doLogin
=
SSO_HOST
+
"/doLogin"
;
...
...
@@ -837,4 +853,6 @@ public class BasicConfig {
public
static
final
String
MANAGER_removeMember
=
MANAGER_HOST
+
"/kjy/manager/sellerTeam/removeMember"
;
public
static
final
String
MANAGER_ID_ENCODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/encode"
;
public
static
final
String
MANAGER_TKU_DECODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/decryptTku"
;
public
static
final
String
MANAGER_searchTemplateList
=
MANAGER_HOST
+
"/kjy/manager/game/searchTemplateList"
;
public
static
final
String
MANAGER_getTemplateDetail
=
MANAGER_HOST
+
"/kjy/manager/game/getTemplateDetail"
;
}
src/test/wechatTestNG.xml
View file @
2accc348
...
...
@@ -49,10 +49,14 @@
</test>
<test
preserve-order=
"true"
name =
"贺卡"
>
<classes>
<class
name=
"com.kjj.cases.assistant.markettools.greetingCrad"
/>
<class
name=
"com.kjj.cases.assistant.markettools.GreetingCrad"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"抽奖转盘"
>
<classes>
<class
name=
"com.kjj.cases.assistant.markettools.GameLottery"
/>
</classes>
</test>
</suite>
<!-- Suite -->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment