Commit 9497389e authored by xiamengchen's avatar xiamengchen

谁看过我+我的转发

parent 55679348
package com.kjj.cases.assistant.whoSawMe.MyCustomer;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// 我的客户-客户详情页
public class CustomerInfo implements Authorization {
private Response response;
private Map<String, Object> param;
private ForwardAndRead far;
private Long custUserId;
private String visitorWxName;
private boolean compare;
private int visitCount;
private int monthVisitCount;
private int grassNum;
@BeforeClass
public void setUp() throws IOException{
agentTku();
BaseUtils.ssoLogin();
far = new ForwardAndRead();
}
// 进入客户详情页
// 客户详情页_新手任务蒙层
@Test(description = "判断是否展示新手任务蒙层", priority = 1)
public void 新手任务蒙层展示() throws IOException{
param = new HashMap<>();
param.put("sceneCode", "noviceTask_visitorsCustomerInfoComplete");
response = network.postResponse(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY, "接口请求失败", response.body().asString()));
Object isDisplay = response.jsonPath().getJsonObject("data.isDisplay");
Assert.assertNotNull(isDisplay, network.message(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY, "判断是否展示新手任务蒙层失败, isDisplay返回null", response.body().asString()));
}
// 客户详情页_特别关注弹窗
@Test(description = "特别关注弹层", priority = 2)
public void 特别关注弹层() throws IOException{
response = network.getResponse(BasicConfig.ISDISPLAYSPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.ISDISPLAYSPECIAL, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.ISDISPLAYSPECIAL, "data返回为null", response.body().asString()));
}
//客户详情页_获取客户资料页头部信息
@Test(description = "获取客户资料页头部信息", priority = 2)
public void 获取头部信息() throws IOException{
custUserId = far.decodeTku(BasicConfig.VISITOR_TKU).get("userId");
param = new HashMap<>();
param.put("custUserId", custUserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFOHEADER, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
String nickName = response.jsonPath().getString("data.nickName");
// 获取访客wxName
network.agentCookies.put("tku", BasicConfig.VISITOR_TKU);
response = network.getResponse(BasicConfig.USER_INFO);
visitorWxName = response.jsonPath().getString("data.wxName");
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
Assert.assertNotNull(data, network.message(param, BasicConfig.CUSTINFOHEADER, "头部信息获取失败,data返回为空", response.body().asString()));
Assert.assertEquals(nickName, visitorWxName, network.message(param, BasicConfig.CUSTINFOHEADER, "头部信息返回错误,客户微信昵称与预期不符", response.body().asString()));
}
// 客户详情页_获取客户信息
@Test(description = "获取客户信息", priority = 2)
public void 获取客户信息() throws IOException{
param = new HashMap<>();
param.put("userId", custUserId);
response = network.getResponse(param, BasicConfig.CUSTINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFO, "接口请求失败", response.body().asString()));
Long sellerId = response.jsonPath().getLong("data.sellerId");
String custWxName = response.jsonPath().getString("data.custWxName");
Assert.assertEquals(sellerId, far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId"), network.message(param, BasicConfig.CUSTINFO, "客户代理人的sellerId不符合预期", response.body().asString()));
Assert.assertEquals(custWxName, visitorWxName, network.message(param, BasicConfig.CUSTINFO, "客户微信昵称与预期不符", response.body().asString()));
}
// 客户详情页_获取客户访问线索统计
@Test(description = "客户访问线索统计", priority = 3)
public void 客户访问线索统计() throws IOException{
param = new HashMap<>();
param.put("userId", custUserId);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUESTATISTICS, "接口请求失败", response.body().asString()));
visitCount = response.jsonPath().getInt("data.visitCount");
grassNum = response.jsonPath().getInt("data.grassNum");
compare = visitCount >= 1;
Assert.assertTrue(compare, network.message(param, BasicConfig.CLUESTATISTICS, "获取客户访问线索统计失败,客户访问次数小于1", response.body().asString()));
}
// 客户详情页_获取客户人脉数
@Test(description = "获取客户人脉数", priority = 4)
public void 获取客户人脉数() throws IOException{
param = new HashMap<>();
param.put("custUserId", custUserId);
response = network.getResponse(param, BasicConfig.CUSTRELATION);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTRELATION, "接口请求失败", response.body().asString()));
Object num = response.jsonPath().getJsonObject("data.num");
Assert.assertNotNull(num, network.message(param, BasicConfig.CUSTRELATION, "获取到客户人脉数为null", response.body().asString()));
}
// 客户详情页_获取客户阅读偏好
@Test(description = "获取客户阅读偏好", priority = 5)
public void 获取客户阅读偏好() throws IOException{
param = new HashMap<>();
param.put("custUserId", custUserId);
response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTREADPERFERENCE, "接口请求失败", response.body().asString()));
}
// 客户详情页_最近线索统计数据
@Test(description = "获取客户最近线索统计", priority = 6)
public void 获取客户最近线索统计() throws IOException{
param = new HashMap<>();
param.put("custUserId", custUserId);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
monthVisitCount = response.jsonPath().getInt("data.visitCount");
compare = monthVisitCount >= 1;
Assert.assertTrue(compare, network.message(param, BasicConfig.CLUESTATISTICS, "获取客户最近30天访问线索统计失败,客户访问次数小于1", response.body().asString()));
}
// 客户详情页_获取客户访问详情列表
@Test(description = "获取最近客户访问详情列表", priority = 7)
public void 获取最近客户访问详情列表() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("custUserId", custUserId);
param.put("filterType", 1);
param.put("timeType", 2);
param.put("timeOrderType", 2);
response = network.getResponse(param, BasicConfig.CUSTVISITLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTVISITLIST, "接口请求失败", response.body().asString()));
List<Object> list = response.jsonPath().getJsonObject("data.list");
int recordCount = list.size();
Assert.assertEquals(recordCount, monthVisitCount, network.message(param, BasicConfig.CUSTVISITLIST, "客户最近访问记录数不正确", response.body().asString()));
}
// 客户详情页_素材访问记录
@Test(description = "客户素材访问记录", priority = 8)
public void 客户素材访问记录() throws IOException{
param = new HashMap<>();
param.put("custUserId", custUserId);
param.put("pageIndex", 1);
param.put("pageSize", 30);
response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD);
Assert.assertTrue(response.jsonPath().getBoolean("success"));
int visitNum = response.jsonPath().getInt("data.visitNum");
List<Object> recordList = response.jsonPath().getJsonObject("data.list");
Assert.assertEquals(visitNum, recordList.size(), network.message(param, BasicConfig.CONTENTVISITRECORD, "访问次数与素材访问记录数不一致", response.body().asString()));
}
}
......@@ -32,11 +32,21 @@
<class name="com.kjj.cases.assistant.DailyPaper"/>
</classes>
</test>
<test preserve-order="true" name = "谁看过我_团队看板">
<test preserve-order="true" name = "获取访客">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
</classes>
</test>
<test preserve-order="true" name = "谁看过我">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.WhoSawMe"/>
</classes>
</test>
<test preserve-order="true" name = "我的转发">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.MyForward"/>
</classes>
</test>
<test preserve-order="true" name = "贺卡">
<classes>
<class name="com.kjj.cases.assistant.markettools.greetingCrad"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment