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
ec5930a5
Commit
ec5930a5
authored
Jul 22, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了创建红包贺卡/礼物贺卡、访客开红包/领取礼物、代理人查看已发出贺卡详情的测试用例
parent
04d76684
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
512 additions
and
16 deletions
+512
-16
Gift.java
src/test/java/com/kjj/bean/gift/Gift.java
+11
-0
ArticalPersonCard.java
.../java/com/kjj/cases/assistant/card/ArticalPersonCard.java
+0
-1
greetingCrad.java
...ava/com/kjj/cases/assistant/markettools/greetingCrad.java
+480
-12
GreetingCard.java
src/test/java/com/kjj/cases/basics/GreetingCard.java
+2
-2
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+19
-1
No files found.
src/test/java/com/kjj/bean/gift/Gift.java
0 → 100644
View file @
ec5930a5
package
com
.
kjj
.
bean
.
gift
;
import
lombok.Data
;
@Data
public
class
Gift
{
String
id
;
String
giftName
;
String
giftPicUrl
;
int
giftType
;
}
src/test/java/com/kjj/cases/assistant/card/ArticalPersonCard.java
View file @
ec5930a5
...
...
@@ -326,7 +326,6 @@ public class ArticalPersonCard implements Authorization {
@AfterClass
public
static
void
tearDown
(){
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//tku 切换为访客的
apiCount
+=
16
;
}
...
...
src/test/java/com/kjj/cases/assistant/markettools/greetingCrad.java
View file @
ec5930a5
package
com
.
kjj
.
cases
.
assistant
.
markettools
;
import
com.kjj.bean.gift.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
;
...
...
@@ -9,6 +11,7 @@ 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
.
config
.
BasicConfig
.*;
...
...
@@ -16,12 +19,16 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
greetingCrad
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
String
sid
;
// 加密的销售ID
public
String
greetingCardId
;
// 文章的contentId
public
String
scid
;
// getScid后的文章scid
public
String
scId
;
// 底部名片获取的scid
public
String
greetingCardId
;
// 红包贺卡的contentId
public
String
confId
;
// 红包贺卡配置的confId
public
String
scid
;
// 红包贺卡对应的scid
public
String
giftConfId
;
// 礼物贺卡配置的confId
public
String
greetingCardGiftId
;
// 礼物贺卡的contentId
public
String
giftScid
;
// 礼物贺卡对应的scid
public
int
userId
;
// 代理人用户ID
public
String
visitId
;
// 访问记录ID
public
Gift
gift
;
//奖品
public
String
giftId
;
// 加密后的giftId
public
String
visitId
;
// 加密后的visitId
@BeforeClass
public
void
setUp
(){
...
...
@@ -104,6 +111,7 @@ public class greetingCrad implements Authorization{
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
GREETING_allForward
,
"贺卡列表为空"
,
response
.
body
().
asString
()));
greetingCardId
=
response
.
jsonPath
().
getString
(
"data.get(0).id"
);
greetingCardGiftId
=
response
.
jsonPath
().
getString
(
"data.get(1).id"
);
}
@Test
(
description
=
"根据page获取当前页面的Tips"
,
priority
=
7
)
...
...
@@ -195,8 +203,8 @@ public class greetingCrad implements Authorization{
String
blessWord
=
response
.
jsonPath
().
getString
(
"data.blessWord"
);
String
sellerSignature
=
response
.
jsonPath
().
getString
(
"data.sellerSignature"
);
Assert
.
assertNotNull
(
blessWord
,
network
.
message
(
GREETING_preView
,
"
返回数据
为空"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
sellerSignature
,
"吉吉"
,
network
.
message
(
GREETING_preView
,
"
返回数据为空
"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
blessWord
,
network
.
message
(
GREETING_preView
,
"
祝福语
为空"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
sellerSignature
,
"吉吉"
,
network
.
message
(
GREETING_preView
,
"
贺卡分享者不是吉吉
"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"红包功能是否开启"
,
priority
=
14
)
...
...
@@ -231,8 +239,8 @@ public class greetingCrad implements Authorization{
userId
=
response
.
jsonPath
().
getInt
(
"data.userId"
);
String
sellerName
=
response
.
jsonPath
().
getString
(
"data.sellerName"
);
Assert
.
assertEquals
(
userId
,
5495
,
network
.
message
(
params
,
GREETING_getInfoByScid
,
"
接口返回失败
"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
sellerName
,
"吉吉"
,
network
.
message
(
params
,
GREETING_getInfoByScid
,
"
返回数据为失败
"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
userId
,
5495
,
network
.
message
(
params
,
GREETING_getInfoByScid
,
"
用户id错误
"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
sellerName
,
"吉吉"
,
network
.
message
(
params
,
GREETING_getInfoByScid
,
"
用户不是吉吉
"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取代理人是否超过次数限制"
,
priority
=
17
)
...
...
@@ -257,20 +265,480 @@ public class greetingCrad implements Authorization{
@Test
(
description
=
"保存默认的贺卡"
,
priority
=
19
)
public
void
保存默认的贺卡
(){
sleep
(
5000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"createSource"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_saveDefault
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
confId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_saveDefault
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
confId
,
network
.
message
(
params
,
GREETING_saveDefault
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@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
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_H5SHARE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_H5SHARE
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_H5SHARE
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
nickName
=
response
.
jsonPath
().
getString
(
"data.nickname"
);
Assert
.
assertEquals
(
nickName
,
"吉吉"
,
network
.
message
(
params
,
GREETING_H5SHARE
,
"分享者信息错误"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"返回数据为空"
,
response
.
body
().
asString
()));
boolean
hasConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasConf"
);
boolean
hasGiftConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasConf"
);
Assert
.
assertFalse
(
hasConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"红包配置信息错误"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasGiftConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_effective
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_effective
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_spareBlessWordList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_spareBlessWordList
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
GREETING_list
,
"祝福语列表为空"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_detail
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_detail
,
"返回数据为空"
,
response
.
body
().
asString
()));
String
id
=
response
.
jsonPath
().
getString
(
"data.id"
);
Assert
.
assertEquals
(
id
,
null
,
network
.
message
(
params
,
GREETING_list
,
"奖品信息配置错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取奖品列表"
,
priority
=
25
)
public
void
获取奖品列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
25
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_list
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_list
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_list
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
GREETING_list
,
"奖品列表为空"
,
response
.
body
().
asString
()));
List
<
Gift
>
giftList
=
JsonUtil
.
parseResponsePathToListBean
(
response
,
"data.list"
,
Gift
.
class
);
gift
=
giftList
.
get
(
0
);
//选择第一个奖品
}
@Test
(
description
=
"修改贺卡内容及添加礼物"
,
priority
=
26
)
public
void
修改贺卡内容及添加礼物
(){
//修改称呼、祝福语、签名、分享文案
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"blessImageUrl"
,
""
);
params
.
put
(
"companyName"
,
"客集集测试公司"
);
params
.
put
(
"companyNameSwitch"
,
0
);
params
.
put
(
"confId"
,
confId
);
params
.
put
(
"nickname"
,
"用户名"
);
//称呼名
params
.
put
(
"scid"
,
"Kj20MjI0OTk5"
);
params
.
put
(
"sellerSignature"
,
"可爱的吉吉"
);
//签名
params
.
put
(
"shareSubTitle"
,
"这是生日贺卡"
);
//分享文案-主标题
params
.
put
(
"shareTitle"
,
"吉吉送的"
);
//分享文案-副标题
params
.
put
(
"visitorSignature"
,
"用户名"
);
//称呼
params
.
put
(
"blessWord"
,
"祝你生日快乐呀"
);
//祝福语
params
.
put
(
"greetings"
,
"祝你生日快乐呀"
);
//祝福语
Response
response
=
network
.
postResponse
(
params
,
GREETING_saveOrUpdate
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
String
result
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_saveOrUpdate
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
result
,
confId
,
network
.
message
(
params
,
GREETING_saveOrUpdate
,
"返回数据为空"
,
response
.
body
().
asString
()));
//添加礼物-保存礼物
params
.
clear
();
params
.
put
(
"id"
,
gift
.
getId
());
params
.
put
(
"giftName"
,
gift
.
getGiftName
());
params
.
put
(
"giftPicUrl"
,
gift
.
getGiftPicUrl
());
params
.
put
(
"giftType"
,
gift
.
getGiftType
());
params
.
put
(
"giftSource"
,
2
);
//称呼名
response
=
network
.
postResponse
(
params
,
GREETING_giftSaveOrUpdate
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
giftId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_giftSaveOrUpdate
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
giftId
,
network
.
message
(
params
,
GREETING_giftSaveOrUpdate
,
"返回礼物ID为空"
,
response
.
body
().
asString
()));
//添加礼物-保存礼物到贺卡中
params
.
clear
();
params
.
put
(
"confId"
,
confId
);
params
.
put
(
"giftId"
,
giftId
);
params
.
put
(
"totalNum"
,
1
);
response
=
network
.
postResponse
(
params
,
GREETING_save
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_save
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_save
,
"添加礼物失败"
,
response
.
body
().
asString
()));
//判断贺卡是否修改成功
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"confId"
,
confId
);
response
=
network
.
getResponse
(
params
,
GREETING_preView
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
String
sellerSignature
=
response
.
jsonPath
().
getString
(
"data.sellerSignature"
);
String
shareSubTitle
=
response
.
jsonPath
().
getString
(
"data.shareSubTitle"
);
String
shareTitle
=
response
.
jsonPath
().
getString
(
"data.shareTitle"
);
String
blessWord
=
response
.
jsonPath
().
getString
(
"data.blessWord"
);
String
giftName
=
response
.
jsonPath
().
getString
(
"data.giftName"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_preView
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
blessWord
,
"祝你生日快乐呀"
,
network
.
message
(
GREETING_preView
,
"祝福语修改失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
sellerSignature
,
"可爱的吉吉"
,
network
.
message
(
params
,
GREETING_preView
,
"签名修改失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
shareTitle
,
"吉吉送的"
,
network
.
message
(
params
,
GREETING_preView
,
"分享文案-主标题修改失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
shareSubTitle
,
"这是生日贺卡"
,
network
.
message
(
params
,
GREETING_preView
,
"分享文案-副标题修改失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
giftName
,
gift
.
getGiftName
(),
network
.
message
(
params
,
GREETING_preView
,
"分享文案-副标题修改失败"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_delete
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_delete
,
"删除礼物失败"
,
response
.
body
().
asString
()));
//查看是否删除成功
response
=
network
.
getResponse
(
params
,
GREETING_redPacketDetail
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
hasGiftConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasGiftConf"
);
boolean
hasConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasConf"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_preView
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasGiftConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"塞红包"
,
priority
=
28
)
public
void
塞红包
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"confId"
,
confId
);
params
.
put
(
"blessWord"
,
"生日的人最老大"
);
params
.
put
(
"payAmount"
,
99
);
params
.
put
(
"singleAmount"
,
33
);
params
.
put
(
"totalAmount"
,
99
);
params
.
put
(
"totalNum"
,
3
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_create
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_create
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_create
,
"返回数据为空"
,
response
.
body
().
asString
()));
//查看是否添加红包成功
params
.
clear
();
params
.
put
(
"confId"
,
confId
);
response
=
network
.
getResponse
(
params
,
GREETING_redPacketDetail
);
System
.
out
.
println
(
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
hasGiftConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasGiftConf"
);
boolean
hasConf
=
response
.
jsonPath
().
getBoolean
(
"data.hasConf"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_preView
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasGiftConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"奖品配置信息错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
hasConf
,
network
.
message
(
params
,
GREETING_redPacketDetail
,
"红包配置信息错误"
,
response
.
body
().
asString
()));
}
@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
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_editState
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_editState
,
"修改礼物编辑状态失败"
,
response
.
body
().
asString
()));
}
@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"
);
redirectUrl
.
replace
(
"/"
,
"%2F"
);
redirectUrl
.
replace
(
"?"
,
"%3F"
);
redirectUrl
.
replace
(
"&"
,
"%26"
);
redirectUrl
.
replace
(
"="
,
"%3D"
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"editScene"
,
2
);
params
.
put
(
"confId"
,
confId
);
params
.
put
(
"width"
,
128
);
params
.
put
(
"height"
,
128
);
params
.
put
(
"redirectUrl"
,
redirectUrl
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_getPosterConfig
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_getPosterConfig
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_getPosterConfig
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_打开贺卡"
,
priority
=
31
)
public
void
访客
_
打开贺卡
(){
//切换为访客
userTku
();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"bizNo"
,
confId
);
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
()));
visitId
=
response
.
jsonPath
().
getString
(
"data.visitId"
);
params
.
clear
();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"confId"
,
confId
);
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
()));
String
redPacketBlessWord
=
response
.
jsonPath
().
getString
(
"data.redPacketBlessWord"
);
Assert
.
assertEquals
(
redPacketBlessWord
,
"生日的人最老大"
,
network
.
message
(
params
,
GREETING_view
,
"接口返回失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_拆红包"
,
priority
=
32
)
public
void
访客
_
拆红包
(){
//开红包
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
postResponse
(
params
,
GREETING_open
);
System
.
out
.
println
(
GREETING_open
+
"\n"
+
response
.
body
().
asString
());
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
params
,
GREETING_open
,
"接口返回失败"
,
response
.
body
().
asString
()));
sleep
(
2000
);
//获取拆红包结果
response
=
network
.
postResponse
(
params
,
GREETING_openResult
);
System
.
out
.
println
(
GREETING_openResult
+
"\n"
+
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
result
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_openResult
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
result
,
network
.
message
(
params
,
GREETING_openResult
,
"拆红包失败"
,
response
.
body
().
asString
()));
int
redPacketState
=
response
.
jsonPath
().
getInt
(
"data.redPacketState"
);
int
receivedAmount
=
response
.
jsonPath
().
getInt
(
"data.receivedAmount"
);
Assert
.
assertEquals
(
redPacketState
,
2
,
network
.
message
(
params
,
GREETING_openResult
,
"红包领取失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
receivedAmount
,
0
,
network
.
message
(
params
,
GREETING_openResult
,
"红包领取金额错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_创建礼物贺卡"
,
priority
=
33
)
public
void
代理人
_
创建礼物贺卡
()
{
//切换代理人
agentTku
();
//进入贺卡详情
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentId"
,
greetingCardGiftId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
giftScid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
giftScid
,
network
.
message
(
params
,
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
//保存贺卡
params
.
put
(
"scid"
,
giftScid
);
params
.
put
(
"createSource"
,
1
);
response
=
network
.
postResponse
(
params
,
GREETING_saveDefault
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
giftConfId
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_saveDefault
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_saveDefault
,
"返回数据为空"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
giftConfId
,
network
.
message
(
params
,
GREETING_saveDefault
,
"返回数据为空"
,
response
.
body
().
asString
()));
//添加礼物-保存礼物到贺卡中
params
.
clear
();
params
.
put
(
"confId"
,
giftConfId
);
params
.
put
(
"giftId"
,
giftId
);
params
.
put
(
"totalNum"
,
3
);
response
=
network
.
postResponse
(
params
,
GREETING_save
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_save
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_save
,
"添加礼物失败"
,
response
.
body
().
asString
()));
//配置生效
params
.
clear
();
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
postResponse
(
params
,
GREETING_effective
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
"giftConfId:"
+
giftConfId
+
" , scid :"
+
giftScid
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_effective
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GREETING_effective
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_领取礼物"
,
priority
=
34
)
public
void
访客
_
领取礼物
(){
//切换为访客
userTku
();
//查看阅读记录
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
);
System
.
out
.
println
(
params
.
toString
());
System
.
out
.
println
(
GREETING_receive
+
"\n"
+
response
.
body
().
asString
());
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_receive
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
GREETING_receive
,
"领取礼物失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取已发出贺卡记录"
,
priority
=
35
)
public
void
代理人
_
获取已发出贺卡记录
(){
//切换为代理人
agentTku
();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_confList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_confList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_confList
,
"返回记录为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取已发出贺卡详情"
,
priority
=
36
)
public
void
代理人
_
获取已发出贺卡详情
(){
//切换为代理人
agentTku
();
//红包贺卡
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_receiveDetail
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
receiveNum
=
response
.
jsonPath
().
getInt
(
"data.receiveNum"
);
int
giftReceiveNum
=
response
.
jsonPath
().
getInt
(
"data.giftReceiveNum"
);
Assert
.
assertEquals
(
receiveNum
,
1
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"打开贺卡人数错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
giftReceiveNum
,
0
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"领取红包人数错误"
,
response
.
body
().
asString
()));
//礼物贺卡
params
.
put
(
"confId"
,
giftConfId
);
response
=
network
.
getResponse
(
params
,
GREETING_receiveDetail
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"返回数据为空"
,
response
.
body
().
asString
()));
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
(
giftReceiveNum
,
1
,
network
.
message
(
params
,
GREETING_receiveDetail
,
"领取礼物人数错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取收下贺卡用户列表"
,
priority
=
37
)
public
void
代理人
_
获取收下贺卡用户列表
(){
//红包贺卡-已收下贺卡
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"confId"
,
confId
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
params
.
put
(
"type"
,
0
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_receiveList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
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
()));
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertEquals
(
size
,
1
,
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"
);
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
,
1
,
network
.
message
(
params
,
GREETING_receiveList
,
"领取礼物人数列表错误"
,
response
.
body
().
asString
()));
}
@AfterClass
public
void
teardown
(){
apiCount
+=
37
;
}
}
src/test/java/com/kjj/cases/basics/GreetingCard.java
View file @
ec5930a5
...
...
@@ -111,9 +111,9 @@ public class GreetingCard {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_CONFLIST
);
Response
response
=
network
.
getResponse
(
params
,
GREETING_confList
);
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
>
0
;
Assert
.
assertFalse
(
hasList
,
network
.
message
(
params
,
GREETING_CONFLIST
,
"获取我的贺卡初始列表数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasList
,
network
.
message
(
params
,
GREETING_confList
,
"获取我的贺卡初始列表数量有误"
,
response
.
body
().
asString
()));
}
@AfterClass
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
ec5930a5
...
...
@@ -792,7 +792,7 @@ public class BasicConfig {
public
static
final
String
GREETING_allForward
=
HOST
+
"/kjy/mp/greeting/allForward"
;
public
static
final
String
GREETING_findByType
=
HOST
+
"/kjy/mp/tag/findByType"
;
public
static
final
String
GREETING_pageList
=
HOST
+
"/kjy/mp/greeting/pageList"
;
public
static
final
String
GREETING_
CONFLIST
=
HOST
+
"/kjy/mp/greeting/conf/list"
;
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_SAVEDEFAULT
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/saveDefault"
;
...
...
@@ -810,6 +810,24 @@ public class BasicConfig {
public
static
final
String
GREETING_checkLimit
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/checkLimit"
;
public
static
final
String
GREETING_more
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/more"
;
public
static
final
String
GREETING_saveDefault
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/saveDefault"
;
public
static
final
String
GREETING_redPacketDetail
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/redPacketDetail"
;
public
static
final
String
GREETING_effective
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/conf/effective"
;
public
static
final
String
GREETING_spareBlessWordList
=
HOST
+
"/kjy/mp/greeting/spareBlessWordList"
;
public
static
final
String
GREETING_saveOrUpdate
=
HOST
+
"/kjy/mp/greeting/conf/saveOrUpdate"
;
public
static
final
String
GREETING_list
=
HOST
+
"/kjy/mp/marketing/list"
;
public
static
final
String
GREETING_detail
=
HOST
+
"/kjy/mp/greeting/gift/detail"
;
public
static
final
String
GREETING_giftSaveOrUpdate
=
HOST
+
"/kjy/mp/marketing/saveOrUpdate"
;
public
static
final
String
GREETING_save
=
HOST
+
"/kjy/mp/greeting/gift/save"
;
public
static
final
String
GREETING_delete
=
HOST
+
"/kjy/mp/greeting/gift/delete"
;
public
static
final
String
GREETING_create
=
HOST
+
"/kjy/mp/greeting/packet/create"
;
public
static
final
String
GREETING_editState
=
HOST
+
"/kjy/mp/greeting/gift/editState"
;
public
static
final
String
GREETING_getPosterConfig
=
HOST
+
"/kjy/mp/greeting/getPosterConfig"
;
public
static
final
String
GREETING_view
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/view"
;
public
static
final
String
GREETING_open
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/packet/open"
;
public
static
final
String
GREETING_openResult
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/packet/openResult"
;
public
static
final
String
GREETING_receive
=
ACTIVITY_HOST
+
"/kjy/mp/greeting/gift/receive"
;
public
static
final
String
GREETING_receiveDetail
=
HOST
+
"/kjy/mp/greeting/conf/detail"
;
public
static
final
String
GREETING_receiveList
=
HOST
+
"/kjy/mp/greeting/conf/receiveList"
;
// *************** 管理后台 ***************
...
...
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