Commit 20a9bbdd authored by xiamengchen's avatar xiamengchen

修改动态访问记录,解决接口报错

parent 915ee51a
......@@ -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;
......@@ -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().getLong("timestamp");
}
@Test(description = "代理人转发名片", priority = 2)
......@@ -125,7 +129,7 @@ public class ForwardAndRead implements Authorization {
@Test(description = "添加访问记录", priority = 7)
public void 添加访问记录() throws IOException{
param.clear();
param.put("forwardTime", forwardTime + 5000);
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()));
......
......@@ -24,7 +24,7 @@ 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;
......@@ -142,6 +142,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");
}
// 我的客户首页_获取全部客户列表_按照访问次数排列
......@@ -371,11 +373,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()));
}
// 客户详情页_阅读偏好
......
......@@ -28,9 +28,6 @@ public class WhoSawMe implements Authorization {
private Long xxrUserId;
private Long jjSellerId;
private String tagId0;
private String contentId;
private Integer taskId;
private String taskContentId; // 团队任务转发的素材contentId
@BeforeClass
public void setUp() throws IOException {
......@@ -41,6 +38,7 @@ public class WhoSawMe implements Authorization {
far = new ForwardAndRead();
// 关闭数据看板演示数据
far.closeDemoData();
xxrUserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
}
// 进入谁看过我主页
......@@ -135,7 +133,7 @@ public class WhoSawMe implements Authorization {
}
// 获取首页来访统计
@Test(description = "获取谁看过我首页来访统计", priority = 10)
@Test(description = "获取谁看过我首页来访统计", priority = 9)
public void 来访统计() throws IOException{
response = network.getResponse(BasicConfig.VISITHEADER);
boolean success = response.jsonPath().getBoolean("success");
......@@ -147,7 +145,7 @@ public class WhoSawMe implements Authorization {
}
// 查看谁看过我首页我的访客列表
@Test(description = "查看我的访客列表", priority = 11)
@Test(description = "查看我的访客列表", priority = 10)
public void 查看我的访客列表() throws IOException{
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
......@@ -164,7 +162,7 @@ public class WhoSawMe implements Authorization {
}
// 获取代理人标签列表
@Test(description = "获取代理人标签列表", priority = 12)
@Test(description = "获取代理人标签列表", priority = 11)
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,7 +171,7 @@ public class WhoSawMe implements Authorization {
}
// 进入运营周报首页
@Test(description = "进入运营周报首页", priority = 13)
@Test(description = "进入运营周报首页", priority = 12)
public void 进入运营周报首页() throws IOException{
response = network.getResponse(BasicConfig.WEEKLY_LIST);
boolean success = response.jsonPath().getBoolean("success");
......@@ -181,7 +179,7 @@ public class WhoSawMe implements Authorization {
}
// 进入团队看板首页
@Test(description = "进入团队看板首页", priority = 14)
@Test(description = "进入团队看板首页", priority = 13)
public void 进入团队看板首页() throws IOException{
// 获取当前页面Tips
param.clear();
......@@ -209,7 +207,7 @@ public class WhoSawMe implements Authorization {
}
// 邀请成员加入团队
@Test(description = "生成团队邀请码", priority = 15)
@Test(description = "生成团队邀请码", priority = 14)
public void 生成团队邀请码() throws IOException{
Integer inviteType = 2;
param = new HashMap<>();
......@@ -219,7 +217,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 = 15)
public void 邀请加入团队() throws IOException{
// 切换代理人加入团队
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
......@@ -241,7 +239,7 @@ public class WhoSawMe implements Authorization {
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
}
@Test(description = "查看被邀请代理人上级名称", priority = 17)
@Test(description = "查看被邀请代理人上级名称", priority = 16)
public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId
childSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
......@@ -254,7 +252,7 @@ public class WhoSawMe implements Authorization {
}
// 获取代理人团队信息
@Test(description = "代理人团队信息", priority = 19)
@Test(description = "代理人团队信息", priority = 17)
public void 代理人团队信息() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -267,7 +265,7 @@ public class WhoSawMe implements Authorization {
}
// 代理人团队成员数
@Test(description = "代理人团队成员数", priority = 20)
@Test(description = "代理人团队成员数", priority = 18)
public void 代理人团队成员数() throws IOException{
param = new HashMap<>();
param.put("superiorId", xxxSellerId);
......@@ -278,7 +276,7 @@ public class WhoSawMe implements Authorization {
}
// 获取个人排行列表
@Test(description = "获取个人排行列表", priority = 22)
@Test(description = "获取个人排行列表", priority = 19)
public void 获取个人排行列表() throws IOException{
param= new HashMap<>();
param.put("pageIndex", 1);
......@@ -302,7 +300,7 @@ public class WhoSawMe implements Authorization {
// 团队架构
// 团队架构_当前代理人身份
@Test(description = "团队架构_当前代理人身份", priority = 21)
@Test(description = "团队架构_当前代理人身份", priority = 20)
public void 团队架构_当前代理人身份() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -312,7 +310,7 @@ public class WhoSawMe implements Authorization {
}
// 团队架构_搜索成员
@Test(description = "团队架构_搜索成员", priority = 22)
@Test(description = "团队架构_搜索成员", priority = 21)
public void 团队架构_搜索成员() throws IOException{
jjSellerId = far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>();
......@@ -342,135 +340,8 @@ 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<>();
// 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);
// int taskStatus = response.jsonPath().getInt("data.list[0].taskStatus");
// Assert.assertEquals(taskStatus, 1, network.message(param, BasicConfig.BOSS_TEAMTASKLIST, "任务状态错误", response.body().asString()));
// }
//
// // 个人中心_下级_新任务提醒
// @Test(description = "个人中心_下级_新任务提醒", priority = 29)
// 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 = 30)
// 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 = 31)
// public void 我的任务列表_未完成任务() throws IOException{
// param.clear();
// param.put("pageSize", 20);
// param.put("type", 1);
// response = network.getResponse(param, BasicConfig.MYTASKLIST);
// Integer myTaskId = response.jsonPath().getInt("data.list[0].taskId");
// int myTaskStatus = response.jsonPath().getInt("data.list[0].taskStatus");
// taskContentId = response.jsonPath().getString("data.list[0].contentId");
// Assert.assertEquals(myTaskId, taskId, network.message(param, BasicConfig.MYTASKLIST, "未完成任务ID与创建时任务ID不符", response.body().asString()));
// Assert.assertEquals(myTaskStatus, 1, network.message(param, BasicConfig.MYTASKLIST, "任务完成状态错误", response.body().asString()));
// }
//
// // 个人中心_下级_完成任务
// @Test(description = "下级_完成任务", priority = 32)
// public void 下级_完成任务() throws IOException{
// // 生成下级的文章scid
// String scid = far.getContentScId(taskContentId);
// param.clear();
// param.put("scId", scid);
// param.put("forwardType", 1);
// response = network.getResponse(param, BasicConfig.FORWARD);
// Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.FORWARD, "转发文章失败", response.body().asString()));
// }
// 查看今日转发素材列表
@Test(description = "查看今日转发素材列表", priority = 29)
@Test(description = "查看今日转发素材列表", priority = 22)
public void 查看转发素材列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -484,7 +355,7 @@ public class WhoSawMe implements Authorization {
}
// 查看转发名片记录列表
@Test(description = "查看转发名片记录列表", priority = 30)
@Test(description = "查看转发名片记录列表", priority = 23)
public void 查看转发名片记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -497,7 +368,7 @@ public class WhoSawMe implements Authorization {
}
// 使用工具
@Test(description = "使用工具", priority = 31)
@Test(description = "使用工具", priority = 24)
public void 使用工具() throws IOException{
// 生成抽奖转盘素材scId
String lottery_scId = far.getContentScId(BasicConfig.LOTTERY_CONTENTID);
......@@ -512,7 +383,7 @@ public class WhoSawMe implements Authorization {
}
// 查看使用工具记录列表
@Test(description = "查看使用工具记录列表", priority = 32)
@Test(description = "查看使用工具记录列表", priority = 25)
public void 查看使用工具记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -526,7 +397,7 @@ public class WhoSawMe implements Authorization {
}
// 查看获得线索记录列表
@Test(description = "查看获得线索记录列表", priority = 33)
@Test(description = "查看获得线索记录列表", priority = 26)
public void 查看获得线索记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
......@@ -540,7 +411,7 @@ public class WhoSawMe implements Authorization {
}
// 查看转发动态访问列表
@Test(description = "查看转发素材访问列表", priority = 34)
@Test(description = "查看转发素材访问列表", priority = 27)
public void 查看转发素材访问列表() throws IOException{
// 获取首条素材列表中首条动态id
param = new HashMap<>();
......@@ -556,11 +427,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 = 28)
public void 销售线索详情_新线索引导() throws IOException{
param = new HashMap<>();
param.put("guideType", 34);
......@@ -570,7 +442,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_线索详情
@Test(description = "销售线索_线索详情", priority = 36)
@Test(description = "销售线索_线索详情", priority = 29)
public void 销售线索_线索详情() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
......@@ -585,7 +457,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_跟进建议
@Test(description = "销售线索_跟进建议", priority = 37)
@Test(description = "销售线索_跟进建议", priority = 30)
public void 销售线索_跟进建议() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
......@@ -596,9 +468,8 @@ public class WhoSawMe implements Authorization {
}
// 管理客户信息
@Test(description = "管理客户信息", priority = 38)
@Test(description = "管理客户信息", priority = 31)
public void 管理客户信息() throws IOException{
xxrUserId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
List<String> tagIds = Lists.newArrayList();
tagIds.add(tagId0);
param = new HashMap<>();
......@@ -612,7 +483,7 @@ public class WhoSawMe implements Authorization {
}
// 销售线索_获取访客管理信息
@Test(description = "销售线索_获取访客管理信息", priority = 39)
@Test(description = "销售线索_获取访客管理信息", priority = 32)
public void 销售线索_获取访客管理信息() throws IOException{
String encodeUserId = far.encodeId(xxrUserId);
param = new HashMap<>();
......
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