Commit bc007d2a authored by Su-Yi's avatar Su-Yi

新增文章访客视角case

parent 07b70c06
package com.kjj.qa.cases; package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.qa.config.BasicConfig.*;
import com.google.inject.internal.asm.$TypePath;
import com.kjj.qa.utils.NetworkUtil; import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response; import io.restassured.response.Response;
...@@ -21,6 +23,7 @@ public class Article { ...@@ -21,6 +23,7 @@ public class Article {
String articleContentId = ""; // 文章的contentId String articleContentId = ""; // 文章的contentId
String scid = ""; // getScid后的文章id String scid = ""; // getScid后的文章id
String userId = ""; // 代理人用户ID String userId = ""; // 代理人用户ID
String visitId = ""; // 访问记录ID
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
...@@ -75,13 +78,6 @@ public class Article { ...@@ -75,13 +78,6 @@ public class Article {
int openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()"); int openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,0,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"代理人视角-名片关闭状态与设置中心不一致")); Assert.assertEquals(openCount,0,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"代理人视角-名片关闭状态与设置中心不一致"));
//检查访客视角名片展示
network.agentCookies.put("tku",VISITOR_TKU); //tku 切换为访客的
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,0,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"访客视角-名片关闭状态与设置中心不一致"));
network.agentCookies.put("tku",AGENT_TKU); //tku 切换为访客的
//开启名片展示 //开启名片展示
sellerCardParams.put("configKey","card_show_on_top");//素材尾部名片 sellerCardParams.put("configKey","card_show_on_top");//素材尾部名片
sellerCardParams.put("configValue",true); sellerCardParams.put("configValue",true);
...@@ -95,14 +91,6 @@ public class Article { ...@@ -95,14 +91,6 @@ public class Article {
openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()"); openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,2,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"代理人视角-名片开启状态与设置中心不一致")); Assert.assertEquals(openCount,2,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"代理人视角-名片开启状态与设置中心不一致"));
//再次检查文章内名片展示
network.agentCookies.put("tku",VISITOR_TKU); //tku 切换为访客的
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,2,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"访客视角-名片开启状态与设置中心不一致"));
network.agentCookies.put("tku",AGENT_TKU); //tku 切换为访客的
//名片样式 //名片样式
Map<String, Object> styleParams = new HashMap<String, Object>(); Map<String, Object> styleParams = new HashMap<String, Object>();
styleParams.put("id",scid); styleParams.put("id",scid);
...@@ -252,24 +240,96 @@ public class Article { ...@@ -252,24 +240,96 @@ public class Article {
Assert.assertEquals(desc,"OK",network.message(params, CHECKUNREAD, "获取私信有误")); Assert.assertEquals(desc,"OK",network.message(params, CHECKUNREAD, "获取私信有误"));
} }
@Test(description="访客_查看代理人信息",priority = 12) // ******************************** 访客 ****************************
public void 访客_查看代理人信息() throws IOException { @Test(description="访客_记录查看素材",priority = 12)
network.agentCookies.put("tku",VISITOR_TKU); //tku 切换为访客的 public void 访客_记录查看素材() throws IOException{
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("fromUserId",userId); // 代理人的用户id
params.put("visitPath",1); //访问路径来源 0未知,1个人,2朋友圈,3群
Response response = network.getResponse(params,CONTENT_READ);
visitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(visitId,network.message(params,CONTENT_READ,"访客视角-获取访问记录失败"));
}
@Test(description="访客_文章内容页",priority = 12)
public void 访客_文章内容页() throws IOException
{
// 访客视角的scid是直接从转发出来的url里取的,且URL里那个scid就是代理人视角里h5info接口里取出来的那个值,所以访客视角不用重新获取
Map<String, Object> infoParams = new HashMap<String, Object>(); Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid",scid); infoParams.put("scid",scid);
Response response = network.getResponse(infoParams,ARTICLE_H5INFO); Response response = network.getResponse(infoParams,ARTICLE_H5INFO);
String id = response.jsonPath().getString("data.id"); String id = response.jsonPath().getString("data.id");
userId = response.jsonPath().getString("data.userId"); Assert.assertEquals(articleContentId, id, network.message(infoParams,ARTICLE_H5INFO,"访客视角-获取文章内容页失败"));
Assert.assertEquals(articleContentId, id, network.message(infoParams,ARTICLE_H5INFO,"获取文章内容页失败")); }
//名片是否展示
@Test(description="访客_名片是否展示",priority = 14)
public void 访客_名片是否展示() throws IOException {
//tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU);
//代理人 关闭名片展示
Map<String, Object> sellerCardParams = new HashMap<String, Object>();
sellerCardParams.put("configKey","card_show_on_top");//素材头部名片
sellerCardParams.put("configValue",false);
Response response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
boolean isChanged = response.jsonPath().getBoolean("data");
Assert.assertTrue(isChanged,network.message(sellerCardParams,SELLERCONFIG_EDITCONFIG,"关闭素材头部名片失败"));
sellerCardParams.put("configKey","card_show_on_bottom");//素材尾部名片
sellerCardParams.put("configValue",false);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
isChanged = response.jsonPath().getBoolean("data");
Assert.assertTrue(isChanged,network.message(sellerCardParams,SELLERCONFIG_EDITCONFIG,"关闭素材底部名片失败"));
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
//检查文章内名片展示
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
int openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,0,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"访客视角-名片关闭状态与设置中心不一致"));
//tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU);
// 代理人 开启名片展示
sellerCardParams.put("configKey","card_show_on_top");//素材尾部名片
sellerCardParams.put("configValue",true);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
sellerCardParams.put("configKey","card_show_on_bottom");//素材尾部名片
sellerCardParams.put("configValue",true);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
//再次检查文章内名片展示
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,2,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"访客视角-名片开启状态与设置中心不一致"));
//名片样式
Map<String, Object> styleParams = new HashMap<String, Object>();
styleParams.put("id",scid);
response = network.getResponse(styleParams,SELLERCARD_GETSELLERCARDSTYLE);
String backgroundColor = response.jsonPath().getString("data.find {it.code == 'card_background_color'}.val");
Assert.assertEquals(backgroundColor,"1",network.message(styleParams,SELLERCARD_GETSELLERCARDSTYLE,"访客视角-名片-背景色样式不对"));
} }
@Test(description="访客_查看代理人头部名片",priority = 12) // 头部名片
public void 访客_查看代理人头部名片() throws IOException { @Test(description="访客_头部名片详情",priority = 15)
public void 访客_头部名片详情() throws IOException {
//获取加密的销售ID //获取加密的销售ID
Response response = network.getResponse(USER_INFO); Response response = network.getResponse(USER_INFO);
sid = response.jsonPath().getString("data.encodeSellerId");
userId = response.jsonPath().getString("data.userId");
String sellerName = response.jsonPath().getString("data.sellerName"); String sellerName = response.jsonPath().getString("data.sellerName");
//获取名片的姓名、公司等 //获取名片的姓名、公司等
...@@ -279,25 +339,150 @@ public class Article { ...@@ -279,25 +339,150 @@ public class Article {
response = network.getResponse(params,SELLERCARD_TOPOFCONTENT); response = network.getResponse(params,SELLERCARD_TOPOFCONTENT);
String scId = response.jsonPath().getString("data.scid"); String scId = response.jsonPath().getString("data.scid");
String name = response.jsonPath().getString("data.sellerName"); String name = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(name,sellerName,"头部名片信息显示有误"); Assert.assertEquals(name,sellerName,"访客-头部名片信息显示有误");
//获取名片的点赞 //获取名片的点赞
Map<String, Object> likeParams = new HashMap<String, Object>(); Map<String, Object> likeParams = new HashMap<String, Object>();
likeParams.put("scId",scId); likeParams.put("scId",scId);
response = network.getResponse(likeParams,HASALREADYLIKE); response = network.getResponse(likeParams,HASALREADYLIKE);
boolean favourResult = response.jsonPath().getBoolean("data.favourResult"); boolean favourResult = response.jsonPath().getBoolean("data.favourResult");
int favourTimes = response.jsonPath().getInt("data.favourTimes"); int favourTimes =response.jsonPath().getInt("data.favourTimes");
Assert.assertTrue(favourResult,"头部名片点赞数量显示有误"); Assert.assertTrue(favourResult,"访客-头部名片点赞数量显示有误");
// 点赞名片
likeParams.put("visitTableId",visitId);
response =network.postResponse(likeParams,INTERACTION_LIKE);
boolean isLike = (response.jsonPath().getInt("data.favourTimes") - favourTimes) > 0;
Assert.assertTrue(isLike,"访客-头部名片点赞失败");
}
// 底部名片
@Test(description="访客_底部名片详情",priority = 16)
public void 访客_底部名片详情() throws IOException {
//获取加密的销售ID
Response response = network.getResponse(USER_INFO);
sid = response.jsonPath().getString("data.encodeSellerId");
String sellerName = response.jsonPath().getString("data.sellerName");
//获取名片的姓名、公司等
Map<String, Object> params = new HashMap<String, Object>();
params.put("sid",sid);
params.put("t", System.currentTimeMillis());
response = network.getResponse(params,SELLERCARD_TOPOFCONTENT);
String name = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(name, sellerName,"访客-获取底部名片信息显示有误");
}
// 是否爆款素材
@Test(description="访客_文章类型判断",priority = 17)
public void 访客_文章类型判断() throws IOException {
//获得素材类型 种草、发圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("id",articleContentId);
Response response = network.getResponse(params,ARTICLE_GETTAGTYPESBYCONTENTID);
boolean isContains = response.jsonPath().getBoolean("data.contains('grass_content')");
Assert.assertTrue(isContains,"访客-类型判断错误-类型应该存在种草素材");
//获得爆款素材详情
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("contentId",articleContentId);
response = network.getResponse(infoParams,ARTICLE_GETEXPINFO);
String tags = response.jsonPath().getString("data.tags");
String recommendReason = response.jsonPath().getString("data.recommendReason");
Assert.assertNotNull(tags,network.message(infoParams,ARTICLE_GETEXPINFO,"访客-获取文章标签有误"));
Assert.assertNotNull(recommendReason,network.message(infoParams,ARTICLE_GETEXPINFO,"访客-获取文章推荐理由有误"));
}
// 获取互动区-专业解读
@Test(description="访客_互动区-专业解读",priority = 18)
public void 访客_互动区_专业解读() throws IOException
{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageIndex",1);
params.put("pageSize",10);
Response response = network.getResponse(params,ARTICLE_ENHANCEDCOLUMN_GETCONTENTS);
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
Assert.assertTrue(hasList, network.message(params,ARTICLE_ENHANCEDCOLUMN_GETCONTENTS,"访客-获取专业解读列表有误"));
}
//给代理人点赞 // 获取互动区-互动问答
@Test(description="访客_互动区-互动问答",priority = 19)
public void 访客_互动区_互动问答() throws IOException
{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageIndex",1);
params.put("pageSize",3);
Response response = network.getResponse(params,ARTICLE_ENHANCEDCOLUMN_GETFAQS);
int count = response.jsonPath().getInt("data.list.size()");
Assert.assertEquals(count,3,network.message(params,ARTICLE_ENHANCEDCOLUMN_GETFAQS,"访客-获取个人专栏列表有误"));
String answer = response.jsonPath().getString("data.list[0].answer");
Assert.assertNotNull(answer,network.message(params,ARTICLE_ENHANCEDCOLUMN_GETFAQS,"访客-获取问答内容有误"));
}
// 获取互动区-风险评测
@Test(description="访客_互动区-风险评测",priority = 20)
public void 访客_互动区_风险评测() throws IOException
{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
Response response = network.getResponse(params,ARTICLE_ISDISPLAYACTIVITY);
boolean isDisplay = response.jsonPath().getBoolean("data.isDisplay");
String riskScid = response.jsonPath().getString("data.scid");
Assert.assertTrue(isDisplay,network.message(params,ARTICLE_ISDISPLAYACTIVITY,"访客-互动区-风险评测显示有误"));
Assert.assertNotNull(riskScid, network.message(params,ARTICLE_ISDISPLAYACTIVITY,"访客-互动区-风险评测内容有误"));
} }
// @Test(description="访客_换成我的名片功能",priority = 12) // 获取代理人个人专栏
// public void 访客_换成我的名片功能() throws IOException { @Test(description="访客_代理人个人专栏",priority = 21)
// public void 访客_代理人个人专栏() throws IOException {
// } // 先获取代理人个人专栏设置
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
Response response = network.getResponse(params,ARTICLE_GETENHANCEDCOLUMNCONFIG);
boolean isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertTrue(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"访客-获取代理人日常精准素材个人专栏开关有误"));
//tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU);
//关闭 代理人个人专栏开关
Map<String, Object> configParams = new HashMap<String, Object>();
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",false);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
//再获取代理人个人专栏
response = network.getResponse(params,ARTICLE_GETENHANCEDCOLUMNCONFIG);
isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertFalse(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"访客-获取代理人日常精准素材个人专栏开关有误"));
//tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU);
//再次开启 代理人个人专栏开关
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",true);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
}
// 获取代理人个人专栏
@Test(description="访客_获取代理人私信",priority = 22)
public void 访客_获取代理人私信() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("t",System.currentTimeMillis());
Response response = network.getResponse(params, CHECKUNREAD);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(params, CHECKUNREAD, "获取私信有误"));
}
@AfterClass @AfterClass
public static void tearDown(){ public static void tearDown(){
......
...@@ -17,16 +17,16 @@ public class BasicConfig { ...@@ -17,16 +17,16 @@ public class BasicConfig {
// *************** 钉钉机器人 *************** // *************** 钉钉机器人 ***************
// 线上-告警群 // 线上-告警群
public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2"; // public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
// 测试 // 测试
// public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd"; public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd";
; ;
// *************** 客集集域名 *************** // *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn"; public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn";
// *************** TKU *************** // *************** TKU ***************
public static final String VISITOR_TKU = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3kN3PeAJu6T4SYLjBqEdVj2rNy2gA2DQRHowL8c9"; public static final String VISITOR_TKU = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3kN3PcWwcLdzfxPp2gghfE4x3BFH8JN3f8PUzQ6W";
// *************** 素材ID *************** // *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc"; public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc";
...@@ -56,6 +56,8 @@ public class BasicConfig { ...@@ -56,6 +56,8 @@ public class BasicConfig {
public static final String CONTENT_READ = "/kjy/mp/content/read"; public static final String CONTENT_READ = "/kjy/mp/content/read";
public static final String INTERACTION_LIKE = "/kjy/mp/interaction/like";
// *************** 支付 *************** // *************** 支付 ***************
public static final String PAY_GETMIDDLEDETAIL = "/kjy/mp/payMiddle/getMiddleDetail"; public static final String PAY_GETMIDDLEDETAIL = "/kjy/mp/payMiddle/getMiddleDetail";
......
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