Commit 6dc8b3d9 authored by 张艳玲's avatar 张艳玲

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

Feature/20210730 xmc

See merge request test-group/kejiji!86
parents c7c5f249 b2643e61
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ArticlePage {
private String contentType;
private String contentId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ChatList {
private int chatContentType;
private String content;
private long id;
private boolean mine;
private int readFlag;
private Long receiverId;
private Long senderId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class CustFavorite {
private String contentId;
private String userActionTypeEnum;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class LinkList {
private Map<String, Object> session;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class RankingList {
private String sellerId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class RemindInfo {
private String id;
private String remindContent;
private int remindStatus;
private Long remindTime;
}
...@@ -30,6 +30,14 @@ public interface Authorization { ...@@ -30,6 +30,14 @@ public interface Authorization {
} }
//代理人
default void visitor2Tku() {
network.agentCookies.put("tku", VISITOR2_TKU);
System.out.println("代理人tku:" + VISITOR2_TKU);
}
// 获取访客tku:Su Yi // 获取访客tku:Su Yi
default void userTku() { default void userTku() {
network.agentCookies.put("tku", VISITOR_UserTku); network.agentCookies.put("tku", VISITOR_UserTku);
......
...@@ -298,7 +298,7 @@ public class GameLottery implements Authorization { ...@@ -298,7 +298,7 @@ public class GameLottery implements Authorization {
@Test(description="访客_打开抽奖链接",priority = 13) @Test(description="访客_打开抽奖链接",priority = 13)
public void 访客_打开抽奖链接(){ public void 访客_打开抽奖链接(){
//切换为访客-请勿打扰 //切换为访客-请勿打扰
userTku1(); // userTku1();
//添加访问记录 //添加访问记录
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
...@@ -541,7 +541,7 @@ public class GameLottery implements Authorization { ...@@ -541,7 +541,7 @@ public class GameLottery implements Authorization {
@Test(description="访客_第二个客户未中奖",priority = 21) @Test(description="访客_第二个客户未中奖",priority = 21)
public void 访客_第二个客户未中奖(){ public void 访客_第二个客户未中奖(){
//切换为请勿打扰 //切换为请勿打扰
userTku1(); // userTku1();
//添加访问记录 //添加访问记录
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
......
...@@ -658,7 +658,7 @@ public class GreetingCrad implements Authorization{ ...@@ -658,7 +658,7 @@ public class GreetingCrad implements Authorization{
@Test(description="访客_礼物被领取完领取失败",priority = 35) @Test(description="访客_礼物被领取完领取失败",priority = 35)
public void 访客_礼物被领取完领取失败(){ public void 访客_礼物被领取完领取失败(){
//切换为访客 //切换为访客
userTku1(); // userTku1();
//查看阅读记录 //查看阅读记录
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
......
...@@ -7,8 +7,7 @@ import org.testng.Assert; ...@@ -7,8 +7,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG; import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
...@@ -21,10 +20,11 @@ public class ForwardAndRead implements Authorization { ...@@ -21,10 +20,11 @@ public class ForwardAndRead implements Authorization {
private Long sellerId; private Long sellerId;
private String visitId; private String visitId;
private String insuranceId; private String insuranceId;
private String forwardTime;
@BeforeClass @BeforeClass
public void setUp() throws IOException{ public void setUp() throws IOException{
agentTku(); visitor2Tku();
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
} }
...@@ -39,6 +39,8 @@ public class ForwardAndRead implements Authorization { ...@@ -39,6 +39,8 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString()));
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString())); Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
forwardTime = response.jsonPath().getString("timestamp");
} }
@Test(description = "代理人转发名片", priority = 2) @Test(description = "代理人转发名片", priority = 2)
...@@ -58,8 +60,8 @@ public class ForwardAndRead implements Authorization { ...@@ -58,8 +60,8 @@ public class ForwardAndRead implements Authorization {
// 访客访问素材及产生线索 // 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 3) @Test(description = "访客阅读文章", priority = 3)
public void 访客阅读文章() throws IOException{ public void 访客阅读文章() throws IOException{
sellerId = (Long) getUserInfo(BasicConfig.AGENT_TKU).get("sellerId"); sellerId = decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR_TKU); network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
param = new HashMap<>(); param = new HashMap<>();
param.put("scid", articleScId); param.put("scid", articleScId);
param.put("fromUserId", sellerId); param.put("fromUserId", sellerId);
...@@ -108,7 +110,7 @@ public class ForwardAndRead implements Authorization { ...@@ -108,7 +110,7 @@ public class ForwardAndRead implements Authorization {
@Test(description = "二度访客阅读文章", priority = 6) @Test(description = "二度访客阅读文章", priority = 6)
public void 二度访客阅读文章() throws IOException{ public void 二度访客阅读文章() throws IOException{
Long fromUserId = decodeTku(BasicConfig.VISITOR_TKU).get("sellerId"); Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客 network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客
param = new HashMap<>(); param = new HashMap<>();
param.put("scid", articleScId); param.put("scid", articleScId);
...@@ -147,18 +149,16 @@ public class ForwardAndRead implements Authorization { ...@@ -147,18 +149,16 @@ public class ForwardAndRead implements Authorization {
} }
// 获取用户信息 // 获取用户信息
public Map<String, Object> getUserInfo(String userTku){ public Map<String, String> getUserInfo(String userTku){
network.agentCookies.put("tku", userTku); network.agentCookies.put("tku", userTku);
response = network.getResponse(BasicConfig.USER_INFO); response = network.getResponse(BasicConfig.USER_INFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString()));
String avatar = response.jsonPath().getString("data.avatar");
String wxName = response.jsonPath().getString("data.wxName"); String wxName = response.jsonPath().getString("data.wxName");
Long sellerId = response.jsonPath().getLong("data.sellerId"); Map<String, String> infos = new HashMap<>();
Long userId = response.jsonPath().getLong("data.userId"); infos.put("avatar", avatar);
Map<String, Object> infos = new HashMap<>();
infos.put("wxName", wxName); infos.put("wxName", wxName);
infos.put("sellerId", sellerId); network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
infos.put("userId", userId);
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
return infos; return infos;
} }
......
package com.kjj.cases.assistant.whoSawMe;
import com.jogamp.common.util.ArrayHashSet;
import com.kjj.bean.whoSawMe.ChatList;
import com.kjj.bean.whoSawMe.CustFavorite;
import com.kjj.bean.whoSawMe.LinkList;
import com.kjj.bean.whoSawMe.RemindInfo;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import freemarker.template.utility.DateUtil;
import io.restassured.response.Response;
import org.apache.commons.lang.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import javax.xml.crypto.Data;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
// 我的客户-首页
public class MyCustomer implements Authorization {
private Response response;
private Map<String, Object> param;
private ForwardAndRead far;
private String createTagId;
private long visitor1UserId;
private String sessionId;
private int visitCount;
private String id; // 自定义提醒事项id
@BeforeClass
public void setUp() throws IOException{
BaseUtils.ssoLogin();
visitor2Tku();
far = new ForwardAndRead();
}
// 我的客户首页_客户统计
@Test(description = "首页_客户统计", priority = 1)
public void 首页_客户统计() throws IOException{
response = network.getResponse(BasicConfig.CUSTOMERSTATISTICS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.CUSTOMERSTATISTICS, "接口请求失败", response.body().asString()));
int sevenDaysActiveCount = response.jsonPath().getInt("data.sevenDaysActiveCount");
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertTrue(sevenDaysActiveCount >= 1, network.message(BasicConfig.CUSTOMERSTATISTICS, "七日活跃客户数小于1", response.body().asString()));
Assert.assertTrue(totalCount >= 1, network.message(BasicConfig.CUSTOMERSTATISTICS, "累计获客数小于1", response.body().asString()));
}
// 我的客户首页_查询未读信息
@Test(description = "首页_查询未读信息", priority = 2)
public void 首页_查询未读信息() throws IOException{
response = network.getResponse(BasicConfig.SELLERUNREADMESSAGE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.SELLERUNREADMESSAGE, "接口请求失败", response.body().asString()));
Object unreadCount = response.jsonPath().getJsonObject("data.unreadCount");
Assert.assertNotNull(unreadCount, network.message(BasicConfig.SELLERUNREADMESSAGE, "获取未读消息数失败", response.body().asString()));
}
// 消息通知页_对话记录
@Test(description = "消息通知页_对话记录", priority = 99)
public void 消息通知页_对话记录() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 90);
response = network.getResponse(param, BasicConfig.CHAT_LINKMANLIST);
List<LinkList> linkLists = JsonUtil.parseResponseToPageBean(response, LinkList.class);
String sessionIds = (String) linkLists.get(0).getSession().get("sessionId");
String lastContent = (String) linkLists.get(0).getSession().get("lastContent");
Assert.assertEquals(sessionIds, sessionId, network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录sessionId有误", response.body().asString()));
Assert.assertEquals(lastContent, "Hello", network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录最后一条内容错误", response.body().asString()));
}
// 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =3)
public void 标签管理_新建标签() throws IOException{
// 添加标签
param = new HashMap<>();
param.put("tagName", "新标签");
response = network.postResponse(param, BasicConfig.TAG_ADDORUPDATE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_ADDORUPDATE, "接口请求失败", response.body().asString()));
createTagId = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(createTagId, network.message(param, BasicConfig.TAG_ADDORUPDATE, "data数据为空", response.body().asString()));
// 查看标签列表
response = network.getResponse(BasicConfig.TAG_GETLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.TAG_GETLIST, "接口请求失败", response.body().asString()));
String newTagId = response.jsonPath().getString("data[0].id");
String newTagName = response.jsonPath().getString("data[0].tagName");
Assert.assertEquals(newTagId, (String) createTagId, network.message(BasicConfig.TAG_GETLIST, "新增标签id错误", response.body().asString()));
Assert.assertEquals(newTagName, "新标签", network.message(BasicConfig.TAG_GETLIST, "新增标签名称错误", response.body().asString()));
}
// 标签管理_修改标签
@Test(description = "标签管理_修改标签", priority = 4)
public void 标签管理_修改标签() throws IOException{
// 修改标签
param = new HashMap<>();
param.put("id", createTagId);
param.put("tagName", "新标签2");
response = network.postResponse(param, BasicConfig.TAG_ADDORUPDATE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_ADDORUPDATE, "接口请求失败", response.body().asString()));
// 查看标签列表
response = network.getResponse(BasicConfig.TAG_GETLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.TAG_GETLIST, "接口请求失败", response.body().asString()));
String newTagId = response.jsonPath().getString("data[0].id");
String newTagName = response.jsonPath().getString("data[0].tagName");
Assert.assertEquals(newTagId, (String) createTagId, network.message(BasicConfig.TAG_GETLIST, "新增标签id错误", response.body().asString()));
Assert.assertEquals(newTagName, "新标签2", network.message(BasicConfig.TAG_GETLIST, "新增标签名称错误", response.body().asString()));
}
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 100)
public void 标签管理_删除标签() throws IOException{
// 删除标签
List<String> ids = Lists.newArrayList();
ids.add(createTagId);
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 = 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()));
}
}
// 我的客户首页_获取全部客户列表_最近访问
@Test(description = "客户列表_最近访问", priority = 6)
public void 客户列表_最近访问() throws IOException{
visitor1UserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
param = new HashMap<>();
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()));
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString()));
}
// 我的客户首页_获取全部客户列表_按照访问次数排列
@Test(description = "客户列表_访问次数", priority = 7)
public void 客户列表_访问次数() throws IOException{
// 降序排列
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 1);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
int visitCountFirst = response.jsonPath().getInt("data.list[0].visitCount");
int visitCountSecond = response.jsonPath().getInt("data.list[1].visitCount");
int visitCountThird = response.jsonPath().getInt("data.list[2].visitCount");
boolean compareOne = visitCountFirst >= visitCountSecond;
boolean compareTwo = visitCountSecond >= visitCountThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
// 升序排列
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 2);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
visitCountFirst = response.jsonPath().getInt("data.list[0].visitCount");
visitCountSecond = response.jsonPath().getInt("data.list[1].visitCount");
visitCountThird = response.jsonPath().getInt("data.list[2].visitCount");
compareOne = visitCountFirst <= visitCountSecond;
compareTwo = visitCountSecond <= visitCountThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
}
// 我的客户首页_获取全部客户列表_按客户意向排列
@Test(description = "客户列表_客户意向", priority = 8)
public void 客户列表_客户意向() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 5);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
int customerIntentionFirst = response.jsonPath().getInt("data.list[0].customerIntention");
int customerIntentionSecond = response.jsonPath().getInt("data.list[1].customerIntention");
int customerIntentionThird = response.jsonPath().getInt("data.list[2].customerIntention");
boolean compareOne = customerIntentionFirst >= customerIntentionSecond;
boolean compareTwo = customerIntentionSecond >= customerIntentionThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户意向筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户意向筛选结果排列顺序错误", response.body().asString()));
}
//我的客户首页_获取客户列表_特别关注客户
@Test(description = "客户列表_特别关注", priority = 10)
public void 客户列表_特别关注() throws IOException{
ThreadSleepUtils.sleep(5000);
param = new HashMap<>();
param.put("isSpecialCustomer", 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()));
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户userId不匹配", response.body().asString()));
List<Object> specialCustLists = response.jsonPath().getJsonObject("data.list");
for(int i = 0; i < specialCustLists.size(); i++){
int isSpecialCustomer = response.jsonPath().getInt("data.list["+ i +"].isSpecialCustomer");
Assert.assertEquals(isSpecialCustomer, 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "筛选结果包含非特殊关注客户", response.body().asString()));
}
// 特别关注客户总数
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.totalSpecial);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.totalSpecial, "接口请求失败", response.body().asString()));
int specialCustomerTotal = response.jsonPath().getInt("data.specialCustomerTotal");
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{
param = new HashMap<>();
param.put("custOrigin", 2);
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()));
Long custUserId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(custUserId, far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId"), network.message(param, BasicConfig.CUSTOMERSEARCH, "好友转发的访客userId与预期不一致", response.body().asString()));
}
// 客户列表_标签
@Test(description = "客户列表_标签", priority = 31)
public void 客户列表_标签() throws IOException{
// 等待5s获取新建的标签
ThreadSleepUtils.sleep(5000);
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
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()));
}
// 客户详情页_头部信息栏
@Test(description = "客户详情页_头部信息栏", priority = 16)
public void 客户详情页_头部信息栏() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFOHEADER, "接口请求失败", response.body().asString()));
List<Object> custOrigins = response.jsonPath().getList("data.custOrigins");
Assert.assertEquals(custOrigins.size(), 3, network.message(param, BasicConfig.CUSTINFOHEADER, "二度客户来源链路长度不为3", response.body().asString()));
int cameFrom = response.jsonPath().getInt("data.cameFrom");
Assert.assertEquals(cameFrom, 2, network.message(param, BasicConfig.CUSTINFOHEADER, "访客来源不为二度访客", response.body().asString()));
}
// 客户详情页_客户信息
@Test(description = "客户详情页_客户信息", priority = 17)
public void 客户详情页_客户信息() throws IOException{
param = new HashMap<>();
param.put("userId", visitor1UserId);
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, far.decodeTku(BasicConfig.VISITOR2_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 = 9)
public void 客户详情页_设置特别关注() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 1);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "设置特别关注失败", response.body().asString()));
}
// 客户详情页_取消特别关注
@Test(description = "客户详情页_设置特别关注", priority = 11)
public void 客户详情页_取消特别关注() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 0);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "取消特别关注失败", response.body().asString()));
}
// 客户详情页_设置备注
@Test(description = "客户详情页_设置备注", priority = 18)
public void 客户详情页_设置备注() throws IOException{
// 设置备注
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("remarkName", "备注名");
response = network.postResponse(param, BasicConfig.UPDATEREMARKNAME);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATEREMARKNAME, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEREMARKNAME, "设置备注失败", response.body().asString()));
// 查看用户头部信息
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
String remarkName = response.jsonPath().getString("data.remarkName");
Assert.assertEquals(remarkName, "备注名", network.message(param, BasicConfig.CUSTINFOHEADER, "用户备注名与预期不符", response.body().asString()));
}
// 客户详情页_意向详情
@Test(description = "客户详情页_意向详情", priority = 19)
public void 客户详情页_意向详情() throws IOException{
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUESTATISTICS, "接口请求失败", response.body().asString()));
int drawPresentInsuranceCount = response.jsonPath().getInt("data.drawPresentInsuranceCount");
Assert.assertTrue(drawPresentInsuranceCount >= 1, network.message(param, BasicConfig.CLUESTATISTICS, "客户领取赠险次数小于1", response.body().asString()));
}
// 客户详情页_线索统计
@Test(description = "客户详情页_线索统计", priority = 21)
public void 客户详情页_线索统计() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
visitCount = response.jsonPath().getInt("data.visitCount");
int grassNum = response.jsonPath().getInt("data.grassNum");
Assert.assertTrue(visitCount >= 1, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数小于1", response.body().asString()));
Assert.assertTrue(grassNum >= 1, network.message(param, BasicConfig.CUSTSTATISTIC, "用户阅读种草文章次数小于1", response.body().asString()));
Assert.assertEquals(visitCount, grassNum, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数与阅读种草文章次数不相等", response.body().asString()));
}
// 客户详情页_阅读偏好
@Test(description = "客户详情页_阅读偏好", priority = 22)
public void 客户详情页_阅读偏好() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTREADPERFERENCE, "接口请求失败", response.body().asString()));
}
// 客户详情页_来访记录
@Test(description = "客户详情页_来访记录", priority = 23)
public void 客户详情页_来访记录() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("custUserId", visitor1UserId);
param.put("filterType", 1);
param.put("timeType", 2);
param.put("timeOrderType", 2);
response = network.getResponse(param, BasicConfig.CUSTVISITLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTVISITLIST, "接口请求失败", response.body().asString()));
List<Object> visitLists = response.jsonPath().getList("data.list");
Assert.assertEquals(visitLists.size(), visitCount, network.message(param, BasicConfig.CUSTVISITLIST, "访客来访记录数目与来访次数不符", response.body().asString()));
}
// 客户详情页_任务蒙层
@Test(description = "客户详情页_任务蒙层", priority = 24)
public void 客户详情页_任务蒙层() throws IOException{
param = new HashMap<>();
param.put("sceneCode", "noviceTask_visitorsCustomerInfoComplete");
response = network.postResponse(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY);
boolean isDisplay = response.jsonPath().getBoolean("data.isDisplay");
Assert.assertFalse(isDisplay, network.message(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY, "任务蒙层展示判断错误", response.body().asString()));
}
// 客户详情页_特别关注弹层
@Test(description = "客户详情页_特别关注弹层", priority = 25)
public void 客户详情页_特别关注弹层() throws IOException{
response = network.getResponse(BasicConfig.ISDISPLAYSPECIAL);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.ISDISPLAYSPECIAL, "接口返回数据为空", response.body().asString()));
}
// 客户详情页_素材访问记录
@Test(description = "客户详情页_素材访问记录", priority = 26)
public void 客户详情页_素材访问记录() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("pageIndex", 1);
param.put("paheSize", 30);
response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD);
int totalCount = response.jsonPath().getInt("data.custVisitList.totalCount");
Assert.assertEquals(totalCount, visitCount, network.message(param, BasicConfig.CONTENTVISITRECORD, "访问记录总数与来访次数不符", response.body().asString()));
}
// 客户详情页_关键线索_提交资料
@Test(description = "客户详情页_资料信息", priority = 27)
public void 关键线索_提交资料() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTMATERIALS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTMATERIALS, "接口请求失败", response.body().asString()));
}
// 客户详情页_关键线索_中奖记录
@Test(description = "客户详情页_关键信息_中奖记录",priority = 28)
public void 关键线索_中奖记录() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTLOTTERIES);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTLOTTERIES, "接口请求失败", response.body().asString()));
}
// 客户详情页_关键信息_喜欢的内容
@Test(description = "关键信息_喜欢的内容", priority = 29)
public void 关键信息_喜欢的内容() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTFAVORITE);
List<CustFavorite> custFavorites = JsonUtil.parseResponseToListBean(response, CustFavorite.class);
Assert.assertTrue(custFavorites.size() >= 1, network.message(param, BasicConfig.CUSTFAVORITE, "数据记录数有误", response.body().asString()));
String userActionTypeEnum = custFavorites.get(0).getUserActionTypeEnum();
String contentId = custFavorites.get(0).getContentId();
Assert.assertEquals(userActionTypeEnum, "FORWARD", network.message(param, BasicConfig.CUSTFAVORITE, "用户动作类型记录有误", response.body().asString()));
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param, BasicConfig.CUSTFAVORITE, "用户产生动作的素材ID有误", response.body().asString()));
}
// 客户信息_客户管理_备注和标签
@Test(description = "备注和标签", priority = 30)
public void 客户信息_客户管理_备注和标签() throws IOException{
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
String custUserId = String.valueOf(visitor1UserId);
// 设置客户备注和标签信息
param = new HashMap<>();
param.put("custUserId", custUserId);
param.put("memo", "备忘录内容");
param.put("remarkName", "备注昵称");
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.UPDATETAGANDMEMO);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATETAGANDMEMO, "设置备注信息失败", response.body().asString()));
// 查询用户头部信息
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
String remarkName = response.jsonPath().getString("data.remarkName");
Assert.assertEquals(remarkName, "备注昵称", network.message(param, BasicConfig.CUSTINFOHEADER, "备注昵称与预期不符", response.body().asString()));
// 查询用户标签和备注信息
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETTAGANDREMIND);
String memo = response.jsonPath().getString("data.memo");
String tagId = response.jsonPath().getString("data.tagList[0].id");
Assert.assertEquals(memo, "备忘录内容", network.message(param, BasicConfig.GETTAGANDREMIND, "备忘内容与预期不符", response.body().asString()));
Assert.assertEquals(tagId, createTagId, network.message(param, BasicConfig.GETTAGANDREMIND, "标签id与预期不符", response.body().asString()));
}
// 客户信息_客户管理_自定义提醒事项
@Test(description = "客户信息_客户管理_自定义提醒事项", priority = 32)
public void 客户信息_客户管理_自定义提醒事项() throws IOException{
param = new HashMap<>();
param.put("remindContent", "自定义提醒");
param.put("remindTime", roundUpToGetCurrentTimestamp());
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.UPDATECUSTREMIND);
String remindId = response.jsonPath().getString("data");
Assert.assertNotNull(remindId, network.message(param, BasicConfig.UPDATECUSTREMIND, "自定义提醒id为空", response.body().asString()));
// 查询未提醒事件列表
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
for(RemindInfo remindInfo : remindInfos){
int remindStatus = remindInfo.getRemindStatus();
Assert.assertEquals(remindStatus, 0, network.message(param, BasicConfig.GETREMINDINFOS, "有状态为非未提醒事件", response.body().asString()));
}
id = remindInfos.get(0).getId();
Long stamp = remindInfos.get(0).getRemindTime();
Assert.assertEquals(id, remindId, network.message(param, BasicConfig.GETREMINDINFOS, "事件id与预期不符", response.body().asString()));
Assert.assertEquals(stamp, roundUpToGetCurrentTimestamp(), network.message(param, BasicConfig.GETREMINDINFOS, "事件触发时间与预期不符", response.body().asString()));
}
// 客户信息_客户管理_修改提醒事项
@Test(description = "客户信息_客户管理_修改提醒事项", priority = 33)
public void 客户信息_客户管理_修改提醒事项() throws IOException{
param = new HashMap<>();
param.put("id", id);
param.put("remindContent", "修改自定义提醒");
param.put("remindTime", roundUpToGetCurrentTimestamp());
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.UPDATECUSTREMIND);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc, "OK", network.message(param, BasicConfig.UPDATECUSTREMIND, "修改提醒事项失败", response.body().asString()));
// 查询未提醒事件列表
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
String id = remindInfos.get(0).getId();
String remindContent = remindInfos.get(0).getRemindContent();
Assert.assertEquals(id, id, network.message(param, BasicConfig.GETREMINDINFOS, "事件id与预期不符", response.body().asString()));
Assert.assertEquals(remindContent, "修改自定义提醒", network.message(param, BasicConfig.GETREMINDINFOS, "修改提醒内容未生效", response.body().asString()));
}
//客户信息_客户管理_删除自定义提醒
@Test(description = "客户信息_客户管理_删除自定义提醒", priority = 34)
public void 客户信息_客户管理_删除自定义提醒() throws IOException{
// 删除待提醒事件
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
for (RemindInfo remindInfo : remindInfos){
String id = remindInfo.getId();
param = new HashMap<>();
param.put("id", id);
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.DELETEREMIND);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.DELETEREMIND, "删除失败", response.body().asString()));
}
// 确认全部删除
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<Object> list = response.jsonPath().getList("data.list");
Assert.assertEquals(list.size(), 0, network.message(param, BasicConfig.GETREMINDINFOS, "待提醒事件未全部删除", response.body().asString()));
}
// 客户信息_客户管理_查询已提醒事件列表
@Test(description = "客户信息_客户管理_查询已提醒事件列表", priority = 35)
public void 客户信息_客户管理_查询已提醒事件列表() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 1);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
String remindContent = remindInfos.get(0).getRemindContent();
int remindStatus = remindInfos.get(0).getRemindStatus();
Assert.assertEquals(remindContent, "吃饭", network.message(param, BasicConfig.GETREMINDINFOS, "筛选结果事件内容不正确", response.body().asString()));
Assert.assertEquals(remindStatus, 1, network.message(param, BasicConfig.GETREMINDINFOS, "筛选结果状态非已提醒", response.body().asString()));
}
// 客户信息_客户管理_生日提醒
@Test(description = "客户信息_客户管理_生日提醒", priority = 36)
public void 客户信息_客户管理_生日提醒() throws IOException{
String userId = String.valueOf(visitor1UserId);
// 开启生日提醒
param = new HashMap<>();
param.put("birthRemind", true);
param.put("birthday", "07-30");
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEBIRTHREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEBIRTHREMIND, "开启生日提醒失败", response.body().asString()));
// 检查是否开启
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETCUSTREMINDINFO);
boolean birthRemind = response.jsonPath().getBoolean("data.birthRemind");
String birthday = response.jsonPath().getString("data.birthday");
Assert.assertTrue(birthRemind, network.message(param, BasicConfig.GETCUSTREMINDINFO, "生日提醒未开启", response.body().asString()));
Assert.assertEquals(birthday, "07-30", network.message(param, BasicConfig.GETCUSTREMINDINFO, "生日日期不正确", response.body().asString()));
// 关闭生日提醒
param = new HashMap<>();
param.put("birthRemind", false);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEBIRTHREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEBIRTHREMIND, "关闭生日提醒失败", response.body().asString()));
// 检查是否关闭
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTOMERDETAIL);
birthRemind = response.jsonPath().getBoolean("data.birthRemind");
Assert.assertFalse(birthRemind, network.message(param, BasicConfig.CUSTOMERDETAIL, "生日提醒未关闭", response.body().asString()));
}
// 客户信息_客户管理_节日提醒
@Test(description = "客户信息_客户管理_节日提醒", priority = 37)
public void 客户信息_客户管理_节日提醒() throws IOException{
String userId = String.valueOf(visitor1UserId);
// 开启节日提醒
param = new HashMap<>();
param.put("holidayRemind", true);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEHOLIDAYREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEHOLIDAYREMIND, "节日提醒开启失败", response.body().asString()));
// 检查是否开启
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETTAGANDREMIND);
boolean holidayRemind = response.jsonPath().getBoolean("data.holidayRemind");
Assert.assertTrue(holidayRemind, network.message(param, BasicConfig.GETTAGANDREMIND, "节日提醒未开启", response.body().asString()));
// 关闭节日提醒
param.clear();
param.put("holidayRemind", false);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEHOLIDAYREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEHOLIDAYREMIND, "节日提醒关闭失败", response.body().asString()));
// 检查是否关闭
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETCUSTREMINDINFO);
holidayRemind = response.jsonPath().getBoolean("data.holidayRemind");
Assert.assertFalse(holidayRemind, network.message(param, BasicConfig.GETTAGANDREMIND, "节日提醒未关闭", response.body().asString()));
}
// 客户信息_客户关系链_统计信息
@Test(description = "客户信息_客户关系链_统计信息", priority = 38)
public void 客户信息_客户关系链_统计信息() throws IOException{
param = new HashMap<>();
param.put("custUserId", far.decodeTku(BasicConfig.AGENT_TKU).get("userId"));
response = network.getResponse(param, BasicConfig.RELATIONINFO_HEADER);
String name = response.jsonPath().getString("data.name");
Assert.assertEquals(name, BasicConfig.WECHAT_NAME, network.message(param, BasicConfig.RELATIONINFO_HEADER, "客户姓名不正确", response.body().asString()));
}
// 客户信息_客户关系链_人脉列表
@Test(description = "客户信息_客户关系链_人脉列表", priority = 39)
public void 客户信息_客户关系链_人脉列表() throws IOException{
param = new HashMap<>();
param.put("custUserId", far.decodeTku(BasicConfig.AGENT_TKU).get("userId"));
param.put("type", 1);
param.put("pageSize", 20);
param.put("pageIndex", 1);
response = network.getResponse(param, BasicConfig.RELATIONINFO_LIST);
Object data =response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.RELATIONINFO_LIST, "返回响应为空", response.body().asString()));
}
// 客户信息_客户关系链_邀请排行
@Test(description = "客户信息_客户关系链_邀请排行", priority = 40)
public void 客户信息_客户关系链_邀请排行() throws IOException{
param = new HashMap<>();
param.put("type", 2);
param.put("pageSize", 20);
param.put("pageIndex", 1);
response = network.getResponse(param, BasicConfig.RELATIONINFO_RANKING);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.RELATIONINFO_RANKING, "返回响应为空", response.body().asString()));
}
//客户信息_更多资料
@Test(description = "客户信息_更多资料", priority = 41)
public void 客户信息_更多资料() throws IOException{
// 更新资料信息
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);
String userId = String.valueOf(visitor1UserId);
param = new HashMap<>();
param.put("age", "11");
param.put("birthRemind", true);
param.put("birthday", "07-31");
param.put("birthdayType", 2);
param.put("custArea", "");
param.put("custCity", "北区");
param.put("custGender", 1);
param.put("custPhone", "13705566425");
param.put("extraMaterial", extraMaterial);
param.put("familyStatus", "家庭情况");
param.put("haveCar", false);
param.put("haveHouse", true);
param.put("healthStatus", "健康状态");
param.put("insuranceBuyStatus", "保险购买情况");
param.put("userId", userId);
param.put("yearIncome", 10000);
response = network.postResponse(param, BasicConfig.UPDATECUSTMATERIAL);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATECUSTMATERIAL, "修改保存失败", response.body().asString()));
// 查看修改
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTOMERDETAIL);
boolean haveCar = response.jsonPath().getBoolean("data.haveCar");
boolean haveHouse = response.jsonPath().getBoolean("data.haveHouse");
boolean birthRemind = response.jsonPath().getBoolean("data.birthRemind");
Assert.assertFalse(haveCar, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
Assert.assertTrue(haveHouse, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
Assert.assertTrue(birthRemind, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
}
// 客户详情页_留言
@Test(description = "客户详情页_留言", priority = 42)
public void 客户详情页_留言() throws IOException{
// 判断销售员是否首次访问新功能(留言)
param = new HashMap<>();
param.put("type", 20);
response = network.getResponse(param, BasicConfig.NEWFUNC_FIRSTVISIT);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertFalse(data, network.message(param, BasicConfig.NEWFUNC_FIRSTVISIT, "判断错误,用户非首次访问", response.body().asString()));
}
// 客户详情页_留言_发送消息
@Test(description = "客户详情页_留言_发送消息", priority = 43)
public void 客户详情页_留言_发送消息() throws IOException{
param = new HashMap<>();
param.put("content", "Hello");
param.put("role", "1");
param.put("sessionId", sessionId);
response= network.postResponse(param, BasicConfig.CHAT_SEND);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_SEND, "消息发送失败", response.body().asString()));
}
// 客户详情页_留言_聊天内容
@Test(description = "客户详情页_留言_聊天内容", priority = 44)
public void 客户详情页_留言_聊天内容() throws IOException{
param = new HashMap<>();
param.put("pageSize", 30);
param.put("isPushMessage", true);
param.put("role", 1);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_LIST);
List<ChatList> chatLists = JsonUtil.parseResponseToPageBean(response, ChatList.class);
if(chatLists.size() != 0){
Long senderId = chatLists.get(chatLists.size()-1).getSenderId();
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
Assert.assertEquals(senderId, far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, visitor1UserId, network.message(param, BasicConfig.CHAT_LIST, "接收者userId错误", response.body().asString()));
Assert.assertEquals(content, "Hello", network.message(param, BasicConfig.CHAT_LIST, "消息内容错误", response.body().asString()));
}else {
Assert.assertTrue(true, network.message(param, BasicConfig.CHAT_LIST, "聊天记录为空", response.body().asString()));
}
}
// 客户详情页_留言_留言对象是否关注公众号
@Test(description = "客户详情页_留言_留言对象是否关注公众号", priority = 45)
public void 客户详情页_留言_留言对象是否关注公众号() throws IOException{
param = new HashMap<>();
param.put("targetSid", far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
response = network.getResponse(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS);
int subscribe = response.jsonPath().getInt("data.subscribe");
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();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(current);
int minute = calendar.get(Calendar.MINUTE);
if(minute <= 30){
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 30);
}else {
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.MINUTE, 30);
calendar.add(Calendar.HOUR, 1);
}
Date AfterChange = calendar.getTime();
return AfterChange.getTime();
}
}
...@@ -4,7 +4,6 @@ import com.kjj.cases.admin.Authorization; ...@@ -4,7 +4,6 @@ import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.apache.groovy.json.internal.IO;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -27,8 +26,7 @@ public class MyForward implements Authorization { ...@@ -27,8 +26,7 @@ public class MyForward implements Authorization {
public void setUp() throws IOException { public void setUp() throws IOException {
// 登陆管理后台 // 登陆管理后台
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
// 代理人授权 visitor2Tku();
agentTku();
far = new ForwardAndRead(); far = new ForwardAndRead();
// 关闭数据看板演示数据 // 关闭数据看板演示数据
...@@ -237,10 +235,9 @@ public class MyForward implements Authorization { ...@@ -237,10 +235,9 @@ public class MyForward implements Authorization {
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("type", 4); param.put("type", 4);
response = network.getResponse(param, BasicConfig.FORWARD_VISITRECORD); 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())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD_VISITRECORD, "接口请求失败", response.body().asString()));
String encodeUserId = response.jsonPath().getString("data.list[0].userId"); 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())); Assert.assertEquals(encodeUserId, visitorEncodeUserId, network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString()));
} }
// 获取素材转发关系链 // 获取素材转发关系链
......
package com.kjj.cases.assistant.whoSawMe; package com.kjj.cases.assistant.whoSawMe;
import com.beust.jcommander.internal.Lists; import com.beust.jcommander.internal.Lists;
import com.kjj.bean.whoSawMe.ArticlePage;
import com.kjj.bean.whoSawMe.RankingList;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.AGENT_TKU;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
public class WhoSawMe implements Authorization { public class WhoSawMe implements Authorization {
private Response response; private Response response;
private Map<String, Object> param; private Map<String, Object> param;
private ForwardAndRead far; private ForwardAndRead far;
private Long xxxSellerId;
private Long childSellerId; private Long childSellerId;
private Long clueId;
private Long xxrUserId;
private Long jjSellerId;
private String tagId0;
private String contentId;
private Integer taskId;
@BeforeClass @BeforeClass
public void setUp() throws IOException { public void setUp() throws IOException {
// 代理人授权 // 代理人授权
agentTku(); visitor2Tku();
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
far = new ForwardAndRead(); far = new ForwardAndRead();
...@@ -44,7 +52,7 @@ public class WhoSawMe implements Authorization { ...@@ -44,7 +52,7 @@ public class WhoSawMe implements Authorization {
param.put("vipGuideType", 2); param.put("vipGuideType", 2);
response = network.getResponse(param, BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType"); response = network.getResponse(param, BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType");
Boolean success = response.jsonPath().getBoolean("success"); Boolean success = response.jsonPath().getBoolean("success");
Assert.assertEquals(success, Boolean.TRUE, network.message(BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType", "判断代理人是否新会员失败", response.body().asString())); Assert.assertEquals(success, Boolean.TRUE, network.message(BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType", "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType", "新老会员判断错误,预期为新会员判断为老会员", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(BasicConfig.HOST + "/kjy/mp/rookieGuide/isNewVipByType", "新老会员判断错误,预期为新会员判断为老会员", response.body().asString()));
} }
...@@ -54,9 +62,9 @@ public class WhoSawMe implements Authorization { ...@@ -54,9 +62,9 @@ public class WhoSawMe implements Authorization {
// 获取代理人用户信息 // 获取代理人用户信息
response = network.getResponse(BasicConfig.USER_INFO); response = network.getResponse(BasicConfig.USER_INFO);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.USER_INFO, "获取代理人用户信息失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.USER_INFO, "接口请求失败", response.body().asString()));
String wxName = response.jsonPath().getString("data.wxName"); Long userId = response.jsonPath().getLong("data.userId");
Assert.assertEquals(wxName, BasicConfig.WECHAT_NAME, network.message(BasicConfig.USER_INFO, "代理人微信昵称获取有误,预期为" + BasicConfig.WECHAT_NAME, response.body().asString())); Assert.assertEquals(userId, far.decodeTku(BasicConfig.VISITOR2_TKU).get("userId"), network.message(BasicConfig.USER_INFO, "代理人userId与预期不符", response.body().asString()));
} }
// 获取当前页面Tips // 获取当前页面Tips
...@@ -67,95 +75,105 @@ public class WhoSawMe implements Authorization { ...@@ -67,95 +75,105 @@ public class WhoSawMe implements Authorization {
String page = "who_saw_me"; String page = "who_saw_me";
param.put("page", page); param.put("page", page);
response = network.getResponse(param, BasicConfig.GETTIPSBYPAGE); response = network.getResponse(param, BasicConfig.GETTIPSBYPAGE);
Object data = response.jsonPath().getJsonObject("data"); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.GETTIPSBYPAGE, "接口请求失败", response.body().asString()));
Boolean isShowTips = response.jsonPath().getBoolean("data.isShowTips"); Object id = response.jsonPath().getJsonObject("data.id");
Integer jumpType = response.jsonPath().getInt("data.jumpType"); Assert.assertNotNull(id, network.message(param, BasicConfig.GETTIPSBYPAGE, "获取页面Tips失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.GETTIPSBYPAGE, "获取当前页面tips失败", response.body().asString()));
Assert.assertNotNull(data, network.message(BasicConfig.GETTIPSBYPAGE, "获取当前页面tips失败", response.body().asString()));
Assert.assertNotNull(isShowTips, network.message(BasicConfig.GETTIPSBYPAGE, "获取isShowTips值失败", response.body().asString()));
Assert.assertNotNull(jumpType, network.message(BasicConfig.GETTIPSBYPAGE, "获取跳转类型失败", response.body().asString()));
} }
// 查询代理人当前使用版本 // 查询代理人当前使用版本
@Test(description = "首页_查询使用版本", priority = 4) @Test(description = "首页_查询使用版本", priority = 4)
public void 查询代理人当前使用版本() throws IOException { public void 查询代理人当前使用版本() throws IOException {
param = new HashMap<>(); param = new HashMap<>();
String sellerIdEncode = far.encodeId((Long)far.getUserInfo(AGENT_TKU).get("sellerId")); xxxSellerId = far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
String sellerIdEncode = far.encodeId(xxxSellerId);
param.put("sellerId", sellerIdEncode); param.put("sellerId", sellerIdEncode);
response = network.getResponse(param, BasicConfig.USING_VERSION); response = network.getResponse(param, BasicConfig.USING_VERSION);
String userVersion = response.jsonPath().getString("data.userVersion"); String userVersion = response.jsonPath().getString("data.userVersion");
Assert.assertEquals(userVersion, "2", network.message(BasicConfig.USING_VERSION, "代理人当前使用版本错误,实际为2.保险专业版", response.body().asString())); Assert.assertEquals(userVersion, "2", network.message(BasicConfig.USING_VERSION, "代理人当前使用版本错误,实际为2.保险专业版", response.body().asString()));
} }
// 判断是否展示续费弹窗 // 判断是否展示续费弹窗
@Test(description = "判断是否展示续费弹窗", priority = 6) @Test(description = "判断是否展示续费弹窗", priority = 5)
public void 判断是否展示续费弹窗() throws IOException{ public void 判断是否展示续费弹窗() throws IOException{
// 判断是否展示续费弹窗 // 判断是否展示续费弹窗
response = network.getResponse(BasicConfig.LAYER_RENEW); response = network.getResponse(BasicConfig.LAYER_RENEW);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.LAYER_RENEW, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data"); Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.LAYER_RENEW, "判断是否展示续费弹窗失败,data为空", response.body().asString())); Assert.assertNotNull(data, network.message(BasicConfig.LAYER_RENEW, "判断是否展示续费弹窗失败,data为空", response.body().asString()));
} }
// 判断是否展示邀请弹窗 // 判断是否展示邀请弹窗
@Test(description = "展示邀请活动弹窗", priority = 7) @Test(description = "展示邀请活动弹窗", priority = 6)
public void 展示邀请活动弹窗() throws IOException { public void 展示邀请活动弹窗() throws IOException {
// 邀请活动弹窗 // 邀请活动弹窗
response = network.getResponse(BasicConfig.DISTRIBUTION_LAYER); response = network.getResponse(BasicConfig.DISTRIBUTION_LAYER);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.DISTRIBUTION_LAYER, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data"); Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(BasicConfig.DISTRIBUTION_LAYER, "判断是否展示邀请活动弹窗失败", response.body().asString()));
Assert.assertNotNull(data, network.message(BasicConfig.DISTRIBUTION_LAYER, "判断是否展示邀请活动弹窗失败,data为空", response.body().asString())); Assert.assertNotNull(data, network.message(BasicConfig.DISTRIBUTION_LAYER, "判断是否展示邀请活动弹窗失败,data为空", response.body().asString()));
} }
// 判断是否展示线索页新手引导 // 判断是否展示线索页新手引导
@Test(description = "获取线索页新手引导", priority = 8) @Test(description = "获取线索页新手引导", priority = 7)
public void 获取线索页新手引导() throws IOException { public void 获取线索页新手引导() throws IOException {
// 获取线索页新手引导 // 获取线索页新手引导
response = network.getResponse(BasicConfig.ROOKIECLUEGUIDE); response = network.getResponse(BasicConfig.ROOKIECLUEGUIDE);
Boolean showClueGuide = response.jsonPath().getBoolean("data.showClueGuide"); Object showClueGuide = response.jsonPath().getJsonObject("data.showClueGuide");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.ROOKIECLUEGUIDE, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.ROOKIECLUEGUIDE, "接口请求失败", response.body().asString()));
Assert.assertNotNull(response.jsonPath().getJsonObject("data"), network.message(BasicConfig.ROOKIECLUEGUIDE, "获取线索页新手引导失败", response.body().asString()));
Assert.assertNotNull(showClueGuide, network.message(BasicConfig.ROOKIECLUEGUIDE, "获取showClueGuide值失败", response.body().asString())); Assert.assertNotNull(showClueGuide, network.message(BasicConfig.ROOKIECLUEGUIDE, "获取showClueGuide值失败", response.body().asString()));
} }
// 获取周报首页数据 // 获取周报首页数据
@Test(description = "获取周报首页数据", priority = 9) @Test(description = "获取周报首页数据", priority = 8)
public void 获取周报首页数据() throws IOException{ public void 获取周报首页数据() throws IOException{
// 获取周报首页数据 // 获取周报首页数据
response = network.getResponse(BasicConfig.SELLERWEEKLY); response = network.getResponse(BasicConfig.SELLERWEEKLY);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(BasicConfig.SELLERWEEKLY, "接口请求失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.SELLERWEEKLY, "接口请求失败", response.body().asString()));
Assert.assertNotNull(data, network.message(BasicConfig.SELLERWEEKLY, "获取周报首页数据失败", response.body().asString()));
}
// 获取代理人标签列表
@Test(description = "获取代理人标签列表", priority = 10)
public void 获取代理人标签列表() throws IOException {
// 获取代理人标签列表
response = network.getResponse(BasicConfig.HOST + "/kjy/mp/sellerTag/getTagList");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.HOST + "/kjy/mp/sellerTag/getTagList", "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data"); Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.HOST + "/kjy/mp/sellerTag/getTagList", "获取代理人标签列表失败", response.body().asString())); Assert.assertNotNull(data, network.message(BasicConfig.SELLERWEEKLY, "获取周报首页数据失败", response.body().asString()));
} }
// 获取首页来访统计 // 获取首页来访统计
@Test(description = "获取谁看过我首页来访统计", priority = 11) @Test(description = "获取谁看过我首页来访统计", priority = 10)
public void 来访统计() throws IOException{ public void 来访统计() throws IOException{
response = network.getResponse(BasicConfig.VISITHEADER); response = network.getResponse(BasicConfig.VISITHEADER);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.VISITHEADER, "接口请求失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.VISITHEADER, "接口请求失败", response.body().asString()));
int todayClueNum = response.jsonPath().getInt("data.todayClueNum"); int todayClueNum = response.jsonPath().getInt("data.todayClueNum");
int todayVisitNum = response.jsonPath().getInt("data.todayVisitNum"); int todayVisitNum = response.jsonPath().getInt("data.todayVisitNum");
Assert.assertTrue(todayClueNum >= 1, network.message(BasicConfig.VISITHEADER, "获取今日线索数小于1", response.body().asString())); Assert.assertTrue(todayClueNum >= 2, network.message(BasicConfig.VISITHEADER, "获取今日线索数有误", response.body().asString()));
Assert.assertTrue(todayVisitNum >= 1, network.message(BasicConfig.VISITHEADER, "获取今日访问数小于1", response.body().asString())); Assert.assertTrue(todayVisitNum >= 2, network.message(BasicConfig.VISITHEADER, "获取今日访问数有误", response.body().asString()));
}
// 查看谁看过我首页我的访客列表
@Test(description = "查看我的访客列表", priority = 11)
public void 查看我的访客列表() throws IOException{
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
param.put("lastClueId", 0);
param.put("listType", 1);
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()));
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()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
}
// 获取代理人标签列表
@Test(description = "获取代理人标签列表", priority = 12)
public void 获取代理人标签列表() throws IOException{
response = network.getResponse(BasicConfig.TAG_GETLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_GETLIST, "接口请求失败", response.body().asString()));
tagId0 = response.jsonPath().getString("data[0].id");
Assert.assertNotNull(tagId0, network.message(BasicConfig.TAG_GETLIST, "标签id为null", response.body().asString()));
} }
// 进入运营周报首页 // 进入运营周报首页
@Test(description = "进入运营周报首页", priority = 12) @Test(description = "进入运营周报首页", priority = 13)
public void 进入运营周报首页() throws IOException{ public void 进入运营周报首页() throws IOException{
response = network.getResponse(BasicConfig.WEEKLY_LIST); response = network.getResponse(BasicConfig.WEEKLY_LIST);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
...@@ -163,27 +181,35 @@ public class WhoSawMe implements Authorization { ...@@ -163,27 +181,35 @@ public class WhoSawMe implements Authorization {
} }
// 进入团队看板首页 // 进入团队看板首页
@Test(description = "进入团队看板首页", priority = 13) @Test(description = "进入团队看板首页", priority = 14)
public void 进入团队看板首页() throws IOException{ public void 进入团队看板首页() throws IOException{
// 获取当前页面Tips // 获取当前页面Tips
param.clear(); param.clear();
param.put("page", "data_board"); param.put("page", "data_board");
response = network.getResponse(param, BasicConfig.GETTIPSBYPAGE); response = network.getResponse(param, BasicConfig.GETTIPSBYPAGE);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
String tipsContent = response.jsonPath().getString("data.tipsContent");
Assert.assertTrue(success, network.message(BasicConfig.GETTIPSBYPAGE, "接口请求失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.GETTIPSBYPAGE, "接口请求失败", response.body().asString()));
String tipsContent = response.jsonPath().getString("data.tipsContent");
Assert.assertEquals(tipsContent, "数据看板-tips", network.message(param, BasicConfig.GETTIPSBYPAGE, "当前页面Tips错误,实际为 数据看板", response.body().asString())); Assert.assertEquals(tipsContent, "数据看板-tips", network.message(param, BasicConfig.GETTIPSBYPAGE, "当前页面Tips错误,实际为 数据看板", response.body().asString()));
// 获取我的上级名称 // 获取我的上级名称
param.clear(); param.clear();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS); response = network.getResponse(param, BasicConfig.BOSS_BOSS);
success = response.jsonPath().getBoolean("success"); success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.BOSS_BOSS, "获取上级名称失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNull(data, network.message(param, BasicConfig.BOSS_BOSS, "代理人上级名称不为空", response.body().asString()));
// 获取当前使用版本
response = network.getResponse(BasicConfig.version_info);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.version_info, "接口请求失败", response.body().asString()));
int userVersion = response.jsonPath().getInt("data[0].userVersion");
Assert.assertEquals(userVersion, 2, network.message(BasicConfig.version_info, "获取版本错误", response.body().asString()));
} }
// 邀请成员加入团队 // 邀请成员加入团队
@Test(description = "生成团队邀请码", priority = 14) @Test(description = "生成团队邀请码", priority = 15)
public void 生成团队邀请码() throws IOException{ public void 生成团队邀请码() throws IOException{
Integer inviteType = 2; Integer inviteType = 2;
param = new HashMap<>(); param = new HashMap<>();
...@@ -193,11 +219,10 @@ public class WhoSawMe implements Authorization { ...@@ -193,11 +219,10 @@ public class WhoSawMe implements Authorization {
Assert.assertNotNull(data, network.message(param, BasicConfig.BOSS_CODE, "获取团队邀请码失败", response.body().asString())); Assert.assertNotNull(data, network.message(param, BasicConfig.BOSS_CODE, "获取团队邀请码失败", response.body().asString()));
} }
@Test(description = "其他代理人加入该代理人团队", priority = 15) @Test(description = "其他代理人加入该代理人团队", priority = 16)
public void 邀请加入团队() throws IOException{ public void 邀请加入团队() throws IOException{
// 切换代理人加入团队 // 切换代理人加入团队
Long sellerId = (Long)far.getUserInfo(AGENT_TKU).get("sellerId"); network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
// 确定被邀请代理人没有上级 // 确定被邀请代理人没有上级
response = network.getResponse(BasicConfig.BOSS_ROLE); response = network.getResponse(BasicConfig.BOSS_ROLE);
...@@ -206,51 +231,203 @@ public class WhoSawMe implements Authorization { ...@@ -206,51 +231,203 @@ public class WhoSawMe implements Authorization {
// 代理人加入团队 // 代理人加入团队
param = new HashMap<>(); param = new HashMap<>();
param.put("inviterSid", sellerId); param.put("inviterSid", far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("inviteType", 2); param.put("inviteType", 2);
response = network.getResponse(param, BasicConfig.BOSS_BOUND); response = network.getResponse(param, BasicConfig.BOSS_BOUND);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(param, BasicConfig.BOSS_BOUND, "接口请求失败", response.body().asString())); 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())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.BOSS_BOUND, "添加代理人进入团队失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.AGENT_TKU); network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
} }
@Test(description = "查看被邀请代理人上级名称", priority = 16) @Test(description = "查看被邀请代理人上级名称", priority = 17)
public void 查看上级名称() throws IOException{ public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId // 获取被邀请代理人sellerId
childSellerId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("sellerId"); childSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", childSellerId); param.put("sellerId", childSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS); response = network.getResponse(param, BasicConfig.BOSS_BOSS);
String bossName = response.jsonPath().getString("data"); String bossName = response.jsonPath().getString("data");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString()));
Assert.assertEquals(bossName, BasicConfig.WECHAT_NAME, network.message(param, BasicConfig.BOSS_BOSS, "被邀请人上级名称与邀请人不一致", response.body().asString())); Assert.assertEquals(bossName, far.getUserInfo(BasicConfig.VISITOR2_TKU).get("wxName"), network.message(param, BasicConfig.BOSS_BOSS, "被邀请人上级名称与邀请人不一致", response.body().asString()));
}
// 获取代理人团队信息
@Test(description = "代理人团队信息", priority = 19)
public void 代理人团队信息() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
response = network.getResponse(param, BasicConfig.BOSS_ROLE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_ROLE, "接口请求失败", response.body().asString()));
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");
int teamNumber = response.jsonPath().getInt("data.teamNumber");
Assert.assertTrue(hasSubordinate, network.message(param, BasicConfig.BOSS_ROLE, "代理人查询无下级", response.body().asString()));
Assert.assertEquals(teamNumber, 2, network.message(param, BasicConfig.BOSS_ROLE, "代理人团队人数有误", response.body().asString()));
}
// 代理人团队成员数
@Test(description = "代理人团队成员数", priority = 20)
public void 代理人团队成员数() throws IOException{
param = new HashMap<>();
param.put("superiorId", xxxSellerId);
response = network.getResponse(param, BasicConfig.TEAMMEMBERNUM);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMMEMBERNUM, "接口请求失败", response.body().asString()));
int personalNum = response.jsonPath().getInt("data.personalNum");
Assert.assertEquals(personalNum, 2, network.message(param, BasicConfig.TEAMMEMBERNUM, "代理人团队人数有误", response.body().asString()));
}
// 获取个人排行列表
@Test(description = "获取个人排行列表", priority = 22)
public void 获取个人排行列表() throws IOException{
param= new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 4);
param.put("superiorId", xxxSellerId);
param.put("listType", 4);
param.put("team", false);
response = network.getResponse(param, BasicConfig.TEAMRANKINGLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMRANKINGLIST, "接口请求失败", response.body().asString()));
List<RankingList> rankingLists = JsonUtil.parseResponseToPageBean(response, RankingList.class);
List<String> memberSids = Lists.newArrayList();
memberSids.add(far.encodeId(xxxSellerId));
memberSids.add(far.encodeId(far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId")));
Assert.assertTrue(rankingLists.size() >= 2, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜人员数有误", response.body().asString()));
for (int i = 0; i < rankingLists.size(); i++){
boolean isExist = memberSids.contains(rankingLists.get(i).getSellerId());
Assert.assertTrue(isExist, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜内成员sid有误", response.body().asString()));
}
}
// 团队架构
// 团队架构_当前代理人身份
@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 = 17) // 团队架构_搜索成员
public void 删除团队成员() throws IOException{ @Test(description = "团队架构_搜索成员", priority = 22)
// 登陆管理后台调用管理后台接口删除成员 public void 团队架构_搜索成员() throws IOException{
jjSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>(); param = new HashMap<>();
param.put("superiorSid", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerName", "吉吉");
param.put("childSid", childSellerId); param.put("superiorSid", String.valueOf(xxxSellerId));
response = network.postResponse(param, BasicConfig.MANAGER_removeMember); System.out.println();
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.MANAGER_removeMember, "删除成员失败", response.body().asString())); response = network.getResponse(param, BasicConfig.MEMBERSEARCH);
String sellerId = response.jsonPath().getString("data[0].sellerId");
Assert.assertEquals(sellerId, far.encodeId(jjSellerId), network.message(param, BasicConfig.MEMBERSEARCH, "搜索结果错误", 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);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.MEMBERREMOVE, "删除成员失败", response.body().asString()));
// 切换到被删除代理人确认已没有上级 // 检查被删除成员是否有上级
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
response = network.getResponse(BasicConfig.BOSS_ROLE); response = network.getResponse(BasicConfig.BOSS_ROLE);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior"); boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人还有上级", response.body().asString())); Assert.assertFalse(hasSuperior, network.message(param, BasicConfig.BOSS_ROLE, "成员仍有上级", response.body().asString()));
}
network.agentCookies.put("tku", AGENT_TKU); // 团队任务
// 新建任务_选择素材
@Test(description = "新建任务_选择素材", priority = 23)
public void 新建任务_选择素材() throws IOException{
param = new HashMap<>();
param.put("contentType", "article");
param.put("pageIndex", 1);
param.put("pageSize", 20);
response = network.getResponse(param, BasicConfig.FINDPAGEBYCONTENTTYPE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FINDPAGEBYCONTENTTYPE, "接口请求失败", response.body().asString()));
List<ArticlePage> articlePages = JsonUtil.parseResponseToPageBean(response, ArticlePage.class);
for(int i = 0; i < articlePages.size(); i++){
String contentType = articlePages.get(i).getContentType();
Assert.assertEquals(contentType, "article", network.message(param, BasicConfig.FINDPAGEBYCONTENTTYPE, "素材类型错误", response.body().asString()));
}
contentId = articlePages.get(0).getContentId();
}
// 新建任务_创建任务
@Test(description = "新建任务_创建任务", priority = 24)
public void 新建任务_创建任务() throws IOException{
String scid = far.getContentScId(contentId);
param = new HashMap<>();
param.put("scid", scid);
response = network.postResponse(param, BasicConfig.BOSS_CREATE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_CREATE, "接口请求失败", response.body().asString()));
taskId = response.jsonPath().getInt("data");
Assert.assertNotNull(taskId, network.message(param, BasicConfig.BOSS_CREATE, "返回taskId为空", response.body().asString()));
}
// 新建任务_任务详情
@Test(description = "新建任务_任务详情", priority = 25)
public void 新建任务_任务详情() throws IOException{
param = new HashMap<>();
param.put("taskId", taskId);
response = network.getResponse(param, BasicConfig.BOSS_DETAIL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_DETAIL, "接口请求失败", response.body().asString()));
}
// 新建任务_可推送成员
@Test(description = "新建任务_可推送成员", priority = 26)
public void 新建任务_可推送成员() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sellerId", xxxSellerId);
response = network.getResponse(param, BasicConfig.TEAMMEMBER);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMMEMBER, "接口请求失败", response.body().asString()));
int totalCount = response.jsonPath().getInt("data.totalCount");
String sellerId = response.jsonPath().getString("data.list["+(totalCount-1)+"].sellerId");
Assert.assertEquals(totalCount, 1, network.message(param, BasicConfig.TEAMMEMBER, "可推送成员数有误", response.body().asString()));
Assert.assertEquals(sellerId, far.encodeId(jjSellerId), network.message(param, BasicConfig.TEAMMEMBER, "可推送成员sellerId有误", response.body().asString()));
}
// 新建任务_推送任务
@Test(description = "新建任务_推送任务", priority = 27)
public void 新建任务_推送任务() throws IOException{
List<String> sellerIds = Lists.newArrayList();
List<String> superiorIds = Lists.newArrayList();
sellerIds.add(far.encodeId(jjSellerId));
param = new HashMap<>();
param.put("effectiveDuration", 7);
param.put("isAllMen", true);
param.put("sellerIds", sellerIds);
param.put("superiorIds", superiorIds);
param.put("taskId", taskId);
response = network.postResponse(param, BasicConfig.BOSS_PUBLISH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_PUBLISH, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.BOSS_PUBLISH, "推送任务失败", response.body().asString()));
}
// 新建任务_查看任务
@Test(description = "新建任务_查看任务", priority = 28)
public void 新建任务_查看任务() throws IOException{
param = new HashMap<>();
param.put("pageSize", 20);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "接口请求失败", response.body().asString()));
} }
// 查看今日转发素材列表 // 查看今日转发素材列表
@Test(description = "查看今日转发素材列表", priority = 19) @Test(description = "查看今日转发素材列表", priority = 29)
public void 查看转发素材列表() throws IOException{ public void 查看转发素材列表() throws IOException{
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("sortType", 4); param.put("sortType", 4);
...@@ -261,10 +438,10 @@ public class WhoSawMe implements Authorization { ...@@ -261,10 +438,10 @@ public class WhoSawMe implements Authorization {
} }
// 查看转发名片记录列表 // 查看转发名片记录列表
@Test(description = "查看转发名片记录列表", priority = 21) @Test(description = "查看转发名片记录列表", priority = 30)
public void 查看转发名片记录列表() throws IOException{ public void 查看转发名片记录列表() throws IOException{
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("sortType", 4); param.put("sortType", 4);
...@@ -274,7 +451,7 @@ public class WhoSawMe implements Authorization { ...@@ -274,7 +451,7 @@ public class WhoSawMe implements Authorization {
} }
// 使用工具 // 使用工具
@Test(description = "使用工具", priority = 22) @Test(description = "使用工具", priority = 31)
public void 使用工具() throws IOException{ public void 使用工具() throws IOException{
// 生成抽奖转盘素材scId // 生成抽奖转盘素材scId
String lottery_scId = far.getContentScId(BasicConfig.LOTTERY_CONTENTID); String lottery_scId = far.getContentScId(BasicConfig.LOTTERY_CONTENTID);
...@@ -289,10 +466,10 @@ public class WhoSawMe implements Authorization { ...@@ -289,10 +466,10 @@ public class WhoSawMe implements Authorization {
} }
// 查看使用工具记录列表 // 查看使用工具记录列表
@Test(description = "查看使用工具记录列表", priority = 23) @Test(description = "查看使用工具记录列表", priority = 32)
public void 查看使用工具记录列表() throws IOException{ public void 查看使用工具记录列表() throws IOException{
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("sortType", 4); param.put("sortType", 4);
...@@ -303,10 +480,10 @@ public class WhoSawMe implements Authorization { ...@@ -303,10 +480,10 @@ public class WhoSawMe implements Authorization {
} }
// 查看获得线索记录列表 // 查看获得线索记录列表
@Test(description = "查看获得线索记录列表", priority = 24) @Test(description = "查看获得线索记录列表", priority = 33)
public void 查看获得线索记录列表() throws IOException{ public void 查看获得线索记录列表() throws IOException{
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("sortType", 4); param.put("sortType", 4);
...@@ -317,11 +494,11 @@ public class WhoSawMe implements Authorization { ...@@ -317,11 +494,11 @@ public class WhoSawMe implements Authorization {
} }
// 查看转发动态访问列表 // 查看转发动态访问列表
@Test(description = "查看转发动态访问列表", priority = 25) @Test(description = "查看转发素材访问列表", priority = 34)
public void 查看转发动态访问列表() throws IOException{ public void 查看转发素材访问列表() throws IOException{
// 获取首条素材列表中首条动态id // 获取首条素材列表中首条动态id
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", far.getUserInfo(AGENT_TKU).get("sellerId")); param.put("sellerId", xxxSellerId);
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("sortType", 4); param.put("sortType", 4);
...@@ -336,18 +513,71 @@ public class WhoSawMe implements Authorization { ...@@ -336,18 +513,71 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.GETVISITLIST, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.GETVISITLIST, "接口请求失败", response.body().asString()));
} }
// 查看谁看过我首页我的访客列表 // 销售线索_新线索引导
@Test(description = "查看我的访客列表", priority = 26) @Test(description = "销售线索详情_新线索引导", priority = 35)
public void 查看我的访客列表() throws IOException{ public void 销售线索详情_新线索引导() throws IOException{
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>(); param = new HashMap<>();
param.put("customerTagIds", customerTagIds); param.put("guideType", 34);
param.put("lastClueId", 0); response = network.postResponse(param, BasicConfig.COMPLETEGUIDE);
param.put("listType", 1); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.COMPLETEGUIDE, "接口请求失败", response.body().asString()));
param.put("pageSize", 20); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.COMPLETEGUIDE, "完成该引导失败", response.body().asString()));
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3); }
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
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())); @Test(description = "销售线索_线索详情", priority = 36)
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 visitClueType = response.jsonPath().getInt("data.visitClueType");
Long custUserId = response.jsonPath().getLong("data.custUserId");
String contentScid = response.jsonPath().getString("data.fromContent.scid");
Assert.assertEquals(visitClueType, 31, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(custUserId, far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId"), network.message(param, BasicConfig.CLUEINFO, "线索来源访客userId错误", response.body().asString()));
Assert.assertEquals(contentScid, far.getContentScId(BasicConfig.ARTICLE_CONTENTID), network.message(param, BasicConfig.CLUEINFO, "线索来源素材id错误", response.body().asString()));
}
// 销售线索_跟进建议
@Test(description = "销售线索_跟进建议", priority = 37)
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 = 38)
public void 管理客户信息() throws IOException{
xxrUserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
List<String> tagIds = Lists.newArrayList();
tagIds.add(tagId0);
param = new HashMap<>();
param.put("custUserId", xxrUserId);
param.put("memo", "备忘录");
param.put("remarkName", "备注");
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.UPDATETAGANDMEMO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATETAGANDMEMO, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATETAGANDMEMO, "更新客户信息失败", response.body().asString()));
}
// 销售线索_获取访客管理信息
@Test(description = "销售线索_获取访客管理信息", priority = 39)
public void 销售线索_获取访客管理信息() throws IOException{
String encodeUserId = far.encodeId(xxrUserId);
param = new HashMap<>();
param.put("userId", encodeUserId);
response = network.getResponse(param, BasicConfig.GETCUSTAGANDMEMO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.GETCUSTAGANDMEMO, "接口请求失败", response.body().asString()));
String memo = response.jsonPath().getString("data.memo");
String remarkName = response.jsonPath().getString("data.remarkName");
boolean tagIsMark = response.jsonPath().getBoolean("data.tagList[0].isMark");
Assert.assertEquals(memo, "备忘录", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备忘录内容错误", response.body().asString()));
Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString()));
Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString()));
} }
} }
...@@ -74,6 +74,8 @@ public class BasicConfig { ...@@ -74,6 +74,8 @@ public class BasicConfig {
public static String VISITOR_TKU = "T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV"; public static String VISITOR_TKU = "T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV";
// 基础线访客(小雪人) TKU // 基础线访客(小雪人) TKU
public static String VISITOR1_TKU = "T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPMspUQD6pVEn2FNMefM2nieKPicXG9c1tDg8qtN"; public static String VISITOR1_TKU = "T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPMspUQD6pVEn2FNMefM2nieKPicXG9c1tDg8qtN";
// 基础线访客
public static String VISITOR2_TKU = "T3gM31f18jCeKCBVHf5MANgyXeBZGCm8vTJQTuWYXHFqx97PATsWyUYamGaNdNip8bEs9shoE9tTsAmp8x"; // 二度访客用
// 访客的sids // 访客的sids
public static final String sids = "Kj21MjMwNTU"; public static final String sids = "Kj21MjMwNTU";
// 访客(SuYi) userID:4425 // 访客(SuYi) userID:4425
...@@ -230,6 +232,9 @@ public class BasicConfig { ...@@ -230,6 +232,9 @@ public class BasicConfig {
public static final String MOBILE_result = MOBILE_HOST + "/clue/guess/number/red/result"; public static final String MOBILE_result = MOBILE_HOST + "/clue/guess/number/red/result";
public static final String MANAGER_encode = MANAGER_HOST + "/kjy/manager/testUser/encode";
// *************** 宝箱裂变 *************** // *************** 宝箱裂变 ***************
public static final String MANAGER_getList4Admin = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/getList4Admin"; public static final String MANAGER_getList4Admin = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/getList4Admin";
public static final String MANAGER_saveTreasureConf = MANAGER_HOST + "/kjy/manager/live/treasure/saveTreasureConf"; public static final String MANAGER_saveTreasureConf = MANAGER_HOST + "/kjy/manager/live/treasure/saveTreasureConf";
...@@ -613,6 +618,7 @@ public class BasicConfig { ...@@ -613,6 +618,7 @@ public class BasicConfig {
public static final String VISITHEADER = HOST + "/kjy/mp/visit/header/v2"; public static final String VISITHEADER = HOST + "/kjy/mp/visit/header/v2";
public static final String SELLERWEEKLY = HOST + "/kjy/mp/whoSawMe/sellerWeekly"; public static final String SELLERWEEKLY = HOST + "/kjy/mp/whoSawMe/sellerWeekly";
public static final String WEEKLY_LIST = HOST + "/kjy/mp/seller/weekly/list"; public static final String WEEKLY_LIST = HOST + "/kjy/mp/seller/weekly/list";
public static final String NEWFUNC_FIRSTVISIT = HOST + "/kjy/mp/newFunction/sellerFirstVisit";
// *************** 支付 *************** // *************** 支付 ***************
...@@ -697,6 +703,7 @@ public class BasicConfig { ...@@ -697,6 +703,7 @@ public class BasicConfig {
// *************** 新手任务 *************** // *************** 新手任务 ***************
public static final String NOVICE_LIST = HOST + "/kjy/mp/seller/novice/list"; public static final String NOVICE_LIST = HOST + "/kjy/mp/seller/novice/list";
public static final String NOVICE_MONGOLIANLAYERISPLAY = HOST + "/kjy/mp/seller/novice/mongolianLayerDisplay"; public static final String NOVICE_MONGOLIANLAYERISPLAY = HOST + "/kjy/mp/seller/novice/mongolianLayerDisplay";
public static final String COMPLETEGUIDE = HOST + "/kjy/mp/rookieGuide/completeGuide";
// *************** 谁看过我 *************** // *************** 谁看过我 ***************
...@@ -706,10 +713,54 @@ public class BasicConfig { ...@@ -706,10 +713,54 @@ public class BasicConfig {
public static final String FORWARD_LIST = HOST + "/kjy/mp/whoSawMe/forward/list/v2"; 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_CONTENTHEADER = HOST + "/kjy/mp/whoSawMe/forward/contentHeader";
public static final String FORWARD_VISITRECORD = HOST + "/kjy/mp/whoSawMe/forward/visitRecordList/v2"; 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 DYNAMIC_ADDVISIT = HOST + "/kjy/mp/seller/dynamic/addVisit";
public static final String CLUEINFO = HOST + "/kjy/mp/whoSawMe/clue/info";
public static final String CLUEADVISE = HOST + "/kjy/mp/whoSawMe/clue/info/advise";
// *************** 客户信息 *************** // *************** 客户信息 ***************
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 INVITATIONCHAIN = HOST + "/kjy/mp/whoSawMe/forward/forwardList";
public static final String UPDATESPECIAL = HOST + "/kjy/mp/whoSawMe/updateSpecial";
public static final String totalSpecial = HOST + "/kjy/mp/whoSawMe/customerTotalStatistics";
public static final String UPDATEREMARKNAME = HOST + "/kjy/mp/seller/customer/updateRemarkName";
public static final String GETCUSTAGANDMEMO = HOST + "/kjy/mp/seller/getCustomerTagAndMemoInfo";
public static final String UPDATETAGANDMEMO = HOST + "/kjy/mp/seller/updateTagAndMemoInfo";
public static final String CUSTMATERIALS = HOST + "/kjy/mp/whoSawMe/materials";
public static final String CUSTLOTTERIES = HOST + "/kjy/mp/whoSawMe/lotteries";
public static final String CUSTFAVORITE = HOST + "/kjy/mp/whoSawMe/custFavorite";
public static final String GETTAGANDREMIND = HOST + "/kjy/mp/seller/getTagAndRemindInfo";
public static final String UPDATECUSTREMIND = HOST + "/kjy/mp/seller/saveOrUpdateCustomRemind";
public static final String GETREMINDINFOS = HOST + "/kjy/mp/seller/getRemindInfos";
public static final String DELETEREMIND = HOST + "/kjy/mp/seller/deleteCustomRemind";
public static final String UPDATEBIRTHREMIND = HOST + "/kjy/mp/seller/updateBirthdayRemindInfo";
public static final String UPDATEHOLIDAYREMIND = HOST + "/kjy/mp/seller/updateHolidayRemindInfo";
public static final String GETCUSTREMINDINFO = HOST + "/kjy/mp/seller/getCustomerRemindInfo";
public static final String CUSTOMERDETAIL = HOST + "/kjy/mp/seller/v2/customer/detail";
public static final String RELATIONINFO_HEADER = HOST + "/kjy/mp/seller/customer/getRelationInfoHeader";
public static final String RELATIONINFO_LIST = HOST + "/kjy/mp/seller/customer/getRelationInfoList";
public static final String RELATIONINFO_RANKING = HOST + "/kjy/mp/seller/customer/relation/ranking";
public static final String UPDATECUSTMATERIAL = HOST + "/kjy/mp/seller/v2/customer/material/saveOrUpdate";
// *************** 标签管理 ***************
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";
// *************** 留言 ***************
public static final String CHAT_SEND = HOST + "/kjy/mp/chat/send";
public static final String CHAT_LIST = HOST + "/kjy/mp/chat/list";
public static final String CHAT_GETSUBSCRIBESTATUS = HOST + "/kjy/mp/chat/getSubscribeStatus";
public static final String CHAT_LINKMANLIST = HOST + "/kjy/mp/chat/sellerLinkmanList";
// *************** 文章 *************** // *************** 文章 ***************
...@@ -779,12 +830,27 @@ public class BasicConfig { ...@@ -779,12 +830,27 @@ public class BasicConfig {
public static final String BOSS_CODE = HOST + "/kjy/mp/seller/team/invite/code"; public static final String BOSS_CODE = HOST + "/kjy/mp/seller/team/invite/code";
public static final String BOSS_BOSS = HOST + "/kjy/mp/seller/team/boss"; public static final String BOSS_BOSS = HOST + "/kjy/mp/seller/team/boss";
public static final String BOSS_EDITCONFIG = HOST + "/kjy/mp/sellerConfig/editConfig"; public static final String BOSS_EDITCONFIG = HOST + "/kjy/mp/sellerConfig/editConfig";
public static final String BOSS_ISDEMO = HOST + "/kjy/mp/seller/team/isDemo";
public static final String BOSS_TEAMTASKLIST = HOST + "/kjy/mp/seller/team/task/teamTaskList";
public static final String BOSS_CREATE = HOST + "/kjy/mp/seller/team/task/create";
public static final String BOSS_DETAIL = HOST + "/kjy/mp/seller/team/task/detail";
public static final String BOSS_PUBLISH = HOST + "/kjy/mp/seller/team/task/publish";
public static final String BOSS_RECEIVERLIST = HOST + "/kjy/mp/seller/team/task/receiverList";
public static final String BOSS_BOUND = HOST + "/kjy/mp/seller/team/bound"; public static final String BOSS_BOUND = HOST + "/kjy/mp/seller/team/bound";
public static final String MATERIALLIST = HOST + "/kjy/mp/seller/dynamic/getMaterialList"; public static final String MATERIALLIST = HOST + "/kjy/mp/seller/dynamic/getMaterialList";
public static final String FORWARDCARDLIST = HOST + "/kjy/mp/seller/dynamic/getForwardCardList"; public static final String FORWARDCARDLIST = HOST + "/kjy/mp/seller/dynamic/getForwardCardList";
public static final String MARKETINGTOOLLIST = HOST + "/kjy/mp/seller/dynamic/getMarketingToolList"; public static final String MARKETINGTOOLLIST = HOST + "/kjy/mp/seller/dynamic/getMarketingToolList";
public static final String SALECLUELIST = HOST + "/kjy/mp/seller/dynamic/getSaleClueList"; public static final String SALECLUELIST = HOST + "/kjy/mp/seller/dynamic/getSaleClueList";
public static final String GETVISITLIST = HOST + "/kjy/mp/seller/dynamic/getVisitList"; public static final String GETVISITLIST = HOST + "/kjy/mp/seller/dynamic/getVisitList";
public static final String TEAMDATA = HOST + "/kjy/mp/seller/team/data";
public static final String TEAMMEMBERNUM = HOST + "/kjy/mp/seller/team/memberNumber";
public static final String TEAMRANKINGLIST = HOST + "/kjy/mp/seller/team/rankingList";
// 团队管理
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";
public static final String MEMBERSEARCH = HOST + "/kjy/mp/seller/team/member/search";
...@@ -855,7 +921,7 @@ public class BasicConfig { ...@@ -855,7 +921,7 @@ public class BasicConfig {
public static final String MANAGER_findId = MANAGER_HOST + "/kjy/manager/dailyPosters/findById"; public static final String MANAGER_findId = MANAGER_HOST + "/kjy/manager/dailyPosters/findById";
public static final String MANAGER_addOrUpdate = MANAGER_HOST + "/kjy/manager/dailyPosters/addOrUpdate"; 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_dailyPostersDelete = MANAGER_HOST + "/kjy/manager/dailyPosters/delete";
public static final String MANAGER_removeMember = MANAGER_HOST + "/kjy/manager/sellerTeam/removeMember"; public static final String MANAGER_SELLERTEAM_REMOVEMEMBER = MANAGER_HOST + "/kjy/manager/sellerTeam/removeMember";
public static final String MANAGER_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"; public static final String MANAGER_TKU_DECODE = MANAGER_HOST + "/kjy/manager/testUser/decryptTku";
public static final String MANAGER_getPushContent = MANAGER_HOST + "/kjy/manager/pushManager/getPushContent"; public static final String MANAGER_getPushContent = MANAGER_HOST + "/kjy/manager/pushManager/getPushContent";
......
...@@ -57,6 +57,11 @@ ...@@ -57,6 +57,11 @@
<class name="com.kjj.cases.assistant.whoSawMe.MyForward"/> <class name="com.kjj.cases.assistant.whoSawMe.MyForward"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "我的客户">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.MyCustomer"/>
</classes>
</test>
<test preserve-order="true" name = "贺卡"> <test preserve-order="true" name = "贺卡">
<classes> <classes>
<class name="com.kjj.cases.assistant.markettools.GreetingCrad"/> <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>
......
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