Commit 47f73497 authored by 龚小红's avatar 龚小红

新增文章配置素材的测试用例

parent a948910d
package com.kjj.bean.marketTools;
import lombok.Data;
@Data
public class Activity {
private String title;
private long id;
private int status;
}
...@@ -25,7 +25,7 @@ public class ArticalPersonCard implements Authorization { ...@@ -25,7 +25,7 @@ public class ArticalPersonCard implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
agentAuth(); agentTku();
} }
//文章内容页 //文章内容页
......
package com.kjj.cases.assistant.homePage; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.IdMakeUtil.decodingId;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils; import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -31,7 +33,6 @@ public class RecommendMaterial implements Authorization { ...@@ -31,7 +33,6 @@ public class RecommendMaterial implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
userTku();
agentTku(); agentTku();
} }
...@@ -406,6 +407,4 @@ public class RecommendMaterial implements Authorization { ...@@ -406,6 +407,4 @@ public class RecommendMaterial implements Authorization {
String desc = response.jsonPath().getString("desc"); String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc, "OK", network.message(params, CHECKUNREAD, "访客-获取私信有误", response.body().asString())); Assert.assertEquals(desc, "OK", network.message(params, CHECKUNREAD, "访客-获取私信有误", response.body().asString()));
} }
} }
\ No newline at end of file
...@@ -9,6 +9,8 @@ import org.testng.annotations.*; ...@@ -9,6 +9,8 @@ import org.testng.annotations.*;
import java.util.*; import java.util.*;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku;
public class PersonalCenter implements Authorization{ public class PersonalCenter implements Authorization{
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
public String faqId; // 问答的contentId public String faqId; // 问答的contentId
......
...@@ -20,6 +20,8 @@ import java.util.HashMap; ...@@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class WhoSawMe implements Authorization { public class WhoSawMe implements Authorization {
private Response response; private Response response;
...@@ -30,6 +32,8 @@ public class WhoSawMe implements Authorization { ...@@ -30,6 +32,8 @@ public class WhoSawMe implements Authorization {
private Long xxrUserId; private Long xxrUserId;
private Long jjSellerId; private Long jjSellerId;
private String tagId0; private String tagId0;
private String reportId;
private String reportScid;
private String weeklyPublicationId; private String weeklyPublicationId;
private String scid; // 代理人周报scid private String scid; // 代理人周报scid
private String taskArticleContentId; // 任务素材contentId private String taskArticleContentId; // 任务素材contentId
...@@ -869,4 +873,74 @@ public class WhoSawMe implements Authorization { ...@@ -869,4 +873,74 @@ public class WhoSawMe implements Authorization {
Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString())); Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString()));
Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString())); Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString()));
} }
// 销售线索_测评报告领取线索
@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.nickName == '小葡萄'}.clueSummary");
Assert.assertEquals(clueSummary, "TA想要领取风险测评报告", network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
clueId = response.jsonPath().getLong("data.list.find{it.nickName == '小葡萄'}.clueId");
System.out.println(response.body().asString());
}
// 销售线索_查看测评报告的领取详情
@Test(description = "销售线索_查看测评报告的领取详情", priority = 59)
public void 销售线索_查看测评报告的领取详情() throws IOException{
param = new HashMap<>();
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()));
System.out.println(response.body().asString());
}
// 代理人_转发评测报告
@Test(description = "代理人_转发评测报告", priority = 60)
public void 代理人_转发评测报告() throws IOException{
param = new HashMap<>();
param.put("contentId",reportId);
response = network.getResponse(param,GETSCID);
reportScid = response.jsonPath().getString("data");
Assert.assertNotNull(reportScid, network.message(param,GETSCID,"获取sCid失败",response.body().asString()));
//查看线索客户信息
param.put("clueId",clueId);
Response response = network.getResponse(param,WHOSAWME_clientInfo);
String custName = response.jsonPath().getString("data.custName");
Assert.assertEquals(custName,"小葡萄", network.message(param,WHOSAWME_clientInfo,"线索客户信息错误",response.body().asString()));
}
// 访客_咨询问题
@Test(description = "访客_咨询问题", priority = 61)
public void 访客_咨询问题() throws IOException{
userTku();
//获取问题按钮列表
param.put("scene",1);
Response response = network.getResponse(param,GAME_button);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size, 4, network.message(param,GAME_button,"问题个数错误",response.body().asString()));
//点击问题
param.clear();
param.put("order",3);
param.put("scene",2);
param.put("scid",reportScid);
response = network.postResponse(param,GAME_consult);
String sCid = response.jsonPath().getString("data");
Assert.assertNotNull(reportScid, network.message(param,GAME_consult,"获取sCid失败",response.body().asString()));
}
} }
...@@ -242,7 +242,7 @@ public class Answer implements Authorization { ...@@ -242,7 +242,7 @@ public class Answer implements Authorization {
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString()));
Integer amount = response.jsonPath().getJsonObject("data.amount"); Integer amount = response.jsonPath().getJsonObject("data.amount");
System.out.println(amount); System.out.println( response.body().asString());
Assert.assertTrue(amount>0,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString())); Assert.assertTrue(amount>0,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString()));
......
...@@ -444,7 +444,7 @@ public class FlipCard implements Authorization { ...@@ -444,7 +444,7 @@ public class FlipCard implements Authorization {
@Test(description = "用户开红包状态查询", priority = 21) @Test(description = "用户开红包状态查询", priority = 21)
public void 用户开红包状态查询() { public void 用户开红包状态查询() {
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
...@@ -1355,7 +1355,7 @@ public class Lottery implements Authorization { ...@@ -1355,7 +1355,7 @@ public class Lottery implements Authorization {
Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result); Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result);
try { try {
Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery"); Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery");
Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "企业指定访客F未中奖", hasEndRes.body().asString())); Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "团队未指定访客F中奖", hasEndRes.body().asString()));
} catch (Exception e) { } catch (Exception e) {
System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get())); System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get()));
throw e; throw e;
...@@ -1364,22 +1364,22 @@ public class Lottery implements Authorization { ...@@ -1364,22 +1364,22 @@ public class Lottery implements Authorization {
@Test(description = "不在团队指定访客I是否中奖", priority = 93) @Test(description = "不在团队指定访客I是否中奖", priority = 93)
public void 不在团队指定访客I是否中奖() { public void 不在团队指定访客I是否中奖() {
visitorAuth8(); visitorAuth8();
ThreadSleepUtils.sleep(3000); ThreadSleepUtils.sleep(3000);
Map<String, Object> hasEndParam = new HashMap<>(); Map<String, Object> hasEndParam = new HashMap<>();
hasEndParam.put("confId", this.List_ConfId.get(3).getWelfareConfId()); hasEndParam.put("confId", this.List_ConfId.get(3).getWelfareConfId());
hasEndParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); hasEndParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result); Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result);
try { try {
Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery"); Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery");
Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "企业指定访客I未中奖", hasEndRes.body().asString())); Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "团队未指定访客I中奖", hasEndRes.body().asString()));
} catch (Exception e) { } catch (Exception e) {
System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get())); System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get()));
throw e; throw e;
} }
} }
@Test(description = "开始第五轮抽奖", priority = 94) @Test(description = "开始第五轮抽奖", priority = 94)
......
...@@ -92,6 +92,7 @@ public class BasicConfig { ...@@ -92,6 +92,7 @@ public class BasicConfig {
public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn"; public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn";
public static final String MOBILE_HOST = "https://live.duibatest.com.cn"; public static final String MOBILE_HOST = "https://live.duibatest.com.cn";
public static final String MOBILE_SPOKEHOST = "https://tt.duibatest.com.cn"; public static final String MOBILE_SPOKEHOST = "https://tt.duibatest.com.cn";
public static final String ACTIVITY_HOST1 = "https://kjj-activity-1.duibatest.com.cn";
// *************** 开启&结束直播 *************** // *************** 开启&结束直播 ***************
public static final String ANCHOR_OPEN = MOBILE_HOST + "/conf/live/open"; public static final String ANCHOR_OPEN = MOBILE_HOST + "/conf/live/open";
...@@ -738,6 +739,7 @@ public class BasicConfig { ...@@ -738,6 +739,7 @@ public class BasicConfig {
public static final String CLUEINFO = HOST + "/kjy/mp/whoSawMe/clue/info"; 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 CLUEADVISE = HOST + "/kjy/mp/whoSawMe/clue/info/advise";
public static final String FOLLOWADVICE = HOST + "/kjy/mp/whoSawMe/clue/followAdvice"; 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 WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo"; public static final String WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo";
...@@ -805,6 +807,7 @@ public class BasicConfig { ...@@ -805,6 +807,7 @@ public class BasicConfig {
public static final String ARTICLE_ENHANCEDCOLUMN_GETFAQS = HOST + "/kjy/mp/enhancedColumn/getFAQs"; public static final String ARTICLE_ENHANCEDCOLUMN_GETFAQS = HOST + "/kjy/mp/enhancedColumn/getFAQs";
public static final String ARTICLE_getQuestionDetail = HOST +"/kjy/mp/explosioncontent/qa/getQuestionDetail"; public static final String ARTICLE_getQuestionDetail = HOST +"/kjy/mp/explosioncontent/qa/getQuestionDetail";
public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = HOST + "/kjy/mp/explosioncontent/getExplosionContentList"; public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = HOST + "/kjy/mp/explosioncontent/getExplosionContentList";
public static final String ARTICLE_interact = HOST + "/kjy/mp/article/interact";
// 风险评测 // 风险评测
public static final String RISKTEST_SENDINFO = ACTIVITY1_HOST + "/kjy/mp/activity/sendInfoForRisk"; public static final String RISKTEST_SENDINFO = ACTIVITY1_HOST + "/kjy/mp/activity/sendInfoForRisk";
...@@ -983,6 +986,10 @@ public class BasicConfig { ...@@ -983,6 +986,10 @@ public class BasicConfig {
//*********************趣味测试************************ //*********************趣味测试************************
public static final String GAME_answerPageList = HOST + "/kjy/mp/game/answerPageList"; public static final String GAME_answerPageList = HOST + "/kjy/mp/game/answerPageList";
public static final String GAME_clueList = HOST + "/kjy/mp/tag/clue/list"; public static final String GAME_clueList = HOST + "/kjy/mp/tag/clue/list";
public static final String GAME_sendInfo= ACTIVITY_HOST + "/kjy/mp/activity/sendInfo";
public static final String GAME_sendInfoForRisk= ACTIVITY_HOST + "/kjy/mp/activity/sendInfoForRisk";
public static final String GAME_consult= ACTIVITY_HOST + "/kjy/mp/activity/consult";
public static final String GAME_button= ACTIVITY_HOST + "/kjy/mp/activity/button";
// *************** 管理后台 *************** // *************** 管理后台 ***************
public static final String SSO_doLogin = SSO_HOST + "/doLogin"; public static final String SSO_doLogin = SSO_HOST + "/doLogin";
...@@ -1012,6 +1019,14 @@ public class BasicConfig { ...@@ -1012,6 +1019,14 @@ public class BasicConfig {
public static final String MANAGER_encryptTku = MANAGER_HOST + "/kjy/manager/testUser/encryptTku"; public static final String MANAGER_encryptTku = MANAGER_HOST + "/kjy/manager/testUser/encryptTku";
public static final String MANAGER_changeCompany = MANAGER_HOST + "/kjy/manager/seller/changeCompany"; public static final String MANAGER_changeCompany = MANAGER_HOST + "/kjy/manager/seller/changeCompany";
public static final String MANAGER_feedBackList = MANAGER_HOST + "/kjy/manager/feedback/list"; public static final String MANAGER_feedBackList = MANAGER_HOST + "/kjy/manager/feedback/list";
public static final String MANAGER_articleInteraction = MANAGER_HOST + "/kjy/manager/interact/article/searchPageList"; public static final String MANAGER_searchAnswerList = MANAGER_HOST + "/kjy/manager/game/searchAnswerList";
public static final String MANAGER_interactSolution = MANAGER_HOST + "/kjy/manager/interact/solution/searchPageList"; public static final String MANAGER_saveActivity = MANAGER_HOST + "/kjy/manager/interact/solution/save";
public static final String MANAGER_updateActivity = MANAGER_HOST + "/kjy/manager/interact/solution/update";
public static final String MANAGER_solutionPageList = MANAGER_HOST + "/kjy/manager/interact/solution/searchPageList";
public static final String MANAGER_saveInteract = MANAGER_HOST + "/kjy/manager/interact/article/save";
public static final String MANAGER_updateInteract = MANAGER_HOST + "/kjy/manager/interact/article/update";
public static final String MANAGER_articlePageList = MANAGER_HOST + "/kjy/manager/interact/article/searchPageList";
public static final String MANAGER_activityName = MANAGER_HOST + "/kjy/manager/interact/solution/activityName";
public static final String MANAGER_deleteInteract = MANAGER_HOST + "/kjy/manager/interact/article/delete";
public static final String MANAGER_deleteActivity = MANAGER_HOST + "/kjy/manager/interact/solution/delete";
} }
...@@ -102,6 +102,18 @@ public class NetworkUtils { ...@@ -102,6 +102,18 @@ public class NetworkUtils {
return response; return response;
} }
// post 头部带参请求
public Response postHeaderResponse(Map<String, Object> params, String path) {
Response response = given()
.cookies(agentCookies)
.params(params)
.post(path);
if (!Objects.equals(response.statusCode(),200)){
System.out.println("请求状态码错误,path=【"+path+"】 code=【"+response.statusCode()+"】");
}
return response;
}
// post 文件上传 // post 文件上传
public Response postFileResponse(String filePath, String path){ public Response postFileResponse(String filePath, String path){
Response response = given() Response response = given()
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
<class name="com.kjj.cases.live.liveConfig.SaveLive"/> <class name="com.kjj.cases.live.liveConfig.SaveLive"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="成功案例"> <test preserve-order="true" name="成功案例">
<classes> <classes>
<class name="com.kjj.cases.live.liveConfig.LiveCase"/> <class name="com.kjj.cases.live.liveConfig.LiveCase"/>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<class name="com.kjj.cases.assistant.homePage.Upload"/> <class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "获取访客"> <test preserve-order="true" name = "获取访客">
<classes> <classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/> <class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
......
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