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
4937689e
Commit
4937689e
authored
Jan 25, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
访问重构:针对同一文章同一用户不同时间访问,访问次数只记录1次
parent
cdbac803
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
311 additions
and
318 deletions
+311
-318
Cashback.java
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
+265
-266
MyCustomer.java
...est/java/com/kjj/cases/assistant/whoSawMe/MyCustomer.java
+3
-9
MyForward.java
...test/java/com/kjj/cases/assistant/whoSawMe/MyForward.java
+3
-12
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+3
-31
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+37
-0
No files found.
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
View file @
4937689e
This diff is collapsed.
Click to expand it.
src/test/java/com/kjj/cases/assistant/whoSawMe/MyCustomer.java
View file @
4937689e
...
...
@@ -23,9 +23,7 @@ public class MyCustomer implements Authorization {
private
Map
<
String
,
Object
>
param
;
private
String
createTagId
;
private
long
visitor1UserId
;
private
String
sessionId
;
private
String
id
;
// 自定义提醒事项id
private
long
lastMessageId
;
private
long
newUserId
;
@BeforeClass
...
...
@@ -185,13 +183,9 @@ public class MyCustomer implements Authorization {
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"
);
sessionId
=
response
.
jsonPath
().
getString
(
"data.sessionId"
);
Assert
.
assertEquals
(
sellerId
,
ForwardAndRead
.
decodeTku
(
BasicConfig
.
AGENT2_TKU
).
get
(
"sellerId"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"访客所属销售员sellerId不符"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
sessionId
,
network
.
message
(
param
,
BasicConfig
.
CUSTINFO
,
"访客sessionId为空"
,
response
.
body
().
asString
()));
}
// 客户详情页_设置备注
@Test
(
description
=
"客户详情页_设置备注"
,
priority
=
18
)
public
void
客户详情页
_
设置备注
()
throws
IOException
{
...
...
@@ -222,9 +216,9 @@ public class MyCustomer implements Authorization {
int
visitCount
=
response
.
jsonPath
().
getInt
(
"data.visitCount"
);
int
grassNum
=
response
.
jsonPath
().
getInt
(
"data.grassNum"
);
int
datagramNum
=
response
.
jsonPath
().
getInt
(
"data.datagramNum"
);
Assert
.
assertEquals
(
grassNum
,
ForwardAndRead
.
custClueStatistics
.
get
(
"grassNum"
)
+
1
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客阅读种草文章记录次数未正确
增加"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
visitCount
,
ForwardAndRead
.
custClueStatistics
.
get
(
"visitCount"
)
+
2
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客来访记录次数未正确增加"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
datagramNum
,
ForwardAndRead
.
custClueStatistics
.
get
(
"datagramNum"
)
+
1
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客领取资料次数未正确增加"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
grassNum
,
ForwardAndRead
.
custClueStatistics
.
get
(
"grassNum"
)
+
0
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客阅读种草文章记录次数
增加"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
visitCount
,
ForwardAndRead
.
custClueStatistics
.
get
(
"visitCount"
)
+
0
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客来访记录次数未正确增加"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
datagramNum
,
ForwardAndRead
.
custClueStatistics
.
get
(
"datagramNum"
)
+
0
,
network
.
message
(
param
,
BasicConfig
.
CLUESTATISTICS
,
"访客领取资料次数未正确增加"
,
response
.
body
().
asString
()));
}
// //客户详情页_阅读偏好------访问重构未更新
...
...
src/test/java/com/kjj/cases/assistant/whoSawMe/MyForward.java
View file @
4937689e
...
...
@@ -15,6 +15,7 @@ import java.util.List;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku1
;
public
class
MyForward
implements
Authorization
{
private
Response
response
;
...
...
@@ -189,7 +190,7 @@ public class MyForward implements Authorization {
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
visitorUserIdEncode
=
response
.
jsonPath
().
getString
(
"data.list[0].userId"
);
// 获取访客加密的userId
visitorEncodeUserId
=
ForwardAndRead
.
encodeId
(
ForwardAndRead
.
decodeTku
(
VISITOR1_TKU
).
get
(
"userId"
));
visitorEncodeUserId
=
ForwardAndRead
.
encodeId
(
ForwardAndRead
.
decodeTku
(
tku1
).
get
(
"userId"
));
Assert
.
assertEquals
(
visitorUserIdEncode
,
visitorEncodeUserId
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"转发素材访客记录中首条记录用户userId不正确"
,
response
.
body
().
asString
()));
}
...
...
@@ -206,6 +207,7 @@ public class MyForward implements Authorization {
List
<
Object
>
custLists
=
response
.
jsonPath
().
getList
(
"data.list"
);
for
(
int
i
=
0
;
i
<
custLists
.
size
();
i
++){
boolean
areClued
=
response
.
jsonPath
().
getBoolean
(
"data.list["
+
i
+
"].clued"
);
Assert
.
assertTrue
(
areClued
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"筛选结果中第"
+
i
+
"条记录为未留下线索的访客"
,
response
.
body
().
asString
()));
}
}
...
...
@@ -238,15 +240,4 @@ public class MyForward implements Authorization {
String
encodeUserId
=
response
.
jsonPath
().
getString
(
"data.list[0].userId"
);
Assert
.
assertEquals
(
encodeUserId
,
visitorEncodeUserId
,
network
.
message
(
param
,
FORWARD_VISITRECORD
,
"筛选结果首条记录userId与预期不符"
,
response
.
body
().
asString
()));
}
// 获取素材转发关系链----访问重构
@Test
(
description
=
"文章详情_访客记录_转发关系"
,
priority
=
14
)
public
void
文章详情
_
访客记录
_
转发关系
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
ForwardAndRead
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"pageSize"
,
20
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
INVITATIONCHAIN
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
INVITATIONCHAIN
,
"接口请求失败"
,
response
.
body
().
asString
()));
}
}
\ No newline at end of file
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
View file @
4937689e
...
...
@@ -147,8 +147,8 @@ public class WhoSawMe implements Authorization {
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
todayClueNum
=
response
.
jsonPath
().
getInt
(
"data.todayClueNum"
);
int
todayVisitNum
=
response
.
jsonPath
().
getInt
(
"data.todayVisitNum"
);
Assert
.
assertTrue
(
todayClueNum
>=
0
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayVisitNum
>=
2
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayClueNum
==
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayVisitNum
==
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数有误"
,
response
.
body
().
asString
()));
}
// 查看谁看过我首页我的访客列表
...
...
@@ -160,9 +160,7 @@ public class WhoSawMe implements Authorization {
response
=
network
.
getResponse
(
param
,
BasicConfig
.
WHOSAWME_visitList
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_visitList
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
visitId
=
response
.
jsonPath
().
getString
(
"data.list[0].customerInfo.customerUserId"
);
Assert
.
assertEquals
(
visitId
,
IdMakeUtil
.
encodingId
(
xxrUserId
),
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_visitList
,
"最近访客微信用户ID不匹配"
,
response
.
body
().
asString
()));
clueId
=
response
.
jsonPath
().
getString
(
"data.list[1].clueInfoList[1].clueId"
);
Assert
.
assertEquals
(
visitId
,
IdMakeUtil
.
encodingId
(
userId
),
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_visitList
,
"最近访客微信用户ID不匹配"
,
response
.
body
().
asString
()));
}
// 将新用户标记为老用户(小葡萄)
...
...
@@ -837,32 +835,6 @@ public class WhoSawMe implements Authorization {
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
COMPLETEGUIDE
,
"完成该引导失败"
,
response
.
body
().
asString
()));
}
// 销售线索_线索详情
@Test
(
description
=
"销售线索_线索详情"
,
priority
=
54
)
public
void
销售线索
_
线索详情
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"clueId"
,
clueId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CLUEINFO
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
clueBizType
=
response
.
jsonPath
().
getInt
(
"data.clueBizType"
);
String
customerUserId
=
response
.
jsonPath
().
getString
(
"data.customerUserId"
);
String
contentScid
=
response
.
jsonPath
().
getString
(
"data.sourceContent.scid"
);
Assert
.
assertEquals
(
clueBizType
,
3
,
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"线索类型错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
customerUserId
,
IdMakeUtil
.
encodingId
(
xxrUserId
),
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"线索来源访客userId错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentScid
,
ForwardAndRead
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
),
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"线索来源素材id错误"
,
response
.
body
().
asString
()));
}
// 销售线索_跟进建议
@Test
(
description
=
"销售线索_跟进建议"
,
priority
=
55
)
public
void
销售线索
_
跟进建议
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"clueId"
,
clueId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CLUEADVISE
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CLUEADVISE
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
adviseList
=
response
.
jsonPath
().
getJsonObject
(
"data.adviceList"
);
Assert
.
assertNotNull
(
adviseList
,
network
.
message
(
param
,
BasicConfig
.
CLUEADVISE
,
"跟进建议内容为空"
,
response
.
body
().
asString
()));
}
// 管理客户信息
@Test
(
description
=
"管理客户信息"
,
priority
=
56
)
public
void
管理客户信息
()
throws
IOException
{
...
...
src/test/java/com/kjj/utils/BaseUtils.java
View file @
4937689e
...
...
@@ -385,4 +385,41 @@ public class BaseUtils {
//put company Id
network
.
agentCookies
.
put
(
"companyId"
,
"Kj20MjE1"
);
}
/**
* 销售员登录销售工作台
*/
public
static
void
otoSellerLogin
(){
ThreadSleepUtils
.
sleep
(
2000
);
// 调用登录接口
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"phone"
,
"15136361308"
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
WORK_getCaptcha
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
WORK_getCaptcha
,
"获取验证码失败"
,
response
.
body
().
asString
()));
//专用于自动化获取验证码
params
.
clear
();
params
.
put
(
"phone"
,
"15136361308"
);
Response
autoTestRes
=
network
.
getResponse
(
params
,
BasicConfig
.
CORP_getCaptchaForAutoTest
);
String
captcha
=
autoTestRes
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
captcha
);
//登录接口
ThreadSleepUtils
.
sleep
(
2000
);
params
.
clear
();
params
.
put
(
"phone"
,
"15136361308"
);
params
.
put
(
"captcha"
,
captcha
);
Response
loginRes
=
network
.
postResponse
(
params
,
BasicConfig
.
WORK_login
);
boolean
success
=
loginRes
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
WORK_login
,
"登录失败"
,
loginRes
.
body
().
asString
()));
//获取cookie
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
}
}
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