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
de18c142
Commit
de18c142
authored
Aug 12, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化团队成员管理逻辑
parent
b8adf4b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
89 deletions
+101
-89
VipList.java
src/test/java/com/kjj/bean/whoSawMe/VipList.java
+10
-0
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+31
-29
wechatTestNG.xml
src/test/wechatTestNG.xml
+60
-60
No files found.
src/test/java/com/kjj/bean/whoSawMe/VipList.java
0 → 100644
View file @
de18c142
package
com
.
kjj
.
bean
.
whoSawMe
;
import
lombok.Data
;
@Data
public
class
VipList
{
private
long
id
;
private
String
nickname
;
private
long
userId
;
}
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
View file @
de18c142
package
com
.
kjj
.
cases
.
assistant
.
whoSawMe
;
import
com.beust.jcommander.internal.Lists
;
import
com.kjj.bean.whoSawMe.MyTaskList
;
import
com.kjj.bean.whoSawMe.RankingList
;
import
com.kjj.bean.whoSawMe.TeamTaskList
;
import
com.kjj.bean.whoSawMe.WeeklyList
;
import
com.kjj.bean.whoSawMe.*
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
...
...
@@ -12,13 +9,11 @@ import com.kjj.utils.JsonUtil;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Parameters
;
import
org.testng.annotations.Test
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
...
...
@@ -158,7 +153,6 @@ public class WhoSawMe implements Authorization {
public
void
查看我的访客列表
()
throws
IOException
{
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR2_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
System
.
out
.
println
(
response
.
body
().
asString
());
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
param
=
new
HashMap
<>();
param
.
put
(
"customerTagIds"
,
customerTagIds
);
...
...
@@ -363,11 +357,10 @@ public class WhoSawMe implements Authorization {
// 获取被邀请人sellerId
childSellerId
=
ForwardAndRead
.
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"sellerId"
);
// 确定被邀请代理人没有上级
// network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
// response = network.getResponse(BasicConfig.BOSS_ROLE);
// boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
// while (hasSuperior){
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
BOSS_ROLE
);
boolean
hasSuperior
=
response
.
jsonPath
().
getBoolean
(
"data.hasSuperior"
);
while
(
hasSuperior
){
// 获取上级昵称
Map
<
String
,
Object
>
bossNamePar
=
new
HashMap
<>();
bossNamePar
.
put
(
"sellerId"
,
childSellerId
);
...
...
@@ -380,17 +373,28 @@ public class WhoSawMe implements Authorization {
bossSIdPar
.
put
(
"pageNo"
,
1
);
bossSIdPar
.
put
(
"pageSize"
,
20
);
Response
getBossSIdRes
=
network
.
getResponse
(
bossSIdPar
,
BasicConfig
.
MANAGER_vipList
);
// }
List
<
VipList
>
list
=
JsonUtil
.
parseResponseToPageBean
(
getBossSIdRes
,
VipList
.
class
);
Optional
<
VipList
>
bossInfos
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getNickname
(),
bossName
)).
findFirst
();
long
bossSId
=
bossInfos
.
get
().
getId
();
// 将被邀请人移除所属上级团队
Map
<
String
,
Object
>
remMemPar
=
new
HashMap
<>();
remMemPar
.
put
(
"childSid"
,
childSellerId
);
remMemPar
.
put
(
"superiorSid"
,
bossSId
);
Response
remMemRes
=
network
.
postResponse
(
remMemPar
,
MANAGER_SELLERTEAM_REMOVEMEMBER
);
Assert
.
assertTrue
(
remMemRes
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
remMemPar
,
MANAGER_SELLERTEAM_REMOVEMEMBER
,
"删除成员失败"
,
remMemRes
.
body
().
asString
()));
hasSuperior
=
Boolean
.
FALSE
;
}
// 代理人加入团队
//
param = new HashMap<>();
//
param.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
//
param.put("inviteType", 2);
//
response = network.getResponse(param, BasicConfig.BOSS_BOUND);
//
boolean success = response.jsonPath().getBoolean("success");
//
Assert.assertTrue(success, network.message(param, BasicConfig.BOSS_BOUND, "接口请求失败", response.body().asString()));
//
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.BOSS_BOUND, "添加代理人进入团队失败", response.body().asString()));
//
//
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
param
=
new
HashMap
<>();
param
.
put
(
"inviterSid"
,
ForwardAndRead
.
decodeTku
(
BasicConfig
.
VISITOR2_TKU
).
get
(
"sellerId"
));
param
.
put
(
"inviteType"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_BOUND
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
param
,
BasicConfig
.
BOSS_BOUND
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
BOSS_BOUND
,
"添加代理人进入团队失败"
,
response
.
body
().
asString
()));
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
VISITOR2_TKU
);
}
@Test
(
description
=
"查看被邀请代理人上级名称"
,
priority
=
26
)
...
...
@@ -468,7 +472,6 @@ public class WhoSawMe implements Authorization {
param
=
new
HashMap
<>();
param
.
put
(
"sellerName"
,
"吉吉"
);
param
.
put
(
"superiorSid"
,
String
.
valueOf
(
xxxSellerId
));
System
.
out
.
println
();
response
=
network
.
getResponse
(
param
,
BasicConfig
.
MEMBERSEARCH
);
String
sellerId
=
response
.
jsonPath
().
getString
(
"data[0].sellerId"
);
Assert
.
assertEquals
(
sellerId
,
ForwardAndRead
.
encodeId
(
jjSellerId
),
network
.
message
(
param
,
BasicConfig
.
MEMBERSEARCH
,
"搜索结果错误"
,
response
.
body
().
asString
()));
...
...
@@ -489,7 +492,7 @@ public class WhoSawMe implements Authorization {
network
.
agentCookies
.
put
(
"tku"
,
BasicConfig
.
AGENT_TKU
);
response
=
network
.
getResponse
(
BasicConfig
.
BOSS_ROLE
);
boolean
hasSuperior
=
response
.
jsonPath
().
getBoolean
(
"data.hasSuperior"
);
Assert
.
assertFalse
(
hasSuperior
,
network
.
message
(
param
,
BasicConfig
.
BOSS_ROLE
,
"成员仍有上级"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
hasSuperior
,
network
.
message
(
BasicConfig
.
BOSS_ROLE
,
"成员仍有上级"
,
response
.
body
().
asString
()));
}
// 团队任务_新建任务
...
...
@@ -698,7 +701,6 @@ public class WhoSawMe implements Authorization {
param
.
put
(
"taskStatus"
,
2
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
BOSS_TEAMTASKLIST
);
List
<
TeamTaskList
>
teamTaskLists
=
JsonUtil
.
parseResponseToPageBean
(
response
,
TeamTaskList
.
class
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
id
=
teamTaskLists
.
get
(
0
).
getId
();
int
taskAchieverNum
=
teamTaskLists
.
get
(
0
).
getTaskAchieverNum
();
int
taskStatus
=
teamTaskLists
.
get
(
0
).
getTaskStatus
();
...
...
@@ -901,7 +903,6 @@ public class WhoSawMe implements Authorization {
String
clueSummary
=
response
.
jsonPath
().
getString
(
"data.list.find{it.nickName == '小葡萄'}.clueSummary"
);
Assert
.
assertEquals
(
clueSummary
,
"TA想要领取风险测评报告"
,
network
.
message
(
param
,
BasicConfig
.
WHOSAWME_CUSTCLUELISTV3
,
"最近访客微信昵称不匹配"
,
response
.
body
().
asString
()));
clueId
=
response
.
jsonPath
().
getLong
(
"data.list.find{it.nickName == '小葡萄'}.clueId"
);
System
.
out
.
println
(
response
.
body
().
asString
());
}
// 销售线索_查看测评报告的领取详情
...
...
@@ -916,7 +917,6 @@ public class WhoSawMe implements Authorization {
String
clueSummary
=
response
.
jsonPath
().
getString
(
"data.clueSummary"
);
Assert
.
assertEquals
(
visitClueType
,
32
,
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"线索类型错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
clueSummary
,
"领评测报告"
,
network
.
message
(
param
,
BasicConfig
.
CLUEINFO
,
"线索来源类型错误"
,
response
.
body
().
asString
()));
System
.
out
.
println
(
response
.
body
().
asString
());
}
// 代理人_转发评测报告
...
...
@@ -954,5 +954,7 @@ public class WhoSawMe implements Authorization {
response
=
network
.
postResponse
(
param
,
GAME_consult
);
String
sCid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
reportScid
,
network
.
message
(
param
,
GAME_consult
,
"获取sCid失败"
,
response
.
body
().
asString
()));
visitor2Tku
();
}
}
src/test/wechatTestNG.xml
View file @
de18c142
...
...
@@ -6,46 +6,46 @@
<class
name=
"com.kjj.cases.assistant.menu.NoviceGuidance"
/>
</classes>
</test>
<!-- <test preserve-order="true" name="支付">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.pay.Pay"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name="邀请返现">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.pay.Cashback"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "首页">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.homePage.HomePage"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name="我的名片">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.card.PersonCard"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name="文章中个人名片">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "种草素材">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "今日早报">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.homePage.DailyPaper"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "上传链接">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.homePage.Upload"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name=
"支付"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.pay.Pay"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name=
"邀请返现"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.pay.Cashback"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"首页"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.homePage.HomePage"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name=
"我的名片"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.card.PersonCard"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name=
"文章中个人名片"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.card.ArticalPersonCard"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"种草素材"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.homePage.RecommendMaterial"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"今日早报"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.homePage.DailyPaper"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"上传链接"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.homePage.Upload"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"获取访客"
>
<classes>
<class
name=
"com.kjj.cases.assistant.whoSawMe.ForwardAndRead"
/>
...
...
@@ -66,26 +66,26 @@
<class
name=
"com.kjj.cases.assistant.whoSawMe.MyCustomer"
/>
</classes>
</test>
<!-- <test preserve-order="true" name = "贺卡">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "抽奖转盘">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.markettools.GameLottery"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "邀请函和趣味测评">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<!-- <test preserve-order="true" name = "使用攻略和设置中心">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.assistant.menu.PersonalCenter"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name =
"贺卡"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.markettools.GreetingCrad"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"抽奖转盘"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.markettools.GameLottery"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"邀请函和趣味测评"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.markettools.InvitationLetter"
/
>
</classes
>
</test
>
<test
preserve-order=
"true"
name =
"使用攻略和设置中心"
>
<classes
>
<class
name=
"com.kjj.cases.assistant.menu.PersonalCenter"
/
>
</classes
>
</test
>
</suite>
<!-- Suite -->
...
...
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