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
fa6bd4f4
Commit
fa6bd4f4
authored
Jul 16, 2021
by
郭姣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
今日早报、问答接口自动化用例
parent
6cff471e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
503 additions
and
21 deletions
+503
-21
DailyPaper.java
src/test/java/com/kjj/cases/assistant/DailyPaper.java
+275
-0
RecommendMaterial.java
src/test/java/com/kjj/cases/assistant/RecommendMaterial.java
+201
-17
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+22
-4
wechatTestNG.xml
src/test/wechatTestNG.xml
+5
-0
No files found.
src/test/java/com/kjj/cases/assistant/DailyPaper.java
0 → 100644
View file @
fa6bd4f4
package
com
.
kjj
.
cases
.
assistant
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.ThreadSleepUtils
;
import
org.testng.Assert
;
import
org.testng.annotations.*
;
import
io.restassured.response.Response
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.util.Date
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
DailyPaper
implements
Authorization
{
public
String
contentId
;
//获取文章id
public
String
currentId
;
//获取发圈素材id
public
int
firstTagId
;
public
Object
pId
;
//获取早晚安打开图片ID
public
Object
pUrl
;
//获取早晚安打开图片url
public
String
aUrl
;
//获取管理后台打卡图片
public
String
deleteId
;
//获取管理后台要删除的早安打卡图片的ID
@BeforeClass
public
void
setUp
()
{
BaseUtils
.
ssoLogin
();
// 创建用户 并传到network里
AGENT_TKU
=
BaseUtils
.
createTku
();
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU
=
BaseUtils
.
getTku
(
VISITOR_USERID
);
//System.out.println("访客tku:"+VISITOR_TKU);
}
@Test
(
description
=
"今日早报_获取今日早报列表"
,
priority
=
1
)
public
void
代理人
_
今日早报
_
获取今日早报列表
(){
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String dt = simpleDateFormat.format(new Date());
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"dateDay"
,
"20201021"
);
Response
response
=
network
.
getResponse
(
params
,
Daily_dailyList
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
contentId
=
response
.
jsonPath
().
getJsonObject
(
"data[0].dailyId"
);
System
.
out
.
println
(
contentId
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
Daily_dailyList
,
"获取今日早报列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_今日早报转发"
,
priority
=
2
)
public
void
今日早报
_
今日早报转发
(){
//获取今日早报scid
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"contentId"
,
contentId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GETSCID
,
"获取文章的scid失败"
,
response
.
body
().
asString
()));
//获取visitId
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<>();
infoParams
.
put
(
"scid"
,
data
);
infoParams
.
put
(
"visitPath"
,
0
);
Response
infoResponse
=
network
.
getResponse
(
infoParams
,
CONTENT_READ
);
String
visitId
=
infoResponse
.
jsonPath
().
getString
(
"data.visitId"
);
System
.
out
.
println
(
visitId
);
Assert
.
assertNotNull
(
visitId
,
network
.
message
(
params
,
CONTENT_READ
,
"访客记录查看素材失败"
,
response
.
body
().
asString
()));
//今日早报转发
Map
<
String
,
Object
>
infoParams2
=
new
HashMap
<>();
infoParams2
.
put
(
"scId"
,
data
);
infoParams2
.
put
(
"visitId"
,
visitId
);
infoParams2
.
put
(
"forwardType"
,
1
);
Response
infoResponse2
=
network
.
getResponse
(
infoParams2
,
FORWARD
);
boolean
reData
=
infoResponse2
.
jsonPath
().
getBoolean
(
"data"
);
boolean
success
=
infoResponse2
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
reData
,
network
.
message
(
infoParams2
,
FORWARD
,
"今日早报转发失败"
,
infoResponse2
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
infoParams2
,
FORWARD
,
"今日早报转发失败"
,
infoResponse2
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_今日早报首页配置"
,
priority
=
3
)
public
void
今日早报
_
今日早报首页配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"type"
,
2
);
Response
response
=
network
.
getResponse
(
params
,
Daily_getHomeConf
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
Daily_getHomeConf
,
"获取今日早报配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_发圈素材列表"
,
priority
=
4
)
public
void
今日早报
_
发圈素材列表
(){
// 获取首页发圈素材列表
Response
response
=
network
.
getResponse
(
HOME_GETHOMETIMELINECONTENT
);
currentId
=
response
.
jsonPath
().
getString
(
"data.materialVos[0].contentId"
);
Assert
.
assertNotNull
(
currentId
,
network
.
message
(
HOME_GETHOMETIMELINECONTENT
,
"获取首页发圈列表有误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_发圈素材_是否首次进入"
,
priority
=
5
)
public
void
今日早报
_
发圈素材
_
是否首次进入
(){
Response
response
=
network
.
getResponse
(
FRIENDS_ISUSERFIRSTENTERANDCOLLECT
);
String
desc
=
response
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
desc
,
"OK"
,
network
.
message
(
FRIENDS_ISUSERFIRSTENTERANDCOLLECT
,
"是否首次进入和首次收藏发圈素材列表-接口有误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_发圈素材标签列表"
,
priority
=
6
)
public
void
今日早报
_
发圈素材标签列表
(){
Response
response
=
network
.
getResponse
(
FRIENDS_GETMATERIALTAGS
);
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.size()"
)
>
0
;
int
id
=
response
.
jsonPath
().
getInt
(
"data.find {it.name == '保险'}.id"
);
//标签tab
firstTagId
=
response
.
jsonPath
().
getInt
(
"data[0].id"
);
//第一个标签的ID
Assert
.
assertTrue
(
hasList
,
network
.
message
(
FRIENDS_GETMATERIALTAGS
,
"获取tab数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
id
,
595
,
network
.
message
(
FRIENDS_GETMATERIALTAGS
,
"获取tab中不包含保险"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_发圈素材详情"
,
priority
=
7
)
public
void
今日早报
_
发圈素材详情
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"currentId"
,
currentId
);
Response
response
=
network
.
getResponse
(
params
,
FRIENDS_GETCURRENTINFO
);
String
topContentId
=
response
.
jsonPath
().
getString
(
"data.contentId"
);
Assert
.
assertEquals
(
topContentId
,
currentId
,
network
.
message
(
params
,
FRIENDS_GETCURRENTINFO
,
"从首页进入发圈的头部素材有误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_成功案例列表"
,
priority
=
8
)
public
void
今日早报
_
成功案例列表
(){
Response
response
=
network
.
getResponse
(
Daily_getHomeCaseList
);
List
<
HashMap
>
hashMapList
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
hashMapList
,
network
.
message
(
Daily_getHomeCaseList
,
"获取成功案例列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_获取案例列表"
,
priority
=
9
)
public
void
今日早报
_
获取案例列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"pageSize"
,
20
);
params
.
put
(
"pageIndex"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
Daily_getCaseList
);
String
contentId
=
response
.
jsonPath
().
getString
(
"data.list[0].contentId"
);
Assert
.
assertNotNull
(
contentId
,
network
.
message
(
params
,
Daily_getCaseList
,
"获取案例列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取客集集专区产品列表"
,
priority
=
10
)
public
void
今日早报
_
获取客集集专区产品列表
(){
Response
response
=
network
.
getResponse
(
Daily_getHomeCompanyArea
);
Object
contentList
=
response
.
jsonPath
().
getJsonObject
(
"data.contentList"
);
System
.
out
.
println
(
contentList
);
Assert
.
assertNotNull
(
contentList
,
network
.
message
(
Daily_getHomeCaseList
,
"获取客集集专区产品列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_客集集专区_获取公司专区标签"
,
priority
=
11
)
public
void
今日早报
_
客集集专区
_
获取公司专区标签
(){
Response
response
=
network
.
getResponse
(
Daily_getTagList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
Daily_getTagList
,
"获取公司专区标签列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"今日早报_客集集专区_获取资料列表"
,
priority
=
12
)
public
void
今日早报
_
客集集专区
_
获取资料列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
Daily_list
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
Daily_list
,
"获取资料列表失败"
,
response
.
body
().
asString
()
));
}
@Test
(
description
=
"获取晚安心语列表"
,
priority
=
13
)
public
void
获取晚安心语列表
(){
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
dt
=
simpleDateFormat
.
format
(
new
Date
());
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"dateDay"
,
dt
);
Response
response
=
network
.
getResponse
(
params
,
Daily_eveningList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
Daily_eveningList
,
"获取晚安心语列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"管理后台_早安打卡图片编辑"
,
priority
=
14
)
public
void
管理后台
_
早安打卡列表查询
(){
//获取早安打卡(configType= 1)图库中的的首个图片id
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"configType"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
listRes
=
network
.
getResponse
(
params
,
MANAGER_dailyPostersList
);
boolean
success
=
listRes
.
jsonPath
().
getBoolean
(
"success"
);
Object
id
=
listRes
.
jsonPath
().
getJsonObject
(
"data.list[0].id"
);
System
.
out
.
println
(
id
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_dailyPostersList
,
"获取管理后台打卡列表失败"
,
listRes
.
body
().
asString
()));
//获取早安打卡图片的详细信息
Map
<
String
,
Object
>
paramsFind
=
new
HashMap
<>();
paramsFind
.
put
(
"id"
,
id
);
Response
findRes
=
network
.
getResponse
(
paramsFind
,
MANAGER_findId
);
aUrl
=
findRes
.
jsonPath
().
getString
(
"data.imageUrl"
);
System
.
out
.
println
(
aUrl
);
boolean
successDetail
=
findRes
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
successDetail
,
network
.
message
(
paramsFind
,
MANAGER_findId
,
"获取打卡详情失败"
,
findRes
.
body
().
asString
()));
}
@Test
(
description
=
"管理后台_早安打卡新增"
,
priority
=
15
)
public
void
管理后台
_
早安打卡新增
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"configType"
,
1
);
params
.
put
(
"imageUrlConfig"
,
aUrl
);
params
.
put
(
"imgContent"
,
"测试使用"
);
long
pt
=
System
.
currentTimeMillis
();
params
.
put
(
"pushTime"
,
pt
);
Response
response
=
network
.
postResponse
(
params
,
MANAGER_addOrUpdate
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_addOrUpdate
,
"新增早安打卡图片失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
MANAGER_addOrUpdate
,
"新增早安打卡图片失败"
,
response
.
body
().
asString
()));
//获取新增的早安打卡的配置ID
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<>();
infoParams
.
put
(
"configType"
,
1
);
infoParams
.
put
(
"pageIndex"
,
1
);
infoParams
.
put
(
"pageSize"
,
10
);
Response
listRes
=
network
.
getResponse
(
infoParams
,
MANAGER_dailyPostersList
);
deleteId
=
listRes
.
jsonPath
().
getString
(
"data.list[0].id"
);
boolean
successList
=
listRes
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
successList
,
network
.
message
(
infoParams
,
MANAGER_dailyPostersList
,
"获取管理后台打卡列表失败"
,
listRes
.
body
().
asString
()));
}
@Test
(
description
=
"获取早晚安图库列表"
,
priority
=
16
)
public
void
获取早晚安图库列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"galleryType"
,
1
);
params
.
put
(
"recommend"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
HOME_selectPage
);
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
List
<
HashMap
>
hashMapList
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
pId
=
hashMapList
.
get
(
0
).
get
(
"id"
);
pUrl
=
hashMapList
.
get
(
0
).
get
(
"imageUrlConfig"
);
System
.
out
.
println
(
pId
);
System
.
out
.
println
(
list
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
HOME_selectPage
,
"获取早晚安图库列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"早安打卡"
,
priority
=
17
)
public
void
早安打卡
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
pId
);
System
.
out
.
println
(
pId
);
params
.
put
(
"imageUrlConfig"
,
pUrl
);
params
.
put
(
"clock"
,
"false"
);
Response
response
=
network
.
getResponse
(
params
,
HOME_getInfo
);
boolean
isClock
=
response
.
jsonPath
().
getBoolean
(
"data.isClock"
);
Assert
.
assertTrue
(
isClock
,
network
.
message
(
params
,
HOME_getInfo
,
"打卡失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"管理后台_删除早安打卡配置"
,
priority
=
18
)
public
void
管理后台
_
删除早安打卡配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
deleteId
);
Response
response
=
network
.
postResponse
(
params
,
MANAGER_dailyPostersDelete
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_dailyPostersDelete
,
"删除早安打卡配置失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
MANAGER_dailyPostersDelete
,
"删除早安打卡配置失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/RecommendMaterial.java
View file @
fa6bd4f4
...
...
@@ -11,6 +11,7 @@ import org.testng.annotations.*;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
RecommendMaterial
implements
Authorization
{
public
String
sid
;
//加密的销售id
public
String
grasscontentId
;
//文章内容id
...
...
@@ -20,6 +21,12 @@ public class RecommendMaterial implements Authorization {
public
String
inId
;
//获取赠险详情的id,用于删除赠险
public
String
userId
;
// 代理人用户ID
public
String
visitId
;
// 访问记录ID
public
Object
bId
;
//获取资料包id
public
String
bScid
;
//获取资料包的scid
public
String
bContentid
;
//获取资料包中的文章id
public
String
bSid
;
//获取用户的id
public
String
aScid
;
//获取资料包文章内容的scid
public
String
qId
;
//获取问答列表中的问题id
@BeforeClass
public
void
setUp
()
{
...
...
@@ -44,10 +51,11 @@ public class RecommendMaterial implements Authorization {
@Test
(
description
=
"代理人_今日早报_种草素材内容页"
,
priority
=
2
)
public
void
代理人
_
今日早报
_
种草素材内容页
()
{
//根据种草素材的ContentId获取Scid
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"contentId"
,
grasscontentId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
scid
=
response
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
scid
);
Assert
.
assertNotNull
(
scid
,
network
.
message
(
params
,
GETSCID
,
"获取文章的scid失败"
,
response
.
body
().
asString
()));
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -57,8 +65,18 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertEquals
(
grasscontentId
,
id
,
network
.
message
(
infoParams
,
ARTICLE_H5INFO
,
"获取种草文章内容失败"
,
response
.
body
().
asString
()));
}
//种草素材中资料包领取
@Test
(
description
=
"代理人_今日早报_种草资料包领取"
,
priority
=
3
)
public
void
代理人
_
今日早报
_
种草资料包领取
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
GRASS_direct
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
GRASS_direct
,
"领取文章中的资料包失败"
,
response
.
body
().
asString
()));
}
//种草文章转发
@Test
(
description
=
"代理人_今日早报_种草素材转发"
,
priority
=
3
)
@Test
(
description
=
"代理人_今日早报_种草素材转发"
,
priority
=
4
)
public
void
代理人
_
今日早报
_
种草素材转发
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scId"
,
scid
);
...
...
@@ -70,15 +88,16 @@ public class RecommendMaterial implements Authorization {
//种草素材标签列表
@Test
(
description
=
"代理人_今日早报_种草素材标签列表"
,
priority
=
4
)
@Test
(
description
=
"代理人_今日早报_种草素材标签列表"
,
priority
=
5
)
public
void
代理人
_
今日早报
_
种草素材标签列表
()
{
Response
response
=
network
.
getResponse
(
GRASS_getTagList
);
String
tagId
=
response
.
jsonPath
().
getString
(
"data[0].id"
);
System
.
out
.
println
(
tagId
);
Assert
.
assertNotNull
(
tagId
,
network
.
message
(
GRASS_getTagList
,
"获取种草素材标签列表失败"
,
response
.
body
().
asString
()));
}
//猜你想搜列表
@Test
(
description
=
"代理人_种草素材_猜你想搜列表"
,
priority
=
5
)
@Test
(
description
=
"代理人_种草素材_猜你想搜列表"
,
priority
=
6
)
public
void
代理人
_
种草素材
_
猜你想搜列表
()
{
Response
response
=
network
.
getResponse
(
GRASS_guessYourMind
);
keyWord
=
response
.
jsonPath
().
getString
(
"data[1].keyWord"
);
...
...
@@ -86,7 +105,7 @@ public class RecommendMaterial implements Authorization {
}
//搜索获取种草素材列表
@Test
(
description
=
"代理人_种草素材_搜索获取动画种草素材列表"
,
priority
=
6
)
@Test
(
description
=
"代理人_种草素材_搜索获取动画种草素材列表"
,
priority
=
7
)
public
void
代理人
_
种草素材
_
搜索获取动画种草素材列表
()
{
String
type
=
"game_animation"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -99,7 +118,7 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertNotNull
(
gameContentId
,
network
.
message
(
params
,
GRASS_searchContent
,
"获取动画种草素材列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_种草素材_搜索获取文章种草素材列表"
,
priority
=
7
)
@Test
(
description
=
"代理人_种草素材_搜索获取文章种草素材列表"
,
priority
=
8
)
public
void
代理人
_
种草素材
_
搜索获取文章种草素材列表
()
{
String
type
=
"article"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -111,7 +130,7 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertNotNull
(
gameContentId
,
network
.
message
(
params
,
GRASS_searchContent
,
"获取文章种草素材列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_种草素材_搜索获取视频种草素材列表"
,
priority
=
8
)
@Test
(
description
=
"代理人_种草素材_搜索获取视频种草素材列表"
,
priority
=
9
)
public
void
代理人
_
种草素材
_
搜索获取视频种草素材列表
()
{
String
type
=
"video"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -124,16 +143,15 @@ public class RecommendMaterial implements Authorization {
}
//获取赠险列表
@Test
(
description
=
"代理人_赠险管理_获取赠险列表"
,
priority
=
9
)
@Test
(
description
=
"代理人_赠险管理_获取赠险列表"
,
priority
=
10
)
public
void
代理人
_
赠险管理
_
获取赠险列表
()
{
Response
response
=
network
.
getResponse
(
GRASS_insuranceListV3t
);
Object
object
=
response
.
jsonPath
().
getJsonObject
(
"data.insuranceVos"
);
System
.
out
.
println
(
object
);
Assert
.
assertNotNull
(
object
,
network
.
message
(
GRASS_insuranceListV3t
,
"获取赠险列表失败"
,
response
.
body
().
asString
()));
}
//赠险详情
@Test
(
description
=
"代理人_赠险管理_赠险详情"
,
priority
=
1
0
)
@Test
(
description
=
"代理人_赠险管理_赠险详情"
,
priority
=
1
1
)
public
void
代理人
_
赠险管理
_
赠险详情
()
{
//根据赠险列表接口获取insuranceType
Response
responseParams
=
network
.
getResponse
(
GRASS_insuranceListV3t
);
...
...
@@ -147,7 +165,7 @@ public class RecommendMaterial implements Authorization {
// 编辑赠险
@Test
(
description
=
"代理人_赠险管理_新增赠险"
,
priority
=
1
1
)
@Test
(
description
=
"代理人_赠险管理_新增赠险"
,
priority
=
1
2
)
public
void
代理人
_
赠险管理
_
新增赠险
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"insuranceTitle"
,
"2222"
);
...
...
@@ -171,7 +189,8 @@ public class RecommendMaterial implements Authorization {
//删除赠险
@Test
(
description
=
"代理人_赠险管理_删除赠险"
,
priority
=
12
)
@Test
(
description
=
"代理人_赠险管理_删除赠险"
,
priority
=
13
)
public
void
代理人
_
赠险管理
_
删除赠险
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
inId
);
...
...
@@ -182,8 +201,65 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
GRASS_delInsurance
,
"删除赠险信息校验失败"
,
response
.
body
().
asString
()));
}
// 获取资料包列表
@Test
(
description
=
"代理人_获取资料包列表"
,
priority
=
14
)
public
void
代理人
_
获取资料包列表
()
{
Response
response
=
network
.
getResponse
(
GRASS_materialListV2
);
Object
obj
=
response
.
jsonPath
().
getJsonObject
(
"data.materialVos"
);
bId
=
response
.
jsonPath
().
getJsonObject
(
"data.materialVos.get(0).id"
);
Assert
.
assertNotNull
(
obj
,
network
.
message
(
GRASS_materialListV2
,
"获取赠险列表失败"
,
response
.
body
().
asString
()));
}
//获取资料包内容
@Test
(
description
=
"代理人_获取资料包内容"
,
priority
=
15
)
public
void
代理人
_
获取资料包内容
()
{
//根据资料包的id获取scid
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"contentId"
,
bId
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
bScid
=
response
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
bScid
);
Assert
.
assertNotNull
(
bScid
,
network
.
message
(
params
,
GETSCID
,
"获取资料包的scid失败"
,
response
.
body
().
asString
()));
//获取资料包内容
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<>();
infoParams
.
put
(
"scid"
,
bScid
);
Response
responseInfo
=
network
.
getResponse
(
infoParams
,
GRASS_getDetailList
);
Object
articleBlocks
=
responseInfo
.
jsonPath
().
getJsonObject
(
"data.articleBlocks"
);
bContentid
=
responseInfo
.
jsonPath
().
getJsonObject
(
"data.articleBlocks.get(0).articles.get(0).contentId"
);
System
.
out
.
println
(
bContentid
);
Assert
.
assertNotNull
(
articleBlocks
,
network
.
message
(
infoParams
,
GRASS_getDetailList
,
"获取资料包内容失败"
,
responseInfo
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取资料包中的文章"
,
priority
=
16
)
public
void
代理人
_
获取资料包中的文章
()
{
//获取用户的id
Response
response
=
network
.
getResponse
(
USER_INFO
);
bSid
=
response
.
jsonPath
().
getString
(
"data.encodeSellerId"
);
Assert
.
assertNotNull
(
bSid
,
network
.
message
(
USER_INFO
,
"获取用户id失败"
,
response
.
body
().
asString
()));
//获取资料包中文章的scid
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<>();
infoParams
.
put
(
"contentId"
,
bContentid
);
infoParams
.
put
(
"sid"
,
bSid
);
Response
responseInfo
=
network
.
getResponse
(
infoParams
,
GETSCID
);
aScid
=
responseInfo
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
aScid
,
network
.
message
(
infoParams
,
GETSCID
,
"获取scid失败"
,
responseInfo
.
body
().
asString
()));
//获取资料包中的文章
Map
<
String
,
Object
>
infoParams2
=
new
HashMap
<>();
infoParams2
.
put
(
"scid"
,
aScid
);
infoParams2
.
put
(
"datagramScid"
,
bScid
);
infoParams2
.
put
(
"needDisplayPreNext"
,
1
);
Response
responseInfo2
=
network
.
getResponse
(
infoParams2
,
GRASS_getArticleInfo
);
Object
data
=
responseInfo2
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
infoParams2
,
GRASS_getArticleInfo
,
"获取文章失败"
,
responseInfo2
.
body
().
asString
()));
}
//******************** 访客 **********************8
@Test
(
description
=
"访客_记录查看素材"
,
priority
=
1
3
)
@Test
(
description
=
"访客_记录查看素材"
,
priority
=
1
7
)
public
void
访客
_
记录查看素材
()
{
//tKu 切换为访客
network
.
agentCookies
.
put
(
"tKu"
,
VISITOR_TKU
);
...
...
@@ -197,7 +273,8 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertNotNull
(
visitId
,
network
.
message
(
params
,
CONTENT_READ
,
"访客记录查看素材失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客_文章内容页"
,
priority
=
14
)
@Test
(
description
=
"访客_文章内容页"
,
priority
=
18
)
public
void
访客
_
文章内容页
()
{
Map
<
String
,
Object
>
infoParams
=
new
HashMap
<>();
infoParams
.
put
(
"scid"
,
scid
);
...
...
@@ -206,8 +283,8 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertEquals
(
grasscontentId
,
id
,
network
.
message
(
infoParams
,
ARTICLE_H5INFO
,
"访客查看文章失败"
,
response
.
body
().
asString
()));
}
//是否爆款素材
@Test
(
description
=
"访客_文章类型判断"
,
priority
=
1
5
)
@Test
(
description
=
"访客_文章类型判断"
,
priority
=
1
9
)
public
void
访客
_
文章类型判断
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
grasscontentId
);
...
...
@@ -224,7 +301,114 @@ public class RecommendMaterial implements Authorization {
Assert
.
assertNotNull
(
tags
,
network
.
message
(
infoParams
,
ARTICLE_GETEXPINFO
,
"访客-获取文章标签有误"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
recommendReason
,
network
.
message
(
infoParams
,
ARTICLE_GETEXPINFO
,
"访客-获取文章推荐理由有误"
,
response
.
body
().
asString
()));
}
}
// 获取互动区-专业解读
@Test
(
description
=
"访客_互动区-专业解读"
,
priority
=
20
)
public
void
访客
_
互动区
_
专业解读
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETCONTENTS
);
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
>
0
;
Assert
.
assertTrue
(
hasList
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETCONTENTS
,
"访客-获取专业解读列表有误"
,
response
.
body
().
asString
()));
}
// 获取互动区-互动问答
@Test
(
description
=
"访客_互动区-互动问答"
,
priority
=
21
)
public
void
访客
_
互动区
_
互动问答
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
2
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
);
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
>
0
;
Assert
.
assertTrue
(
hasList
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取个人专栏列表有误"
,
response
.
body
().
asString
()));
String
answer
=
response
.
jsonPath
().
getString
(
"data.list[0].answer"
);
qId
=
response
.
jsonPath
().
getString
(
"data.list[0].questionId"
);
System
.
out
.
println
(
qId
);
Assert
.
assertNotNull
(
answer
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取问答内容有误"
,
response
.
body
().
asString
()));
}
//获取互动问答详情
@Test
(
description
=
"获取互动问答详情"
,
priority
=
22
)
public
void
获取互动问答详情
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"qId"
,
qId
);
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_getQuestionDetail
);
Object
obj
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
obj
,
network
.
message
(
params
,
ARTICLE_getQuestionDetail
,
"获取互动问答详情失败"
,
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
,
ARTICLE_ISDISPLAYACTIVITY
);
boolean
isDisplay
=
response
.
jsonPath
().
getBoolean
(
"data.isDisplay"
);
String
riskScid
=
response
.
jsonPath
().
getString
(
"data.scid"
);
Assert
.
assertTrue
(
isDisplay
,
network
.
message
(
params
,
ARTICLE_ISDISPLAYACTIVITY
,
"访客-互动区-风险评测显示有误"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
riskScid
,
network
.
message
(
params
,
ARTICLE_ISDISPLAYACTIVITY
,
"访客-互动区-风险评测内容有误"
,
response
.
body
().
asString
()));
}
// 获取代理人个人专栏
@Test
(
description
=
"访客_代理人个人专栏"
,
priority
=
24
)
public
void
访客
_
代理人个人专栏
()
{
// 先获取代理人个人专栏设置
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_GETENHANCEDCOLUMNCONFIG
);
boolean
isOpen
=
response
.
jsonPath
().
getBoolean
(
"data.find {it.code == 'personal_document_switch'}.val"
);
Assert
.
assertTrue
(
isOpen
,
network
.
message
(
params
,
ARTICLE_GETENHANCEDCOLUMNCONFIG
,
"访客-获取代理人日常精准素材个人专栏开关有误"
,
response
.
body
().
asString
()));
//tku 切换为代理人的
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//关闭 代理人个人专栏开关
Map
<
String
,
Object
>
configParams
=
new
HashMap
<
String
,
Object
>();
configParams
.
put
(
"configKey"
,
"personal_document_switch"
);
configParams
.
put
(
"configValue"
,
false
);
response
=
network
.
postResponse
(
configParams
,
SELLERCONFIG_EDITCONFIG
);
//tku 切换为访客的
network
.
agentCookies
.
put
(
"tku"
,
VISITOR_TKU
);
//再获取代理人个人专栏
response
=
network
.
getResponse
(
params
,
ARTICLE_GETENHANCEDCOLUMNCONFIG
);
isOpen
=
response
.
jsonPath
().
getBoolean
(
"data.find {it.code == 'personal_document_switch'}.val"
);
Assert
.
assertFalse
(
isOpen
,
network
.
message
(
params
,
ARTICLE_GETENHANCEDCOLUMNCONFIG
,
"访客-获取代理人日常精准素材个人专栏开关有误"
,
response
.
body
().
asString
()));
//tku 切换为代理人的
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//再次开启 代理人个人专栏开关
configParams
.
put
(
"configKey"
,
"personal_document_switch"
);
configParams
.
put
(
"configValue"
,
true
);
response
=
network
.
postResponse
(
configParams
,
SELLERCONFIG_EDITCONFIG
);
//tku 切换为访客的
network
.
agentCookies
.
put
(
"tku"
,
VISITOR_TKU
);
}
// 获取代理人个人专栏
@Test
(
description
=
"访客_获取代理人私信"
,
priority
=
25
)
public
void
访客
_
获取代理人私信
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"t"
,
System
.
currentTimeMillis
());
Response
response
=
network
.
getResponse
(
params
,
CHECKUNREAD
);
String
desc
=
response
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
desc
,
"OK"
,
network
.
message
(
params
,
CHECKUNREAD
,
"访客-获取私信有误"
,
response
.
body
().
asString
()));
}
@AfterClass
public
void
tearDown
()
{
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//tku 切换为访客的
apiCount
+=
13
;
}
}
\ No newline at end of file
src/test/java/com/kjj/config/BasicConfig.java
View file @
fa6bd4f4
...
...
@@ -674,6 +674,7 @@ public class BasicConfig {
public
static
final
String
ARTICLE_GETENHANCEDCOLUMNCONFIG
=
HOST
+
"/kjy/mp/sellerConfig/getEnhancedColumnConfig"
;
public
static
final
String
ARTICLE_ENHANCEDCOLUMN_GETCONTENTS
=
HOST
+
"/kjy/mp/enhancedColumn/getContents"
;
public
static
final
String
ARTICLE_ENHANCEDCOLUMN_GETFAQS
=
HOST
+
"/kjy/mp/enhancedColumn/getFAQs"
;
public
static
final
String
ARTICLE_getQuestionDetail
=
HOST
+
"/kjy/mp/explosioncontent/qa/getQuestionDetail"
;
public
static
final
String
ARTICLE_GETEXPLOSIONCONTENTLIST
=
HOST
+
"/kjy/mp/explosioncontent/getExplosionContentList"
;
...
...
@@ -698,11 +699,26 @@ public class BasicConfig {
public
static
final
String
GRASS_lastInsurance
=
HOST
+
"/kjy/mp/welfare/lastInsurance"
;
public
static
final
String
GRASS_editInsurance
=
HOST
+
"/kjy/mp/welfare/editInsurance"
;
public
static
final
String
GRASS_delInsurance
=
HOST
+
"/kjy/mp/welfare/delInsurance"
;
public
static
final
String
GRASS_materialListV2
=
HOST
+
"/kjy/mp/welfare/materialListV2"
;
public
static
final
String
GRASS_getDetailList
=
HOST
+
"/kjy/mp/datagram/getDetailList"
;
public
static
final
String
GRASS_getArticleInfo
=
HOST
+
"/kjy/mp/datagram/getArticleInfo"
;
public
static
final
String
GRASS_direct
=
HOST
+
"/kjy/mp/user/direct"
;
// ************* 今日早报 *********
public
static
final
String
Daily_dailyList
=
HOST
+
"/kjy/mp/gatherPage/dailyList"
;
public
static
final
String
Daily_getHomeConf
=
HOST
+
"/kjy/mp/home/getHomeConf"
;
public
static
final
String
Daily_getHomeCaseList
=
HOST
+
"/kjy/mp/successCases/getHomeCaseList"
;
public
static
final
String
Daily_getCaseList
=
HOST
+
"/kjy/mp/successCases/getCaseList"
;
public
static
final
String
Daily_getHomeCompanyArea
=
HOST
+
"/kjy/mp/home/getHomeCompanyArea"
;
public
static
final
String
Daily_getTagList
=
HOST
+
"/kjy/mp/companyArea/getTagList"
;
public
static
final
String
Daily_getContentList
=
HOST
+
"/kjy/mp/companyArea/getContentList"
;
public
static
final
String
Daily_list
=
HOST
+
"/kjy/mp/companyDocument/list"
;
public
static
final
String
Daily_eveningList
=
HOST
+
"/kjy/mp/gatherPage/eveningList"
;
// ************** 首页 ****************
public
static
final
String
HOME_GETHOMETIMELINECONTENT
=
HOST
+
"/kjy/mp/home/getHomeTimeLineContent"
;
public
static
final
String
HOME_getInfo
=
HOST
+
"/kjy/mp/dailyPoster/getInfo"
;
public
static
final
String
HOME_selectPage
=
HOST
+
"/kjy/mp/dailyPoster/selectPage"
;
// ************** 设置中心 ***************
public
static
final
String
SELLERCONFIG_EDITCONFIG
=
HOST
+
"/kjy/mp/sellerConfig/editConfig"
;
...
...
@@ -747,6 +763,8 @@ public class BasicConfig {
public
static
final
String
MANAGER_PROMOTIONCODELIST
=
MANAGER_HOST
+
"/kjy/manager/promotionCode/codeList"
;
public
static
final
String
MANAGER_PROMOTIONBATCHMODIFY
=
MANAGER_HOST
+
"/kjy/manager/promotionCode/batchModify"
;
public
static
final
String
MANAGER_PROMOTIONCODEBATCHDETAIL
=
MANAGER_HOST
+
"/kjy/manager/promotionCode/batchDetail"
;
public
static
final
String
MANAGER_dailyPostersList
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/list"
;
public
static
final
String
MANAGER_findId
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/findById"
;
public
static
final
String
MANAGER_addOrUpdate
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/addOrUpdate"
;
public
static
final
String
MANAGER_dailyPostersDelete
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/delete"
;
}
src/test/wechatTestNG.xml
View file @
fa6bd4f4
...
...
@@ -56,6 +56,11 @@
<class
name=
"com.kjj.cases.assistant.RecommendMaterial"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"今日早报"
>
<classes>
<class
name=
"com.kjj.cases.assistant.DailyPaper"
/>
</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