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
9497389e
Commit
9497389e
authored
Jul 26, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
谁看过我+我的转发
parent
55679348
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
517 deletions
+11
-517
CustomerInfo.java
...kjj/cases/assistant/whoSawMe/MyCustomer/CustomerInfo.java
+0
-167
HomePage.java
...com/kjj/cases/assistant/whoSawMe/MyCustomer/HomePage.java
+0
-349
wechatTestNG.xml
src/test/wechatTestNG.xml
+11
-1
No files found.
src/test/java/com/kjj/cases/assistant/whoSawMe/MyCustomer/CustomerInfo.java
deleted
100644 → 0
View file @
55679348
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
.
MyCustomer
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.assistant.whoSawMe.ForwardAndRead
;
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
;
// 我的客户-客户详情页
public
class
CustomerInfo
implements
Authorization
{
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
ForwardAndRead
far
;
private
Long
custUserId
;
private
String
visitorWxName
;
private
boolean
compare
;
private
int
visitCount
;
private
int
monthVisitCount
;
private
int
grassNum
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
agentTku
();
BaseUtils
.
ssoLogin
();
far
=
new
ForwardAndRead
();
}
// 进入客户详情页
// 客户详情页_新手任务蒙层
@Test
(
description
=
"判断是否展示新手任务蒙层"
,
priority
=
1
)
public
void
新手任务蒙层展示
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sceneCode"
,
"noviceTask_visitorsCustomerInfoComplete"
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
NOVICE_MONGOLIANLAYERISPLAY
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
NOVICE_MONGOLIANLAYERISPLAY
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
isDisplay
=
response
.
jsonPath
().
getJsonObject
(
"data.isDisplay"
);
Assert
.
assertNotNull
(
isDisplay
,
network
.
message
(
param
,
BasicConfig
.
NOVICE_MONGOLIANLAYERISPLAY
,
"判断是否展示新手任务蒙层失败, isDisplay返回null"
,
response
.
body
().
asString
()));
}
// 客户详情页_特别关注弹窗
@Test
(
description
=
"特别关注弹层"
,
priority
=
2
)
public
void
特别关注弹层
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
ISDISPLAYSPECIAL
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
ISDISPLAYSPECIAL
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
ISDISPLAYSPECIAL
,
"data返回为null"
,
response
.
body
().
asString
()));
}
//客户详情页_获取客户资料页头部信息
@Test
(
description
=
"获取客户资料页头部信息"
,
priority
=
2
)
public
void
获取头部信息
()
throws
IOException
{
custUserId
=
far
.
decodeTku
(
BasicConfig
.
VISITOR_TKU
).
get
(
"userId"
);
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
custUserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFOHEADER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
String
nickName
=
response
.
jsonPath
().
getString
(
"data.nickName"
);
// 获取访客wxName
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
visitorWxName
=
response
.
jsonPath
().
getString
(
"data.wxName"
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"头部信息获取失败,data返回为空"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickName
,
visitorWxName
,
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"头部信息返回错误,客户微信昵称与预期不符"
,
response
.
body
().
asString
()));
}
// 客户详情页_获取客户信息
@Test
(
description
=
"获取客户信息"
,
priority
=
2
)
public
void
获取客户信息
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"userId"
,
custUserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFO
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"接口请求失败"
,
response
.
body
().
asString
()));
Long
sellerId
=
response
.
jsonPath
().
getLong
(
"data.sellerId"
);
String
custWxName
=
response
.
jsonPath
().
getString
(
"data.custWxName"
);
Assert
.
assertEquals
(
sellerId
,
far
.
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"sellerId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"客户代理人的sellerId不符合预期"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
custWxName
,
visitorWxName
,
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"客户微信昵称与预期不符"
,
response
.
body
().
asString
()));
}
// 客户详情页_获取客户访问线索统计
@Test
(
description
=
"客户访问线索统计"
,
priority
=
3
)
public
void
客户访问线索统计
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"userId"
,
custUserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CLUESTATISTICS
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"接口请求失败"
,
response
.
body
().
asString
()));
visitCount
=
response
.
jsonPath
().
getInt
(
"data.visitCount"
);
grassNum
=
response
.
jsonPath
().
getInt
(
"data.grassNum"
);
compare
=
visitCount
>=
1
;
Assert
.
assertTrue
(
compare
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"获取客户访问线索统计失败,客户访问次数小于1"
,
response
.
body
().
asString
()));
}
// 客户详情页_获取客户人脉数
@Test
(
description
=
"获取客户人脉数"
,
priority
=
4
)
public
void
获取客户人脉数
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
custUserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTRELATION
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTRELATION
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
num
=
response
.
jsonPath
().
getJsonObject
(
"data.num"
);
Assert
.
assertNotNull
(
num
,
network
.
message
(
param
,
BasicConfig
.
CUSTRELATION
,
"获取到客户人脉数为null"
,
response
.
body
().
asString
()));
}
// 客户详情页_获取客户阅读偏好
@Test
(
description
=
"获取客户阅读偏好"
,
priority
=
5
)
public
void
获取客户阅读偏好
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
custUserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTREADPERFERENCE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTREADPERFERENCE
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 客户详情页_最近线索统计数据
@Test
(
description
=
"获取客户最近线索统计"
,
priority
=
6
)
public
void
获取客户最近线索统计
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
custUserId
);
param
.
put
(
"type"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTSTATISTIC
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTSTATISTIC
,
"接口请求失败"
,
response
.
body
().
asString
()));
monthVisitCount
=
response
.
jsonPath
().
getInt
(
"data.visitCount"
);
compare
=
monthVisitCount
>=
1
;
Assert
.
assertTrue
(
compare
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"获取客户最近30天访问线索统计失败,客户访问次数小于1"
,
response
.
body
().
asString
()));
}
// 客户详情页_获取客户访问详情列表
@Test
(
description
=
"获取最近客户访问详情列表"
,
priority
=
7
)
public
void
获取最近客户访问详情列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"custUserId"
,
custUserId
);
param
.
put
(
"filterType"
,
1
);
param
.
put
(
"timeType"
,
2
);
param
.
put
(
"timeOrderType"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTVISITLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTVISITLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
int
recordCount
=
list
.
size
();
Assert
.
assertEquals
(
recordCount
,
monthVisitCount
,
network
.
message
(
param
,
BasicConfig
.
CUSTVISITLIST
,
"客户最近访问记录数不正确"
,
response
.
body
().
asString
()));
}
// 客户详情页_素材访问记录
@Test
(
description
=
"客户素材访问记录"
,
priority
=
8
)
public
void
客户素材访问记录
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
custUserId
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
30
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CONTENTVISITRECORD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
));
int
visitNum
=
response
.
jsonPath
().
getInt
(
"data.visitNum"
);
List
<
Object
>
recordList
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Assert
.
assertEquals
(
visitNum
,
recordList
.
size
(),
network
.
message
(
param
,
BasicConfig
.
CONTENTVISITRECORD
,
"访问次数与素材访问记录数不一致"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/whoSawMe/MyCustomer/HomePage.java
deleted
100644 → 0
View file @
55679348
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
.
MyCustomer
;
import
com.kjj.bean.agent.CustOrigins
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.assistant.whoSawMe.ForwardAndRead
;
import
com.kjj.cases.assistant.whoSawMe.WhoSawMe
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.collections.Lists
;
import
java.io.IOException
;
import
java.lang.reflect.AccessibleObject
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
// 我的客户-首页
public
class
HomePage
implements
Authorization
{
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
ForwardAndRead
far
;
private
String
createTagId
;
private
long
visitor1_UserId
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
agentTku
();
BaseUtils
.
ssoLogin
();
far
=
new
ForwardAndRead
();
}
// 我的客户首页_客户统计
@Test
(
description
=
"首页_客户统计"
,
priority
=
1
)
public
void
首页
_
客户统计
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
CUSTOMERSTATISTICS
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
CUSTOMERSTATISTICS
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
sevenDaysActiveCount
=
response
.
jsonPath
().
getInt
(
"data.sevenDaysActiveCount"
);
int
totalCount
=
response
.
jsonPath
().
getInt
(
"data.totalCount"
);
Assert
.
assertTrue
(
sevenDaysActiveCount
>=
1
,
network
.
message
(
BasicConfig
.
CUSTOMERSTATISTICS
,
"七日活跃客户数小于1"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
totalCount
>=
1
,
network
.
message
(
BasicConfig
.
CUSTOMERSTATISTICS
,
"累计获客数小于1"
,
response
.
body
().
asString
()));
}
// 我的客户首页_查询未读信息
@Test
(
description
=
"首页_查询未读信息"
,
priority
=
2
)
public
void
首页
_
查询未读信息
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
SELLERUNREADMESSAGE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
SELLERUNREADMESSAGE
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
unreadCount
=
response
.
jsonPath
().
getJsonObject
(
"data.unreadCount"
);
Assert
.
assertNotNull
(
unreadCount
,
network
.
message
(
BasicConfig
.
SELLERUNREADMESSAGE
,
"获取未读消息数失败"
,
response
.
body
().
asString
()));
}
// 消息通知
// 标签管理页_新建标签
@Test
(
description
=
"标签管理_新建标签"
,
priority
=
3
)
public
void
标签管理
_
新建标签
()
throws
IOException
{
// 添加标签
param
=
new
HashMap
<>();
param
.
put
(
"tagName"
,
"新标签"
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
TAG_ADDORUPDATE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
TAG_ADDORUPDATE
,
"接口请求失败"
,
response
.
body
().
asString
()));
createTagId
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
createTagId
,
network
.
message
(
param
,
BasicConfig
.
TAG_ADDORUPDATE
,
"data数据为空"
,
response
.
body
().
asString
()));
// 查看标签列表
response
=
network
.
getResponse
(
BasicConfig
.
TAG_GETLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
newTagId
=
response
.
jsonPath
().
getString
(
"data[0].id"
);
String
newTagName
=
response
.
jsonPath
().
getString
(
"data[0].tagName"
);
Assert
.
assertEquals
(
newTagId
,
(
String
)
createTagId
,
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"新增标签id错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
newTagName
,
"新标签"
,
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"新增标签名称错误"
,
response
.
body
().
asString
()));
}
// 标签管理_修改标签
@Test
(
description
=
"标签管理_修改标签"
,
priority
=
4
)
public
void
标签管理
_
修改标签
()
throws
IOException
{
// 修改标签
param
=
new
HashMap
<>();
param
.
put
(
"id"
,
createTagId
);
param
.
put
(
"tagName"
,
"新标签2"
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
TAG_ADDORUPDATE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
TAG_ADDORUPDATE
,
"接口请求失败"
,
response
.
body
().
asString
()));
// 查看标签列表
response
=
network
.
getResponse
(
BasicConfig
.
TAG_GETLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
newTagId
=
response
.
jsonPath
().
getString
(
"data[0].id"
);
String
newTagName
=
response
.
jsonPath
().
getString
(
"data[0].tagName"
);
Assert
.
assertEquals
(
newTagId
,
(
String
)
createTagId
,
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"新增标签id错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
newTagName
,
"新标签2"
,
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"新增标签名称错误"
,
response
.
body
().
asString
()));
}
// 标签管理_删除标签
@Test
(
description
=
"标签管理_删除标签"
,
priority
=
5
)
public
void
标签管理
_
删除标签
()
throws
IOException
{
// 删除标签
param
=
new
HashMap
<>();
List
<
String
>
ids
=
Lists
.
newArrayList
();
ids
.
add
(
createTagId
);
param
.
put
(
"ids"
,
ids
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
TAG_DELETE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
TAG_DELETE
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
TAG_DELETE
,
"标签删除失败"
,
response
.
body
().
asString
()));
// 查看标签列表
response
=
network
.
getResponse
(
BasicConfig
.
TAG_GETLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
TAG_GETLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取全部客户列表_最近访问
@Test
(
description
=
"客户列表_最近访问"
,
priority
=
6
)
public
void
客户列表
_
最近访问
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
3
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
Long
userId
=
response
.
jsonPath
().
getLong
(
"data.list[0].userId"
);
Assert
.
assertEquals
(
userId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"最新访问记录首位用户userId错误"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取全部客户列表_按照访问次数排列
@Test
(
description
=
"客户列表_访问次数"
,
priority
=
7
)
public
void
客户列表
_
访问次数
()
throws
IOException
{
// 降序排列
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
visitCountFirst
=
response
.
jsonPath
().
getInt
(
"data.list[0].visitCount"
);
int
visitCountSecond
=
response
.
jsonPath
().
getInt
(
"data.list[1].visitCount"
);
int
visitCountThird
=
response
.
jsonPath
().
getInt
(
"data.list[2].visitCount"
);
boolean
compareOne
=
visitCountFirst
>=
visitCountSecond
;
boolean
compareTwo
=
visitCountSecond
>=
visitCountThird
;
Assert
.
assertTrue
(
compareOne
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"访问次数筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
compareTwo
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"访问次数筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
// 升序排列
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
2
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
visitCountFirst
=
response
.
jsonPath
().
getInt
(
"data.list[0].visitCount"
);
visitCountSecond
=
response
.
jsonPath
().
getInt
(
"data.list[1].visitCount"
);
visitCountThird
=
response
.
jsonPath
().
getInt
(
"data.list[2].visitCount"
);
compareOne
=
visitCountFirst
<=
visitCountSecond
;
compareTwo
=
visitCountSecond
<=
visitCountThird
;
Assert
.
assertTrue
(
compareOne
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"访问次数筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
compareTwo
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"访问次数筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取全部客户列表_按客户意向排列
@Test
(
description
=
"客户列表_客户意向"
,
priority
=
8
)
public
void
客户列表
_
客户意向
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
5
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
customerIntentionFirst
=
response
.
jsonPath
().
getInt
(
"data.list[0].customerIntention"
);
int
customerIntentionSecond
=
response
.
jsonPath
().
getInt
(
"data.list[1].customerIntention"
);
int
customerIntentionThird
=
response
.
jsonPath
().
getInt
(
"data.list[2].customerIntention"
);
boolean
compareOne
=
customerIntentionFirst
>=
customerIntentionSecond
;
boolean
compareTwo
=
customerIntentionSecond
>=
customerIntentionThird
;
Assert
.
assertTrue
(
compareOne
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"客户意向筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
compareTwo
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"客户意向筛选结果排列顺序错误"
,
response
.
body
().
asString
()));
}
//我的客户首页_获取客户列表_特别关注客户
@Test
(
description
=
"客户列表_特别关注"
,
priority
=
9
)
public
void
客户列表
_
特别关注
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"isSpecialCustomer"
,
1
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
3
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"获取特别关注客户列表失败, data为空"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test
(
description
=
"客户列表_七日活跃"
,
priority
=
10
)
public
void
客户列表
_
七日活跃
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"activeType"
,
1
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
3
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
lists
=
response
.
jsonPath
().
getList
(
"data.list"
);
Assert
.
assertTrue
(
lists
.
size
()
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"七日活跃客户数为0"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test
(
description
=
"客户列表_直接转发"
,
priority
=
11
)
public
void
客户列表
_
直接转发
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custOrigin"
,
1
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
3
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
lists
=
response
.
jsonPath
().
getList
(
"data.list"
);
Assert
.
assertTrue
(
lists
.
size
()
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"直接转发客户数为0"
,
response
.
body
().
asString
()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test
(
description
=
"客户列表_好友转发"
,
priority
=
12
)
public
void
客户列表
_
好友转发
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custOrigin"
,
2
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"sortType"
,
3
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CUSTOMERSEARCH
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"接口请求失败"
,
response
.
body
().
asString
()));
System
.
out
.
println
(
response
.
body
().
asString
());
Long
custUserId
=
response
.
jsonPath
().
getLong
(
"data.list[0].userId"
);
Assert
.
assertEquals
(
custUserId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"通过好友转发的访客userId与预期不一致"
,
response
.
body
().
asString
()));
}
// 我的客户首页_搜索客户
@Test
(
description
=
"搜索客户"
,
priority
=
13
)
public
void
客户列表
_
搜索客户
()
throws
IOException
{
param
=
new
HashMap
<>();
// 获取用户微信昵称
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
String
customerName
=
response
.
jsonPath
().
getString
(
"data.wxName"
);
// 代理人搜索客户
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
param
.
put
(
"content"
,
customerName
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
SEARCHCUSTOMERBYCONTENT
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SEARCHCUSTOMERBYCONTENT
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
// 客户详情页_头部信息栏
@Test
(
description
=
"客户详情页_头部信息栏"
,
priority
=
14
)
public
void
客户详情页
_
头部信息栏
()
throws
IOException
{
visitor1_UserId
=
far
.
decodeTku
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"userId"
);
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
visitor1_UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFOHEADER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
System
.
out
.
println
(
response
.
body
().
asString
());
List
<
CustOrigins
>
custOrigins
=
JsonUtil
.
parseResponseToPageBean
(
response
,
CustOrigins
.
class
);
Assert
.
assertEquals
(
custOrigins
.
size
(),
3
,
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"用户被邀链路长度不为3"
,
response
.
body
().
asString
()));
Long
selfUserId
=
custOrigins
.
get
(
2
).
getUserId
();
Long
fatherUserId
=
custOrigins
.
get
(
1
).
getUserId
();
Long
superUserId
=
custOrigins
.
get
(
0
).
getUserId
();
Assert
.
assertEquals
(
selfUserId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"二级访客userId与预期不符"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
fatherUserId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"一级访客userId与预期不符"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
superUserId
,
far
.
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"代理人userId与预期不符"
,
response
.
body
().
asString
()));
}
// 客户详情页_客户信息
@Test
(
description
=
"客户详情页_客户信息"
,
priority
=
15
)
public
void
客户详情页
_
客户信息
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"userId"
,
visitor1_UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFO
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
CustOrigins
>
origins
=
JsonUtil
.
parseResponseToPageBean
(
response
,
CustOrigins
.
class
);
Long
selfUserId
=
origins
.
get
(
1
).
getUserId
();
Long
fatherUserId
=
origins
.
get
(
0
).
getUserId
();
Long
superUserId
=
response
.
jsonPath
().
getLong
(
"data.sellerId"
);
Assert
.
assertEquals
(
selfUserId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"二级访客userId与预期不符"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
fatherUserId
,
far
.
decodeTku
(
BasicConfig
.
VISITOR_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"一级访客userId与预期不符"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
superUserId
,
far
.
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"userId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"代理人userId与预期不符"
,
response
.
body
().
asString
()));
}
// 客户详情页_意向详情
@Test
(
description
=
"客户详情页_意向详情"
,
priority
=
16
)
public
void
客户详情页
_
意向详情
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"userId"
,
visitor1_UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CLUESTATISTICS
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
drawPresentInsuranceCount
=
response
.
jsonPath
().
getInt
(
"data.drawPresentInsuranceCount"
);
Assert
.
assertTrue
(
drawPresentInsuranceCount
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"客户领取赠险次数小于1"
,
response
.
body
().
asString
()));
}
// 客户详情页_人脉统计
@Test
(
description
=
"客户详情页_人脉统计"
,
priority
=
17
)
public
void
客户详情页
_
人脉统计
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
visitor1_UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTRELATION
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTRELATION
,
"接口请求失败"
,
response
.
body
().
asString
()));
Integer
num
=
response
.
jsonPath
().
getInt
(
"data.hasNew"
);
Assert
.
assertNotNull
(
num
,
network
.
message
(
param
,
BasicConfig
.
CUSTRELATION
,
"客户人脉统计数量为null"
,
response
.
body
().
asString
()));
}
// 客户详情页_阅读偏好
@Test
(
description
=
"客户详情页_阅读偏好"
,
priority
=
18
)
public
void
客户详情页
_
阅读偏好
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
visitor1_UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTREADPERFERENCE
);
System
.
out
.
println
(
response
.
body
().
asString
());
}
// 客户详情页_最近线索
@Test
(
description
=
"获取客户最近线索统计"
,
priority
=
19
)
public
void
获取客户最近线索统计
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
visitor1_UserId
);
param
.
put
(
"type"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTSTATISTIC
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTSTATISTIC
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
welfareInsuranceNum
=
response
.
jsonPath
().
getInt
(
"data.welfareInsuranceNum"
);
Assert
.
assertTrue
(
welfareInsuranceNum
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"客户最近领取赠险次数小于1"
,
response
.
body
().
asString
()));
}
// 客户详情页_最近访问详情列表
@Test
(
description
=
"客户详情页_最近访问详情列表"
,
priority
=
20
)
public
void
客户详情页
_
最近访问详情列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"custUserId"
,
visitor1_UserId
);
param
.
put
(
"filterType"
,
1
);
param
.
put
(
"timeType"
,
2
);
param
.
put
(
"timeOrderType"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTVISITLIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTVISITLIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
System
.
out
.
println
(
response
.
body
().
asString
());
}
}
src/test/wechatTestNG.xml
View file @
9497389e
...
...
@@ -32,11 +32,21 @@
<class
name=
"com.kjj.cases.assistant.DailyPaper"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"谁看过我_团队看板"
>
<test
preserve-order=
"true"
name =
"获取访客"
>
<classes>
<class
name=
"com.kjj.cases.assistant.whoSawMe.ForwardAndRead"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"谁看过我"
>
<classes>
<class
name=
"com.kjj.cases.assistant.whoSawMe.WhoSawMe"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"我的转发"
>
<classes>
<class
name=
"com.kjj.cases.assistant.whoSawMe.MyForward"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"贺卡"
>
<classes>
<class
name=
"com.kjj.cases.assistant.markettools.greetingCrad"
/>
...
...
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