Commit 89e3c91b authored by xiamengchen's avatar xiamengchen

新增我的客户

parent 91e2ce3e
......@@ -233,6 +233,34 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(specialCustomerTotal, specialCustLists.size(), network.message(param, BasicConfig.totalSpecial, "特别关注客户总数错误", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_七日活跃", priority = 12)
public void 客户列表_七日活跃() throws IOException{
param = new HashMap<>();
param.put("activeType", 1);
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertTrue(lists.size() >= 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "七日活跃客户数为0", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_直接转发", priority = 13)
public void 客户列表_直接转发() throws IOException{
param = new HashMap<>();
param.put("custOrigin", 1);
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertTrue(lists.size() >= 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "直接转发客户数为0", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_好友转发", priority = 14)
public void 客户列表_好友转发() throws IOException{
......@@ -250,6 +278,8 @@ public class MyCustomer implements Authorization {
// 客户列表_标签
@Test(description = "客户列表_标签", priority = 31)
public void 客户列表_标签() throws IOException{
// 等待5s获取新建的标签
ThreadSleepUtils.sleep(5000);
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
param = new HashMap<>();
......@@ -258,7 +288,8 @@ public class MyCustomer implements Authorization {
param.put("sortType", 3);
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
long userId = response.jsonPath().getLong("data.list[0].sellerId");
System.out.println(response.body().asString());
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "筛选结果与预期不符", response.body().asString()));
}
......@@ -761,6 +792,54 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(subscribe, 1, network.message(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS, "判断用户是否关注公众号失败", response.body().asString()));
}
// 还原用户信息
@AfterClass
public void tearDown() throws IOException{
// 关闭生日提醒
param = new HashMap<>();
param.put("birthRemind", false);
param.put("birthday", "07-31");
param.put("userId", String.valueOf(visitor1UserId));
response = network.postResponse(param, BasicConfig.UPDATEBIRTHREMIND);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATEBIRTHREMIND, "关闭生日提醒失败", response.body().asString()));
// 清空备注和备忘录内容
param.clear();
List<String> tagIds = new ArrayList<>();
param.put("custUserId", String.valueOf(visitor1UserId));
param.put("memo", "");
param.put("remarkName", "");
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.UPDATETAGANDMEMO);
data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATETAGANDMEMO, "清空备忘录内容失败", response.body().asString()));
// 清空更多资料
param.clear();
param.put("age", "");
param.put("birthday", "07-31");
param.put("birthdayType", 2);
param.put("custArea", "");
param.put("custCity", "北区");
param.put("custPhone", "");
List<Object> baseMaterial = new ArrayList<>();
List<Object> otherMaterial = new ArrayList<>();
Map<String, List<Object>> extraMaterial = new HashMap<>();
extraMaterial.put("baseMaterial", baseMaterial);
extraMaterial.put("otherMaterial", otherMaterial);
param.put("extraMaterial", extraMaterial);
param.put("familyStatus", "");
param.put("healthStatus", "");
param.put("insuranceBuyStatus", "");
param.put("remarkName", "");
param.put("userId", String.valueOf(visitor1UserId));
param.put("yearIncome", "");
response = network.postResponse(param, BasicConfig.UPDATECUSTMATERIAL);
data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATECUSTMATERIAL, "清空更多资料失败", response.body().asString()));
}
public Long roundUpToGetCurrentTimestamp(){
// 向上取整获取当前时间戳(半小时为单位)
Date current = new Date();
......
......@@ -9,11 +9,11 @@ import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
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;
......@@ -300,8 +300,37 @@ public class WhoSawMe implements Authorization {
}
}
// 团队任务
// 团队架构
// 团队架构_当前代理人身份
@Test(description = "团队架构_当前代理人身份", priority = 21)
public void 团队架构_当前代理人身份() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
response = network.getResponse(param, BasicConfig.TEAMSTRUCTURE_IDENTITY);
int identity = response.jsonPath().getInt("data.identity");
Assert.assertEquals(identity, 1, network.message(param, BasicConfig.TEAMSTRUCTURE_IDENTITY, "当前代理人身份判断错误", response.body().asString()));
}
// 团队架构_删除团队成员
@Test(description = "团队架构_删除团队成员", priority = 100)
public void 团队架构_删除团队成员() throws IOException{
List<String> sids = new ArrayList<>();
sids.add(far.encodeId(childSellerId));
param = new HashMap<>();
param.put("sids", sids);
response = network.postResponse(param, BasicConfig.MEMBERREMOVE);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.MEMBERREMOVE, "删除成员失败", response.body().asString()));
// 检查被删除成员是否有上级
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()));
}
// 团队任务
// 新建任务_选择素材
@Test(description = "新建任务_选择素材", priority = 23)
public void 新建任务_选择素材() throws IOException{
......@@ -540,22 +569,4 @@ public class WhoSawMe implements Authorization {
Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString()));
Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString()));
}
@AfterClass
public void tearDown() throws IOException{
// 登陆管理后台调用管理后台接口删除成员
param = new HashMap<>();
param.put("superiorSid", xxxSellerId);
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", 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()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
}
......@@ -847,6 +847,8 @@ public class BasicConfig {
// 团队任务
public static final String FINDPAGEBYCONTENTTYPE = HOST + "/kjy/mp/exclusiveItem/findPageByContentType";
public static final String TEAMMEMBER = HOST + "/kjy/mp/seller/team/member";
public static final String TEAMSTRUCTURE_IDENTITY = HOST + "/kjy/mp/seller/team/member/identity";
public static final String MEMBERREMOVE = HOST + "/kjy/mp/seller/team/member/remove";
......
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