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
ec90ff4e
Commit
ec90ff4e
authored
Jul 19, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
谁看过我首页+团队看板case
parent
f7c26e90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
466 additions
and
1 deletion
+466
-1
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+446
-0
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+20
-1
No files found.
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
0 → 100644
View file @
ec90ff4e
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
;
import
com.beust.jcommander.internal.Lists
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
AGENT_TKU
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
BOSS_EDITCONFIG
;
public
class
WhoSawMe
implements
Authorization
{
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
String
AGENT1_TKU
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
// 代理人授权
agentTku
();
BaseUtils
.
ssoLogin
();
// 赋值
AGENT1_TKU
=
"T3gM31f18jCeKCBVHf5MANgyXeBZGCm8vTJQTuWYXHFqxAxq2TQ27ozxyRsZykZBimiwFTrzQnGLWkvAs4"
;
// 关闭数据看板演示数据
param
=
new
HashMap
<>();
param
.
put
(
"configKey"
,
"boss_board_demon_switch"
);
param
.
put
(
"configValue"
,
false
);
response
=
network
.
postResponse
(
param
,
BOSS_EDITCONFIG
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BOSS_EDITCONFIG
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BOSS_EDITCONFIG
,
"关闭演示数据开关失败"
,
response
.
body
().
asString
()));
}
// 进入谁扛过我主页
// 判断代理人是否新会员
@Test
(
description
=
"首页_判断是否新会员"
,
priority
=
1
)
public
void
判断是否新会员
()
throws
IOException
{
// 判断是否新会员
param
=
new
HashMap
<>();
param
.
put
(
"vipGuideType"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
HOST
+
"/kjy/mp/rookieGuide/isNewVipByType"
);
Boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertEquals
(
success
,
Boolean
.
TRUE
,
network
.
message
(
BasicConfig
.
HOST
+
"/kjy/mp/rookieGuide/isNewVipByType"
,
"判断代理人是否新会员失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
BasicConfig
.
HOST
+
"/kjy/mp/rookieGuide/isNewVipByType"
,
"新老会员判断错误,预期为新会员判断为老会员"
,
response
.
body
().
asString
()));
}
// 获取代理人用户信息
@Test
(
description
=
"首页_获取代理人用户信息"
,
priority
=
2
)
public
void
获取代理人用户信息
()
throws
IOException
{
// 获取代理人用户信息
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
USER_INFO
,
"获取代理人用户信息失败"
,
response
.
body
().
asString
()));
String
wxName
=
response
.
jsonPath
().
getString
(
"data.wxName"
);
Assert
.
assertEquals
(
wxName
,
BasicConfig
.
WECHAT_NAME
,
network
.
message
(
BasicConfig
.
USER_INFO
,
"代理人微信昵称获取有误,预期为"
+
BasicConfig
.
WECHAT_NAME
,
response
.
body
().
asString
()));
}
// 获取当前页面Tips
@Test
(
description
=
"首页_获取当前页面Tips"
,
priority
=
3
)
public
void
获取当前页面
Tips
()
throws
IOException
{
// 根据page获取当前页面tips
param
=
new
HashMap
<>();
String
page
=
"who_saw_me"
;
param
.
put
(
"page"
,
page
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
GETTIPSBYPAGE
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Boolean
isShowTips
=
response
.
jsonPath
().
getBoolean
(
"data.isShowTips"
);
Integer
jumpType
=
response
.
jsonPath
().
getInt
(
"data.jumpType"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
GETTIPSBYPAGE
,
"获取当前页面tips失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
GETTIPSBYPAGE
,
"获取当前页面tips失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
isShowTips
,
network
.
message
(
BasicConfig
.
GETTIPSBYPAGE
,
"获取isShowTips值失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
jumpType
,
network
.
message
(
BasicConfig
.
GETTIPSBYPAGE
,
"获取跳转类型失败"
,
response
.
body
().
asString
()));
}
// 查询代理人当前使用版本
@Test
(
description
=
"首页_查询使用版本"
,
priority
=
4
)
public
void
查询代理人当前使用版本
()
throws
IOException
{
param
=
new
HashMap
<>();
String
sellerIdEncode
=
encodeSellerId
(
getSellerId
());
param
.
put
(
"sellerId"
,
sellerIdEncode
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
USING_VERSION
);
String
userVersion
=
response
.
jsonPath
().
getString
(
"data.userVersion"
);
Assert
.
assertEquals
(
userVersion
,
"2"
,
network
.
message
(
BasicConfig
.
USING_VERSION
,
"代理人当前使用版本错误,实际为2.保险专业版"
,
response
.
body
().
asString
()));
}
// 判断是否今日首次进入
@Test
(
description
=
"判断是否今日首次进入"
,
priority
=
5
)
public
void
判断是否今日首次进入
()
throws
IOException
{
// 判断是否今日首次进入
response
=
network
.
getResponse
(
BasicConfig
.
DAILY_FIRST
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Boolean
needShow
=
response
.
jsonPath
().
getBoolean
(
"data.needShow"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
DAILY_FIRST
,
"判断是否今日首次进入失败,data字段为空"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
needShow
,
network
.
message
(
BasicConfig
.
DAILY_FIRST
,
"判断是否今日首次进入失败,data.needShow字段为空"
,
response
.
body
().
asString
()));
}
// 判断是否展示续费弹窗
@Test
(
description
=
"判断是否展示续费弹窗"
,
priority
=
6
)
public
void
判断是否展示续费弹窗
()
throws
IOException
{
// 判断是否展示续费弹窗
response
=
network
.
getResponse
(
BasicConfig
.
LAYER_RENEW
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
LAYER_RENEW
,
"判断是否展示续费弹窗失败,data为空"
,
response
.
body
().
asString
()));
}
// 判断是否展示邀请弹窗
@Test
(
description
=
"展示邀请活动弹窗"
,
priority
=
7
)
public
void
展示邀请活动弹窗
()
throws
IOException
{
// 邀请活动弹窗
response
=
network
.
getResponse
(
BasicConfig
.
DISTRIBUTION_LAYER
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
DISTRIBUTION_LAYER
,
"判断是否展示邀请活动弹窗失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
DISTRIBUTION_LAYER
,
"判断是否展示邀请活动弹窗失败,data为空"
,
response
.
body
().
asString
()));
}
// 判断是否展示线索页新手引导
@Test
(
description
=
"获取线索页新手引导"
,
priority
=
8
)
public
void
获取线索页新手引导
()
throws
IOException
{
// 获取线索页新手引导
response
=
network
.
getResponse
(
BasicConfig
.
ROOKIECLUEGUIDE
);
Boolean
showClueGuide
=
response
.
jsonPath
().
getBoolean
(
"data.showClueGuide"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
ROOKIECLUEGUIDE
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
response
.
jsonPath
().
getJsonObject
(
"data"
),
network
.
message
(
BasicConfig
.
ROOKIECLUEGUIDE
,
"获取线索页新手引导失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
showClueGuide
,
network
.
message
(
BasicConfig
.
ROOKIECLUEGUIDE
,
"获取showClueGuide值失败"
,
response
.
body
().
asString
()));
}
// 获取周报首页数据
@Test
(
description
=
"获取周报首页数据"
,
priority
=
9
)
public
void
获取周报首页数据
()
throws
IOException
{
// 获取周报首页数据
response
=
network
.
getResponse
(
BasicConfig
.
SELLERWEEKLY
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
SELLERWEEKLY
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
SELLERWEEKLY
,
"获取周报首页数据失败"
,
response
.
body
().
asString
()));
}
// 获取代理人标签列表
@Test
(
description
=
"获取代理人标签列表"
,
priority
=
10
)
public
void
获取代理人标签列表
()
throws
IOException
{
// 获取代理人标签列表
response
=
network
.
getResponse
(
BasicConfig
.
HOST
+
"/kjy/mp/sellerTag/getTagList"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
HOST
+
"/kjy/mp/sellerTag/getTagList"
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
HOST
+
"/kjy/mp/sellerTag/getTagList"
,
"获取代理人标签列表失败"
,
response
.
body
().
asString
()));
}
// 获取首页来访统计
@Test
(
description
=
"获取谁看过我首页来访统计"
,
priority
=
11
)
public
void
来访统计
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
VISITHEADER
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
todayClueNum
=
response
.
jsonPath
().
getString
(
"data.todayClueNum"
);
String
todayVisitNum
=
response
.
jsonPath
().
getString
(
"data.todayVisitNum"
);
String
totalVisitNum
=
response
.
jsonPath
().
getString
(
"data.totalVisitNum"
);
Assert
.
assertNotNull
(
todayClueNum
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
todayVisitNum
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
totalVisitNum
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取累计访问数失败"
,
response
.
body
().
asString
()));
}
// 进入运营周报首页
@Test
(
description
=
"进入运营周报首页"
,
priority
=
12
)
public
void
进入运营周报首页
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
WEEKLY_LIST
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
WEEKLY_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 进入团队看板首页
@Test
(
description
=
"进入团队看板首页"
,
priority
=
13
)
public
void
进入团队看板首页
()
throws
IOException
{
// 获取当前页面Tips
param
.
clear
();
param
.
put
(
"page"
,
"data_board"
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
GETTIPSBYPAGE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
String
tipsContent
=
response
.
jsonPath
().
getString
(
"data.tipsContent"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
GETTIPSBYPAGE
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
tipsContent
,
"数据看板-tips"
,
network
.
message
(
param
,
BasicConfig
.
GETTIPSBYPAGE
,
"当前页面Tips错误,实际为 数据看板"
,
response
.
body
().
asString
()));
// 获取我的上级名称
param
.
clear
();
param
.
put
(
"sellerId"
,
getSellerId
());
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_BOSS
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
BOSS_BOSS
,
"获取上级名称失败"
,
response
.
body
().
asString
()));
}
// 邀请成员加入团队
@Test
(
description
=
"生成团队邀请码"
,
priority
=
14
)
public
void
生成团队邀请码
()
throws
IOException
{
Integer
inviteType
=
2
;
param
=
new
HashMap
<>();
param
.
put
(
"inviteType"
,
inviteType
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_CODE
);
Object
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
BasicConfig
.
BOSS_CODE
,
"获取团队邀请码失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"其他代理人加入该代理人团队"
,
priority
=
15
)
public
void
邀请加入团队
()
throws
IOException
{
// 切换代理人加入团队
Long
sellerId
=
getSellerId
();
network
.
agentCookies
.
put
(
"tku"
,
AGENT1_TKU
);
// 确定被邀请代理人没有上级
response
=
network
.
getResponse
(
BasicConfig
.
BOSS_ROLE
);
boolean
hasSuperior
=
response
.
jsonPath
().
getBoolean
(
"data.hasSuperior"
);
Assert
.
assertFalse
(
hasSuperior
,
network
.
message
(
BasicConfig
.
BOSS_ROLE
,
"该代理人已有上级"
,
response
.
body
().
asString
()));
// 代理人加入团队
param
=
new
HashMap
<>();
param
.
put
(
"inviterSid"
,
sellerId
);
param
.
put
(
"inviteType"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_BOUND
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
param
,
BasicConfig
.
BOSS_BOUND
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
BOSS_BOUND
,
"添加代理人进入团队失败"
,
response
.
body
().
asString
()));
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
}
@Test
(
description
=
"查看被邀请代理人上级名称"
,
priority
=
16
)
public
void
查看上级名称
()
throws
IOException
{
// 获取被邀请代理人sellerId
Long
sellerId
=
(
Long
)
decodeTku
(
AGENT1_TKU
).
get
(
"sellerId"
);
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
sellerId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_BOSS
);
String
bossName
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
BOSS_BOSS
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
bossName
,
BasicConfig
.
WECHAT_NAME
,
network
.
message
(
param
,
BasicConfig
.
BOSS_BOSS
,
"被邀请人上级名称与邀请人不一致"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"删除团队成员"
,
priority
=
17
)
public
void
删除团队成员
()
throws
IOException
{
// 获取下级代理人sellerId
Long
childSellerId
=
(
Long
)
decodeTku
(
AGENT1_TKU
).
get
(
"sellerId"
);
// 登陆管理后台调用管理后台接口删除成员
param
=
new
HashMap
<>();
param
.
put
(
"superiorSid"
,
getSellerId
());
param
.
put
(
"childSid"
,
childSellerId
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
MANAGER_SELLERTEAM_REMOVEMEMBER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
MANAGER_SELLERTEAM_REMOVEMEMBER
,
"删除成员失败"
,
response
.
body
().
asString
()));
// 切换到被删除代理人确认已没有上级
network
.
agentCookies
.
put
(
"tku"
,
AGENT1_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
BOSS_ROLE
);
boolean
hasSuperior
=
response
.
jsonPath
().
getBoolean
(
"data.hasSuperior"
);
Assert
.
assertFalse
(
hasSuperior
,
network
.
message
(
BasicConfig
.
BOSS_ROLE
,
"该代理人还有上级"
,
response
.
body
().
asString
()));
network
.
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
}
// 转发素材
@Test
(
description
=
"转发素材"
,
priority
=
18
)
public
void
转发素材
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
String
scId
=
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
);
// 获取文章scId
param
=
new
HashMap
<>();
param
.
put
(
"scId"
,
scId
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"转发素材失败"
,
response
.
body
().
asString
()));
}
// 查看今日转发素材列表
@Test
(
description
=
"查看今日转发素材列表"
,
priority
=
19
)
public
void
查看转发素材列表
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
());
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MATERIALLIST
);
String
contentId
=
response
.
jsonPath
().
getString
(
"data.list[0].contentId"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
MATERIALLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentId
,
BasicConfig
.
ARTICLE_CONTENTID
,
network
.
message
(
param
,
BasicConfig
.
MATERIALLIST
,
"首条转发文章contentId不符合预期"
,
response
.
body
().
asString
()));
}
// 转发名片
@Test
(
description
=
"转发名片"
,
priority
=
20
)
public
void
转发名片
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
String
scId
=
network
.
getResponse
(
BasicConfig
.
SELLERCARD_TOPOFDETAIL
).
jsonPath
().
getString
(
"data.scid"
);
param
=
new
HashMap
<>();
param
.
put
(
"scId"
,
scId
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
boolean
forwardResult
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
forwardResult
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"转发名片失败"
,
response
.
body
().
asString
()));
}
// 查看转发名片记录列表
@Test
(
description
=
"查看转发名片记录列表"
,
priority
=
21
)
public
void
查看转发名片记录列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
());
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARDCARDLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARDCARDLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
response
.
jsonPath
().
getJsonObject
(
"data.list"
),
network
.
message
(
param
,
BasicConfig
.
FORWARDCARDLIST
,
"获取转发名片记录列表失败"
,
response
.
body
().
asString
()));
}
// 使用工具
@Test
(
description
=
"使用工具"
,
priority
=
22
)
public
void
使用工具
()
throws
IOException
{
// 生成抽奖转盘素材scId
String
lottery_scId
=
getContentScId
(
BasicConfig
.
LOTTERY_CONTENTID
);
// 分享抽奖
param
=
new
HashMap
<>();
param
.
put
(
"scId"
,
lottery_scId
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"分享抽奖活动失败"
,
response
.
body
().
asString
()));
}
// 查看使用工具记录列表
@Test
(
description
=
"查看使用工具记录列表"
,
priority
=
23
)
public
void
查看使用工具记录列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
());
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MARKETINGTOOLLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
MARKETINGTOOLLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
firstRecordContentId
=
response
.
jsonPath
().
getString
(
"data.list[0].contentId"
);
Assert
.
assertEquals
(
firstRecordContentId
,
BasicConfig
.
LOTTERY_CONTENTID
,
network
.
message
(
param
,
BasicConfig
.
MARKETINGTOOLLIST
,
"首条记录素材Id与预期不匹配"
,
response
.
body
().
asString
()));
}
// 查看获得线索记录列表
@Test
(
description
=
"查看获得线索记录列表"
,
priority
=
24
)
public
void
查看获得线索记录列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
());
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
SALECLUELIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SALECLUELIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 查看转发动态访问列表
@Test
(
description
=
"查看转发动态访问列表"
,
priority
=
25
)
public
void
查看转发动态访问列表
()
throws
IOException
{
// 获取首条素材列表中首条动态id
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
());
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MATERIALLIST
);
Long
dynamicId
=
response
.
jsonPath
().
getLong
(
"data.list[0].id"
);
// 按照动态id查看动态访问列表
param
=
new
HashMap
<>();
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"dynamicId"
,
dynamicId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
GETVISITLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
GETVISITLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 查看谁看过我首页我的访客列表
@Test
(
description
=
"查看我的访客列表"
,
priority
=
26
)
public
void
查看我的访客列表
()
throws
IOException
{
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
param
=
new
HashMap
<>();
param
.
put
(
"customerTagIds"
,
customerTagIds
);
param
.
put
(
"lastClueId"
,
0
);
param
.
put
(
"listType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
WHOSAWME_CUSTCLUELISTV3
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_CUSTCLUELISTV3
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_CUSTCLUELISTV3
,
"获取我的访客列表失败"
,
response
.
body
().
asString
()));
}
// 获取代理人sellerId
public
Long
getSellerId
(){
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
Long
sellerId
=
response
.
jsonPath
().
getLong
(
"data.sellerId"
);
Assert
.
assertNotNull
(
sellerId
,
network
.
message
(
BasicConfig
.
USER_INFO
,
"获取代理人sellerId失败"
,
response
.
body
().
asString
()));
return
sellerId
;
}
// 通过素材contentId获取线索员文章scId
public
String
getContentScId
(
String
contentId
){
param
=
new
HashMap
<>();
param
.
put
(
"contentId"
,
contentId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
GETSCID
);
String
contentScid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
contentScid
,
network
.
message
(
param
,
BasicConfig
.
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
return
contentScid
;
}
// 加密sellerId
public
String
encodeSellerId
(
Long
sellerId
){
// 登陆管理后台
param
=
new
HashMap
<>();
param
.
put
(
"code"
,
sellerId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MANAGER_SELLERID_ENCODE
);
String
sIds
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
sIds
,
network
.
message
(
param
,
BasicConfig
.
MANAGER_SELLERID_ENCODE
,
"加密sellerId失败"
,
response
.
body
().
asString
()));
return
sIds
;
}
// 解密sellerId
public
HashMap
<
String
,
Object
>
decodeTku
(
String
tku
){
// 登陆管理后台
param
=
new
HashMap
<>();
param
.
put
(
"tku"
,
tku
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MANAGER_TKU_DECODE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
MANAGER_TKU_DECODE
,
"接口请求失败"
,
response
.
body
().
asString
()));
Long
userId
=
response
.
jsonPath
().
getLong
(
"data.userId"
);
Long
sellerId
=
response
.
jsonPath
().
getLong
(
"data.sellerId"
);
Assert
.
assertNotNull
(
userId
,
network
.
message
(
param
,
BasicConfig
.
MANAGER_TKU_DECODE
,
"获取userId失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
userId
,
network
.
message
(
param
,
BasicConfig
.
MANAGER_TKU_DECODE
,
"获取userId失败"
,
response
.
body
().
asString
()));
HashMap
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"userId"
,
userId
);
result
.
put
(
"sellerId"
,
sellerId
);
return
result
;
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
ec90ff4e
...
@@ -578,6 +578,7 @@ public class BasicConfig {
...
@@ -578,6 +578,7 @@ public class BasicConfig {
public
static
final
String
ANIMATION_CONTENTID
=
"Kj21MzgzMTk"
;
public
static
final
String
ANIMATION_CONTENTID
=
"Kj21MzgzMTk"
;
public
static
final
String
GAME_CONTENTID
=
"Kj21NjIxNTk"
;
public
static
final
String
GAME_CONTENTID
=
"Kj21NjIxNTk"
;
public
static
final
String
UPLOAD_CONTENTID
=
"Kj21NjA1NTE"
;
public
static
final
String
UPLOAD_CONTENTID
=
"Kj21NjA1NTE"
;
public
static
final
String
LOTTERY_CONTENTID
=
"Kj21MzQ3ODM"
;
// 营销工具抽奖暖冬大转盘素材ID
// *************** 公共 ***************
// *************** 公共 ***************
public
static
final
String
CREATE_USER
=
HOST
+
"/kjy/mp/autotest/create/user"
;
public
static
final
String
CREATE_USER
=
HOST
+
"/kjy/mp/autotest/create/user"
;
...
@@ -592,7 +593,15 @@ public class BasicConfig {
...
@@ -592,7 +593,15 @@ public class BasicConfig {
public
static
final
String
CHECKUNREAD
=
HOST
+
"/kjy/mp/chat/checkUnread"
;
public
static
final
String
CHECKUNREAD
=
HOST
+
"/kjy/mp/chat/checkUnread"
;
public
static
final
String
CONTENT_READ
=
HOST
+
"/kjy/mp/content/read"
;
public
static
final
String
CONTENT_READ
=
HOST
+
"/kjy/mp/content/read"
;
public
static
final
String
INTERACTION_LIKE
=
HOST
+
"/kjy/mp/interaction/like"
;
public
static
final
String
INTERACTION_LIKE
=
HOST
+
"/kjy/mp/interaction/like"
;
public
static
final
String
GETTIPSBYPAGE
=
HOST
+
"/kjy/mp/tips/getTipsByPage"
;
public
static
final
String
USING_VERSION
=
HOST
+
"/kjy/mp/version/getInUseVersion"
;
public
static
final
String
DAILY_FIRST
=
HOST
+
"/kjy/mp/billing/clock/dailyFirst"
;
public
static
final
String
LAYER_RENEW
=
HOST
+
"/kjy/mp/layer/renew"
;
public
static
final
String
DISTRIBUTION_LAYER
=
HOST
+
"/kjy/sp/seller/distributionLayer"
;
public
static
final
String
ROOKIECLUEGUIDE
=
HOST
+
"/kjy/mp/rookieGuide/clueGuide"
;
public
static
final
String
VISITHEADER
=
HOST
+
"/kjy/mp/visit/header/v2"
;
public
static
final
String
SELLERWEEKLY
=
HOST
+
"/kjy/mp/whoSawMe/sellerWeekly"
;
public
static
final
String
WEEKLY_LIST
=
HOST
+
"/kjy/mp/seller/weekly/list"
;
// *************** 支付 ***************
// *************** 支付 ***************
...
@@ -674,6 +683,7 @@ public class BasicConfig {
...
@@ -674,6 +683,7 @@ public class BasicConfig {
// *************** 谁看过我 ***************
// *************** 谁看过我 ***************
public
static
final
String
WHOSAWME_CUSTCLUELISTV2
=
HOST
+
"/kjy/mp/whoSawMe/custClueList/v2"
;
public
static
final
String
WHOSAWME_CUSTCLUELISTV2
=
HOST
+
"/kjy/mp/whoSawMe/custClueList/v2"
;
public
static
final
String
WHOSAWME_CUSTCLUELISTV3
=
HOST
+
"/kjy/mp/whoSawMe/custClueList/v3"
;
// *************** 文章 ***************
// *************** 文章 ***************
...
@@ -748,6 +758,12 @@ public class BasicConfig {
...
@@ -748,6 +758,12 @@ public class BasicConfig {
public
static
final
String
BOSS_DETAIL
=
HOST
+
"/kjy/mp/seller/team/task/detail"
;
public
static
final
String
BOSS_DETAIL
=
HOST
+
"/kjy/mp/seller/team/task/detail"
;
public
static
final
String
BOSS_PUBLISH
=
HOST
+
"/kjy/mp/seller/team/task/publish"
;
public
static
final
String
BOSS_PUBLISH
=
HOST
+
"/kjy/mp/seller/team/task/publish"
;
public
static
final
String
BOSS_RECEIVERLIST
=
HOST
+
"/kjy/mp/seller/team/task/receiverList"
;
public
static
final
String
BOSS_RECEIVERLIST
=
HOST
+
"/kjy/mp/seller/team/task/receiverList"
;
public
static
final
String
BOSS_BOUND
=
HOST
+
"/kjy/mp/seller/team/bound"
;
public
static
final
String
MATERIALLIST
=
HOST
+
"/kjy/mp/seller/dynamic/getMaterialList"
;
public
static
final
String
FORWARDCARDLIST
=
HOST
+
"/kjy/mp/seller/dynamic/getForwardCardList"
;
public
static
final
String
MARKETINGTOOLLIST
=
HOST
+
"/kjy/mp/seller/dynamic/getMarketingToolList"
;
public
static
final
String
SALECLUELIST
=
HOST
+
"/kjy/mp/seller/dynamic/getSaleClueList"
;
public
static
final
String
GETVISITLIST
=
HOST
+
"/kjy/mp/seller/dynamic/getVisitList"
;
...
@@ -778,4 +794,7 @@ public class BasicConfig {
...
@@ -778,4 +794,7 @@ public class BasicConfig {
public
static
final
String
MANAGER_findId
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/findById"
;
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_addOrUpdate
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/addOrUpdate"
;
public
static
final
String
MANAGER_dailyPostersDelete
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/delete"
;
public
static
final
String
MANAGER_dailyPostersDelete
=
MANAGER_HOST
+
"/kjy/manager/dailyPosters/delete"
;
public
static
final
String
MANAGER_SELLERTEAM_REMOVEMEMBER
=
MANAGER_HOST
+
"/kjy/manager/sellerTeam/removeMember"
;
public
static
final
String
MANAGER_SELLERID_ENCODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/encode"
;
public
static
final
String
MANAGER_TKU_DECODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/decryptTku"
;
}
}
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