Commit 20a9bbdd authored by xiamengchen's avatar xiamengchen

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

parent 915ee51a
...@@ -3,6 +3,7 @@ package com.kjj.cases.assistant.whoSawMe; ...@@ -3,6 +3,7 @@ package com.kjj.cases.assistant.whoSawMe;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
...@@ -32,6 +33,10 @@ public class ForwardAndRead implements Authorization { ...@@ -32,6 +33,10 @@ public class ForwardAndRead implements Authorization {
// 代理人转发素材 // 代理人转发素材
@Test(description = "代理人转发文章", priority = 1) @Test(description = "代理人转发文章", priority = 1)
public void 转发文章() throws IOException{ public void 转发文章() throws IOException{
// 转发文章前记录一个时间
forwardTime = new Date().getTime();
ThreadSleepUtils.sleep(5000);
articleScId = getContentScId(BasicConfig.ARTICLE_CONTENTID); // 获取文章scId articleScId = getContentScId(BasicConfig.ARTICLE_CONTENTID); // 获取文章scId
param = new HashMap<>(); param = new HashMap<>();
param.put("scId", articleScId); param.put("scId", articleScId);
...@@ -41,7 +46,6 @@ public class ForwardAndRead implements Authorization { ...@@ -41,7 +46,6 @@ 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()));
forwardTime = response.jsonPath().getLong("timestamp");
} }
@Test(description = "代理人转发名片", priority = 2) @Test(description = "代理人转发名片", priority = 2)
...@@ -125,7 +129,7 @@ public class ForwardAndRead implements Authorization { ...@@ -125,7 +129,7 @@ public class ForwardAndRead implements Authorization {
@Test(description = "添加访问记录", priority = 7) @Test(description = "添加访问记录", priority = 7)
public void 添加访问记录() throws IOException{ public void 添加访问记录() throws IOException{
param.clear(); param.clear();
param.put("forwardTime", forwardTime + 5000); param.put("forwardTime", forwardTime); // 添加访问记录的时间要小于代理人转发时间
param.put("scid", articleScId); param.put("scid", articleScId);
response = network.postResponse(param, BasicConfig.DYNAMIC_ADDVISIT); response = network.postResponse(param, BasicConfig.DYNAMIC_ADDVISIT);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "添加访问记录失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "添加访问记录失败", response.body().asString()));
......
...@@ -24,7 +24,7 @@ public class MyCustomer implements Authorization { ...@@ -24,7 +24,7 @@ public class MyCustomer implements Authorization {
private String createTagId; private String createTagId;
private long visitor1UserId; private long visitor1UserId;
private String sessionId; private String sessionId;
private int visitCount; private int visitCount; // 二次访客来访次数
private String id; // 自定义提醒事项id private String id; // 自定义提醒事项id
private long lastMessageId; private long lastMessageId;
...@@ -142,6 +142,8 @@ public class MyCustomer implements Authorization { ...@@ -142,6 +142,8 @@ public class MyCustomer implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", 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"); long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString())); 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 { ...@@ -371,11 +373,8 @@ public class MyCustomer implements Authorization {
param.put("type", 2); param.put("type", 2);
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC); response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
visitCount = response.jsonPath().getInt("data.visitCount"); int visitCountHere = response.jsonPath().getInt("data.visitCount");
int grassNum = response.jsonPath().getInt("data.grassNum"); Assert.assertEquals(visitCountHere, visitCount, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString()));
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()));
} }
// 客户详情页_阅读偏好 // 客户详情页_阅读偏好
......
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