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
22da38f5
Commit
22da38f5
authored
Jul 26, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210726-xmc' into 'master'
Feature/20210726 xmc See merge request test-group/kejiji!81
parents
e5882849
ba6046c0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
541 additions
and
116 deletions
+541
-116
CustOrigins.java
src/test/java/com/kjj/bean/agent/CustOrigins.java
+10
-0
ForwardAndRead.java
...java/com/kjj/cases/assistant/whoSawMe/ForwardAndRead.java
+208
-0
MyForward.java
...test/java/com/kjj/cases/assistant/whoSawMe/MyForward.java
+256
-0
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+28
-113
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+28
-2
wechatTestNG.xml
src/test/wechatTestNG.xml
+11
-1
No files found.
src/test/java/com/kjj/bean/agent/CustOrigins.java
0 → 100644
View file @
22da38f5
package
com
.
kjj
.
bean
.
agent
;
import
lombok.Data
;
@Data
public
class
CustOrigins
{
private
String
avatar
;
private
String
name
;
private
long
UserId
;
}
src/test/java/com/kjj/cases/assistant/whoSawMe/ForwardAndRead.java
0 → 100644
View file @
22da38f5
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
;
import
com.kjj.bean.red.RedState
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.basics.Article
;
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
javax.crypto.MacSpi
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
BOSS_EDITCONFIG
;
// 谁看过我模块测试前执行一次代理人转发素材及访客访问和产生线索
public
class
ForwardAndRead
implements
Authorization
{
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
String
articleScId
;
private
Long
sellerId
;
private
String
visitId
;
private
String
insuranceId
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
agentTku
();
BaseUtils
.
ssoLogin
();
}
// 代理人转发素材
@Test
(
description
=
"代理人转发文章"
,
priority
=
1
)
public
void
转发文章
()
throws
IOException
{
articleScId
=
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
);
// 获取文章scId
param
=
new
HashMap
<>();
param
.
put
(
"scId"
,
articleScId
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口请求失败"
,
response
.
body
().
asString
()));
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"转发素材失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人转发名片"
,
priority
=
2
)
public
void
转发名片
()
throws
IOException
{
// 获取名片scid
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
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口请求失败"
,
response
.
body
().
asString
()));
boolean
forwardResult
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
forwardResult
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"转发名片失败"
,
response
.
body
().
asString
()));
}
// 访客访问素材及产生线索
@Test
(
description
=
"访客阅读文章"
,
priority
=
3
)
public
void
访客阅读文章
()
throws
IOException
{
sellerId
=
(
Long
)
getUserInfo
(
BasicConfig
.
AGENT_TKU
).
get
(
"sellerId"
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR_TKU
);
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"fromUserId"
,
sellerId
);
param
.
put
(
"cancelPush"
,
false
);
param
.
put
(
"visitPath"
,
0
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CONTENT_READ
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CONTENT_READ
,
"接口调用失败"
,
response
.
body
().
asString
()));
visitId
=
response
.
jsonPath
().
getString
(
"data.visitId"
);
Assert
.
assertNotNull
(
visitId
,
network
.
message
(
param
,
BasicConfig
.
CONTENT_READ
,
"visitId为空"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客领取赠险"
,
priority
=
4
)
public
void
领取赠险
()
throws
IOException
{
// 获取赠险insuranceId
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
articleScId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
SELLERCARD_RECOMMENDLISTV3
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SELLERCARD_RECOMMENDLISTV3
,
"接口调用失败"
,
response
.
body
().
asString
()));
insuranceId
=
response
.
jsonPath
().
getString
(
"data.insuranceVos[0].id"
);
// 领取赠险
param
=
new
HashMap
<>();
param
.
put
(
"clueTypeName"
,
"WELFARE_INSURANCE"
);
param
.
put
(
"insuranceId"
,
insuranceId
);
param
.
put
(
"locationSource"
,
1
);
param
.
put
(
"scId"
,
articleScId
);
param
.
put
(
"sourceId"
,
articleScId
);
param
.
put
(
"sourceType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
,
"接口调用失败"
,
response
.
body
().
asString
()));
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertEquals
(
data
,
"success"
,
network
.
message
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
,
"领取赠险失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客转发文章"
,
priority
=
5
)
public
void
访客转发文章
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scId"
,
articleScId
);
param
.
put
(
"visitId"
,
visitId
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口调用失败"
,
response
.
body
().
asString
()));
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"访客转发素材失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"二度访客阅读文章"
,
priority
=
6
)
public
void
二度访客阅读文章
()
throws
IOException
{
Long
fromUserId
=
decodeTku
(
BasicConfig
.
VISITOR_TKU
).
get
(
"sellerId"
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR1_TKU
);
// 切换二度访客
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"fromUserId"
,
fromUserId
);
param
.
put
(
"cancelPush"
,
false
);
param
.
put
(
"visitPath"
,
0
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CONTENT_READ
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CONTENT_READ
,
"接口调用失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"二度访客领取赠险"
,
priority
=
7
)
public
void
二度访客领取赠险
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"clueTypeName"
,
"WELFARE_INSURANCE"
);
param
.
put
(
"insuranceId"
,
insuranceId
);
param
.
put
(
"locationSource"
,
1
);
param
.
put
(
"scId"
,
articleScId
);
param
.
put
(
"sourceId"
,
articleScId
);
param
.
put
(
"sourceType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
,
"接口调用失败"
,
response
.
body
().
asString
()));
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertEquals
(
data
,
"success"
,
network
.
message
(
param
,
BasicConfig
.
SELLERCARD_SENDPUSHFORSCAN
,
"领取赠险失败"
,
response
.
body
().
asString
()));
}
// 通过素材contentId获取线索员文章scId
public
String
getContentScId
(
String
contentId
){
param
=
new
HashMap
<>();
param
.
put
(
"contentId"
,
contentId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
GETSCID
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
GETSCID
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
contentScid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
contentScid
,
network
.
message
(
param
,
BasicConfig
.
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
return
contentScid
;
}
// 获取用户信息
public
Map
<
String
,
Object
>
getUserInfo
(
String
userTku
){
network
.
agentCookies
.
put
(
"tku"
,
userTku
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
USER_INFO
,
"接口调用失败"
,
response
.
body
().
asString
()));
String
wxName
=
response
.
jsonPath
().
getString
(
"data.wxName"
);
Long
sellerId
=
response
.
jsonPath
().
getLong
(
"data.sellerId"
);
Long
userId
=
response
.
jsonPath
().
getLong
(
"data.userId"
);
Map
<
String
,
Object
>
infos
=
new
HashMap
<>();
infos
.
put
(
"wxName"
,
wxName
);
infos
.
put
(
"sellerId"
,
sellerId
);
infos
.
put
(
"userId"
,
userId
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
return
infos
;
}
// 解密tku
public
HashMap
<
String
,
Long
>
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
(
sellerId
,
network
.
message
(
param
,
BasicConfig
.
MANAGER_TKU_DECODE
,
"获取sellerId失败"
,
response
.
body
().
asString
()));
HashMap
<
String
,
Long
>
result
=
new
HashMap
<>();
result
.
put
(
"userId"
,
userId
);
result
.
put
(
"sellerId"
,
sellerId
);
return
result
;
}
// 加密sellerId
public
String
encodeId
(
Long
Id
){
// 登陆管理后台
param
=
new
HashMap
<>();
param
.
put
(
"code"
,
Id
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MANAGER_ID_ENCODE
);
String
idEncode
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
idEncode
,
network
.
message
(
param
,
BasicConfig
.
MANAGER_ID_ENCODE
,
"加密sellerId失败"
,
response
.
body
().
asString
()));
return
idEncode
;
}
// 关闭数据看板演示数据
public
void
closeDemoData
()
throws
IOException
{
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
()));
}
}
src/test/java/com/kjj/cases/assistant/whoSawMe/MyForward.java
0 → 100644
View file @
22da38f5
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
io.restassured.response.Response
;
import
org.apache.groovy.json.internal.IO
;
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.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
public
class
MyForward
implements
Authorization
{
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
String
visitorEncodeUserId
;
private
ForwardAndRead
far
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
// 登陆管理后台
BaseUtils
.
ssoLogin
();
// 代理人授权
agentTku
();
far
=
new
ForwardAndRead
();
// 关闭数据看板演示数据
far
.
closeDemoData
();
}
// 进入我的转发页面获取转发统计头部信息
@Test
(
description
=
"转发素材统计_头部信息"
,
priority
=
1
)
public
void
转发素材统计
_
头部信息
()
throws
IOException
{
response
=
network
.
getResponse
(
BasicConfig
.
FORWARDHEADER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
BasicConfig
.
FORWARDHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
todayForwardNum
=
response
.
jsonPath
().
getInt
(
"data.todayForwardNum"
);
int
totalForwardNum
=
response
.
jsonPath
().
getInt
(
"data.totalForwardNum"
);
int
weekForwardNum
=
response
.
jsonPath
().
getInt
(
"data.weekForwardNum"
);
Assert
.
assertTrue
(
todayForwardNum
>=
3
,
network
.
message
(
BasicConfig
.
FORWARDHEADER
,
"获取今日转发素材数量失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
totalForwardNum
>=
weekForwardNum
,
network
.
message
(
BasicConfig
.
FORWARDHEADER
,
"获取累计转发素材数量失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
weekForwardNum
>=
todayForwardNum
,
network
.
message
(
BasicConfig
.
FORWARDHEADER
,
"获取本周转发素材数量失败"
,
response
.
body
().
asString
()));
}
// 获取最近转发动态列表
@Test
(
description
=
"转发素材列表_最近转发"
,
priority
=
2
)
public
void
转发素材列表
_
最近转发
()
throws
IOException
{
List
<
Object
>
contentType
=
Lists
.
newArrayList
();
// 创建一个空列表作为contentType参数
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentType
);
param
.
put
(
"orderType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
firstContentId
=
response
.
jsonPath
().
getString
(
"data.list[0].contentVo.contentId"
);
Assert
.
assertEquals
(
firstContentId
,
BasicConfig
.
LOTTERY_CONTENTID
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"首条转发动态contentId错误"
,
response
.
body
().
asString
()));
}
// 获取最近转发文章列表,添加筛选条件
@Test
(
description
=
"转发素材列表_素材类型_文章"
,
priority
=
3
)
public
void
转发素材列表
_
素材类型
_
文章
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
contentTypes
.
add
(
"article"
);
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
forwardArticleList
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
for
(
int
i
=
0
;
i
<
forwardArticleList
.
size
();
i
++)
{
String
contentType
=
response
.
jsonPath
().
getString
(
"data.list["
+
i
+
"].contentVo.contentType"
);
Assert
.
assertEquals
(
contentType
,
"article"
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"筛选结果包含非文章转发记录"
,
response
.
body
().
asString
()));
}
}
// 获取最近转发名片列表
@Test
(
description
=
"转发素材列表_素材类型_名片"
,
priority
=
4
)
public
void
转发素材列表
_
素材类型
_
名片
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
contentTypes
.
add
(
"card"
);
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
forwardArticleList
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
for
(
int
i
=
0
;
i
<
forwardArticleList
.
size
();
i
++)
{
String
contentType
=
response
.
jsonPath
().
getString
(
"data.list["
+
i
+
"].contentVo.contentType"
);
Assert
.
assertEquals
(
contentType
,
"card"
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"筛选结果包含非名片转发记录"
,
response
.
body
().
asString
()));
}
}
// 获取最近转发抽奖列表
@Test
(
description
=
"转发素材列表_素材类型_抽奖"
,
priority
=
5
)
public
void
转发素材列表
_
素材类型
_
抽奖
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
contentTypes
.
add
(
"game_template"
);
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
forwardArticleList
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
for
(
int
i
=
0
;
i
<
forwardArticleList
.
size
();
i
++)
{
String
contentType
=
response
.
jsonPath
().
getString
(
"data.list["
+
i
+
"].contentVo.contentType"
);
Assert
.
assertEquals
(
contentType
,
"game_template"
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"筛选结果包含非抽奖转发记录"
,
response
.
body
().
asString
()));
}
}
// 获取获得多度人脉的素材列表
@Test
(
description
=
"转发素材列表_访问类型_多度人脉"
,
priority
=
6
)
public
void
转发素材列表
_
访问类型
_
多度人脉
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
1
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
2
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口调用失败"
,
response
.
body
().
asString
()));
String
contentId
=
response
.
jsonPath
().
getString
(
"data.list[0].contentVo.contentId"
);
Assert
.
assertEquals
(
contentId
,
ARTICLE_CONTENTID
,
network
.
message
(
param
,
FORWARD_LIST
,
"筛选结果contentId与预期不符"
,
response
.
body
().
asString
()));
}
// 获取访问次数最多的素材列表
@Test
(
description
=
"转发素材列表_最多访问次数"
,
priority
=
7
)
public
void
转发素材列表
_
最多访问次数
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
2
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
firstVisitNum
=
response
.
jsonPath
().
getInt
(
"data.list[0].visitNum"
);
int
secondVisitNum
=
response
.
jsonPath
().
getInt
(
"data.list[1].visitNum"
);
Assert
.
assertTrue
(
firstVisitNum
>=
secondVisitNum
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"首篇素材访问数小于第二篇"
,
response
.
body
().
asString
()));
}
// 查看获得线索最多素材列表
@Test
(
description
=
"转发素材列表_最多获得线索"
,
priority
=
8
)
public
void
转发素材列表
_
最多获得线索
()
throws
IOException
{
List
<
Object
>
contentTypes
=
Lists
.
newArrayList
();
param
=
new
HashMap
<>();
param
.
put
(
"contentType"
,
contentTypes
);
param
.
put
(
"orderType"
,
3
);
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"visitType"
,
1
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
FORWARD_LIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
firstClueNum
=
response
.
jsonPath
().
getInt
(
"data.list[0].clueNum"
);
int
secondClueNum
=
response
.
jsonPath
().
getInt
(
"data.list[1].clueNum"
);
Assert
.
assertTrue
(
firstClueNum
>=
secondClueNum
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_LIST
,
"首篇素材线索数小于第二篇"
,
response
.
body
().
asString
()));
}
// 查看转发文章详情头部信息
@Test
(
description
=
"文章详情_头部信息"
,
priority
=
9
)
public
void
文章详情
_
头部信息
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD_CONTENTHEADER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_CONTENTHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
clueNum
=
response
.
jsonPath
().
getInt
(
"data.clueNum"
);
int
visitNum
=
response
.
jsonPath
().
getInt
(
"data.visitNum"
);
int
forwardNum
=
response
.
jsonPath
().
getInt
(
"data.forwardNum"
);
Assert
.
assertTrue
(
clueNum
>=
1
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_CONTENTHEADER
,
"文章线索数小于1"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
visitNum
>=
1
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_CONTENTHEADER
,
"文章访问数小于1"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
forwardNum
>=
1
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_CONTENTHEADER
,
"文章转发数小于1"
,
response
.
body
().
asString
()));
}
// 获取转发素材访客记录列表
@Test
(
description
=
"文章详情_全部访客记录"
,
priority
=
10
)
public
void
文章详情
_
全部访客记录
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"type"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
);
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
=
far
.
encodeId
(
far
.
decodeTku
(
VISITOR1_TKU
).
get
(
"userId"
));
Assert
.
assertEquals
(
visitorUserIdEncode
,
visitorEncodeUserId
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"转发素材访客记录中首条记录用户userId不正确"
,
response
.
body
().
asString
()));
}
// 筛选素材中线索访客
@Test
(
description
=
"文章详情_访客记录_留下线索"
,
priority
=
11
)
public
void
文章详情
_
访客记录
_
留下线索
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"type"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"接口请求失败"
,
response
.
body
().
asString
()));
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
()));
}
}
// 筛选素材中转发过的访客
@Test
(
description
=
"文章详情_访客记录_转发素材"
,
priority
=
12
)
public
void
文章详情
_
访客记录
_
转发素材
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"type"
,
3
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
custLists
=
response
.
jsonPath
().
getList
(
"data.list"
);
for
(
int
i
=
0
;
i
<
custLists
.
size
();
i
++){
boolean
areForwarded
=
response
.
jsonPath
().
getBoolean
(
"data.list["
+
i
+
"].forwarded"
);
Assert
.
assertTrue
(
areForwarded
,
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"筛选结果中第"
+
i
+
"条记录为未转发素材的访客"
,
response
.
body
().
asString
()));
}
}
// 筛选素材中多度人脉关系
@Test
(
description
=
"文章详情_访客记录_多度人脉"
,
priority
=
13
)
public
void
文章详情
_
访客记录
_
多度人脉
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
getContentScId
(
BasicConfig
.
ARTICLE_CONTENTID
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"type"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
);
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD_VISITRECORD
,
"接口请求失败"
,
response
.
body
().
asString
()));
String
encodeUserId
=
response
.
jsonPath
().
getString
(
"data.list[0].userId"
);
Assert
.
assertEquals
(
encodeUserId
,
far
.
encodeId
((
Long
)
far
.
getUserInfo
(
VISITOR1_TKU
).
get
(
"userId"
)),
network
.
message
(
param
,
FORWARD_VISITRECORD
,
"筛选结果首条记录userId与预期不符"
,
response
.
body
().
asString
()));
}
// 获取素材转发关系链
@Test
(
description
=
"文章详情_访客记录_转发关系"
,
priority
=
14
)
public
void
文章详情
_
访客记录
_
转发关系
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
far
.
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 @
22da38f5
...
...
@@ -21,27 +21,21 @@ public class WhoSawMe implements Authorization {
private
Response
response
;
private
Map
<
String
,
Object
>
param
;
private
String
AGENT1_TKU
;
private
ForwardAndRead
far
;
private
Long
childSellerId
;
@BeforeClass
public
void
setUp
()
throws
IOException
{
// 代理人授权
agentTku
();
BaseUtils
.
ssoLogin
();
// 赋值
AGENT1_TKU
=
"T3gM31f18jCeKCBVHf5MANgyXeBZGCm8vTJQTuWYXHFqxAxq2TQ27ozxyRsZykZBimiwFTrzQnGLWkvAs4"
;
far
=
new
ForwardAndRead
();
// 关闭数据看板演示数据
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
()));
far
.
closeDemoData
();
}
// 进入谁
扛
过我主页
// 进入谁
看
过我主页
// 判断代理人是否新会员
@Test
(
description
=
"首页_判断是否新会员"
,
priority
=
1
)
public
void
判断是否新会员
()
throws
IOException
{
...
...
@@ -86,7 +80,7 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"首页_查询使用版本"
,
priority
=
4
)
public
void
查询代理人当前使用版本
()
throws
IOException
{
param
=
new
HashMap
<>();
String
sellerIdEncode
=
encodeSellerId
(
getSellerId
(
));
String
sellerIdEncode
=
far
.
encodeId
((
Long
)
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"sellerId"
,
sellerIdEncode
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
USING_VERSION
);
String
userVersion
=
response
.
jsonPath
().
getString
(
"data.userVersion"
);
...
...
@@ -154,12 +148,10 @@ public class WhoSawMe implements Authorization {
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
()));
int
todayClueNum
=
response
.
jsonPath
().
getInt
(
"data.todayClueNum"
);
int
todayVisitNum
=
response
.
jsonPath
().
getInt
(
"data.todayVisitNum"
);
Assert
.
assertTrue
(
todayClueNum
>=
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数小于1"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayVisitNum
>=
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数小于1"
,
response
.
body
().
asString
()));
}
// 进入运营周报首页
...
...
@@ -184,7 +176,7 @@ public class WhoSawMe implements Authorization {
// 获取我的上级名称
param
.
clear
();
param
.
put
(
"sellerId"
,
getSellerId
(
));
param
.
put
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_BOSS
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
BOSS_BOSS
,
"获取上级名称失败"
,
response
.
body
().
asString
()));
...
...
@@ -204,8 +196,8 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"其他代理人加入该代理人团队"
,
priority
=
15
)
public
void
邀请加入团队
()
throws
IOException
{
// 切换代理人加入团队
Long
sellerId
=
getSellerId
(
);
network
.
agentCookies
.
put
(
"tku"
,
AGENT
1_TKU
);
Long
sellerId
=
(
Long
)
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR
1_TKU
);
// 确定被邀请代理人没有上级
response
=
network
.
getResponse
(
BasicConfig
.
BOSS_ROLE
);
...
...
@@ -227,9 +219,9 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"查看被邀请代理人上级名称"
,
priority
=
16
)
public
void
查看上级名称
()
throws
IOException
{
// 获取被邀请代理人sellerId
Long
sellerId
=
(
Long
)
decodeTku
(
AGENT
1_TKU
).
get
(
"sellerId"
);
childSellerId
=
far
.
decodeTku
(
BasicConfig
.
VISITOR
1_TKU
).
get
(
"sellerId"
);
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
s
ellerId
);
param
.
put
(
"sellerId"
,
childS
ellerId
);
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
()));
...
...
@@ -238,18 +230,15 @@ public class WhoSawMe implements Authorization {
@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
(
"superiorSid"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
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"
,
AGENT
1_TKU
);
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR
1_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
()));
...
...
@@ -257,25 +246,11 @@ public class WhoSawMe implements Authorization {
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
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
...
...
@@ -285,26 +260,11 @@ public class WhoSawMe implements Authorization {
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
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
...
...
@@ -317,7 +277,7 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"使用工具"
,
priority
=
22
)
public
void
使用工具
()
throws
IOException
{
// 生成抽奖转盘素材scId
String
lottery_scId
=
getContentScId
(
BasicConfig
.
LOTTERY_CONTENTID
);
String
lottery_scId
=
far
.
getContentScId
(
BasicConfig
.
LOTTERY_CONTENTID
);
// 分享抽奖
param
=
new
HashMap
<>();
...
...
@@ -332,7 +292,7 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"查看使用工具记录列表"
,
priority
=
23
)
public
void
查看使用工具记录列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
(
));
param
.
put
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
...
...
@@ -346,12 +306,14 @@ public class WhoSawMe implements Authorization {
@Test
(
description
=
"查看获得线索记录列表"
,
priority
=
24
)
public
void
查看获得线索记录列表
()
throws
IOException
{
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
(
));
param
.
put
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
1
);
param
.
put
(
"sortType"
,
4
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
SALECLUELIST
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
SALECLUELIST
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
visitClueType
=
response
.
jsonPath
().
getInt
(
"data.list[0].visitClueType"
);
Assert
.
assertEquals
(
visitClueType
,
31
,
network
.
message
(
param
,
BasicConfig
.
SALECLUELIST
,
"线索类型不匹配"
,
response
.
body
().
asString
()));
}
// 查看转发动态访问列表
...
...
@@ -359,7 +321,7 @@ public class WhoSawMe implements Authorization {
public
void
查看转发动态访问列表
()
throws
IOException
{
// 获取首条素材列表中首条动态id
param
=
new
HashMap
<>();
param
.
put
(
"sellerId"
,
getSellerId
(
));
param
.
put
(
"sellerId"
,
far
.
getUserInfo
(
AGENT_TKU
).
get
(
"sellerId"
));
param
.
put
(
"pageSize"
,
20
);
param
.
put
(
"pageIndex"
,
1
);
param
.
put
(
"sortType"
,
4
);
...
...
@@ -385,54 +347,7 @@ public class WhoSawMe implements Authorization {
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
;
String
visitorWxName
=
response
.
jsonPath
().
getString
(
"data.list[0].nickName"
);
Assert
.
assertEquals
(
visitorWxName
,
far
.
getUserInfo
(
BasicConfig
.
VISITOR1_TKU
).
get
(
"wxName"
),
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_CUSTCLUELISTV3
,
"访客微信昵称不匹配"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
22da38f5
...
...
@@ -71,6 +71,8 @@ public class BasicConfig {
public
static
String
AGENT_TKU
=
"T3gM31f18jCFEcfTyJdjfJAfSjDmKNMHfH7CvpLDC6UCLbai6Pc41VyJK3bXHe1wg7Hb5FGFZheeLvHjbE"
;
// 基础线访客 TKU
public
static
String
VISITOR_TKU
=
"T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV"
;
// 基础线访客(小雪人) TKU
public
static
String
VISITOR1_TKU
=
"T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPMspUQD6pVEn2FNMefM2nieKPicXG9c1tDg8qtN"
;
// 访客的sids
public
static
final
String
sids
=
"Kj21MjMwNTU"
;
// 访客的userId(固定)
...
...
@@ -596,7 +598,7 @@ public class BasicConfig {
public
static
final
String
ANIMATION_CONTENTID
=
"Kj21MzgzMTk"
;
public
static
final
String
GAME_CONTENTID
=
"Kj21NjIxNTk"
;
public
static
final
String
UPLOAD_CONTENTID
=
"Kj21NjA1NTE"
;
public
static
final
String
LOTTERY_CONTENTID
=
"Kj21MzQ3ODM"
;
//
营销工具抽奖暖冬大转盘素材ID
public
static
final
String
LOTTERY_CONTENTID
=
"Kj21MzQ3ODM"
;
//
抽奖
// *************** 公共 ***************
public
static
final
String
CREATE_USER
=
HOST
+
"/kjy/mp/autotest/create/user"
;
...
...
@@ -702,6 +704,30 @@ public class BasicConfig {
// *************** 谁看过我 ***************
public
static
final
String
WHOSAWME_CUSTCLUELISTV2
=
HOST
+
"/kjy/mp/whoSawMe/custClueList/v2"
;
public
static
final
String
WHOSAWME_CUSTCLUELISTV3
=
HOST
+
"/kjy/mp/whoSawMe/custClueList/v3"
;
public
static
final
String
FORWARDHEADER
=
HOST
+
"/kjy/mp/whoSawMe/forward/header"
;
public
static
final
String
FORWARD_LIST
=
HOST
+
"/kjy/mp/whoSawMe/forward/list/v2"
;
public
static
final
String
FORWARD_CONTENTHEADER
=
HOST
+
"/kjy/mp/whoSawMe/forward/contentHeader"
;
public
static
final
String
FORWARD_VISITRECORD
=
HOST
+
"/kjy/mp/whoSawMe/forward/visitRecordList/v2"
;
public
static
final
String
SELLERUNREADMESSAGE
=
HOST
+
"/kjy/mp/custmarketing/sellerUnreadMsg"
;
public
static
final
String
CUSTOMERSEARCH
=
HOST
+
"/kjy/mp/whoSawMe/customerSearch"
;
public
static
final
String
SEARCHCUSTOMERBYCONTENT
=
HOST
+
"/kjy/mp/custmarketing/searchCustomer"
;
// *************** 客户信息 ***************
public
static
final
String
CUSTINFOHEADER
=
HOST
+
"/kjy/mp/whoSawMe/custInfoHeader"
;
public
static
final
String
CUSTINFO
=
HOST
+
"/kjy/mp/seller/v2/custInfo"
;
public
static
final
String
CLUESTATISTICS
=
HOST
+
"/kjy/mp/whoSawMe/clue/statistics"
;
public
static
final
String
CUSTRELATION
=
HOST
+
"/kjy/mp/seller/customer/relation"
;
public
static
final
String
CUSTOMERSTATISTICS
=
HOST
+
"/kjy/mp/whoSawMe/customerStatistics"
;
public
static
final
String
CUSTREADPERFERENCE
=
HOST
+
"/kjy/mp/seller/customer/getReadPerference"
;
public
static
final
String
CUSTSTATISTIC
=
HOST
+
"/kjy/mp/whoSawMe/customerInfo/statistic"
;
public
static
final
String
CUSTVISITLIST
=
HOST
+
"/kjy/mp/whoSawMe/customerInfo/list"
;
public
static
final
String
ISDISPLAYSPECIAL
=
HOST
+
"/kjy/mp/whoSawMe/isDisplaySpecialCustomerLayer"
;
public
static
final
String
CONTENTVISITRECORD
=
HOST
+
"/kjy/mp/whoSawMe/contentVisitRecord"
;
public
static
final
String
INVITATIONCHAIN
=
HOST
+
"/kjy/mp/whoSawMe/forward/forwardList"
;
// *************** 标签管理 ***************
public
static
final
String
TAG_ADDORUPDATE
=
HOST
+
"/kjy/mp/sellerTag/addOrUpdateTag"
;
public
static
final
String
TAG_GETLIST
=
HOST
+
"/kjy/mp/sellerTag/getTagList"
;
public
static
final
String
TAG_DELETE
=
HOST
+
"/kjy/mp/sellerTag/deleteTag"
;
// *************** 文章 ***************
...
...
@@ -851,6 +877,6 @@ public class BasicConfig {
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_SELLERTEAM_REMOVEMEMBER
=
MANAGER_HOST
+
"/kjy/manager/sellerTeam/removeMember"
;
public
static
final
String
MANAGER_
SELLER
ID_ENCODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/encode"
;
public
static
final
String
MANAGER_ID_ENCODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/encode"
;
public
static
final
String
MANAGER_TKU_DECODE
=
MANAGER_HOST
+
"/kjy/manager/testUser/decryptTku"
;
}
src/test/wechatTestNG.xml
View file @
22da38f5
...
...
@@ -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