Commit ad6eb8bf authored by 龚小红's avatar 龚小红

Merge branch 'feature/20210812-xmc' into 'master'

优化团队成员管理逻辑

See merge request test-group/kejiji!96
parents 2227a860 de18c142
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class VipList {
private long id;
private String nickname;
private long userId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class tagList {
private int count;
private String id;
private String tagName;
}
......@@ -10,7 +10,6 @@ import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import java.io.IOException;
import java.util.*;
......@@ -67,7 +66,7 @@ public class MyCustomer implements Authorization {
}
// 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =3)
@Test(description = "标签管理_新建标签", priority =4)
public void 标签管理_新建标签() throws IOException{
// 添加标签
param = new HashMap<>();
......@@ -87,7 +86,7 @@ public class MyCustomer implements Authorization {
}
// 标签管理_修改标签
@Test(description = "标签管理_修改标签", priority = 4)
@Test(description = "标签管理_修改标签", priority = 5)
public void 标签管理_修改标签() throws IOException{
// 修改标签
param = new HashMap<>();
......@@ -106,24 +105,25 @@ public class MyCustomer implements Authorization {
}
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 100)
@Test(description = "标签管理_删除标签", priority = 3)
public void 标签管理_删除标签() throws IOException{
// 删除标签
List<String> ids = Lists.newArrayList();
ids.add(createTagId);
List<String> ids = new ArrayList<>();
// 删除所有标签
Response getTagListRes = network.getResponse(BasicConfig.TAG_GETLIST);
List<tagList> tagLists = JsonUtil.parseResponseToListBean(getTagListRes, tagList.class);
for(tagList tagList : tagLists){
String tagId = tagList.getId();
ids.add(tagId);
}
param = new HashMap<>();
param.put("ids", ids);
response = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_DELETE, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", response.body().asString()));
Response delTagsRes = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(delTagsRes.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", delTagsRes.body().asString()));
//查看标签列表
response = network.getResponse(BasicConfig.TAG_GETLIST);
List<Object> tagLists = response.jsonPath().getJsonObject("data");
for(int i = 0; i < tagLists.size(); i++){
String tagId = response.jsonPath().getString("data["+ i + "].id");
Assert.assertNotEquals(tagId, createTagId, network.message(BasicConfig.TAG_GETLIST, "标签未删除成功", response.body().asString()));
}
// 检查是否完全删除
tagLists = JsonUtil.parseResponseToListBean(network.getResponse(BasicConfig.TAG_GETLIST), tagList.class);
Assert.assertEquals(tagLists.size(), 0, network.message(param, BasicConfig.TAG_GETLIST, "标签列表内容未全部删除", network.getResponse(BasicConfig.TAG_GETLIST).body().asString()));
}
// 我的客户首页_获取全部客户列表_最近访问
......
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);
......@@ -360,14 +354,37 @@ public class WhoSawMe implements Authorization {
@Test(description = "其他代理人加入该代理人团队", priority = 25)
public void 邀请加入团队() throws IOException{
// 切换代理人加入团队
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
// 获取被邀请人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");
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人已有上级", response.body().asString()));
while (hasSuperior){
// 获取上级昵称
Map<String, Object> bossNamePar = new HashMap<>();
bossNamePar.put("sellerId", childSellerId);
Response getBossNameRes = network.getResponse(bossNamePar, BasicConfig.BOSS_BOSS);
String bossName = getBossNameRes.jsonPath().getString("data");
// 获取上级sellerId
Map<String, Object> bossSIdPar = new HashMap<>();
bossSIdPar.put("sellerName", bossName);
bossSIdPar.put("fuzzyFlag", true);
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"));
......@@ -382,8 +399,6 @@ public class WhoSawMe implements Authorization {
@Test(description = "查看被邀请代理人上级名称", priority = 26)
public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId
childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>();
param.put("sellerId", childSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS);
......@@ -457,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()));
......@@ -478,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()));
}
// 团队任务_新建任务
......@@ -889,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());
}
// 销售线索_查看测评报告的领取详情
......@@ -904,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());
}
// 代理人_转发评测报告
......@@ -942,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();
}
}
......@@ -46,7 +46,6 @@
<class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes>
</test>
<test preserve-order="true" name = "获取访客">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment