Commit a6e8c677 authored by 龚小红's avatar 龚小红

线索重构,删除客户列表和部分接口,替换部分接口

parent 864cd769
package com.kjj.cases.assistant.homePage;
import static com.kjj.cases.assistant.whoSawMe.ForwardAndRead.decodeTku;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.BaseUtils.tku1;
......@@ -9,15 +10,16 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.bean.marketTools.Activity;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import java.io.IOException;
import java.util.*;
public class HomePage implements Authorization {
......@@ -35,7 +37,7 @@ public class HomePage implements Authorization {
public long activity1; //胃部测评的互动id
public long activity2; //摆摊测试的互动id
public String scid; //获取文章对应的scid
public int sid; //代理人的sid
public long sellerId; //代理人的sid
public long userId; //代理人的userId
public String visitId; //用户的visitId
public String activityScid; //测评对应的scid
......@@ -48,11 +50,13 @@ public class HomePage implements Authorization {
public long listSimpleId; //赠险列表id
public String companyContentId; //公司专区文章Id
public String companyScId; //公司专区scid
private long forwardTime; //转发时间
private String clueId; //线索ID
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
agentTku();
userId = ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
userId = decodeTku(AGENT_TKU).get("userId");
}
//获取种草素材列表页
......@@ -595,12 +599,112 @@ public class HomePage implements Authorization {
Map<String,Object> params = new HashMap<>();
params.put("scid",companyScId);
Response interactRes = network.getResponse(params,HOME_companyInsurance);
Object data = interactRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,HOME_companyInsurance,"获取赠险列表失败",interactRes.body().asString()));
String id = interactRes.jsonPath().getJsonObject("data.get(0).id");
Assert.assertEquals(id, IdMakeUtil.encodingId(insuranceId),network.message(params,HOME_companyInsurance,"赠险id错误",interactRes.body().asString()));
}
@Test(description = "转发公司专区的文章",priority = 33)
public void 转发公司专区的文章(){
// 转发文章前记录一个时间
forwardTime = new Date().getTime();
Map<String,Object> params = new HashMap<>();
params.put("scId", companyScId);
params.put("forwardType", 1);
Response response = network.getResponse(params, BasicConfig.FORWARD);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.FORWARD, "接口请求失败", response.body().asString()));
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
}
// 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 34)
public void 访客阅读文章() throws IOException {
sleep(1000);
sellerId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
userTku1();
Map<String,Object> params = new HashMap<>();
params.put("scid", companyScId);
params.put("fromUserId", sellerId);
params.put("visitPath", 0);
Response response = network.postResponse(params, BasicConfig.CONTENT_visit);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
params.clear();
params.put("scid",companyScId);
params.put("forwardTime",forwardTime);
response = network.postResponse(params, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,DYNAMIC_addVisit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString()));
}
@Test(description = "访客领取赠险", priority = 35)
public void 访客领取赠险() {
//领取资料包
Map<String,Object> params = new HashMap<>();
params.put("scId", companyScId);
params.put("companyInsuranceId", IdMakeUtil.encodingId(insuranceId));
params.put("clueTypeName", "COMPANY_INSURANCE");
params.put("locationSource", 2);
params.put("sourceId", companyScId);
params.put("sourceType", 1);
Response response = network.postResponse(params, SELLERCARD_SENDPUSHFORSCAN);
boolean success = response.jsonPath().getBoolean("success");
String result = response.jsonPath().getString("data.");
Assert.assertTrue(success, network.message(params, SELLERCARD_SENDPUSHFORSCAN, "接口返回失败", response.body().asString()));
Assert.assertEquals(result, "success", network.message(params, SELLERCARD_SENDPUSHFORSCAN, "领资料包失败", response.body().asString()));
}
// 查看谁看过我首页我的跟进机会列表
@Test(description = "代理人查看最新的跟进机会列表", priority = 36)
public void 代理人查看最新的跟进机会列表() throws IOException {
agentTku();
sleep(1000);
Map<String, Object> params = new HashMap<>();;
params.put("pageSize", 20);
Response response = network.getResponse(params, BasicConfig.WHOSAWME_clueList);
int clueBizType = response.jsonPath().getInt("data.list[0].clueInfoList[0].clueBizType");
Assert.assertEquals(clueBizType,5, network.message(params, BasicConfig.WHOSAWME_clueList, "接口请求失败", response.body().asString()));
clueId = response.jsonPath().getString("data.list[0].clueInfoList[0].clueId");
}
// 销售线索_线索详情
@Test(description = "查看赠险_线索详情", priority = 37)
public void 查看赠险_线索详情() throws IOException{
Map<String, Object> params = new HashMap<>();
params.put("clueId", clueId);
Response response = network.getResponse(params, BasicConfig.CLUEINFO);
int clueBizType = response.jsonPath().getInt("data.clueBizType");
String insuranceName = response.jsonPath().getString("data.insuranceName");
int insuranceAmount = response.jsonPath().getInt("data.insuranceAmount");
Assert.assertEquals(insuranceName,"人身意外保障险", network.message(params, BasicConfig.WHOSAWME_clueList, "线索类型错误", response.body().asString()));
Assert.assertEquals(insuranceAmount,100, network.message(params, BasicConfig.WHOSAWME_clueList, "线索类型错误", response.body().asString()));
Assert.assertEquals(clueBizType,5, network.message(params, BasicConfig.WHOSAWME_clueList, "线索类型错误", response.body().asString()));
}
// 销售线索_跟进建议
@Test(description = "查看赠险_跟进建议", priority = 38)
public void 查看赠险_跟进建议() throws IOException{
Map<String, Object> params = new HashMap<>();
params = new HashMap<>();
params.put("clueId", clueId);
Response response = network.getResponse(params, BasicConfig.CLUEADVISE);
int userType1 = response.jsonPath().getJsonObject("data.adviceList.get(0).userType");
String advise1 = response.jsonPath().getJsonObject("data.adviceList.get(0).adviceContent");
int userType2 = response.jsonPath().getJsonObject("data.adviceList.get(1).userType");
String advise2 = response.jsonPath().getJsonObject("data.adviceList.get(1).adviceContent");
Assert.assertEquals(userType1,2, network.message(params, BasicConfig.CLUEADVISE, "跟进建议内容为空", response.body().asString()));
Assert.assertEquals(advise1,"测试用户使用话术", network.message(params, BasicConfig.CLUEADVISE, "跟进建议内容为空", response.body().asString()));
Assert.assertEquals(userType2,1, network.message(params, BasicConfig.CLUEADVISE, "跟进建议内容为空", response.body().asString()));
Assert.assertEquals(advise2,"测试代理人使用话术", network.message(params, BasicConfig.CLUEADVISE, "跟进建议内容为空", response.body().asString()));
}
@Test(description = "管理后台删除用户话术",priority = 33)
@Test(description = "管理后台删除用户话术",priority = 39)
public void 管理后台删除话术(){
Map<String,Object> params = new HashMap<>();
params.put("id",adviceId1);
......@@ -609,7 +713,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(data,network.message(params,MANAGER_adviceWordDelWord,"删除用户话术失败",response.body().asString()));
}
@Test(description = "管理后台删除代理人话术",priority = 34)
@Test(description = "管理后台删除代理人话术",priority = 40)
public void 管理后台删除代理人话术(){
Map<String,Object> params = new HashMap<>();
params.put("id",adviceId2);
......@@ -617,7 +721,7 @@ public class HomePage implements Authorization {
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,MANAGER_adviceWordDelWord,"删除代理人话术失败",response.body().asString()));
}
@Test(description = "管理后台_关闭赠险",priority = 35)
@Test(description = "管理后台_关闭赠险",priority = 41)
public void 管理后台_关闭赠险(){
Map<String,Object> params = new HashMap<>();
params.put("id",insuranceId);
......@@ -629,7 +733,7 @@ public class HomePage implements Authorization {
}
//管理后台删除文章
@Test(description = "管理后台_删除公司专区内容",priority = 36)
@Test(description = "管理后台_删除公司专区内容",priority = 42)
public void 管理后台_删除公司专区内容(){
ThreadSleepUtils.sleep(2000);
//获取删除的内容的id
......@@ -669,7 +773,7 @@ public class HomePage implements Authorization {
}
//管理后台删除视频
@Test(description = "管理后台_删除公司专区视频",priority = 37)
@Test(description = "管理后台_删除公司专区视频",priority = 43)
public void 管理后台_删除公司专区视频(){
//获取删除的视频的id
Map<String,Object> params = new HashMap<>();
......@@ -707,7 +811,7 @@ public class HomePage implements Authorization {
}
//管理后台新增成功案例
@Test(description = "管理后台_新增成功案例",priority = 38)
@Test(description = "管理后台_新增成功案例",priority = 44)
public void 新增成功案例(){
//根据内容ID匹配内容标题
......@@ -735,7 +839,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(addSuccess, network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_获取成功案例列表",priority = 39)
@Test(description = "管理后台_获取成功案例列表",priority = 45)
public void 获取成功案例列表(){
Response response = network.getResponse(MANAGER_caseList);
Object list = response.jsonPath().getJsonObject("data.list");
......@@ -743,7 +847,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(list,network.message(MANAGER_caseList,"获取成功案例列表失败",response.body().asString()));
}
@Test(description = "管理后台_获取案例详情",priority = 40)
@Test(description = "管理后台_获取案例详情",priority = 46)
public void 获取案例详情(){
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
......@@ -752,7 +856,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(data,network.message(params,MANAGER_successCaseDetail,"获取案例详情失败",response.body().asString()));
}
@Test(description = "管理后台_编辑案例",priority = 41)
@Test(description = "管理后台_编辑案例",priority = 47)
public void 编辑案例(){
//编辑成功案例
Map<String,Object> params = new HashMap<>();
......@@ -771,7 +875,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(addSuccess, network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_上架/下架成功案例",priority = 42)
@Test(description = "管理后台_上架/下架成功案例",priority = 48)
public void 上架成功案例(){
//上架成功案例 status = 2
Map<String,Object> params = new HashMap<>();
......@@ -795,7 +899,7 @@ public class HomePage implements Authorization {
}
//个人中心—我的反馈
@Test(description = "个人中心_我的反馈",priority = 43)
@Test(description = "个人中心_我的反馈",priority = 49)
public void 我的反馈(){
//tku 切换为访客的
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
......@@ -811,7 +915,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(success,network.message(params,HOME_feedBackSave,"反馈意见提交成功",response.body().asString()));
}
//管理后台-集客助手反馈
@Test(description = "管理后台_集客助手反馈",priority = 44)
@Test(description = "管理后台_集客助手反馈",priority = 50)
public void 集客助手反馈结果(){
//验证管理后台是否接收到消息
Response manageRes = network.getResponse(MANAGER_feedBackList);
......@@ -822,7 +926,7 @@ public class HomePage implements Authorization {
//***********************文章配置素材*******************************
@Test(description = "代理人_访问文章未配置互动素材", priority = 45)
@Test(description = "代理人_访问文章未配置互动素材", priority = 51)
public void 代理人_访问文章未配置互动素材() {
agentTku();
Map<String, Object> params = new HashMap<String, Object>();
......@@ -857,7 +961,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(scid, network.message(params, GETSCID, "获取文章的scid失败", response.body().asString()));
}
@Test(description = "管理后台_新增互动方案", priority = 46)
@Test(description = "管理后台_新增互动方案", priority = 52)
public void 管理后台_新增互动方案() {
ssoLogin();
Map<String, Object> params = new HashMap<String, Object>();
......@@ -916,7 +1020,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(activity2, network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_修改互动方案", priority = 47)
@Test(description = "管理后台_修改互动方案", priority = 53)
public void 管理后台_修改互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
......@@ -943,7 +1047,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(activityName, "快来摆摊测试吧",network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_通过方案id查找方案是否存在", priority = 48)
@Test(description = "管理后台_通过方案id查找方案是否存在", priority = 54)
public void 管理后台_通过方案id查找方案是否存在() {
Map<String, Object> params = new HashMap<String, Object>();
//存在
......@@ -963,7 +1067,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(data,null, network.message(params, MANAGER_activityName, "此方案存在", response.body().asString()));
}
@Test(description = "管理后台_新增文章关联互动方案", priority = 49)
@Test(description = "管理后台_新增文章关联互动方案", priority = 55)
public void 管理后台_新增文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
......@@ -995,7 +1099,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(aolutionId, activity2,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_互动方案使用中会删除失败", priority = 50)
@Test(description = "管理后台_互动方案使用中会删除失败", priority = 56)
public void 管理后台_互动方案使用中会删除失败() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
......@@ -1016,7 +1120,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(data, network.message(params, MANAGER_solutionPageList, "有文章使用互动方案删除成功", response.body().asString()));
}
@Test(description = "代理人_访问文章新增配置互动素材", priority = 51)
@Test(description = "代理人_访问文章新增配置互动素材", priority = 57)
public void 代理人_访问文章新增配置互动素材() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -1034,7 +1138,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(activityId,answer2, network.message(params, ARTICLE_interact, "访问文章配置素材ID与实际配置不一致", response.body().asString()));
}
@Test(description = "管理后台_修改文章关联互动方案", priority = 52)
@Test(description = "管理后台_修改文章关联互动方案", priority = 58)
public void 管理后台_修改文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
......@@ -1063,7 +1167,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(aolutionId, activity1,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "代理人_访问文章修改配置互动素材并转发", priority = 53)
@Test(description = "代理人_访问文章修改配置互动素材并转发", priority = 59)
public void 代理人_访问文章修改配置互动素材并转发() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -1088,11 +1192,11 @@ public class HomePage implements Authorization {
params.clear();
response = network.getResponse(USER_INFO);
sid = response.jsonPath().getInt("data.sellerId");
sellerId = response.jsonPath().getInt("data.sellerId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
}
@Test(description = "访客_访问文章并参与测评", priority = 54)
@Test(description = "访客_访问文章并参与测评", priority = 60)
public void 访客_访问文章并参与测评() {
//切换为新用户小葡萄,每次都会产生线索
network.agentCookies.put(TKU_COOKIE_NAME, tku1);
......@@ -1114,11 +1218,10 @@ public class HomePage implements Authorization {
//打开测评
params.clear();
params.put("contentId",encodingId(answer1));
params.put("sid",encodingId((long)sid));
params.put("sid",encodingId((long) sellerId));
response = network.getResponse(params, GETSCID);
activityScid = response.jsonPath().getString("data");
System.out.println(activityScid);
Assert.assertNotNull(scid,network.message(params, GETSCID,"获取scid失败",response.body().asString()));
Assert.assertNotNull(activityScid,network.message(params, GETSCID,"获取scid失败",response.body().asString()));
params.clear();
params.put("scid", activityScid);
......@@ -1157,7 +1260,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(result, network.message(params, GAME_sendInfoForRisk, "申请领取食谱失败", response.body().asString()));
}
@Test(description = "管理后台_删除文章关联互动方案", priority = 55)
@Test(description = "管理后台_删除文章关联互动方案", priority = 61)
public void 管理后台_删除文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("articleId", articleId);
......@@ -1181,7 +1284,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(size, 0, network.message(params, MANAGER_articlePageList, "删除失败", response.body().asString()));
}
@Test(description = "代理人_访问文章删除配置互动素材", priority = 56)
@Test(description = "代理人_访问文章删除配置互动素材", priority = 62)
public void 代理人_访问文章删除配置互动素材() {
agentTku();
sleep(10000);
......@@ -1194,7 +1297,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(size, 0, network.message(params, ARTICLE_interact, "返回数据不为空", response.body().asString()));
}
@Test(description = "管理后台_删除互动方案成功", priority = 57)
@Test(description = "管理后台_删除互动方案成功", priority = 63)
public void 管理后台_删除互动方案成功() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity1);
......
......@@ -30,7 +30,7 @@ public class NoviceGuidance implements Authorization {
private long dataID; //资料包的contentID
private long dataContentID; //资料包的ID
private long articleDataID; //文章插入资料包后的包id
private long clueId; //线索ID
private String clueId; //线索ID
private long qaID; //互助问答ID
private String questionId; //互助问答加密后的ID
private static final NetworkUtils network = NetworkUtils.getInstance();
......@@ -366,7 +366,7 @@ public class NoviceGuidance implements Authorization {
boolean success = response.jsonPath().getBoolean("success");
String result = response.jsonPath().getString("data.");
Assert.assertTrue(success, network.message(params, SELLERCARD_SENDPUSHFORSCAN, "接口返回失败", response.body().asString()));
Assert.assertEquals(result, "success", network.message(params, SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
Assert.assertEquals(result, "success", network.message(params, SELLERCARD_SENDPUSHFORSCAN, "领资料包失败", response.body().asString()));
}
// 查看谁看过我首页我的跟进机会列表
......@@ -376,17 +376,12 @@ public class NoviceGuidance implements Authorization {
sleep(2000);
Map<String, Object> params = new HashMap<>();
List<Object> customerTagIds = Lists.newArrayList();
params.put("customerTagIds", customerTagIds);
params.put("lastClueId", 0);
params.put("listType", 4);
params.put("pageSize", 20);
params.put("grassContentListType", 5);
Response response = network.postResponse(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Response response = network.getResponse(params, BasicConfig.WHOSAWME_clueList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_clueList, "接口请求失败", response.body().asString()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
clueId = response.jsonPath().getString("data.list[0].clueInfoList[0].clueId");
}
@Test(description = "代理人点击谁看过我显示备注引导", priority = 26)
......@@ -495,17 +490,12 @@ public class NoviceGuidance implements Authorization {
sleep(2000);
Map<String, Object> params = new HashMap<>();
List<Object> customerTagIds = Lists.newArrayList();
params.put("customerTagIds", customerTagIds);
params.put("lastClueId", 0);
params.put("listType", 4);
params.put("pageSize", 20);
params.put("grassContentListType", 5);
Response response = network.postResponse(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Response response = network.getResponse(params, BasicConfig.WHOSAWME_clueList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_clueList, "接口请求失败", response.body().asString()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
clueId = response.jsonPath().getString("data.list[0].clueInfoList[0].clueId");
}
// 销售线索_线索详情
@Test(description = "查看_线索详情", priority = 31)
......@@ -513,12 +503,14 @@ public class NoviceGuidance implements Authorization {
Map<String, Object> params = new HashMap<>();
params.put("clueId", clueId);
Response response = network.getResponse(params, BasicConfig.CLUEINFO);
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(0).subtitle"),"直接访问", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(0).title"),"《一线城市打拼,二线城市买房,80%以上年轻人都在做的这事靠谱吗?》", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(1).subtitle"),"查看问答", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(1).title"),"[自动化专用互助问答]", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(2).subtitle"),"领取资料", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(2).title"), "《自动化专用资料包》", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.clueBizType");
Assert.assertEquals(clueBizType,3, network.message(params, BasicConfig.WHOSAWME_clueList, "线索类型错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(0).subTitle"),"直接访问", network.message(params, BasicConfig.CLUEINFO, "文章访问类型错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(0).title"),"《一线城市打拼,二线城市买房,80%以上年轻人都在做的这事靠谱吗?》", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(1).subTitle"),"查看问答", network.message(params, BasicConfig.CLUEINFO, "问答线索描述错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(1).title"),"[自动化专用互助问答]", network.message(params, BasicConfig.CLUEINFO, "问答标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(2).subTitle"),"领取资料", network.message(params, BasicConfig.CLUEINFO, "资料包描述线索错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.faqCluePathDetails.get(2).title"), "《自动化专用资料包》", network.message(params, BasicConfig.CLUEINFO, "资料包标题错误", response.body().asString()));
}
// 销售线索_跟进建议
......@@ -560,18 +552,13 @@ public class NoviceGuidance implements Authorization {
newUser1();
sleep(2000);
Map<String, Object> params = new HashMap<>();
List<Object> customerTagIds = Lists.newArrayList();
params.put("customerTagIds", customerTagIds);
params.put("lastClueId", 0);
params.put("listType", 4);
Map<String, Object> params = new HashMap<>();;
params.put("pageSize", 20);
params.put("grassContentListType", 5);
Response response = network.postResponse(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Response response = network.getResponse(params, BasicConfig.WHOSAWME_clueList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
Assert.assertTrue(size>0, network.message(params, BasicConfig.WHOSAWME_clueList, "接口请求失败", response.body().asString()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
clueId = response.jsonPath().getString("data.list[0].clueInfoList[0].clueId");
}
// 销售线索_线索详情
@Test(description = "查看关联提问_线索详情", priority = 35)
......@@ -579,8 +566,10 @@ public class NoviceGuidance implements Authorization {
Map<String, Object> params = new HashMap<>();
params.put("clueId", clueId);
Response response = network.getResponse(params, BasicConfig.CLUEINFO);
Assert.assertEquals(response.jsonPath().getString("data.questionAnswerVo.extraQuestion"),"自动化关联问题", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.clueSummary"),"发起提问", network.message(params, BasicConfig.CLUEINFO, "文章标题错误", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.clueBizType");
Assert.assertEquals(clueBizType,4, network.message(params, BasicConfig.WHOSAWME_clueList, "线索类型错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.question"),"自动化专用互助问答", network.message(params, BasicConfig.CLUEINFO, "问题题目错误", response.body().asString()));
Assert.assertEquals(response.jsonPath().getString("data.extraQuestion"),"自动化关联问题", network.message(params, BasicConfig.CLUEINFO, "问题题目错误", response.body().asString()));
}
......
......@@ -65,14 +65,14 @@ public class Cashback implements Authorization {
public void 默认付费_一级用户邀请付费页() {
//代理人续费状态
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
Response response = network.getResponse(PAY_info);
int discountType = response.jsonPath().getInt("data.discountType");
String superiorName = response.jsonPath().getString("data.invitation.superiorName");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
Assert.assertEquals(superiorName,"吉吉",network.message(PAY_info,"上级不是吉吉",response.body().asString()));
Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
// payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
// Response response = network.getResponse(PAY_info);
// int discountType = response.jsonPath().getInt("data.discountType");
// String superiorName = response.jsonPath().getString("data.invitation.superiorName");
// int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
// Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
// Assert.assertEquals(superiorName,"吉吉",network.message(PAY_info,"上级不是吉吉",response.body().asString()));
// Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
}
@Test(description = "邀请的待支付好友列表",priority = 3)
......
......@@ -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.IdMakeUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
......@@ -14,6 +15,8 @@ import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.DYNAMIC_addVisit;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.BaseUtils.tku1;
import static com.kjj.utils.IdMakeUtil.encodingId;
import static com.kjj.utils.ThreadSleepUtils.sleep;
......@@ -41,15 +44,19 @@ public class ForwardAndRead implements Authorization {
@Test(description = "获取二度访客起始线索数据", priority = 1)
public void 获取二度访客起始线索数据(){
long userId = decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
param = new HashMap<>();
custClueStatistics = new HashMap<>();
param.put("userId", userId);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
int drawMaterial = response.jsonPath().getInt("data.drawMaterial");
int grassCount = response.jsonPath().getInt("data.grassCount");
param.put("custUserId", userId);
param.put("type", 2);
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
int visitCount = response.jsonPath().getInt("data.visitCount");
custClueStatistics.put("drawMaterial", drawMaterial);
custClueStatistics.put("grassCount", grassCount);
int grassNum = response.jsonPath().getInt("data.grassNum");
int datagramNum = response.jsonPath().getInt("data.datagramNum");
custClueStatistics = new HashMap<>();
custClueStatistics.put("datagramNum", datagramNum);
custClueStatistics.put("grassNum", grassNum);
custClueStatistics.put("visitCount", visitCount);
}
......@@ -103,7 +110,7 @@ public class ForwardAndRead implements Authorization {
param.clear();
param.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
param.put("forwardTime",forwardTime);
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
......@@ -134,7 +141,7 @@ public class ForwardAndRead implements Authorization {
param.clear();
param.put("scid", articleScId);
param.put("fromUserId", fromUserId);
param.put("traceId", traceId);
param.put("traceId", null);
param.put("visitPath", 0);
response = network.postResponse(param, BasicConfig.CONTENT_visit);
System.out.println(response.body().asString());
......@@ -142,7 +149,7 @@ public class ForwardAndRead implements Authorization {
param.clear();
param.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
param.put("forwardTime",forwardTime);
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
......@@ -158,7 +165,7 @@ public class ForwardAndRead implements Authorization {
param = new HashMap<>();
param.put("scid", articleScId);
param.put("fromUserId", fromUserId);
param.put("traceId", traceId);
param.put("traceId", null);
param.put("visitPath", 0);
response = network.postResponse(param, BasicConfig.CONTENT_visit);
jjvisitId = response.jsonPath().getString("data.userVisitId");
......@@ -169,7 +176,7 @@ public class ForwardAndRead implements Authorization {
public void 添加访问记录() throws IOException{
param.clear();
param.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
param.put("forwardTime",forwardTime);
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
......@@ -223,11 +230,77 @@ public class ForwardAndRead implements Authorization {
param.put("scId", articleScId);
param.put("sourceId", articleScId);
param.put("sourceType", 1);
param.put("delayFlag", false);
response = network.postResponse(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN);
String data = response.jsonPath().getString("data");
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取资料失败", response.body().asString()));
}
@Test(description = "访客_访问文章并参与测评", priority = 60)
public void 访客_访问文章并参与测评() {
//打开测评
param.clear();
param.put("contentId",encodingId(4700L));
param.put("sid",encodingId((long) sellerId));
response = network.getResponse(param, GETSCID);
String activityScid = response.jsonPath().getString("data");
Assert.assertNotNull(activityScid,network.message(param, GETSCID,"获取scid失败",response.body().asString()));
param.clear();
param.put("scid", activityScid);
param.put("fromUserId", fromUserId); //代理人的用户id
param.put("sourceScid", articleScId); //文章对应的Scid
param.put("visitPath", 1);
response = network.postResponse(param, CONTENT_visit);
String visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId, network.message(param, CONTENT_visit, "访客记录查看素材失败", response.body().asString()));
//发送测试结果-多次提交接口返回失败
param.clear();
param.put("scid", activityScid);
param.put("completed",1);
param.put("sourceScId",articleScId);
param.put("visitExtra", "{\"食物\":\"爱吃垃圾食品\",\"喝酒\":\"爱喝酒\",\"睡觉\":\"习惯早睡\",\"早餐\":\"按时吃早饭\",\"心情\":\"心情烦闷\"}");
response = network. postResponse(param,GAME_sendInfo);
//申请领取报告
param.clear();
param.put("scid", activityScid);
param.put("completed",1);
param.put("sourceScId",articleScId);
param.put("originScId",articleScId);
param.put("riskTestOperateType",2);
param.put("sourceType","1");
param.put("visitId",visitId);
response = network. postResponse(param,GAME_sendInfoForRisk);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(param, GAME_sendInfoForRisk, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(param, GAME_sendInfoForRisk, "申请领取食谱失败", response.body().asString()));
}
@Test(description = "访客领取赠险", priority = 35)
public void 访客领取赠险() {
//领取资料包
Map<String,Object> param = new HashMap<>();
param.put("scId", articleScId);
param.put("companyInsuranceId", IdMakeUtil.encodingId(17L));
param.put("clueTypeName", "COMPANY_INSURANCE");
param.put("locationSource", 2);
param.put("sourceId", articleScId);
param.put("sourceType", 1);
param.put("delayFlag", false);
Response response = network.postResponse(param, SELLERCARD_SENDPUSHFORSCAN);
boolean success = response.jsonPath().getBoolean("success");
String result = response.jsonPath().getString("data.");
Assert.assertTrue(success, network.message(param, SELLERCARD_SENDPUSHFORSCAN, "接口返回失败", response.body().asString()));
Assert.assertEquals(result, "success", network.message(param, SELLERCARD_SENDPUSHFORSCAN, "领资料包失败", response.body().asString()));
}
// 通过素材contentId获取线索员文章scId
public static String getContentScId(String contentId){
param = new HashMap<>();
......
......@@ -164,46 +164,18 @@ public class MyCustomer implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "取消特别关注失败", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_七日活跃", priority = 12)
public void 客户列表_七日活跃() throws IOException{
//客户详情页_头部信息栏
@Test(description = "客户详情页_头部信息栏", priority = 16)
public void 客户详情页_头部信息栏() throws IOException{
param = new HashMap<>();
param.put("activeType", 1);
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertTrue(lists.size() >= 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "七日活跃客户数为0", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_直接转发", priority = 13)
public void 客户列表_直接转发() throws IOException{
param = new HashMap<>();
param.put("custOrigin", 1);
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertTrue(lists.size() >= 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "直接转发客户数为0", response.body().asString()));
param.put("custUserId", newUserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFOHEADER, "接口请求失败", response.body().asString()));
List<Object> custOrigins = response.jsonPath().getList("data.custOrigins");
Assert.assertEquals(custOrigins.size(), 3, network.message(param, BasicConfig.CUSTINFOHEADER, "二度客户来源链路长度不为3", response.body().asString()));
int cameFrom = response.jsonPath().getInt("data.cameFrom");
Assert.assertEquals(cameFrom, 2, network.message(param, BasicConfig.CUSTINFOHEADER, "访客来源不为二度访客", response.body().asString()));
}
// //客户详情页_头部信息栏
// @Test(description = "客户详情页_头部信息栏", priority = 16)
// public void 客户详情页_头部信息栏() throws IOException{
// param = new HashMap<>();
// param.put("custUserId", newUserId);
// response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFOHEADER, "接口请求失败", response.body().asString()));
// List<Object> custOrigins = response.jsonPath().getList("data.custOrigins");
// Assert.assertEquals(custOrigins.size(), 3, network.message(param, BasicConfig.CUSTINFOHEADER, "二度客户来源链路长度不为3", response.body().asString()));
// int cameFrom = response.jsonPath().getInt("data.cameFrom");
// Assert.assertEquals(cameFrom, 2, network.message(param, BasicConfig.CUSTINFOHEADER, "访客来源不为二度访客", response.body().asString()));
// }
// 客户详情页_客户信息
@Test(description = "客户详情页_客户信息", priority = 17)
......@@ -238,44 +210,55 @@ public class MyCustomer implements Authorization {
String remarkName = response.jsonPath().getString("data.remarkName");
Assert.assertEquals(remarkName, "备注名", network.message(param, BasicConfig.CUSTINFOHEADER, "用户备注名与预期不符", response.body().asString()));
}
//
// // 客户详情页_意向详情
// @Test(description = "客户详情页_意向详情", priority = 19)
// public void 客户详情页_意向详情() throws IOException{
// param = new HashMap<>();
// param.put("userId", visitor1UserId);
// response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUESTATISTICS, "接口请求失败", response.body().asString()));
// ClueStatistics clueStatistics = JsonUtil.parseResponseToBean(response, ClueStatistics.class);
// int grassCount = clueStatistics.getGrassCount();
// int visitCount = clueStatistics.getVisitCount();
// int drawMaterial = clueStatistics.getDrawMaterial();
// int faqCount = clueStatistics.getFaqCount();
// int riskTestCount = clueStatistics.getRiskTestCount();
// int drawPresentInsuranceCount = clueStatistics.getDrawPresentInsuranceCount();
// Assert.assertEquals(grassCount, ForwardAndRead.custClueStatistics.get("grassCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数未正确增加", response.body().asString()));
// Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString()));
// Assert.assertEquals(drawMaterial, ForwardAndRead.custClueStatistics.get("drawMaterial") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString()));
// Assert.assertEquals(faqCount, ForwardAndRead.custClueStatistics.get("faqCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数未正确增加", response.body().asString()));
// Assert.assertEquals(riskTestCount, ForwardAndRead.custClueStatistics.get("riskTestCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString()));
// Assert.assertEquals(drawPresentInsuranceCount, ForwardAndRead.custClueStatistics.get("drawPresentInsuranceCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString()));
// 客户详情页_意向详情
@Test(description = "客户详情页_意向详情", priority = 19)
public void 客户详情页_意向详情() throws IOException{
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUESTATISTICS, "接口请求失败", response.body().asString()));
ClueStatistics clueStatistics = JsonUtil.parseResponseToBean(response, ClueStatistics.class);
int grassCount = clueStatistics.getGrassCount();
int visitCount = clueStatistics.getVisitCount();
int drawMaterial = clueStatistics.getDrawMaterial();
Assert.assertEquals(grassCount, ForwardAndRead.custClueStatistics.get("grassCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数未正确增加", response.body().asString()));
Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString()));
Assert.assertEquals(drawMaterial, ForwardAndRead.custClueStatistics.get("drawMaterial") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString()));
}
// }
// 客户详情页_线索统计
@Test(description = "客户详情页_线索统计", priority = 21)
public void 客户详情页_线索统计() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("type", 2);
param.put("type", 2); //1-全部,2-30天
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
int visitCountHere = response.jsonPath().getInt("data.visitCount");
Assert.assertEquals(visitCountHere, ForwardAndRead.custClueStatistics.get("visitCount") + 1, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString()));
int visitCount = response.jsonPath().getInt("data.visitCount");
int grassNum = response.jsonPath().getInt("data.grassNum");
int datagramNum = response.jsonPath().getInt("data.datagramNum");
Assert.assertEquals(grassNum, ForwardAndRead.custClueStatistics.get("grassNum") + 2, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数未正确增加", response.body().asString()));
Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount") + 1, 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)
// public void 客户详情页_阅读偏好() throws IOException{
// param = new HashMap<>();
// param.put("custUserId", visitor1UserId);
// response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE);
// List<Object> readPerferences = response.jsonPath().getList("data");
// Assert.assertTrue(readPerferences.size() > 0, network.message(param, BasicConfig.CUSTREADPERFERENCE, "客户无阅读偏好", response.body().asString()));
// }
//客户详情页_阅读偏好------访问重构未更新
@Test(description = "客户详情页_阅读偏好", priority = 22)
public void 客户详情页_阅读偏好() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTREADPERFERENCE);
List<Object> readPerferences = response.jsonPath().getList("data");
Assert.assertTrue(readPerferences.size() > 0, network.message(param, BasicConfig.CUSTREADPERFERENCE, "客户无阅读偏好", response.body().asString()));
}
// 客户详情页_来访记录
@Test(description = "客户详情页_来访记录", priority = 23)
......@@ -284,20 +267,18 @@ public class MyCustomer implements Authorization {
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("custUserId", visitor1UserId);
param.put("custUserId", 373);
param.put("filterType", 1);
param.put("timeType", 2);
param.put("timeOrderType", 1);
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<VisitRecords> visitRecords = JsonUtil.parseResponseToPageBean(response, VisitRecords.class);
System.out.println();
VisitRecords.recordsList recordsOfContent = visitRecords.get(0).getRecords().get(0);
VisitRecords.recordsList recordsOfClue = visitRecords.get(0).getRecords().get(1);
VisitRecords.recordsList recordsOfContent = visitRecords.get(1).getRecords().get(0);
VisitRecords.recordsList recordsOfClue = visitRecords.get(1).getRecords().get(1);
String contentId = recordsOfContent.getContentId();
int clueType = recordsOfClue.getClueType();
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param ,BasicConfig.CUSTVISITLIST, "访问记录详情有误", response.body().asString()));
Assert.assertEquals(clueType, 29, network.message(param, BasicConfig.CUSTVISITLIST, "访问记录详情有误", response.body().asString()));
Assert.assertEquals(clueType, 3, network.message(param, BasicConfig.CUSTVISITLIST, "访问记录详情有误", response.body().asString()));
}
// 客户线索跟进
......@@ -339,7 +320,7 @@ public class MyCustomer implements Authorization {
response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD);
String contentId;
try {
contentId = response.jsonPath().getString("data.custVisitList.list[0].contentId");
contentId = response.jsonPath().getString("data.custVisitList.list[1].contentId");
}catch (NullPointerException e){
System.out.println(response.body().asString());
e.printStackTrace();
......
......@@ -25,7 +25,7 @@ public class WhoSawMe implements Authorization {
private Map<String, Object> param;
private Long xxxSellerId;
private Long childSellerId;
private Long clueId;
private String clueId;
private long xxrUserId;
private Long jjSellerId;
private String tagId0;
......@@ -39,6 +39,7 @@ public class WhoSawMe implements Authorization {
@BeforeClass
public void setUp() throws IOException {
sleep(60000);
// 代理人授权
agent2Tku();
BaseUtils.ssoLogin();
......@@ -157,20 +158,13 @@ public class WhoSawMe implements Authorization {
public void 查看我的访客列表() throws IOException{
sleep(3000);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
long visitId = response.jsonPath().getLong("data.list[0].visitId");
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertEquals(visitId, xxrUserId, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "新老客户身份判断错误", response.body().asString()));
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
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");
Assert.assertEquals(visitId, IdMakeUtil.encodingId(xxrUserId), network.message(param, BasicConfig.WHOSAWME_visitList, "最近访客微信用户ID不匹配", response.body().asString()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
clueId = response.jsonPath().getString("data.list[1].clueInfoList[1].clueId");
}
// 将新用户标记为老用户(小葡萄)
......@@ -178,23 +172,19 @@ public class WhoSawMe implements Authorization {
public void 标记新用户为老用户() throws IOException{
// 检查新用户
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);
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
int size = response.jsonPath().getInt("data.list.size()");
for (int i = 0;i< size;i++){
String nickName = response.jsonPath().getString("data.list["+i+"].nickName");
if(nickName.equals("小葡萄")){
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId");
if(visitId.equals(IdMakeUtil.encodingId(userId))){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew");
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "新客户身份错误", response.body().asString()));
break;
}
}
long xptUserId = ForwardAndRead.decodeTku(BaseUtils.tku1).get("userId");
param.clear();
param.put("userId", ForwardAndRead.encodeId(xptUserId));
param.put("userId", ForwardAndRead.encodeId(userId));
response = network.getResponse(param, BasicConfig.UPDATENEWTOOLD);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATENEWTOOLD, "用户身份更新失败", response.body().asString()));
......@@ -206,12 +196,12 @@ public class WhoSawMe implements Authorization {
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
for (int i = 0;i< size;i++){
String nickName = response.jsonPath().getString("data.list["+i+"].nickName");
if(nickName.equals("小葡萄")){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].isNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
String visitId = response.jsonPath().getString("data.list["+i+"].customerInfo.customerUserId");
if(visitId.equals(IdMakeUtil.encodingId(userId))){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].customerInfo.isCustomerNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_visitList, "客户身份未更新为老客户", response.body().asString()));
break;
}
}
......@@ -803,20 +793,20 @@ public class WhoSawMe implements Authorization {
String firstRecordContentId = response.jsonPath().getString("data.list[0].contentId");
Assert.assertEquals(firstRecordContentId, BasicConfig.LOTTERY_CONTENTID, network.message(param, BasicConfig.MARKETINGTOOLLIST, "首条记录素材Id与预期不匹配", response.body().asString()));
}
// 查看获得线索记录列表
@Test(description = "查看获得线索记录列表", priority = 51)
public void 查看获得线索记录列表() throws IOException{
param = new HashMap<>();
param.put("sellerId", xxxSellerId);
param.put("pageSize", 20);
param.put("pageIndex", 1);
param.put("sortType", 4);
response = network.getResponse(param, BasicConfig.SALECLUELIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.SALECLUELIST, "接口请求失败", response.body().asString()));
int visitClueType = response.jsonPath().getInt("data.list[0].visitClueType");
Assert.assertEquals(visitClueType, 29, network.message(param, BasicConfig.SALECLUELIST, "线索类型不匹配", response.body().asString()));
}
//
// // 查看获得线索记录列表
// @Test(description = "查看获得线索记录列表", priority = 51)
// public void 查看获得线索记录列表() throws IOException{
// param = new HashMap<>();
// param.put("sellerId", xxxSellerId);
// param.put("pageSize", 20);
// param.put("pageIndex", 1);
// param.put("sortType", 4);
// response = network.getResponse(param, BasicConfig.SALECLUELIST);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.SALECLUELIST, "接口请求失败", response.body().asString()));
// int visitClueType = response.jsonPath().getInt("data.list[0].visitClueType");
// Assert.assertEquals(visitClueType, 29, network.message(param, BasicConfig.SALECLUELIST, "线索类型不匹配", response.body().asString()));
// }
// 查看转发动态访问列表
// @Test(description = "查看转发素材访问列表", priority = 52)
......@@ -856,11 +846,11 @@ public class WhoSawMe implements Authorization {
param.put("clueId", clueId);
response = network.getResponse(param, BasicConfig.CLUEINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUEINFO, "接口请求失败", response.body().asString()));
int visitClueType = response.jsonPath().getInt("data.visitClueType");
Long custUserId = response.jsonPath().getLong("data.custUserId");
String contentScid = response.jsonPath().getString("data.fromContent.scid");
Assert.assertEquals(visitClueType, 29, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(custUserId, ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId"), network.message(param, BasicConfig.CLUEINFO, "线索来源访客userId错误", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.clueBizType");
String customerUserId = response.jsonPath().getString("data.customerUserId");
String contentScid = response.jsonPath().getString("data.sourceContent.scid");
Assert.assertEquals(clueBizType, 3, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(customerUserId, IdMakeUtil.encodingId(xxrUserId), network.message(param, BasicConfig.CLUEINFO, "线索来源访客userId错误", response.body().asString()));
Assert.assertEquals(contentScid, ForwardAndRead.getContentScId(BasicConfig.ARTICLE_CONTENTID), network.message(param, BasicConfig.CLUEINFO, "线索来源素材id错误", response.body().asString()));
}
......@@ -910,17 +900,13 @@ public class WhoSawMe implements Authorization {
@Test(description = "销售线索_测评报告领取线索", priority = 58)
public void 销售线索_测评报告领取线索() throws IOException{
agentTku();
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
String clueSummary = response.jsonPath().getString("data.list.find{it.visitId == "+userId+"}.clueSummary");
Assert.assertEquals(clueSummary, "TA想要领取风险测评报告", network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
clueId = response.jsonPath().getLong("data.list.find{it.visitId == "+userId+"}.clueId");
response = network.getResponse(param, BasicConfig.WHOSAWME_clueList);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_clueList, "接口请求失败", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.list[1].clueInfoList[0].clueBizType");
Assert.assertEquals(clueBizType, 7, network.message(param, BasicConfig.WHOSAWME_clueList, "线索描述错误", response.body().asString()));
clueId = response.jsonPath().getString("data.list[1].clueInfoList[0].clueId");
}
// 销售线索_查看测评报告的领取详情
......@@ -930,11 +916,9 @@ public class WhoSawMe implements Authorization {
param.put("clueId", clueId);
response = network.getResponse(param, BasicConfig.CLUEINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUEINFO, "接口请求失败", response.body().asString()));
int visitClueType = response.jsonPath().getInt("data.visitClueType");
reportId = response.jsonPath().getString("data.contentId");
String clueSummary = response.jsonPath().getString("data.clueSummary");
Assert.assertEquals(visitClueType, 32, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(clueSummary, "领评测报告", network.message(param, BasicConfig.CLUEINFO, "线索来源类型错误", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.clueBizType");
Assert.assertEquals(clueBizType, 7, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
reportId = response.jsonPath().getString("data.testContentId");
}
// 代理人_转发评测报告
......
......@@ -767,7 +767,7 @@ public class BasicConfig {
public static final String MANAGER_updateTeam = MANAGER_HOST+ "/kjy/manager/live/ques/reward/updateTeamAssignmentType";
// *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc";
public static final String ARTICLE_CONTENTID = "Kj22MTk4NDg2Mw";
public static final String ANIMATION_CONTENTID = "Kj21MzgzMTk";
public static final String GAME_CONTENTID = "Kj21NjIxNTk";
public static final String UPLOAD_CONTENTID = "Kj21NjA1NTE";
......@@ -786,7 +786,7 @@ public class BasicConfig {
public static final String LAYER_RENEW = HOST + "/kjy/mp/layer/renew";
public static final String DISTRIBUTION_LAYER = HOST + "/kjy/sp/seller/distributionLayer";
public static final String ROOKIECLUEGUIDE = HOST + "/kjy/mp/rookieGuide/clueGuide";
public static final String VISITHEADER = HOST + "/kjy/mp/visit/header/v2";
public static final String VISITHEADER = HOST + "/kjj/visit/header";
public static final String SELLERWEEKLY = HOST + "/kjy/mp/whoSawMe/sellerWeekly";
public static final String WEEKLY_LIST = HOST + "/kjy/mp/seller/weekly/list";
public static final String NEWFUNC_FIRSTVISIT = HOST + "/kjy/mp/newFunction/sellerFirstVisit";
......@@ -883,7 +883,7 @@ public class BasicConfig {
// *************** 谁看过我 ***************
public static final String WHOSAWME_CUSTCLUELISTV3 = HOST + "/kjy/mp/whoSawMe/custClueList/v3";
public static final String WHOSAWME_visitList = HOST + "/kjj/visit/list";
public static final String FORWARDHEADER = HOST + "/kjy/mp/whoSawMe/forward/header";
public static final String FORWARD_LIST = HOST + "/kjy/mp/whoSawMe/forward/list/v2";
public static final String FORWARD_CONTENTHEADER = HOST + "/kjy/mp/whoSawMe/forward/contentHeader";
......@@ -891,10 +891,11 @@ public class BasicConfig {
public static final String SELLERUNREADMESSAGE = HOST + "/kjy/mp/custmarketing/sellerUnreadMsg";
public static final String CUSTOMERSEARCH = HOST + "/kjy/mp/whoSawMe/customerSearch";
public static final String DYNAMIC_ADDVISIT = HOST + "/kjy/mp/seller/dynamic/addVisit";
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 CLUEINFO = HOST + "/kjj/content/clue/detail";
public static final String CLUEADVISE = HOST + "/kjj/content/clue/advice";
public static final String FOLLOWADVICE = HOST + "/kjy/mp/whoSawMe/clue/followAdvice";
public static final String WHOSAWME_clientInfo = HOST + "/kjy/mp/whoSawMe/clue/clientInfo";
public static final String WHOSAWME_clueList = HOST + "/kjj/visit/clue/list";
// *************** 运营周报 ***************
public static final String WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo";
......
......@@ -73,6 +73,7 @@ public class BaseUtils {
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, openId);
Object userId = result.get("user_id");
sleep(1000);
Map<String, Object> params = new HashMap<>();
params.put("userId",userId);
params.put("validDays",365);
......@@ -95,6 +96,7 @@ public class BaseUtils {
System.out.println("取关\n"+response.body().asString());
network.agentHeaders.put("Content-Type","application/json");
Object userId = result.get("user_id");
System.out.println(userId);
return userId;
}
......
......@@ -28,7 +28,7 @@ public class NetworkUtils {
//cookies中的tku
agentCookies.put("tku",AGENT_TKU);
//多场景测试标志
// agentCookies.put("_duibaServiceGroupKey","miria-2679");
agentCookies.put("_duibaServiceGroupKey","miria-2652");
//json类型的headers
agentHeaders.put("Content-Type","application/json");
//二进制文件的headers
......
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