Commit 1b81fd6b authored by 龚小红's avatar 龚小红

Merge branch 'Feature/20210215-gxh' into 'master'

fix-访问接口更新

See merge request test-group/kejiji!223
parents 3eedec9f a50df135
...@@ -134,8 +134,8 @@ public class ForwardAndRead implements Authorization { ...@@ -134,8 +134,8 @@ public class ForwardAndRead implements Authorization {
} }
// 获取新用户 // 获取新用户
@Test(description = "新用户访问", priority = 7) @Test(description = "新用户访问阅读文章", priority = 7)
public void 新用户访问() throws IOException{ public void 新用户访问阅读文章() throws IOException{
sleep(2000); sleep(2000);
newUser1(); newUser1();
response = network.getResponse(BasicConfig.USER_INFO); response = network.getResponse(BasicConfig.USER_INFO);
...@@ -146,7 +146,7 @@ public class ForwardAndRead implements Authorization { ...@@ -146,7 +146,7 @@ public class ForwardAndRead implements Authorization {
param.put("traceId", null); param.put("traceId", null);
param.put("visitPath", 0); param.put("visitPath", 0);
response = network.postResponse(param, BasicConfig.CONTENT_visit); response = network.postResponse(param, BasicConfig.CONTENT_visit);
System.out.println(response.body().asString()); jjvisitId = response.jsonPath().getString("data.userVisitId");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
param.clear(); param.clear();
...@@ -159,21 +159,6 @@ public class ForwardAndRead implements Authorization { ...@@ -159,21 +159,6 @@ public class ForwardAndRead implements Authorization {
Assert.assertNotNull(data,network.message(param, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString())); Assert.assertNotNull(data,network.message(param, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString()));
} }
@Test(description = "二度访客阅读文章", priority = 9)
public void 二度访客阅读文章() throws IOException{
sleep(5000);
userTku2(); // 切换二度访客
param = new HashMap<>();
param.put("scid", articleScId);
param.put("fromUserId", fromUserId);
param.put("traceId", null);
param.put("visitPath", 0);
response = network.postResponse(param, BasicConfig.CONTENT_visit);
jjvisitId = response.jsonPath().getString("data.userVisitId");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
}
@Test(description = "添加访问记录", priority = 10) @Test(description = "添加访问记录", priority = 10)
public void 添加访问记录() throws IOException{ public void 添加访问记录() throws IOException{
param.clear(); param.clear();
...@@ -251,7 +236,7 @@ public class ForwardAndRead implements Authorization { ...@@ -251,7 +236,7 @@ public class ForwardAndRead implements Authorization {
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()));
userTku2(); // 切换二度访客 newUser1(); // 切换二度访客
param.clear(); param.clear();
param.put("scid", activityScid); param.put("scid", activityScid);
param.put("fromUserId",encodingId(6491L)); //代理人的用户id param.put("fromUserId",encodingId(6491L)); //代理人的用户id
......
...@@ -30,7 +30,7 @@ public class MyCustomer implements Authorization { ...@@ -30,7 +30,7 @@ public class MyCustomer implements Authorization {
public void setUp() throws IOException{ public void setUp() throws IOException{
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
agent2Tku(); agent2Tku();
visitor1UserId = ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId"); visitor1UserId = ForwardAndRead.decodeTku(tku1).get("userId");
newUserId = ForwardAndRead.decodeTku(tku1).get("userId"); newUserId = ForwardAndRead.decodeTku(tku1).get("userId");
} }
...@@ -118,7 +118,7 @@ public class MyCustomer implements Authorization { ...@@ -118,7 +118,7 @@ public class MyCustomer implements Authorization {
param.put("isSpecialCustomer", 1); param.put("isSpecialCustomer", 1);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL); 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("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "设置特别关注失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "取消特别关注失败", response.body().asString()));
} }
...@@ -127,29 +127,11 @@ public class MyCustomer implements Authorization { ...@@ -127,29 +127,11 @@ public class MyCustomer implements Authorization {
public void 客户列表_特别关注() throws IOException{ public void 客户列表_特别关注() throws IOException{
ThreadSleepUtils.sleep(5000); ThreadSleepUtils.sleep(5000);
param = new HashMap<>(); param = new HashMap<>();
param.put("isSpecialCustomer", 1); param.put("custUserId", newUserId);
param.put("pageIndex", 1); response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
param.put("pageSize", 20); int isSpecialCustomer = response.jsonPath().getInt("data.isSpecialCustomer");
param.put("sortType", 3); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH); Assert.assertEquals(isSpecialCustomer, 1,network.message(param, BasicConfig.UPDATESPECIAL, "设置特别关注失败", response.body().asString()));
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 = 11) @Test(description = "客户详情页_取消特别关注", priority = 11)
...@@ -216,20 +198,20 @@ public class MyCustomer implements Authorization { ...@@ -216,20 +198,20 @@ public class MyCustomer implements Authorization {
int visitCount = response.jsonPath().getInt("data.visitCount"); int visitCount = response.jsonPath().getInt("data.visitCount");
int grassNum = response.jsonPath().getInt("data.grassNum"); int grassNum = response.jsonPath().getInt("data.grassNum");
int datagramNum = response.jsonPath().getInt("data.datagramNum"); int datagramNum = response.jsonPath().getInt("data.datagramNum");
Assert.assertEquals(grassNum, ForwardAndRead.custClueStatistics.get("grassNum") +0, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数增加", response.body().asString())); Assert.assertEquals(grassNum, ForwardAndRead.custClueStatistics.get("grassNum") +1, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数增加", response.body().asString()));
Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount")+0, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString())); Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount")+2, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString()));
Assert.assertEquals(datagramNum, ForwardAndRead.custClueStatistics.get("datagramNum") +0, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString())); Assert.assertEquals(datagramNum, ForwardAndRead.custClueStatistics.get("datagramNum") +1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString()));
} }
// //客户详情页_阅读偏好------访问重构未更新 //客户详情页_阅读偏好------访问重构未更新
// @Test(description = "客户详情页_阅读偏好", priority = 22) @Test(description = "客户详情页_阅读偏好", priority = 22)
// public void 客户详情页_阅读偏好() throws IOException{ public void 客户详情页_阅读偏好() throws IOException{
// param = new HashMap<>(); param = new HashMap<>();
// param.put("custUserId", visitor1UserId); param.put("custUserId", visitor1UserId);
// response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE); response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE);
// List<Object> readPerferences = response.jsonPath().getList("data"); List<Object> readPerferences = response.jsonPath().getList("data");
// Assert.assertTrue(readPerferences.size() > 0, network.message(param, BasicConfig.CUSTREADPERFERENCE, "客户无阅读偏好", response.body().asString())); Assert.assertTrue(readPerferences.size() > 0, network.message(param, BasicConfig.CUSTREADPERFERENCE, "客户无阅读偏好", response.body().asString()));
// } }
// 客户详情页_来访记录 // 客户详情页_来访记录
@Test(description = "客户详情页_来访记录", priority = 23) @Test(description = "客户详情页_来访记录", priority = 23)
...@@ -244,13 +226,14 @@ public class MyCustomer implements Authorization { ...@@ -244,13 +226,14 @@ public class MyCustomer implements Authorization {
response = network.getResponse(param, BasicConfig.CUSTVISITLIST); response = network.getResponse(param, BasicConfig.CUSTVISITLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTVISITLIST, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTVISITLIST, "接口请求失败", response.body().asString()));
List<VisitRecords> visitRecords = JsonUtil.parseResponseToPageBean(response, VisitRecords.class); List<VisitRecords> visitRecords = JsonUtil.parseResponseToPageBean(response, VisitRecords.class);
VisitRecords.recordsList recordsOfContent = visitRecords.get(1).getRecords().get(0); int clueType1 = visitRecords.get(0).getRecords().get(1).getClueType();
VisitRecords.recordsList recordsOfClue = visitRecords.get(1).getRecords().get(1); String contentId =visitRecords.get(1).getRecords().get(0).getContentId();
String contentId = recordsOfContent.getContentId(); int clueType2 = visitRecords.get(1).getRecords().get(1).getClueType();
int clueType = recordsOfClue.getClueType(); int clueType3 = visitRecords.get(1).getRecords().get(2).getClueType();
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param ,BasicConfig.CUSTVISITLIST, "访问记录详情有误", response.body().asString())); Assert.assertEquals(clueType1, 6, network.message(param, BasicConfig.CUSTVISITLIST, "测评领取报告的线索类型有误有误", response.body().asString()));
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param ,BasicConfig.CUSTVISITLIST, "文章访问记录的文章ID有误", response.body().asString()));
Assert.assertEquals(clueType, 3, network.message(param, BasicConfig.CUSTVISITLIST, "访问记录详情有误", response.body().asString())); Assert.assertEquals(clueType2, 3, network.message(param, BasicConfig.CUSTVISITLIST, "资料包的线索类型有误有误", response.body().asString()));
Assert.assertEquals(clueType3, 5, network.message(param, BasicConfig.CUSTVISITLIST, "赠险的线索类型有误有误", response.body().asString()));
} }
// 客户线索跟进 // 客户线索跟进
...@@ -365,23 +348,6 @@ public class MyCustomer implements Authorization { ...@@ -365,23 +348,6 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(tagId, createTagId, network.message(param, BasicConfig.GETTAGANDREMIND, "标签id与预期不符", response.body().asString())); Assert.assertEquals(tagId, createTagId, network.message(param, BasicConfig.GETTAGANDREMIND, "标签id与预期不符", 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);
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "筛选结果与预期不符", response.body().asString()));
}
// 客户信息_客户管理_自定义提醒事项 // 客户信息_客户管理_自定义提醒事项
@Test(description = "客户信息_客户管理_自定义提醒事项", priority = 32) @Test(description = "客户信息_客户管理_自定义提醒事项", priority = 32)
public void 客户信息_客户管理_自定义提醒事项() throws IOException{ public void 客户信息_客户管理_自定义提醒事项() throws IOException{
......
...@@ -33,7 +33,6 @@ public class WhoSawMe implements Authorization { ...@@ -33,7 +33,6 @@ public class WhoSawMe implements Authorization {
private String scid; // 代理人周报scid private String scid; // 代理人周报scid
private String taskArticleContentId; // 任务素材contentId private String taskArticleContentId; // 任务素材contentId
private int taskId; private int taskId;
private long userId;
@BeforeClass @BeforeClass
public void setUp() throws IOException { public void setUp() throws IOException {
...@@ -44,8 +43,7 @@ public class WhoSawMe implements Authorization { ...@@ -44,8 +43,7 @@ public class WhoSawMe implements Authorization {
// 关闭数据看板演示数据 // 关闭数据看板演示数据
ForwardAndRead.closeDemoData(); ForwardAndRead.closeDemoData();
xxrUserId = ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId"); xxrUserId = ForwardAndRead.decodeTku(tku1).get("userId");
userId = ForwardAndRead.decodeTku(tku1).get("userId");
} }
// 进入谁看过我主页 // 进入谁看过我主页
...@@ -160,7 +158,7 @@ public class WhoSawMe implements Authorization { ...@@ -160,7 +158,7 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList); response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_visitList, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_visitList, "接口请求失败", response.body().asString()));
String visitId = response.jsonPath().getString("data.list[0].customerInfo.customerUserId"); String visitId = response.jsonPath().getString("data.list[0].customerInfo.customerUserId");
Assert.assertEquals(visitId, IdMakeUtil.encodingId(userId), network.message(param, BasicConfig.WHOSAWME_visitList, "最近访客微信用户ID不匹配", response.body().asString())); Assert.assertEquals(visitId, IdMakeUtil.encodingId(xxrUserId), network.message(param, BasicConfig.WHOSAWME_visitList, "最近访客微信用户ID不匹配", response.body().asString()));
} }
// 将新用户标记为老用户(小葡萄) // 将新用户标记为老用户(小葡萄)
...@@ -173,14 +171,14 @@ public class WhoSawMe implements Authorization { ...@@ -173,14 +171,14 @@ public class WhoSawMe implements Authorization {
int size = response.jsonPath().getInt("data.list.size()"); int size = response.jsonPath().getInt("data.list.size()");
for (int i = 0;i< size;i++){ for (int i = 0;i< size;i++){
String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId"); String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId");
if(visitId.equals(IdMakeUtil.encodingId(userId))){ if(visitId.equals(IdMakeUtil.encodingId(xxrUserId))){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew"); boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew");
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "新客户身份错误", response.body().asString())); Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "新客户身份错误", response.body().asString()));
break; break;
} }
} }
param.clear(); param.clear();
param.put("userId", ForwardAndRead.encodeId(userId)); param.put("userId", ForwardAndRead.encodeId(xxrUserId));
response = network.getResponse(param, BasicConfig.UPDATENEWTOOLD); response = network.getResponse(param, BasicConfig.UPDATENEWTOOLD);
boolean data =response.jsonPath().getBoolean("data"); boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATENEWTOOLD, "用户身份更新失败", response.body().asString())); Assert.assertTrue(data, network.message(param, BasicConfig.UPDATENEWTOOLD, "用户身份更新失败", response.body().asString()));
...@@ -195,7 +193,7 @@ public class WhoSawMe implements Authorization { ...@@ -195,7 +193,7 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList); response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
for (int i = 0;i< size;i++){ for (int i = 0;i< size;i++){
String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId"); String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId");
if(visitId.equals(IdMakeUtil.encodingId(userId))){ if(visitId.equals(IdMakeUtil.encodingId(xxrUserId))){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew"); boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "客户身份未更新为老客户", response.body().asString())); Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "客户身份未更新为老客户", response.body().asString()));
break; break;
......
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