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
efff1a87
Commit
efff1a87
authored
Feb 08, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/20220208-gxh' into 'master'
公域引流自动化 See merge request test-group/kejiji!220
parents
5aab65c3
f12ce811
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
574 additions
and
14 deletions
+574
-14
Manager.java
src/test/java/com/kjj/cases/otoseller/Manager.java
+535
-0
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+19
-0
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+20
-14
No files found.
src/test/java/com/kjj/cases/otoseller/Manager.java
0 → 100644
View file @
efff1a87
package
com
.
kjj
.
cases
.
otoseller
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.NetworkUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeTest
;
import
org.testng.annotations.Test
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.*;
public
class
Manager
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
int
tagId
;
//标签ID
public
int
custId
;
//客户ID
public
String
name
;
//客户手机号
public
String
phone
;
//客户手机号
public
int
followTimes
;
//跟进次数
public
static
Map
<
String
,
Integer
>
header
;
public
static
Map
<
String
,
Integer
>
chart
;
@BeforeTest
public
void
setUp
(){
ssoLogin
();
Date
date
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"MM/dd"
);
name
=
"自动化用户"
+
sdf
.
format
(
date
);
}
@Test
(
description
=
"公域引流_创建标签"
,
priority
=
1
)
public
void
公域引流
_
创建标签
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"tagName"
,
"勿动-自动化测试标签"
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_saveTag
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_saveTag
,
"创建标签失败"
,
response
.
body
().
asString
()));
//创建名称相同的标签失败
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_saveTag
);
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertFalse
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_saveTag
,
"创建同名的标签成功"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"公域引流_查看标签列表"
,
priority
=
2
)
public
void
公域引流
_
查看标签列表
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_oto_tagList
);
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
String
tagName
=
response
.
jsonPath
().
getString
(
"data.list[0].tagName"
);
int
customerCount
=
response
.
jsonPath
().
getInt
(
"data.list[0].customerCount"
);
int
tagStatus
=
response
.
jsonPath
().
getInt
(
"data.list[0].tagStatus"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
BasicConfig
.
MANAGER_oto_tagList
,
"标签列表为空"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
tagName
,
"勿动-自动化测试标签"
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_tagList
,
"标签名称错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
customerCount
,
0
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_tagList
,
"新标签的客户数不为0"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
tagStatus
,
1
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_tagList
,
"新标签的状态不为打开"
,
response
.
body
().
asString
()));
tagId
=
response
.
jsonPath
().
getInt
(
"data.list[0].id"
);
}
@Test
(
description
=
"公域引流_修改标签"
,
priority
=
3
)
public
void
公域引流
_
修改标签
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"tagName"
,
"勿动-自动化更新标签"
);
params
.
put
(
"id"
,
tagId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_updateTag
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_updateTag
,
"修改标签失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"公域引流_填写表单"
,
priority
=
4
)
public
void
公域引流
_
填写表单
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
String
str
=
String
.
valueOf
(
System
.
currentTimeMillis
());
phone
=
"130"
+
str
.
substring
(
str
.
length
()-
8
,
str
.
length
());
params
.
put
(
"formId"
,
"Kj20ODA3"
);
params
.
put
(
"phoneNum"
,
phone
);
params
.
put
(
"urlLink"
,
"https://kjj-static.duibatest.com.cn/cpic-home/202111261430?formId=Kj20ODA3&channel=bd&agent=x"
);
params
.
put
(
"username"
,
name
);
params
.
put
(
"uuid"
,
"622d83e4-ca21-4ccd-94cb-182c0f2a6b60"
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
FORM_submit
);
String
recordId
=
response
.
jsonPath
().
getString
(
"data.recordId"
);
Assert
.
assertNotNull
(
recordId
,
network
.
message
(
params
,
BasicConfig
.
FORM_submit
,
"客户创建失败"
,
response
.
body
().
asString
()));
params
.
clear
();
ArrayList
<
String
>
optionIds
=
new
ArrayList
<>();
optionIds
.
add
(
"Kj21NTY1OTE"
);
params
.
put
(
"optionIds"
,
optionIds
);
params
.
put
(
"questionId"
,
"Kj21MjQ5Njc"
);
params
.
put
(
"recordId"
,
recordId
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
FORM_submit
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
FORM_submit
,
"客户填写表单失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"公域引流_查找客户"
,
priority
=
5
)
public
void
公域引流
_
查找客户
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
params
.
put
(
"phoneNum"
,
phone
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_oto_customerList
);
int
totalCount
=
response
.
jsonPath
().
getInt
(
"data.totalCount"
);
Assert
.
assertTrue
(
totalCount
==
1
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_customerList
,
"未查找到该客户"
,
response
.
body
().
asString
()));
String
custName
=
response
.
jsonPath
().
getString
(
"data.list[0].custName"
);
Assert
.
assertEquals
(
custName
,
name
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_customerList
,
"未查找到该客户"
,
response
.
body
().
asString
()));
custId
=
response
.
jsonPath
().
getInt
(
"data.list[0].id"
);
}
@Test
(
description
=
"公域引流_分配客户"
,
priority
=
6
)
public
void
公域引流
_
分配客户
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
String
str
=
String
.
valueOf
(
System
.
currentTimeMillis
());
params
.
put
(
"customerId"
,
custId
);
params
.
put
(
"sellerId"
,
22
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_assignSeller
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_assignSeller
,
"分配客户失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"工作台_销售信息"
,
priority
=
7
)
public
void
客户分类
_
销售信息
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_userInfo
);
String
sellerName
=
response
.
jsonPath
().
getString
(
"data.sellerName"
);
Assert
.
assertEquals
(
sellerName
,
"勿动-自动化测试销售"
,
network
.
message
(
BasicConfig
.
WORK_userInfo
,
"销售姓名错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"工作台_通知栏"
,
priority
=
8
)
public
void
工作台
_
通知栏
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_notifyList
);
int
size
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
Assert
.
assertEquals
(
size
,
0
,
network
.
message
(
BasicConfig
.
WORK_notifyList
,
"通知栏不为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"客户分类_数量总览"
,
priority
=
9
)
public
void
客户分类
_
数量总览
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticHeader
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"数量总览数据为空"
,
response
.
body
().
asString
()));
header
.
put
(
"starNum"
,
response
.
jsonPath
().
getInt
(
"data.starNum"
));
header
.
put
(
"totalNum"
,
response
.
jsonPath
().
getInt
(
"data.totalNum"
));
header
.
put
(
"unContactNum"
,
response
.
jsonPath
().
getInt
(
"data.unContactNum"
));
header
.
put
(
"unMeetNum"
,
response
.
jsonPath
().
getInt
(
"data.unMeetNum"
));
header
.
put
(
"unRedialNum"
,
response
.
jsonPath
().
getInt
(
"data.unRedialNum"
));
}
@Test
(
description
=
"客户分类_表格总览"
,
priority
=
10
)
public
void
客户分类
_
表格总览
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticChart
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"跟进表格数量为空"
,
response
.
body
().
asString
()));
chart
.
put
(
"needContact"
,
response
.
jsonPath
().
getInt
(
"data[0].custNum"
));
chart
.
put
(
"needMeet"
,
response
.
jsonPath
().
getInt
(
"data[1].custNum"
));
chart
.
put
(
"commitPlan"
,
response
.
jsonPath
().
getInt
(
"data[2].custNum"
));
chart
.
put
(
"toFacilitate"
,
response
.
jsonPath
().
getInt
(
"data[3].custNum"
));
chart
.
put
(
"completedOrder"
,
response
.
jsonPath
().
getInt
(
"data[4].custNum"
));
}
@Test
(
description
=
"工作台_标签列表"
,
priority
=
11
)
public
void
工作台
_
标签列表
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_tagList
);
String
tagName
=
response
.
jsonPath
().
getString
(
"data.find{it.tagId =="
+
tagId
+
"].tagName"
);
Assert
.
assertEquals
(
tagName
,
"勿动-自动化测试标签"
,
network
.
message
(
BasicConfig
.
WORK_tagList
,
"跟进表格数量为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"需要联系客户列表"
,
priority
=
12
)
public
void
需要联系客户列表
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
params
.
put
(
"custClassifyType"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_customerList
);
int
customerId
=
response
.
jsonPath
().
getInt
(
"data.list[0].custId"
);
Assert
.
assertEquals
(
customerId
,
custId
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"需要联系列表中首位客户非新增客户"
,
response
.
body
().
asString
()));
int
custStar
=
response
.
jsonPath
().
getInt
(
"data.list[0].custStar"
);
int
followStatus
=
response
.
jsonPath
().
getInt
(
"data.list[0].followStatus"
);
followTimes
=
response
.
jsonPath
().
getInt
(
"data.list[0].followTimes"
);
Object
custValue
=
response
.
jsonPath
().
getJsonObject
(
"data.list[0].custValue"
);
Object
lastFollowTime
=
response
.
jsonPath
().
getJsonObject
(
"data.list[0].lastFollowTime"
);
Assert
.
assertEquals
(
custStar
,
0
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"新客户默认为星标客户"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
followStatus
,
1
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"新客户的默认跟进状态非需要联系状态"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
followTimes
,
0
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"新客户的默认跟进次数不为0"
,
response
.
body
().
asString
()));
Assert
.
assertNull
(
custValue
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"新客户的默认客户价值不为null"
,
response
.
body
().
asString
()));
Assert
.
assertNull
(
lastFollowTime
,
network
.
message
(
params
,
BasicConfig
.
WORK_customerList
,
"新客户的默认跟进时间不为null"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询客户手机号"
,
priority
=
13
)
public
void
查询客户手机号
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_phone
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertEquals
(
data
,
phone
,
network
.
message
(
params
,
BasicConfig
.
WORK_phone
,
"手机号错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询新客户见面情况"
,
priority
=
14
)
public
void
查询新客户见面情况
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_info
);
boolean
todayMeetFlag
=
response
.
jsonPath
().
getBoolean
(
"data.todayMeetFlag"
);
boolean
orderVisitFlag
=
response
.
jsonPath
().
getBoolean
(
"data.orderVisitFlag"
);
Object
orderVisitDate
=
response
.
jsonPath
().
getJsonObject
(
"data.todayMeetFlag"
);
Assert
.
assertFalse
(
todayMeetFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"今日见面状态错误:为已见面"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
orderVisitFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约参观状态错误:为已预约"
,
response
.
body
().
asString
()));
Assert
.
assertNull
(
orderVisitDate
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约时间不为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询新客户头部信息"
,
priority
=
15
)
public
void
查询新客户头部信息
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_header
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_header
,
"头部信息为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询新客户详细信息"
,
priority
=
16
)
public
void
查询新客户详细信息
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_detail
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"详细信息为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询客户电话表单回填状态"
,
priority
=
17
)
public
void
查询客户电话表单回填状态
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_showFeedback
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertFalse
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_showFeedback
,
"电话表单回填状态错误:为需要回填"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询省市列表"
,
priority
=
18
)
public
void
查询省市列表
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_regionCity
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
BasicConfig
.
WORK_regionCity
,
"省市列表为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询历史通话"
,
priority
=
19
)
public
void
查询历史通话
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"logDays"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_callLog
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_callLog
,
"历史通话为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"标记星标用户"
,
priority
=
20
)
public
void
标记星标用户
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_star
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_star
,
"标记星标客户失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询星标客户更新"
,
priority
=
21
)
public
void
查询星标客户更新
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticHeader
);
int
unContactNum
=
response
.
jsonPath
().
getInt
(
"data.unContactNum"
);
int
starNum
=
response
.
jsonPath
().
getInt
(
"data.starNum"
);
Assert
.
assertEquals
(
unContactNum
,
header
.
get
(
"unContactNum"
)-
1
,
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"需要联系客户数量未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
starNum
,
header
.
get
(
"starNum"
)+
1
,
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"星标客户数量未加1"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"取消星标用户"
,
priority
=
22
)
public
void
取消星标用户
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_star
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertFalse
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_star
,
"标记星标客户失败"
,
response
.
body
().
asString
()));
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticHeader
);
int
unContactNum
=
response
.
jsonPath
().
getInt
(
"data.unContactNum"
);
int
starNum
=
response
.
jsonPath
().
getInt
(
"data.starNum"
);
Assert
.
assertEquals
(
unContactNum
,
java
.
util
.
Optional
.
ofNullable
(
header
.
get
(
"unContactNum"
)),
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"星标客户数量未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
starNum
,
java
.
util
.
Optional
.
ofNullable
(
header
.
get
(
"starNum"
)),
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"需要联系客户数量未加1"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改客户价值"
,
priority
=
23
)
public
void
修改客户价值
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"custValue"
,
200
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_assess
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_assess
,
"修改客户价值失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改客户跟进权重"
,
priority
=
24
)
public
void
修改客户跟进权重
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"followWeight"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_weight
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_weight
,
"修改客户跟进权重失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改客户标签"
,
priority
=
25
)
public
void
修改客户标签
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
ArrayList
<
Integer
>
tags
=
new
ArrayList
<>();
tags
.
add
(
tagId
);
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"tagIds"
,
tags
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_tag
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_tag
,
"修改客户标签失败"
,
response
.
body
().
asString
()));
//查询信息更新
params
.
clear
();
params
.
put
(
"custId"
,
custId
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_detail
);
int
tagSize
=
response
.
jsonPath
().
getInt
(
"data.custInfo.tagIds.size()"
);
Assert
.
assertEquals
(
tagSize
,
1
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"标签数量错误"
,
response
.
body
().
asString
()));
int
tId
=
response
.
jsonPath
().
getInt
(
"data.custInfo.tagIds[0]"
);
Assert
.
assertEquals
(
tId
,
tagId
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"标签Id错误"
,
response
.
body
().
asString
()));
int
custValue
=
response
.
jsonPath
().
getInt
(
"data.custInfo.custValue"
);
Assert
.
assertEquals
(
custValue
,
200
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"客户价值错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改标签状态为关闭"
,
priority
=
26
)
public
void
修改标签状态为关闭
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
tagId
);
params
.
put
(
"tagStatus"
,
0
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_switchStatus
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertFalse
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_switchStatus
,
"关闭标签显示失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询更新的标签列表和客户标签"
,
priority
=
27
)
public
void
查询更新的标签列表和客户标签
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_detail
);
int
tagSize
=
response
.
jsonPath
().
getInt
(
"data.custInfo.tagIds.size()"
);
Assert
.
assertEquals
(
tagSize
,
0
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"标签数量错误"
,
response
.
body
().
asString
()));
response
=
network
.
getResponse
(
BasicConfig
.
WORK_tagList
);
int
size
=
response
.
jsonPath
().
getInt
(
"data.findAll{it.tagId =="
+
tagId
+
"].size()"
);
Assert
.
assertEquals
(
size
,
0
,
network
.
message
(
BasicConfig
.
WORK_tagList
,
"跟进表格数量为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改标签状态为开启"
,
priority
=
28
)
public
void
修改标签状态为开启
()
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
tagId
);
params
.
put
(
"tagStatus"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_oto_switchStatus
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_oto_switchStatus
,
"修改客户标签失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"删除客户标签"
,
priority
=
29
)
public
void
删除客户标签
()
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
ArrayList
<
Integer
>
tags
=
new
ArrayList
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"tagIds"
,
tags
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_tag
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_tag
,
"修改客户标签失败"
,
response
.
body
().
asString
()));
//校验还原
params
.
clear
();
params
.
put
(
"custId"
,
custId
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_detail
);
int
tagSize
=
response
.
jsonPath
().
getInt
(
"data.custInfo.tagIds.size()"
);
Assert
.
assertEquals
(
tagSize
,
0
,
network
.
message
(
params
,
BasicConfig
.
WORK_detail
,
"标签数量错误"
,
response
.
body
().
asString
()));
response
=
network
.
getResponse
(
BasicConfig
.
WORK_tagList
);
int
size
=
response
.
jsonPath
().
getInt
(
"data.findAll{it.tagId =="
+
tagId
+
"].size()"
);
Assert
.
assertEquals
(
size
,
1
,
network
.
message
(
BasicConfig
.
WORK_tagList
,
"跟进表格数量为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"完成今日见面"
,
priority
=
30
)
public
void
完成今日见面
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"commitPlanFlag"
,
0
);
params
.
put
(
"custValue"
,
102
);
params
.
put
(
"followWeight"
,
2
);
params
.
put
(
"meetRemark"
,
"今日见面的备注"
+
new
Date
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_meet
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_meet
,
"完成今日见面失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"客户状态见面为待计划"
,
priority
=
31
)
public
void
客户状态见面为待计划
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticHeader
);
int
unContactNum
=
response
.
jsonPath
().
getInt
(
"data.unContactNum"
);
int
unMeetNum
=
response
.
jsonPath
().
getInt
(
"data.unMeetNum"
);
Assert
.
assertEquals
(
unContactNum
,
header
.
get
(
"unContactNum"
)-
1
,
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"需要联系客户数量未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
unMeetNum
,
java
.
util
.
Optional
.
ofNullable
(
header
.
get
(
"unMeetNum"
)),
network
.
message
(
BasicConfig
.
WORK_staticHeader
,
"需要约见客户数量变化"
,
response
.
body
().
asString
()));
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticChart
);
int
needContact
=
response
.
jsonPath
().
getInt
(
"data[0].custNum"
);
int
needMeet
=
response
.
jsonPath
().
getInt
(
"data[1].custNum"
);
int
commitPlan
=
response
.
jsonPath
().
getInt
(
"data[2].custNum"
);
Assert
.
assertEquals
(
needContact
,
chart
.
get
(
"needContact"
)-
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"需要联系客户未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
needMeet
,
java
.
util
.
Optional
.
ofNullable
(
chart
.
get
(
"needMeet"
)),
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"需要约见客户数量变化"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
commitPlan
,
chart
.
get
(
"commitPlan"
)+
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"要发计划书客户未加1"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"预约参观"
,
priority
=
32
)
public
void
预约参观
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"coreMaker"
,
1
);
params
.
put
(
"ideaAgree"
,
1
);
params
.
put
(
"insApplicant"
,
4
);
params
.
put
(
"insByApplicant"
,
4
);
params
.
put
(
"insMoney"
,
500
);
params
.
put
(
"insPeriod"
,
20
);
params
.
put
(
"orderVisitTime"
,
System
.
currentTimeMillis
()-
86400000
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_order
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_order
,
"完成今日见面失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"见面并预约后更新客户见面情况"
,
priority
=
33
)
public
void
见面并预约后更新客户见面情况
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_info
);
boolean
todayMeetFlag
=
response
.
jsonPath
().
getBoolean
(
"data.todayMeetFlag"
);
boolean
orderVisitFlag
=
response
.
jsonPath
().
getBoolean
(
"data.orderVisitFlag"
);
Object
orderVisitDate
=
response
.
jsonPath
().
getJsonObject
(
"data.todayMeetFlag"
);
Assert
.
assertTrue
(
todayMeetFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"今日见面状态错误:为未见面"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
orderVisitFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约参观状态错误:为未预约"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
orderVisitDate
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约时间为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"上传参观详情"
,
priority
=
34
)
public
void
上传参观详情
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"commitPlanFlag"
,
1
);
params
.
put
(
"commitCustStatus"
,
1
);
params
.
put
(
"custValue"
,
201
);
params
.
put
(
"followWeight"
,
2
);
params
.
put
(
"visitRemark"
,
"今日参观的备注"
+
new
Date
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_feedback
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_feedback
,
"上传参观详情失败失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"上传参观详情后更新客户见面情况"
,
priority
=
35
)
public
void
上传参观详情后更新客户见面情况
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_info
);
boolean
todayMeetFlag
=
response
.
jsonPath
().
getBoolean
(
"data.todayMeetFlag"
);
boolean
orderVisitFlag
=
response
.
jsonPath
().
getBoolean
(
"data.orderVisitFlag"
);
Object
orderVisitDate
=
response
.
jsonPath
().
getJsonObject
(
"data.todayMeetFlag"
);
Assert
.
assertTrue
(
todayMeetFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"今日见面状态错误:为未见面"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
orderVisitFlag
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约参观状态错误:为已预约"
,
response
.
body
().
asString
()));
Assert
.
assertNull
(
orderVisitDate
,
network
.
message
(
params
,
BasicConfig
.
WORK_info
,
"预约时间不为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"客户状态见面为待促成"
,
priority
=
36
)
public
void
客户状态见面为待促成
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticChart
);
int
commitPlan
=
response
.
jsonPath
().
getInt
(
"data[2].custNum"
);
int
toFacilitate
=
response
.
jsonPath
().
getInt
(
"data[3].custNum"
);
Assert
.
assertEquals
(
commitPlan
,
chart
.
get
(
"commitPlan"
)-
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"要发计划书客户未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
toFacilitate
,
chart
.
get
(
"toFacilitate"
)+
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"待促成客户未加1"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改客户基础信息"
,
priority
=
37
)
public
void
修改客户基础信息
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
ArrayList
<
Integer
>
array
=
new
ArrayList
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"commitPlanFlag"
,
1
);
params
.
put
(
"commitCustStatus"
,
1
);
params
.
put
(
"addWxStatus"
,
0
);
params
.
put
(
"coreMaker"
,
1
);
params
.
put
(
"ideaAgree"
,
1
);
params
.
put
(
"insApplicant"
,
4
);
params
.
put
(
"insByApplicant"
,
4
);
params
.
put
(
"insMoney"
,
500
);
params
.
put
(
"insPeriod"
,
20
);
params
.
put
(
"custArea"
,
"北京-北京市"
);
params
.
put
(
"custDescription"
,
"客户的备注"
);
params
.
put
(
"custName"
,
name
);
params
.
put
(
"dealFlag"
,
1
);
params
.
put
(
"forWho"
,
array
);
params
.
put
(
"retireMoney"
,
0
);
params
.
put
(
"roomerAge"
,
0
);
params
.
put
(
"roomerCity"
,
""
);
params
.
put
(
"visitOrg"
,
array
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_edit
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_edit
,
"修改客户基础信息失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"客户状态见面为已成单"
,
priority
=
38
)
public
void
客户状态见面为已成单
(){
Response
response
=
network
.
getResponse
(
BasicConfig
.
WORK_staticChart
);
int
toFacilitate
=
response
.
jsonPath
().
getInt
(
"data[3].custNum"
);
int
completedOrder
=
response
.
jsonPath
().
getInt
(
"data[4].custNum"
);
Assert
.
assertEquals
(
toFacilitate
,
chart
.
get
(
"toFacilitate"
)-
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"待促成客户未减1"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
completedOrder
,
chart
.
get
(
"completedOrder"
)+
1
,
network
.
message
(
BasicConfig
.
WORK_staticChart
,
"已成单客户未加1"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查看客户动态"
,
priority
=
39
)
public
void
查看客户动态
(){
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"custId"
,
custId
);
params
.
put
(
"logDays"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_operation
);
int
logSize
=
response
.
jsonPath
().
getInt
(
"data.list[0].dayLog.size()"
);
Assert
.
assertEquals
(
logSize
,
12
,
network
.
message
(
params
,
BasicConfig
.
WORK_operation
,
"客户动态条数错误"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
efff1a87
...
...
@@ -1289,6 +1289,7 @@ public class BasicConfig {
public
static
final
String
MANAGER_oto_saveTag
=
MANAGER_HOST
+
"/kjy/manager/oto/tag/save"
;
public
static
final
String
MANAGER_oto_updateTag
=
MANAGER_HOST
+
"/kjy/manager/oto/tag/update"
;
public
static
final
String
MANAGER_oto_tagList
=
MANAGER_HOST
+
"/kjy/manager/oto/tag/list"
;
public
static
final
String
MANAGER_oto_switchStatus
=
MANAGER_HOST
+
"/kjy/manager/oto/tag/switchStatus"
;
public
static
final
String
WORK_getCaptcha
=
WORK_HOST
+
"/kjy/oto/manager/auth/captcha"
;
public
static
final
String
WORK_login
=
WORK_HOST
+
"/kjy/oto/manager/auth/login"
;
public
static
final
String
WORK_userInfo
=
WORK_HOST
+
"/kjy/oto/manager/auth/userInfo"
;
...
...
@@ -1298,4 +1299,22 @@ public class BasicConfig {
public
static
final
String
WORK_notifyList
=
WORK_HOST
+
"/kjy/oto/manager/customer/notify/list"
;
public
static
final
String
MANAGER_oto_customerList
=
MANAGER_HOST
+
"/kjy/manager/pub/form/customer/list/v2"
;
public
static
final
String
MANAGER_oto_assignSeller
=
MANAGER_HOST
+
"/kjy/manager/pub/form/customer/assignSeller"
;
public
static
final
String
WORK_tagList
=
WORK_HOST
+
"/kjy/oto/manager/tag/list"
;
public
static
final
String
WORK_customerList
=
WORK_HOST
+
"/kjy/oto/manager/customer/list"
;
public
static
final
String
WORK_phone
=
WORK_HOST
+
"/kjy/oto/manager/customer/phoneNum"
;
public
static
final
String
WORK_info
=
WORK_HOST
+
"kjy/oto/manager/customer/visit/info"
;
public
static
final
String
WORK_header
=
WORK_HOST
+
"/kjy/oto/manager/customer/header"
;
public
static
final
String
WORK_detail
=
WORK_HOST
+
"/kjy/oto/manager/customer/detail"
;
public
static
final
String
WORK_showFeedback
=
WORK_HOST
+
"/kjy/oto/manager/customer/call/showFeedback"
;
public
static
final
String
WORK_regionCity
=
WORK_HOST
+
"/kjy/oto/manager/customer/regionCity"
;
public
static
final
String
WORK_callLog
=
WORK_HOST
+
"/kjy/oto/manager/customer/log/call"
;
public
static
final
String
WORK_meet
=
WORK_HOST
+
"/kjy/oto/manager/customer/meet"
;
public
static
final
String
WORK_star
=
WORK_HOST
+
"/kjy/oto/manager/customer/star"
;
public
static
final
String
WORK_assess
=
WORK_HOST
+
"/kjy/oto/manager/customer/assess"
;
public
static
final
String
WORK_weight
=
WORK_HOST
+
"/kjy/oto/manager/customer/follow/weight"
;
public
static
final
String
WORK_tag
=
WORK_HOST
+
"/kjy/oto/manager/customer/tag"
;
public
static
final
String
WORK_order
=
WORK_HOST
+
"/kjy/oto/manager/customer/order"
;
public
static
final
String
WORK_feedback
=
WORK_HOST
+
"/kjy/oto/manager/customer/feedback"
;
public
static
final
String
WORK_edit
=
WORK_HOST
+
"/kjy/oto/manager/customer/edit"
;
public
static
final
String
WORK_operation
=
WORK_HOST
+
"/kjy/oto/manager/customer/log/operation"
;
}
src/test/java/com/kjj/utils/BaseUtils.java
View file @
efff1a87
...
...
@@ -25,6 +25,8 @@ public class BaseUtils {
public
static
String
companyCookieValue
;
public
static
String
officeCookieKey
;
public
static
String
officeCookieValue
;
public
static
String
otoCookieKey
;
public
static
String
otoCookieValue
;
/**
...
...
@@ -244,14 +246,14 @@ public class BaseUtils {
public
static
void
superUserLogin
(){
// 调用登录接口
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"phone"
,
"1513636130
8
"
);
params
.
put
(
"phone"
,
"1513636130
1
"
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptcha
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
CORP_getCaptcha
,
"获取验证码失败"
,
response
.
body
().
asString
()));
//专用于自动化获取验证码
params
.
clear
();
params
.
put
(
"phone"
,
"1513636130
8
"
);
params
.
put
(
"phone"
,
"1513636130
1
"
);
Response
autoTestRes
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptchaForAutoTest
);
String
captcha
=
autoTestRes
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
captcha
);
...
...
@@ -259,7 +261,7 @@ public class BaseUtils {
//登录接口
ThreadSleepUtils
.
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"phone"
,
"1513636130
8
"
);
params
.
put
(
"phone"
,
"1513636130
1
"
);
params
.
put
(
"captcha"
,
captcha
);
Response
loginRes
=
network
.
postResponse
(
params
,
BasicConfig
.
CORP_login
);
boolean
success
=
loginRes
.
jsonPath
().
getBoolean
(
"success"
);
...
...
@@ -284,6 +286,7 @@ public class BaseUtils {
superCookieValue
=
cookieKeyValue
[
1
];
network
.
agentCookies
.
put
(
cookieKeyValue
[
0
],
cookieKeyValue
[
1
]);
//存入cookies
network
.
agentCookies
.
put
(
"companyId"
,
"Kj20MjE1"
);
System
.
out
.
println
(
"超级管理员Cookie中key:"
+
superCookieKey
+
" ,values:"
+
superCookieValue
);
}
/**
...
...
@@ -293,14 +296,14 @@ public class BaseUtils {
ThreadSleepUtils
.
sleep
(
2000
);
// 调用登录接口
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"phone"
,
"1
513636130
7"
);
params
.
put
(
"phone"
,
"1
375823125
7"
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptcha
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
CORP_getCaptcha
,
"获取验证码失败"
,
response
.
body
().
asString
()));
//专用于自动化获取验证码
params
.
clear
();
params
.
put
(
"phone"
,
"1
513636130
7"
);
params
.
put
(
"phone"
,
"1
375823125
7"
);
Response
autoTestRes
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptchaForAutoTest
);
String
captcha
=
autoTestRes
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
captcha
);
...
...
@@ -308,7 +311,7 @@ public class BaseUtils {
//登录接口
ThreadSleepUtils
.
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"phone"
,
"1
513636130
7"
);
params
.
put
(
"phone"
,
"1
375823125
7"
);
params
.
put
(
"captcha"
,
captcha
);
Response
loginRes
=
network
.
postResponse
(
params
,
BasicConfig
.
CORP_login
);
boolean
success
=
loginRes
.
jsonPath
().
getBoolean
(
"success"
);
...
...
@@ -334,6 +337,7 @@ public class BaseUtils {
network
.
agentCookies
.
put
(
cookieKeyValue
[
0
],
cookieKeyValue
[
1
]);
//存入cookies
//put company Id
network
.
agentCookies
.
put
(
"companyId"
,
"Kj20MjE1"
);
System
.
out
.
println
(
"公司管理员Cookie中key:"
+
companyCookieKey
+
" ,values:"
+
companyCookieValue
);
}
/**
...
...
@@ -343,14 +347,14 @@ public class BaseUtils {
ThreadSleepUtils
.
sleep
(
2000
);
// 调用登录接口
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"phone"
,
"1
5136361306
"
);
params
.
put
(
"phone"
,
"1
3600546247
"
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptcha
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
CORP_getCaptcha
,
"获取验证码失败"
,
response
.
body
().
asString
()));
//专用于自动化获取验证码
params
.
clear
();
params
.
put
(
"phone"
,
"1
5136361306
"
);
params
.
put
(
"phone"
,
"1
3600546247
"
);
Response
autoTestRes
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptchaForAutoTest
);
String
captcha
=
autoTestRes
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
captcha
);
...
...
@@ -358,7 +362,7 @@ public class BaseUtils {
//登录接口
ThreadSleepUtils
.
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"phone"
,
"1
5136361306
"
);
params
.
put
(
"phone"
,
"1
3600546247
"
);
params
.
put
(
"captcha"
,
captcha
);
Response
loginRes
=
network
.
postResponse
(
params
,
BasicConfig
.
CORP_login
);
boolean
success
=
loginRes
.
jsonPath
().
getBoolean
(
"success"
);
...
...
@@ -384,6 +388,7 @@ public class BaseUtils {
network
.
agentCookies
.
put
(
officeCookieKey
,
officeCookieValue
);
//存入cookies
//put company Id
network
.
agentCookies
.
put
(
"companyId"
,
"Kj20MjE1"
);
System
.
out
.
println
(
"营业部管理员Cookie中key:"
+
officeCookieKey
+
" ,values:"
+
officeCookieValue
);
}
/**
...
...
@@ -400,7 +405,7 @@ public class BaseUtils {
//专用于自动化获取验证码
params
.
clear
();
params
.
put
(
"phone"
,
"1513636130
8
"
);
params
.
put
(
"phone"
,
"1513636130
1
"
);
Response
autoTestRes
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptchaForAutoTest
);
String
captcha
=
autoTestRes
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
captcha
);
...
...
@@ -408,7 +413,7 @@ public class BaseUtils {
//登录接口
ThreadSleepUtils
.
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"phone"
,
"1513636130
8
"
);
params
.
put
(
"phone"
,
"1513636130
1
"
);
params
.
put
(
"captcha"
,
captcha
);
Response
loginRes
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_login
);
boolean
success
=
loginRes
.
jsonPath
().
getBoolean
(
"success"
);
...
...
@@ -418,8 +423,9 @@ public class BaseUtils {
String
header
=
loginRes
.
getHeader
(
"Set-Cookie"
);
String
cookieStr
=
header
.
split
(
";"
)[
0
];
String
[]
cookieKeyValue
=
cookieStr
.
split
(
"="
);
officeCookieKey
=
cookieKeyValue
[
0
];
officeCookieValue
=
cookieKeyValue
[
1
];
network
.
agentCookies
.
put
(
officeCookieKey
,
officeCookieValue
);
//存入cookies
otoCookieKey
=
cookieKeyValue
[
0
];
otoCookieValue
=
cookieKeyValue
[
1
];
network
.
agentCookies
.
put
(
otoCookieKey
,
otoCookieValue
);
//存入cookies
System
.
out
.
println
(
"销售Cookie中key:"
+
otoCookieKey
+
" ,values:"
+
otoCookieValue
);
}
}
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