Commit 9e530877 authored by xiamengchen's avatar xiamengchen

修改代理人访客线索核验

parent 34f6ad96
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ClueStatistics {
private int drawMaterial; //领取资料次数
private int drawPresentInsuranceCount; // 领取赠险次数
private int faqCount; // 查看FAQ次数
private int grassCount; // 阅读种草素材次数
private int riskTestCount; // 参与风险评测次数
private int visitCount; // 来访次数
}
......@@ -23,6 +23,8 @@ public class ForwardAndRead implements Authorization {
private String jjvisitId;
private String insuranceId;
private long forwardTime;
private String questionId;
public static Map<String, Integer> custClueStatistics;
@BeforeClass
public void setUp() throws IOException{
......@@ -30,8 +32,32 @@ public class ForwardAndRead implements Authorization {
BaseUtils.ssoLogin();
}
// 获取二度访客起始线索数据
@Test(description = "获取二度访客起始线索数据", priority = 1)
public void 获取二度访客起始线索数据(){
long userId = decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
param = new HashMap<>();
custClueStatistics = new HashMap<>();
param.put("userId", userId);
System.out.println(param);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
System.out.println(response.body().asString());
int drawMaterial = response.jsonPath().getInt("data.drawMaterial");
int drawPresentInsuranceCount = response.jsonPath().getInt("data.drawPresentInsuranceCount");
int faqCount = response.jsonPath().getInt("data.faqCount");
int grassCount = response.jsonPath().getInt("data.faqCount");
int riskTestCount = response.jsonPath().getInt("data.riskTestCount");
int visitCount = response.jsonPath().getInt("data.visitCount");
custClueStatistics.put("drawMaterial", drawMaterial);
custClueStatistics.put("drawPresentInsuranceCount", drawPresentInsuranceCount);
custClueStatistics.put("faqCount", faqCount);
custClueStatistics.put("grassCount", grassCount);
custClueStatistics.put("riskTestCount", riskTestCount);
custClueStatistics.put("visitCount", visitCount);
}
// 代理人转发素材
@Test(description = "代理人转发文章", priority = 1)
@Test(description = "代理人转发文章", priority = 2)
public void 转发文章() throws IOException{
// 转发文章前记录一个时间
forwardTime = new Date().getTime();
......@@ -48,7 +74,7 @@ public class ForwardAndRead implements Authorization {
}
@Test(description = "代理人转发名片", priority = 2)
@Test(description = "代理人转发名片", priority = 3)
public void 转发名片() throws IOException{
// 获取名片scid
String scId = network.getResponse(BasicConfig.SELLERCARD_topOfDetail).jsonPath().getString("data.scid");
......@@ -63,7 +89,7 @@ public class ForwardAndRead implements Authorization {
}
// 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 3)
@Test(description = "访客阅读文章", priority = 4)
public void 访客阅读文章() throws IOException{
sellerId = decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
......@@ -78,7 +104,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertNotNull(jjvisitId, network.message(param, BasicConfig.CONTENT_READ, "visitId为空", response.body().asString()));
}
@Test(description = "访客领取赠险", priority = 4)
@Test(description = "访客领取赠险", priority = 5)
public void 领取赠险() throws IOException{
// 获取赠险insuranceId
param = new HashMap<>();
......@@ -101,7 +127,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
@Test(description = "访客转发文章", priority = 5)
@Test(description = "访客转发文章", priority = 6)
public void 访客转发文章() throws IOException{
param = new HashMap<>();
param.put("scId", articleScId);
......@@ -114,7 +140,7 @@ public class ForwardAndRead implements Authorization {
}
// 获取新用户
@Test(description = "新用户访问", priority = 6)
@Test(description = "新用户访问", priority = 7)
public void 新用户访问() throws IOException{
ThreadSleepUtils.sleep(5000);
network.agentCookies.put("tku", BaseUtils.tku);
......@@ -131,7 +157,7 @@ public class ForwardAndRead implements Authorization {
}
// 新用户领取赠险
@Test(description = "新用户领取赠险", priority = 7)
@Test(description = "新用户领取赠险", priority = 8)
public void 新用户领取赠险() throws IOException{
param.clear();
param.put("clueTypeName", "WELFARE_INSURANCE");
......@@ -146,7 +172,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
@Test(description = "二度访客阅读文章", priority = 8)
@Test(description = "二度访客阅读文章", priority = 9)
public void 二度访客阅读文章() throws IOException{
ThreadSleepUtils.sleep(5000);
Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
......@@ -160,7 +186,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
}
@Test(description = "添加访问记录", priority = 9)
@Test(description = "添加访问记录", priority = 10)
public void 添加访问记录() throws IOException{
param.clear();
param.put("forwardTime", forwardTime); // 添加访问记录的时间要小于代理人转发时间
......@@ -169,7 +195,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "添加访问记录失败", response.body().asString()));
}
@Test(description = "二度访客领取赠险", priority = 10)
@Test(description = "二度访客领取赠险", priority = 11)
public void 二度访客领取赠险() throws IOException{
param = new HashMap<>();
param.put("clueTypeName", "WELFARE_INSURANCE");
......@@ -184,7 +210,7 @@ public class ForwardAndRead implements Authorization {
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
@Test(description = "获取文章FAQs", priority = 11)
@Test(description = "获取文章FAQs", priority = 12)
public void 获取文章FAQs() throws IOException{
param.clear();
param.put("scid", articleScId);
......@@ -195,12 +221,24 @@ public class ForwardAndRead implements Authorization {
int totalCount = response.jsonPath().getInt("data.totalCount");
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertEquals(totalCount, lists.size(), network.message(param, BasicConfig.ARTICLE_ENHANCEDCOLUMN_GETFAQS, "FAQ总数与FAQ列表大小不一致", response.body().asString()));
questionId = response.jsonPath().getString("data.list[0].questionId");
}
// @Test(description = "二度访客点击FAQ", priority = 12)
// public void 二度访客点击FAQ() throws IOException{
//
// }
@Test(description = "二度访客发起提问", priority = 13)
public void 二度访客发起提问() throws IOException{
param.clear();
param.put("clueTypeName", "FAQ_VISIT_DETAIL");
param.put("locationSource", 2);
param.put("qId", questionId);
param.put("scId", articleScId);
param.put("sourceId", articleScId);
param.put("sourceType", 1);
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()));
ThreadSleepUtils.sleep(10000);
}
// 通过素材contentId获取线索员文章scId
public String getContentScId(String contentId){
......@@ -228,11 +266,12 @@ public class ForwardAndRead implements Authorization {
}
// 解密tku
public HashMap<String, Long> decodeTku(String tku){
public static HashMap<String, Long> decodeTku(String tku){
// 登陆管理后台
Map<String, Object> param = new HashMap<>();
param = new HashMap<>();
param.put("tku", tku);
response = network.getResponse(param, BasicConfig.MANAGER_TKU_DECODE);
Response response = network.getResponse(param, BasicConfig.MANAGER_TKU_DECODE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.MANAGER_TKU_DECODE, "接口请求失败", response.body().asString()));
Long userId = response.jsonPath().getLong("data.userId");
Long sellerId = response.jsonPath().getLong("data.sellerId");
......
......@@ -360,8 +360,15 @@ public class MyCustomer implements Authorization {
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CLUESTATISTICS);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUESTATISTICS, "接口请求失败", response.body().asString()));
int drawPresentInsuranceCount = response.jsonPath().getInt("data.drawPresentInsuranceCount");
Assert.assertTrue(drawPresentInsuranceCount >= 1, network.message(param, BasicConfig.CLUESTATISTICS, "客户领取赠险次数小于1", response.body().asString()));
ClueStatistics clueStatistics = JsonUtil.parseResponseToBean(response, ClueStatistics.class);
int drawPresentInsuranceCount = clueStatistics.getDrawPresentInsuranceCount();
int faqCount = clueStatistics.getFaqCount();
int grassCount = clueStatistics.getGrassCount();
int visitCount = clueStatistics.getVisitCount();
Assert.assertEquals(drawPresentInsuranceCount, ForwardAndRead.custClueStatistics.get("drawPresentInsuranceCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取赠险记录次数未正确增加", response.body().asString()));
Assert.assertEquals(faqCount, ForwardAndRead.custClueStatistics.get("faqCount") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客查看FAQ记录次数未正确增加", response.body().asString()));
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()));
}
// 客户详情页_线索统计
......
......@@ -6,46 +6,46 @@
<class name="com.kjj.cases.assistant.menu.NoviceGuidance"/>
</classes>
</test>
<test preserve-order="true" name="支付">
<classes>
<class name="com.kjj.cases.assistant.pay.Pay"/>
</classes>
</test>
<test preserve-order="true" name="邀请返现">
<classes>
<class name="com.kjj.cases.assistant.pay.Cashback"/>
</classes>
</test>
<test preserve-order="true" name = "首页">
<classes>
<class name="com.kjj.cases.assistant.homePage.HomePage"/>
</classes>
</test>
<test preserve-order="true" name="我的名片">
<classes>
<class name="com.kjj.cases.assistant.card.PersonCard"/>
</classes>
</test>
<test preserve-order="true" name="文章中个人名片">
<classes>
<class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>
</classes>
</test>
<test preserve-order="true" name = "种草素材">
<classes>
<class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>
</classes>
</test>
<test preserve-order="true" name = "今日早报">
<classes>
<class name="com.kjj.cases.assistant.homePage.DailyPaper"/>
</classes>
</test>
<test preserve-order="true" name = "上传链接">
<classes>
<class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes>
</test>
<!-- <test preserve-order="true" name="支付">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.pay.Pay"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="邀请返现">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.pay.Cashback"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "首页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.HomePage"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="我的名片">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.card.PersonCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="文章中个人名片">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "种草素材">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "今日早报">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.DailyPaper"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "上传链接">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.Upload"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name = "获取访客">
<classes>
......@@ -67,26 +67,26 @@
<class name="com.kjj.cases.assistant.whoSawMe.MyCustomer"/>
</classes>
</test>
<test preserve-order="true" name = "贺卡">
<classes>
<class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>
</classes>
</test>
<test preserve-order="true" name = "抽奖转盘">
<classes>
<class name="com.kjj.cases.assistant.markettools.GameLottery"/>
</classes>
</test>
<test preserve-order="true" name = "邀请函和趣味测评">
<classes>
<class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>
</classes>
</test>
<test preserve-order="true" name = "使用攻略和设置中心">
<classes>
<class name="com.kjj.cases.assistant.menu.PersonalCenter"/>
</classes>
</test>
<!-- <test preserve-order="true" name = "贺卡">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "抽奖转盘">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.GameLottery"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "邀请函和趣味测评">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "使用攻略和设置中心">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.menu.PersonalCenter"/>-->
<!-- </classes>-->
<!-- </test>-->
</suite>
<!-- Suite -->
......
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