Commit 3366d3d2 authored by 张艳玲's avatar 张艳玲

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

更新谁看过我

See merge request test-group/kejiji!93
parents 29455e09 34f6ad96
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class MyTaskList {
private int taskId;
private String contentId;
private int taskStatus;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class TeamTaskList {
private String contentId;
private int id;
private int taskAchieverNum;
private int taskStatus;
private int taskTargetNum;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
import java.util.List;
@Data
public class WeeklyList {
private String yearMonth;
private List<weeklyPublication> weeklyPublications;
@Data
public static class weeklyPublication{
private String endDate;
private int freshVisitorNum;
private String id;
private int keyCluesNum;
private boolean newWeekly;
private String startDate;
private int totalShareNum;
private int totalVisitorNum;
}
}
......@@ -3,6 +3,7 @@ package com.kjj.cases.assistant.whoSawMe;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
......@@ -19,9 +20,9 @@ public class ForwardAndRead implements Authorization {
private Map<String, Object> param;
private String articleScId;
private Long sellerId;
private String visitId;
private String jjvisitId;
private String insuranceId;
private String forwardTime;
private long forwardTime;
@BeforeClass
public void setUp() throws IOException{
......@@ -32,6 +33,10 @@ public class ForwardAndRead implements Authorization {
// 代理人转发素材
@Test(description = "代理人转发文章", priority = 1)
public void 转发文章() throws IOException{
// 转发文章前记录一个时间
forwardTime = new Date().getTime();
ThreadSleepUtils.sleep(5000);
articleScId = getContentScId(BasicConfig.ARTICLE_CONTENTID); // 获取文章scId
param = new HashMap<>();
param.put("scId", articleScId);
......@@ -41,7 +46,6 @@ public class ForwardAndRead implements Authorization {
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
forwardTime = response.jsonPath().getString("timestamp");
}
@Test(description = "代理人转发名片", priority = 2)
......@@ -70,8 +74,8 @@ public class ForwardAndRead implements Authorization {
param.put("visitPath", 0);
response = network.getResponse(param, BasicConfig.CONTENT_READ);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
visitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(visitId, network.message(param, BasicConfig.CONTENT_READ, "visitId为空", response.body().asString()));
jjvisitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(jjvisitId, network.message(param, BasicConfig.CONTENT_READ, "visitId为空", response.body().asString()));
}
@Test(description = "访客领取赠险", priority = 4)
......@@ -101,7 +105,7 @@ public class ForwardAndRead implements Authorization {
public void 访客转发文章() throws IOException{
param = new HashMap<>();
param.put("scId", articleScId);
param.put("visitId", visitId);
param.put("visitId", jjvisitId);
param.put("forwardType", 1);
response = network.getResponse(param, BasicConfig.FORWARD);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口调用失败", response.body().asString()));
......@@ -109,8 +113,42 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "访客转发素材失败", response.body().asString()));
}
@Test(description = "二度访客阅读文章", priority = 6)
// 获取新用户
@Test(description = "新用户访问", priority = 6)
public void 新用户访问() throws IOException{
ThreadSleepUtils.sleep(5000);
network.agentCookies.put("tku", BaseUtils.tku);
response = network.getResponse(BasicConfig.USER_INFO);
System.out.println(response.body().asString());
param.clear();
param.put("scid", articleScId);
param.put("fromUserId", sellerId);
param.put("cancelPush", false);
param.put("visitPath", 0);
response = network.getResponse(param, BasicConfig.CONTENT_READ);
System.out.println(response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
}
// 新用户领取赠险
@Test(description = "新用户领取赠险", priority = 7)
public void 新用户领取赠险() throws IOException{
param.clear();
param.put("clueTypeName", "WELFARE_INSURANCE");
param.put("insuranceId", insuranceId);
param.put("locationSource", 1);
param.put("scId", articleScId);
param.put("sourceId", articleScId);
param.put("sourceType", 1);
response = network.postResponse(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN);
System.out.println(response.body().asString());
String data = response.jsonPath().getString("data");
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
@Test(description = "二度访客阅读文章", priority = 8)
public void 二度访客阅读文章() throws IOException{
ThreadSleepUtils.sleep(5000);
Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客
param = new HashMap<>();
......@@ -122,7 +160,16 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
}
@Test(description = "二度访客领取赠险", priority = 7)
@Test(description = "添加访问记录", priority = 9)
public void 添加访问记录() throws IOException{
param.clear();
param.put("forwardTime", forwardTime); // 添加访问记录的时间要小于代理人转发时间
param.put("scid", articleScId);
response = network.postResponse(param, BasicConfig.DYNAMIC_ADDVISIT);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "添加访问记录失败", response.body().asString()));
}
@Test(description = "二度访客领取赠险", priority = 10)
public void 二度访客领取赠险() throws IOException{
param = new HashMap<>();
param.put("clueTypeName", "WELFARE_INSURANCE");
......@@ -135,9 +182,26 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "接口调用失败", response.body().asString()));
String data = response.jsonPath().getString("data");
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
@Test(description = "获取文章FAQs", priority = 11)
public void 获取文章FAQs() throws IOException{
param.clear();
param.put("scid", articleScId);
param.put("recommend", 1);
param.put("pageIndex", 1);
param.put("pageSize", 2);
response = network.getResponse(param, BasicConfig.ARTICLE_ENHANCEDCOLUMN_GETFAQS);
int totalCount = response.jsonPath().getInt("data.totalCount");
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertEquals(totalCount, lists.size(), network.message(param, BasicConfig.ARTICLE_ENHANCEDCOLUMN_GETFAQS, "FAQ总数与FAQ列表大小不一致", response.body().asString()));
}
// @Test(description = "二度访客点击FAQ", priority = 12)
// public void 二度访客点击FAQ() throws IOException{
//
// }
// 通过素材contentId获取线索员文章scId
public String getContentScId(String contentId){
param = new HashMap<>();
......
......@@ -8,7 +8,6 @@ import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
......@@ -24,8 +23,9 @@ public class MyCustomer implements Authorization {
private String createTagId;
private long visitor1UserId;
private String sessionId;
private int visitCount;
private int visitCount; // 二度访客来访次数
private String id; // 自定义提醒事项id
private long lastMessageId;
@BeforeClass
public void setUp() throws IOException{
......@@ -47,16 +47,16 @@ public class MyCustomer implements Authorization {
}
// 我的客户首页_查询未读信息
@Test(description = "首页_查询未读信息", priority = 2)
@Test(description = "首页_查询未读信息", priority = 49)
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()));
int unreadCount = response.jsonPath().getInt("data.unreadCount");
Assert.assertEquals(unreadCount, 1, network.message(param, BasicConfig.SELLERUNREADMESSAGE, "代理人未读消息数有误", response.body().asString()));
}
// 消息通知页_对话记录
@Test(description = "消息通知页_对话记录", priority = 99)
@Test(description = "消息通知页_对话记录", priority = 51)
public void 消息通知页_对话记录() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
......@@ -66,7 +66,7 @@ public class MyCustomer implements Authorization {
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()));
Assert.assertEquals(lastContent, "你好", network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录最后一条内容错误", response.body().asString()));
}
// 标签管理页_新建标签
......@@ -141,6 +141,8 @@ public class MyCustomer implements Authorization {
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()));
visitCount = response.jsonPath().getInt("data.list[0].visitCount");
}
// 我的客户首页_获取全部客户列表_按照访问次数排列
......@@ -280,7 +282,6 @@ public class MyCustomer implements Authorization {
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()));
}
......@@ -371,11 +372,8 @@ public class MyCustomer implements Authorization {
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()));
int visitCountHere = response.jsonPath().getInt("data.visitCount");
Assert.assertEquals(visitCountHere, visitCount, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString()));
}
// 客户详情页_阅读偏好
......@@ -384,7 +382,8 @@ public class MyCustomer implements Authorization {
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()));
List<Object> readPerferences = response.jsonPath().getList("data");
Assert.assertTrue(readPerferences.size() > 0, network.message(param, BasicConfig.CUSTREADPERFERENCE, "客户无阅读偏好", response.body().asString()));
}
// 客户详情页_来访记录
......@@ -762,8 +761,29 @@ public class MyCustomer implements Authorization {
Assert.assertFalse(data, network.message(param, BasicConfig.NEWFUNC_FIRSTVISIT, "判断错误,用户非首次访问", response.body().asString()));
}
//客户详情页_留言_历史信息
@Test(description = "客户详情页_留言_历史信息", priority = 43)
public void 客户详情页_留言_历史信息() throws IOException{
param.clear();
param.put("role", 1);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_COUNTHISTORY);
int data = response.jsonPath().getInt("data");
Assert.assertTrue(data > 1, network.message(param, BasicConfig.CHAT_COUNTHISTORY, "历史消息总数小于1", response.body().asString()));
}
// 客户详情页_留言_留言对象是否关注公众号
@Test(description = "客户详情页_留言_留言对象是否关注公众号", priority = 44)
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()));
}
// 客户详情页_留言_发送消息
@Test(description = "客户详情页_留言_发送消息", priority = 43)
@Test(description = "客户详情页_留言_发送消息", priority = 45)
public void 客户详情页_留言_发送消息() throws IOException{
param = new HashMap<>();
param.put("content", "Hello");
......@@ -774,7 +794,7 @@ public class MyCustomer implements Authorization {
}
// 客户详情页_留言_聊天内容
@Test(description = "客户详情页_留言_聊天内容", priority = 44)
@Test(description = "客户详情页_留言_聊天内容", priority = 48)
public void 客户详情页_留言_聊天内容() throws IOException{
param = new HashMap<>();
param.put("pageSize", 30);
......@@ -787,27 +807,93 @@ public class MyCustomer implements Authorization {
Long senderId = chatLists.get(chatLists.size()-1).getSenderId();
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
int readFlag = chatLists.get(chatLists.size()-1).getReadFlag();
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()));
Assert.assertEquals(readFlag, 1, network.message(param, BasicConfig.CHAT_LIST, "消息已读状态错误", response.body().asString()));
}else {
Assert.assertTrue(true, network.message(param, BasicConfig.CHAT_LIST, "聊天记录为空", response.body().asString()));
Assert.fail(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()));
// 客户详情页_留言_最新信息
@Test(description = "客户详情页_留言_最新信息", priority = 50)
public void 客户详情页_留言_最新信息() throws IOException{
// 获取当前时间戳
Date current = new Date();
long timestamp = current.getTime();
param.clear();
param.put("role", 1);
param.put("sessionId", sessionId);
param.put("lastId", lastMessageId);
param.put("timestamp", timestamp);
response = network.getResponse(param, BasicConfig.CHAT_NEW);
long senderId = response.jsonPath().getLong("data.list[0].senderId");
long receiverId = response.jsonPath().getLong("data.list[0].receiverId");
String content = response.jsonPath().getString("data.list[0].content");
Assert.assertEquals(senderId, visitor1UserId, network.message(param, BasicConfig.CHAT_NEW, "发送者userID错误", response.body().asString()));
Assert.assertEquals(receiverId, (long)far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_NEW, "接收者sellerId错误", response.body().asString()));
Assert.assertEquals(content, "你好", network.message(param, BasicConfig.CHAT_NEW, "消息内容错误", response.body().asString()));
}
// 留言_客户接收消息
@Test(description = "留言_客户接收消息", priority = 46)
public void 留言_客户接收消息() throws IOException{
String scid = far.getContentScId(BasicConfig.ARTICLE_CONTENTID);
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
param.clear();
param.put("scid", scid);
response = network.getResponse(param, BasicConfig.CHECKUNREAD);
int unreadCount = response.jsonPath().getInt("data.unreadCount");
String sessionIds = response.jsonPath().getString("data.seller.sessionId");
Assert.assertEquals(unreadCount, 1, network.message(param, BasicConfig.CHECKUNREAD, "未读消息数错误", response.body().asString()));
Assert.assertEquals(sessionIds, sessionId, network.message(param, BasicConfig.CHECKUNREAD, "对话sessionId不符", response.body().asString()));
}
// 留言_客户阅读消息
@Test(description = "留言_客户阅读消息", priority = 47)
public void 留言_客户阅读消息() throws IOException{
// 客户获取最后一条聊天记录ID
param.clear();
param.put("pageSize", 30);
param.put("isPushMessage", true);
param.put("role", 2);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_LIST);
List<ChatList> chatLists = JsonUtil.parseResponseToPageBean(response, ChatList.class);
lastMessageId = chatLists.get(chatLists.size()-1).getId();
param.clear();
param.put("role", 2);
param.put("sessionId", sessionId);
param.put("lastId", lastMessageId);
response = network.postResponse(param, BasicConfig.CHAT_READED);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_READED, "访客阅读消息失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
// 留言_客户回复消息
@Test(description = "留言_客户回复消息", priority = 49)
public void 留言_客户回复消息() throws IOException{
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
param.clear();
param.put("content", "你好");
param.put("role", "2");
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()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
// 还原用户信息
@AfterClass
public void tearDown() throws IOException{
@Test(description = "还原用户详细信息", priority = 55)
public void 还原用户详细信息() throws IOException{
// 关闭生日提醒
param = new HashMap<>();
param.put("birthRemind", false);
......
package com.kjj.cases.assistant.whoSawMe;
import com.beust.jcommander.internal.Lists;
import com.kjj.bean.whoSawMe.ArticlePage;
import com.kjj.bean.whoSawMe.MyTaskList;
import com.kjj.bean.whoSawMe.RankingList;
import com.kjj.bean.whoSawMe.TeamTaskList;
import com.kjj.bean.whoSawMe.WeeklyList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
......@@ -29,8 +31,10 @@ public class WhoSawMe implements Authorization {
private Long xxrUserId;
private Long jjSellerId;
private String tagId0;
private String contentId;
private Integer taskId;
private String weeklyPublicationId;
private String scid; // 代理人周报scid
private String taskArticleContentId; // 任务素材contentId
private int taskId;
@BeforeClass
public void setUp() throws IOException {
......@@ -41,6 +45,7 @@ public class WhoSawMe implements Authorization {
far = new ForwardAndRead();
// 关闭数据看板演示数据
far.closeDemoData();
xxrUserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
}
// 进入谁看过我主页
......@@ -71,7 +76,7 @@ public class WhoSawMe implements Authorization {
@Test(description = "首页_获取当前页面Tips", priority = 3)
public void 获取当前页面Tips() throws IOException {
// 根据page获取当前页面tips
param = new HashMap<>();
param.clear();
String page = "who_saw_me";
param.put("page", page);
response = network.getResponse(param, BasicConfig.GETTIPSBYPAGE);
......@@ -83,7 +88,7 @@ public class WhoSawMe implements Authorization {
// 查询代理人当前使用版本
@Test(description = "首页_查询使用版本", priority = 4)
public void 查询代理人当前使用版本() throws IOException {
param = new HashMap<>();
param.clear();
xxxSellerId = far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
String sellerIdEncode = far.encodeId(xxxSellerId);
param.put("sellerId", sellerIdEncode);
......@@ -130,12 +135,12 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(BasicConfig.SELLERWEEKLY);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.SELLERWEEKLY, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.SELLERWEEKLY, "获取周报首页数据失败", response.body().asString()));
weeklyPublicationId = response.jsonPath().getString("data.weeklyPublicationId");
Assert.assertNotNull(weeklyPublicationId, network.message(BasicConfig.SELLERWEEKLY, "代理人运营周报Id为空", response.body().asString()));
}
// 获取首页来访统计
@Test(description = "获取谁看过我首页来访统计", priority = 10)
@Test(description = "获取谁看过我首页来访统计", priority = 9)
public void 来访统计() throws IOException{
response = network.getResponse(BasicConfig.VISITHEADER);
boolean success = response.jsonPath().getBoolean("success");
......@@ -149,6 +154,9 @@ public class WhoSawMe implements Authorization {
// 查看谁看过我首页我的访客列表
@Test(description = "查看我的访客列表", priority = 11)
public void 查看我的访客列表() throws IOException{
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
response = network.getResponse(BasicConfig.USER_INFO);
System.out.println(response.body().asString());
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
......@@ -158,13 +166,36 @@ public class WhoSawMe implements Authorization {
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()));
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertEquals(visitorWxName, far.getUserInfo(BasicConfig.VISITOR1_TKU).get("wxName"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
Assert.assertTrue(isNew, 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{
long xptUserId = far.decodeTku(BaseUtils.tku).get("userId");
param.clear();
param.put("userId", far.encodeId(xptUserId));
response = network.getResponse(param, BasicConfig.UPDATENEWTOOLD);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATENEWTOOLD, "用户身份更新失败", response.body().asString()));
// 检查新用户标记
param.clear();
param.put("customerTagIds", Lists.newArrayList());
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
}
// 获取代理人标签列表
@Test(description = "获取代理人标签列表", priority = 12)
@Test(description = "获取代理人标签列表", priority = 13)
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()));
......@@ -173,15 +204,121 @@ public class WhoSawMe implements Authorization {
}
// 进入运营周报首页
@Test(description = "进入运营周报首页", priority = 13)
public void 进入运营周报首页() throws IOException{
@Test(description = "运营周报_获取周报首页信息", priority = 14)
public void 运营周报_获取周报首页信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_INDEXINFO);
int clueCount = response.jsonPath().getInt("data.clueCount");
int forwardCount = response.jsonPath().getInt("data.forwardCount");
Assert.assertEquals(clueCount, 123, network.message(param, BasicConfig.WEEKLY_INDEXINFO, "获得线索总数错误", response.body().asString()));
Assert.assertEquals(forwardCount, 124, network.message(param, BasicConfig.WEEKLY_INDEXINFO, "总转发数错误", response.body().asString()));
}
@Test(description = "运营周报_获取代理人素材统计信息", priority = 15)
public void 运营周报_获取代理人素材统计信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_CONTENTSTATS);
int contentForwardCount = response.jsonPath().getInt("data.contentForwardCount");
int visitContentCount = response.jsonPath().getInt("data.visitContentCount");
Assert.assertEquals(contentForwardCount, 14, network.message(param, BasicConfig.WEEKLY_CONTENTSTATS, "素材转发数错误", response.body().asString()));
Assert.assertEquals(visitContentCount, 124, network.message(param, BasicConfig.WEEKLY_CONTENTSTATS, "素材累计来访次数错误", response.body().asString()));
}
@Test(description = "运营周报_获取代理人名片统计信息", priority = 16)
public void 运营周报_获取代理人名片统计信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_CARDSTATS);
int forwardCardCount = response.jsonPath().getInt("data.forwardCardCount");
int visitCardCount = response.jsonPath().getInt("data.visitCardCount");
Assert.assertEquals(forwardCardCount, 12, network.message(param, BasicConfig.WEEKLY_CARDSTATS, "名片转发数错误", response.body().asString()));
Assert.assertEquals(visitCardCount, 141, network.message(param, BasicConfig.WEEKLY_CARDSTATS, "名片累计来访次数错误", response.body().asString()));
}
@Test(description = "运营周报_获取周报客户统计信息", priority = 17)
public void 运营周报_获取周报客户统计信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_CUSTOMERSTATS);
int newCustomerCount = response.jsonPath().getInt("data.newCustomerCount");
Assert.assertEquals(newCustomerCount, 14, network.message(param, BasicConfig.WEEKLY_CUSTOMERSTATS, "新用户数量错误", response.body().asString()));
}
@Test(description = "运营周报_获取周报线索统计信息", priority = 18)
public void 运营周报_获取周报线索统计信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_CLUESTATS);
int clueCount = response.jsonPath().getInt("data.clueCount");
Assert.assertEquals(clueCount, 123, network.message(param, BasicConfig.WEEKLY_CLUESTATS, "获得线索总数错误", response.body().asString()));
}
@Test(description = "运营周报_每日统计信息", priority = 19)
public void 运营周报_每日统计信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_DATESTATS);
int clueCount = response.jsonPath().getInt("data.clueCount");
int visitCount = response.jsonPath().getInt("data.visitCount");
Assert.assertEquals(clueCount, 123, network.message(param, BasicConfig.WEEKLY_DATESTATS, "获得线索总数错误", response.body().asString()));
Assert.assertEquals(visitCount, 124, network.message(param, BasicConfig.WEEKLY_DATESTATS, "累计来访次数错误", response.body().asString()));
}
@Test(description = "运营周报_获取周报海报信息", priority = 20)
public void 运营周报_获取周报海报信息() throws IOException{
param.clear();
param.put("id", weeklyPublicationId);
response = network.getResponse(param, BasicConfig.WEEKLY_POSTERINFO);
String positiveAna = response.jsonPath().getString("data.positiveAna");
scid = response.jsonPath().getString("data.scid");
Assert.assertEquals(positiveAna, "不是所有弯路都值得再走一遍,但是每次分享都值得再读一遍", network.message(param, BasicConfig.WEEKLY_POSTERINFO, "海报文案内容错误", response.body().asString()));
Assert.assertEquals(scid, "Kj20MjIyNjk1", network.message(param, BasicConfig.WEEKLY_POSTERINFO, "海报scid错误", response.body().asString()));
}
@Test(description = "运营周报_生成代理人头像二维码", priority = 21)
public void 运营周报_生成代理人头像二维码() throws IOException{
long xxxUserId = far.decodeTku(BasicConfig.VISITOR2_TKU).get("userId");
param.clear();
param.put("needAvatarCover", true);
param.put("pageType", 1);
param.put("scene", scid+","+xxxUserId+",s=1");
param.put("visitorId", xxxUserId);
response = network.postResponse(param, BasicConfig.SELLERCARD_AYSNCGETMPORCODE);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.SELLERCARD_AYSNCGETMPORCODE, "生成代理人头像二维码失败", response.body().asString()));
}
@Test(description = "运营周报_获取往期周报列表", priority = 22)
public void 运营周报_获取往期周报列表() throws IOException{
response = network.getResponse(BasicConfig.WEEKLY_LIST);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.WEEKLY_LIST, "接口请求失败", response.body().asString()));
List<WeeklyList> weeklyLists = JsonUtil.parseResponseToListBean(response, WeeklyList.class);
int weeklyTotalCount = weeklyLists.size();
String freshWeeklyYearMonth = weeklyLists.get(0).getYearMonth();
List<WeeklyList.weeklyPublication> freshWeeklyPublications = weeklyLists.get(0).getWeeklyPublications();
String startDate = freshWeeklyPublications.get(0).getStartDate();
String endDate = freshWeeklyPublications.get(0).getEndDate();
String id = freshWeeklyPublications.get(0).getId();
int freshVisitorNum = freshWeeklyPublications.get(0).getFreshVisitorNum();
int keyClueNum = freshWeeklyPublications.get(0).getKeyCluesNum();
boolean newWeekly = freshWeeklyPublications.get(0).isNewWeekly();
int totalShareNum = freshWeeklyPublications.get(0).getTotalShareNum();
int totalVisitorNum = freshWeeklyPublications.get(0).getTotalVisitorNum();
Assert.assertEquals(weeklyTotalCount, 3, network.message(BasicConfig.WEEKLY_LIST, "往期周报数量错误", response.body().asString()));
Assert.assertEquals(freshWeeklyYearMonth, "2021年7月", network.message(BasicConfig.WEEKLY_LIST, "最近一次周报所属年月错误", response.body().asString()));
Assert.assertEquals(startDate, "7月26日", network.message(BasicConfig.WEEKLY_LIST, "周报开始日期错误", response.body().asString()));
Assert.assertEquals(endDate, "8月1日", network.message(BasicConfig.WEEKLY_LIST, "周报结束日期错误", response.body().asString()));
Assert.assertEquals(id, weeklyPublicationId, network.message(BasicConfig.WEEKLY_LIST, "周报id错误", response.body().asString()));
Assert.assertEquals(freshVisitorNum, 14, network.message(BasicConfig.WEEKLY_LIST, "新增访客数量错误", response.body().asString()));
Assert.assertEquals(keyClueNum, 0, network.message(BasicConfig.WEEKLY_LIST, "关键线索数量错误", response.body().asString()));
Assert.assertTrue(newWeekly, network.message(BasicConfig.WEEKLY_LIST, "判断为非新周报", response.body().asString()));
Assert.assertEquals(totalShareNum, 124, network.message(BasicConfig.WEEKLY_LIST, "统计分享数量错误", response.body().asString()));
Assert.assertEquals(totalVisitorNum, 124, network.message(BasicConfig.WEEKLY_LIST, "统计访客数量错误", response.body().asString()));
}
// 进入团队看板首页
@Test(description = "进入团队看板首页", priority = 14)
@Test(description = "进入团队看板首页", priority = 23)
public void 进入团队看板首页() throws IOException{
// 获取当前页面Tips
param.clear();
......@@ -209,7 +346,7 @@ public class WhoSawMe implements Authorization {
}
// 邀请成员加入团队
@Test(description = "生成团队邀请码", priority = 15)
@Test(description = "生成团队邀请码", priority = 24)
public void 生成团队邀请码() throws IOException{
Integer inviteType = 2;
param = new HashMap<>();
......@@ -219,7 +356,7 @@ public class WhoSawMe implements Authorization {
Assert.assertNotNull(data, network.message(param, BasicConfig.BOSS_CODE, "获取团队邀请码失败", response.body().asString()));
}
@Test(description = "其他代理人加入该代理人团队", priority = 16)
@Test(description = "其他代理人加入该代理人团队", priority = 25)
public void 邀请加入团队() throws IOException{
// 切换代理人加入团队
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
......@@ -241,7 +378,7 @@ public class WhoSawMe implements Authorization {
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
@Test(description = "查看被邀请代理人上级名称", priority = 17)
@Test(description = "查看被邀请代理人上级名称", priority = 26)
public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId
childSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
......@@ -254,7 +391,7 @@ public class WhoSawMe implements Authorization {
}
// 获取代理人团队信息
@Test(description = "代理人团队信息", priority = 19)
@Test(description = "代理人团队信息", priority = 27)
public void 代理人团队信息() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -267,7 +404,7 @@ public class WhoSawMe implements Authorization {
}
// 代理人团队成员数
@Test(description = "代理人团队成员数", priority = 20)
@Test(description = "代理人团队成员数", priority = 28)
public void 代理人团队成员数() throws IOException{
param = new HashMap<>();
param.put("superiorId", xxxSellerId);
......@@ -278,7 +415,7 @@ public class WhoSawMe implements Authorization {
}
// 获取个人排行列表
@Test(description = "获取个人排行列表", priority = 22)
@Test(description = "获取个人排行列表", priority = 29)
public void 获取个人排行列表() throws IOException{
param= new HashMap<>();
param.put("pageIndex", 1);
......@@ -302,7 +439,7 @@ public class WhoSawMe implements Authorization {
// 团队架构
// 团队架构_当前代理人身份
@Test(description = "团队架构_当前代理人身份", priority = 21)
@Test(description = "团队架构_当前代理人身份", priority = 30)
public void 团队架构_当前代理人身份() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -312,7 +449,7 @@ public class WhoSawMe implements Authorization {
}
// 团队架构_搜索成员
@Test(description = "团队架构_搜索成员", priority = 22)
@Test(description = "团队架构_搜索成员", priority = 31)
public void 团队架构_搜索成员() throws IOException{
jjSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>();
......@@ -342,89 +479,243 @@ public class WhoSawMe implements Authorization {
Assert.assertFalse(hasSuperior, network.message(param, BasicConfig.BOSS_ROLE, "成员仍有上级", response.body().asString()));
}
// 团队任务
// 新建任务_选择素材
@Test(description = "新建任务_选择素材", priority = 23)
public void 新建任务_选择素材() throws IOException{
param = new HashMap<>();
// 团队任务_新建任务
@Test(description = "团队任务_新建任务_选择素材", priority = 32)
public void 团队任务_新建任务_选择素材() throws IOException{
param.clear();
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();
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertTrue(totalCount >= 1, network.message(param, BasicConfig.FINDPAGEBYCONTENTTYPE, "素材列表无内容", response.body().asString()));
taskArticleContentId = response.jsonPath().getString("data.list[0].contentId");
}
// 新建任务_创建任务
@Test(description = "新建任务_创建任务", priority = 24)
public void 新建任务_创建任务() throws IOException{
String scid = far.getContentScId(contentId);
param = new HashMap<>();
@Test(description = "团队任务_新建任务_创建任务", priority = 33)
public void 团队任务_新建任务_创建任务() throws IOException{
// 获取选择素材的scId
String scid = far.getContentScId(taskArticleContentId);
param.clear();
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<>();
@Test(description = "团队任务_新建任务_获取可推送成员", priority = 34)
public void 团队任务_新建任务_获取可推送成员() throws IOException{
param.clear();
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()));
String sellerId = response.jsonPath().getString("data.list[0].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 = 35)
public void 团队任务_新建任务_获取任务详情() throws IOException{
param.clear();
param.put("taskId", taskId);
response = network.getResponse(param, BasicConfig.BOSS_DETAIL);
String contentId = response.jsonPath().getString("data.contentId");
int taskStatus = response.jsonPath().getInt("data.taskStatus");
Assert.assertEquals(contentId, taskArticleContentId, network.message(param, BasicConfig.BOSS_DETAIL, "任务素材Id有误", response.body().asString()));
Assert.assertEquals(taskStatus, 0, network.message(param, BasicConfig.BOSS_DETAIL, "任务状态有误", response.body().asString()));
}
// 新建任务_推送任务
@Test(description = "新建任务_推送任务", priority = 27)
public void 新建任务_推送任务() throws IOException{
List<String> sellerIds = Lists.newArrayList();
List<String> superiorIds = Lists.newArrayList();
@Test(description = "团队任务_推送任务", priority = 36)
public void 团队任务_推送任务() throws IOException{
List<String> sellerIds = new ArrayList<>();
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.clear();
param.put("effectiveDuration", 7); // 任务有效期7天
param.put("isAllMen", false);
param.put("sellerIds", sellerIds); // 指定指派成员
param.put("superiorIds", new ArrayList<>());
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()));
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.BOSS_PUBLISH, "任务推送失败", response.body().asString()));
}
// 新建任务_查看任务
@Test(description = "新建任务_查看任务", priority = 28)
public void 新建任务_查看任务() throws IOException{
param = new HashMap<>();
@Test(description = "团队任务_查看发布任务列表_未完成", priority = 37)
public void 团队任务_查看发布任务列表_未完成() throws IOException{
param.clear();
param.put("pageSize", 20);
param.put("taskStatus", 1);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "接口请求失败", response.body().asString()));
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount, 1, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "未完成任务数量有误", response.body().asString()));
List<TeamTaskList> teamTaskLists = JsonUtil.parseResponseToPageBean(response, TeamTaskList.class);
for (TeamTaskList teamTaskList: teamTaskLists){
Assert.assertEquals(teamTaskList.getTaskStatus(), 1, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "未完成任务列表中存在非未完成状态记录", response.body().asString()));
}
int taskId1 = teamTaskLists.get(0).getId();
int taskAchieverNum = teamTaskLists.get(0).getTaskAchieverNum();
Assert.assertEquals(taskId1, taskId, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务id错误", response.body().asString()));
Assert.assertEquals(taskAchieverNum, 0, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务完成人数不为0", response.body().asString()));
}
@Test(description = "团队任务_未完成任务详细", priority = 38)
public void 团队任务_未完成任务详细() throws IOException{
// 判断是否开启了演示数据
response = network.getResponse(BasicConfig.BOSS_ISDEMO);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data, network.message(BasicConfig.BOSS_ISDEMO, "演示数据已开启", response.body().asString()));
// 未完成列表
param.clear();
param.put("taskId", taskId);
param.put("pageSize", 20);
param.put("type", 1);
response = network.getResponse(param, BasicConfig.BOSS_RECEIVERLIST);
int totalCount = response.jsonPath().getInt("data.totalCount");
List<Object> list = response.jsonPath().getList("data.list");
Assert.assertEquals(totalCount, 1, network.message(param, BasicConfig.BOSS_RECEIVERLIST, "未完成人数有误", response.body().asString()));
// 已完成列表
param.clear();
param.put("taskId", taskId);
param.put("pageSize", 20);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.BOSS_RECEIVERLIST);
totalCount = response.jsonPath().getInt("data.totalCount");
list = response.jsonPath().getList("data.list");
Assert.assertEquals(totalCount, 0, network.message(param, BasicConfig.BOSS_RECEIVERLIST, "已完成人数不为0", response.body().asString()));
Assert.assertEquals(list.size(), 0, network.message(param, BasicConfig.BOSS_RECEIVERLIST, "已完成列表非空", response.body().asString()));
}
// 下级代理人完成任务
@Test(description = "接受任务_检查新任务", priority = 40)
public void 接受任务_检查新任务() throws IOException{
// 切换到下级代理人
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
response = network.getResponse(BasicConfig.HASNEWTASK);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(BasicConfig.HASNEWTASK, "未检查到新任务", response.body().asString()));
}
@Test(description = "接受任务_我的任务_头部信息", priority = 41)
public void 接受任务_我的任务_头部信息() throws IOException{
response = network.getResponse(BasicConfig.MYTASKHEADER);
int incompleteTaskNum = response.jsonPath().getInt("data.incompleteTaskNum");
Assert.assertEquals(incompleteTaskNum, 1, network.message(BasicConfig.MYTASKHEADER, "未完成任务数错误", response.body().asString()));
}
@Test(description = "接受任务_我的任务_未完成任务列表", priority = 42)
public void 接受任务_我的任务_未完成任务列表() throws IOException{
param.clear();
param.put("pageSize", 20);
param.put("type", 1);
response = network.getResponse(param, BasicConfig.MYTASKLIST);
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount, 1, network.message(param, BasicConfig.MYTASKLIST, "列表记录数错误", response.body().asString()));
List<MyTaskList> myTaskLists = JsonUtil.parseResponseToPageBean(response, MyTaskList.class);
for (MyTaskList myTaskList : myTaskLists){
Assert.assertEquals(myTaskList.getTaskStatus(), 1, network.message(param, BasicConfig.MYTASKLIST, "未完成任务列表中存在任务状态不正确的记录", response.body().asString()));
}
int taskId1 = myTaskLists.get(0).getTaskId();
String contentId = myTaskLists.get(0).getContentId();
Assert.assertEquals(taskId1, taskId, network.message(param, BasicConfig.MYTASKLIST, "任务ID不正确", response.body().asString()));
Assert.assertEquals(contentId, taskArticleContentId, network.message(param, BasicConfig.MYTASKLIST, "任务素材ID不正确", response.body().asString()));
}
@Test(description = "接受任务_转发素材", priority = 43)
public void 接受任务_转发素材() throws IOException{
// 获取文章scid
String scid = far.getContentScId(taskArticleContentId);
param.clear();
param.put("scId", scid);
param.put("forwardType", 1);
response = network.getResponse(param, BasicConfig.FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
}
@Test(description = "接受任务_我的任务_已完成任务列表", priority = 44)
public void 接受任务_我的任务_已完成任务列表() throws IOException{
param.clear();
param.put("pageSize", 20);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.MYTASKLIST);
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount, 1, network.message(param, BasicConfig.MYTASKLIST, "列表记录数有误", response.body().asString()));
List<MyTaskList> myTaskLists = JsonUtil.parseResponseToPageBean(response, MyTaskList.class);
for (MyTaskList myTaskList : myTaskLists){
Assert.assertEquals(myTaskList.getTaskStatus(), 2, network.message(param, BasicConfig.MYTASKLIST, "已完成任务列表中存在完成状态不正确的记录", response.body().asString()));
}
int taskId1 = myTaskLists.get(0).getTaskId();
String contentId = myTaskLists.get(0).getContentId();
Assert.assertEquals(taskId1, taskId, network.message(param, BasicConfig.MYTASKLIST, "任务ID不正确", response.body().asString()));
Assert.assertEquals(contentId, taskArticleContentId, network.message(param, BasicConfig.MYTASKLIST, "任务素材ID不正确", response.body().asString()));
// 查看未完成任务列表是否为空
param.clear();
param.put("pageSize", 20);
param.put("type", 1);
response = network.getResponse(param, BasicConfig.MYTASKLIST);
totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount, 0, network.message(param, BasicConfig.MYTASKLIST, "未完成列表不为空", response.body().asString()));
myTaskLists = JsonUtil.parseResponseToPageBean(response, MyTaskList.class);
Assert.assertEquals(myTaskLists.size(), 0, network.message(param, BasicConfig.MYTASKLIST, "未完成列表不为空", response.body().asString()));
// 切换回团队主管理员
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
// 团队管理员检查任务完成状态
@Test(description = "团队任务_查看发布任务列表_检查任务完成状态", priority = 45)
public void 团队任务_查看发布任务列表_检查任务完成状态() throws IOException{
// 查看未完成列表
param.clear();
param.put("pageSize", 20);
param.put("taskStatus", 1);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
List<Object> list = response.jsonPath().getList("data.list");
Assert.assertEquals(list.size(), 0, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "未完成列表不为空", response.body().asString()));
// 查看已完成列表
param.clear();
param.put("pageSize", 20);
param.put("taskStatus", 2);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
List<TeamTaskList> teamTaskLists = JsonUtil.parseResponseToPageBean(response, TeamTaskList.class);
int id = teamTaskLists.get(0).getId();
int taskAchieverNum = teamTaskLists.get(0).getTaskAchieverNum();
int taskStatus = teamTaskLists.get(0).getTaskStatus();
Assert.assertEquals(id, taskId, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务id不匹配", response.body().asString()));
Assert.assertEquals(taskAchieverNum, 1, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务完成人数不正确", response.body().asString()));
Assert.assertEquals(taskStatus, 2, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务完成状态不正确", response.body().asString()));
}
@Test(description = "团队任务_查看发布任务列表_查看完成任务详情", priority = 46)
public void 团队任务_查看发布任务列表_查看完成任务详情() throws IOException{
// 已完成任务成员列表
param.clear();
param.put("taskId", taskId);
param.put("pageSize", 20);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.BOSS_RECEIVERLIST);
Long sellerId = response.jsonPath().getLong("data.list[0].sellerId");
Assert.assertEquals(sellerId, jjSellerId, network.message(param, BasicConfig.BOSS_RECEIVERLIST, "已完成成员sellerId错误", response.body().asString()));
// 未完成任务成员列表
param.clear();
param.put("taskId", taskId);
param.put("pageSize", 20);
param.put("type", 1);
response = network.getResponse(param, BasicConfig.BOSS_RECEIVERLIST);
List<Object> list = response.jsonPath().getList("data.list");
Assert.assertEquals(list.size(), 0, network.message(param, BasicConfig.BOSS_RECEIVERLIST, "未完成列表不为空", response.body().asString()));
}
// 查看今日转发素材列表
@Test(description = "查看今日转发素材列表", priority = 29)
@Test(description = "查看今日转发素材列表", priority = 47)
public void 查看转发素材列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -438,7 +729,7 @@ public class WhoSawMe implements Authorization {
}
// 查看转发名片记录列表
@Test(description = "查看转发名片记录列表", priority = 30)
@Test(description = "查看转发名片记录列表", priority = 48)
public void 查看转发名片记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -451,7 +742,7 @@ public class WhoSawMe implements Authorization {
}
// 使用工具
@Test(description = "使用工具", priority = 31)
@Test(description = "使用工具", priority = 49)
public void 使用工具() throws IOException{
// 生成抽奖转盘素材scId
String lottery_scId = far.getContentScId(BasicConfig.LOTTERY_CONTENTID);
......@@ -466,7 +757,7 @@ public class WhoSawMe implements Authorization {
}
// 查看使用工具记录列表
@Test(description = "查看使用工具记录列表", priority = 32)
@Test(description = "查看使用工具记录列表", priority = 50)
public void 查看使用工具记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -480,7 +771,7 @@ public class WhoSawMe implements Authorization {
}
// 查看获得线索记录列表
@Test(description = "查看获得线索记录列表", priority = 33)
@Test(description = "查看获得线索记录列表", priority = 51)
public void 查看获得线索记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -494,7 +785,7 @@ public class WhoSawMe implements Authorization {
}
// 查看转发动态访问列表
@Test(description = "查看转发素材访问列表", priority = 34)
@Test(description = "查看转发素材访问列表", priority = 52)
public void 查看转发素材访问列表() throws IOException{
// 获取首条素材列表中首条动态id
param = new HashMap<>();
......@@ -510,11 +801,12 @@ public class WhoSawMe implements Authorization {
param.put("pageIndex", 1);
param.put("dynamicId", dynamicId);
response = network.getResponse(param, BasicConfig.GETVISITLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.GETVISITLIST, "接口请求失败", response.body().asString()));
Long visitorUserId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(visitorUserId, xxrUserId, network.message(param, BasicConfig.GETVISITLIST, "动态访问记录错误", response.body().asString()));
}
// 销售线索_新线索引导
@Test(description = "销售线索详情_新线索引导", priority = 35)
@Test(description = "销售线索详情_新线索引导", priority = 53)
public void 销售线索详情_新线索引导() throws IOException{
param = new HashMap<>();
param.put("guideType", 34);
......@@ -524,7 +816,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_线索详情
@Test(description = "销售线索_线索详情", priority = 36)
@Test(description = "销售线索_线索详情", priority = 54)
public void 销售线索_线索详情() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
......@@ -539,7 +831,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_跟进建议
@Test(description = "销售线索_跟进建议", priority = 37)
@Test(description = "销售线索_跟进建议", priority = 55)
public void 销售线索_跟进建议() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
......@@ -550,9 +842,8 @@ public class WhoSawMe implements Authorization {
}
// 管理客户信息
@Test(description = "管理客户信息", priority = 38)
@Test(description = "管理客户信息", priority = 56)
public void 管理客户信息() throws IOException{
xxrUserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
List<String> tagIds = Lists.newArrayList();
tagIds.add(tagId0);
param = new HashMap<>();
......@@ -566,7 +857,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_获取访客管理信息
@Test(description = "销售线索_获取访客管理信息", priority = 39)
@Test(description = "销售线索_获取访客管理信息", priority = 57)
public void 销售线索_获取访客管理信息() throws IOException{
String encodeUserId = far.encodeId(xxrUserId);
param = new HashMap<>();
......
......@@ -735,6 +735,15 @@ public class BasicConfig {
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 WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo";
public static final String WEEKLY_CONTENTSTATS = HOST + "/kjy/mp/weekly/getSellerContentStatsInfo";
public static final String WEEKLY_CARDSTATS = HOST + "/kjy/mp/weekly/getSellerCardStatsInfo";
public static final String WEEKLY_CUSTOMERSTATS = HOST + "/kjy/mp/weekly/getSellerWeeklyCustomerStatsInfo";
public static final String WEEKLY_CLUESTATS = HOST + "/kjy/mp/weekly/getSellerWeeklyClueStatsInfo";
public static final String WEEKLY_DATESTATS = HOST + "/kjy/mp/weekly/getSellerWeeklyDateStatsInfo";
public static final String WEEKLY_POSTERINFO = HOST + "/kjy/mp/weekly/getSellerWeeklyPosterInfo";
// *************** 客户信息 ***************
public static final String CUSTINFOHEADER = HOST + "/kjy/mp/whoSawMe/custInfoHeader";
public static final String CUSTINFO = HOST + "/kjy/mp/seller/v2/custInfo";
......@@ -767,6 +776,7 @@ public class BasicConfig {
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 UPDATENEWTOOLD = HOST + "/kjy/mp/whoSawMe/updateNewCustomerToOld";
// *************** 标签管理 ***************
public static final String TAG_ADDORUPDATE = HOST + "/kjy/mp/sellerTag/addOrUpdateTag";
public static final String TAG_GETLIST = HOST + "/kjy/mp/sellerTag/getTagList";
......@@ -776,6 +786,9 @@ public class BasicConfig {
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";
public static final String CHAT_COUNTHISTORY = HOST + "/kjy/mp/chat/countHistory";
public static final String CHAT_READED = HOST + "/kjy/mp/chat/readed";
public static final String CHAT_NEW = HOST + "/kjy/mp/chat/new";
// *************** 文章 ***************
......@@ -877,6 +890,9 @@ public class BasicConfig {
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 HASNEWTASK = HOST + "/kjy/mp/seller/team/task/hasNewTask";
public static final String MYTASKHEADER = HOST + "/kjy/mp/seller/team/task/myTaskHeader";
public static final String MYTASKLIST = HOST + "/kjy/mp/seller/team/task/myTaskList";
// 团队管理
public static final String FINDPAGEBYCONTENTTYPE = HOST + "/kjy/mp/exclusiveItem/findPageByContentType";
public static final String TEAMMEMBER = HOST + "/kjy/mp/seller/team/member";
......
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