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

Merge remote-tracking branch 'origin/master' into 2021081901_gxh

parents dfedecf6 91f894f3
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class LiveList {
private String liveId;
private boolean hasPlayBack;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ResourceList {
private String id;
private int type;
private String recordId;
private String liveId;
private String companyName;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class WelfareList {
private long receiveDate;
private String id;
private int type;
private String recordId;
private String liveId;
}
......@@ -235,27 +235,191 @@ public class HomePage implements Authorization {
Assert.assertNotNull(data, network.message(infoParams,HOME_findPosterById,"查询海报失败",findPosterRes.body().asString()));
}
//管理后台新增视频
@Test(description = "管理后台_编辑视频",priority = 14)
public void 管理后台_编辑视频(){
Map<String,Object> params = new HashMap<>();
List list = new ArrayList();
list.add(723);
list.add(724);
List tagList = new ArrayList();
tagList.add(list);
params.put("accurateContentType",5);
params.put("anxietyType",4);
params.put("contentId",247806);
params.put("firstTagId",101);
params.put("isHotContent",0);
params.put("productId",0);
params.put("status",0);
params.put("tagList",tagList);
System.out.println(params);
Response response = network.postResponse(params,MANAGER_grassContentEdit);
boolean data = response.jsonPath().getBoolean("data");
String desc = response.jsonPath().getString("desc");
Assert.assertTrue(data,network.message(params,MANAGER_grassContentEdit,"编辑视频失败",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(params,MANAGER_grassContentEdit,"编辑视频失败",response.body().asString()));
//启用视频
Map<String,Object> openParams = new HashMap<>();
openParams.put("id",247806);
openParams.put("status",2);
Response openRes = network.postResponse(openParams,MANAGER_videoOpen);
boolean openData = openRes.jsonPath().getBoolean("data");
String openDesc = openRes.jsonPath().getString("desc");
Assert.assertTrue(openData,network.message(openParams,MANAGER_videoOpen,"启用视频失败",openRes.body().asString()));
Assert.assertEquals(openDesc,"OK",network.message(openParams,MANAGER_videoOpen,"启用视频失败",openRes.body().asString()));
}
//获取视频标签列表
@Test(description = "首页_视频标签列表",priority = 15)
public void 首页_视频标签列表(){
Map<String,Object> params = new HashMap<>();
params.put("tagName","视频"); //%E8%A7%86%E9%A2%91
Response response = network.getResponse(params,HOME_getGrassTagByName);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params,HOME_getGrassTagByName,"获取视频标签失败",response.body().asString()));
}
//获取首页视频列表
@Test(description = "首页_视频列表",priority = 14)
@Test(description = "首页_视频列表",priority = 16)
public void 首页_视频列表(){
sleep(5000);
Map<String,Object> params = new HashMap<>();
params.put("firstTagId",723); //一级标签
params.put("secondTagId",724); //二级标签
params.put("contentType","video");
Response response = network.getResponse(params,HOME_getContentList);
Object obj = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString()));
Object obj = response.jsonPath().getJsonObject("data.totalCount");
Assert.assertEquals(obj,3,network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString()));
}
//验证视频是否下架成功
@Test(description = "下架视频",priority = 17)
public void 下架视频(){
//管理后台下架视频
Map<String,Object> openParams = new HashMap<>();
openParams.put("id",247806);
openParams.put("status",1);
Response openRes = network.postResponse(openParams,MANAGER_videoOpen);
boolean openData = openRes.jsonPath().getBoolean("data");
String openDesc = openRes.jsonPath().getString("desc");
Assert.assertTrue(openData,network.message(openParams,MANAGER_videoOpen,"下架视频失败",openRes.body().asString()));
Assert.assertEquals(openDesc,"OK",network.message(openParams,MANAGER_videoOpen,"下架视频失败",openRes.body().asString()));
sleep(5000);
//验证视频是否下架成功,原本视频列表有三个视频,下架后还剩2个
Map<String,Object> params = new HashMap<>();
params.put("firstTagId",723);
params.put("secondTagId",724);
params.put("contentType","video");
Response response = network.getResponse(params,HOME_getContentList);
Object obj = response.jsonPath().getJsonObject("data.totalCount");
Assert.assertEquals(obj,2,network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString()));
}
//管理后台新增公司专区内容
@Test(description = "管理后台_新增内容",priority = 18)
public void 新增内容(){
//根据文章内容id匹配
Map<String,Object> params = new HashMap<>();
params.put("id",9398);
params.put("contentType","article");
Response response = network.getResponse(params,MANAGER_simpleInfo);
String mainImgUrl = response.jsonPath().getString("data.mainImgUrl");
String title = response.jsonPath().getString("data.title");
String infoDesc = response.jsonPath().getString("desc");
Assert.assertEquals(infoDesc,"OK",network.message(params,MANAGER_simpleInfo,"匹配内容失败",response.body().asString()));
//新增公司专区内容
Map<String,Object> addParams = new HashMap<>();
List list = new ArrayList();
list.add(589);
List tagList = new ArrayList();
tagList.add(list);
addParams.put("contentTag","");
addParams.put("customUrl","");
addParams.put("id","");
addParams.put("exclusiveAreaId",21);
addParams.put("itemId",9398);
addParams.put("itemType","article");
addParams.put("mainImgUrl",mainImgUrl);
addParams.put("sort",1);
addParams.put("tagList",tagList);
addParams.put("title",title);
System.out.println(addParams);
Response addRes = network.postResponse(addParams,MANAGER_itemAddOrUpdate);
String desc = addRes.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(addParams,MANAGER_itemAddOrUpdate,"新增公司专区内容失败",addRes.body().asString()));
}
//获取首页公司专区
@Test(description = "首页_公司专区列表",priority = 15)
public void 首页_公司专区列表(){
@Test(description = "首页_公司专区",priority = 19)
public void 首页_公司专区(){
Response response = network.getResponse(HOME_getExclusiveArea);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(HOME_getExclusiveArea,"获取公司专区列表失败",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(HOME_getExclusiveArea,"获取公司专区失败",response.body().asString()));
}
//管理后台新增成功案例
@Test(description = "管理后台_新增成功案例",priority = 15)
//获取公司首页公司专区列表 HOME_companyGetContentList
@Test(description = "首页_公司专区列表",priority = 20)
public void 首页_公司专区列表(){
//获取公司专区标签id
Response response = network.getResponse(Daily_getTagList);
Object id = response.jsonPath().getJsonObject("data.get(0).id");
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(Daily_getTagList,"获取标签id失败",response.body().asString()));
sleep(5000);
//获取专区列表
Map<String,Object> params = new HashMap<>();
params.put("firstTagId",id);
params.put("pageSize",20);
params.put("pageIndex",1);
params.put("source",1);
Response listRes = network.getResponse(params,HOME_companyGetContentList);
int totalCount = listRes.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount,2,network.message(params,HOME_companyGetContentList,"获取公司专区内容列表数据错误",listRes.body().asString()));
}
//管理后台删除文章
@Test(description = "管理后台_删除公司专区内容",priority = 21)
public void 管理后台_删除公司专区内容(){
//获取删除的内容的id
Map<String,Object> params = new HashMap<>();
params.put("exclusiveAreaId",21);
params.put("title","");
params.put("state",0);
params.put("pageNo",1);
params.put("pageSize",20);
Response listRes = network.getResponse(params,MANAGER_exclusiveItemPage);
Object id = listRes.jsonPath().getJsonObject("data.list.get(1).id");
String desc = listRes.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(params,MANAGER_exclusiveItemPage,"获取id失败",listRes.body().asString()));
//删除公司专区内容
Map<String,Object> delParams = new HashMap<>();
delParams.put("id",id);
Response delRes = network.getResponse(delParams,MANAGER_exclusiveItemDel);
String delDesc = delRes.jsonPath().getJsonObject("desc");
Assert.assertEquals(delDesc,"OK",network.message(delParams,MANAGER_exclusiveItemDel,"删除公司专区内容失败",delRes.body().asString()));
sleep(5000);
//验证删除是否成功
Response response = network.getResponse(Daily_getTagList);
Object tagId = response.jsonPath().getJsonObject("data.get(0).id");
Map<String,Object> paramsList = new HashMap<>();
paramsList.put("firstTagId",tagId);
paramsList.put("pageSize",20);
paramsList.put("pageIndex",1);
paramsList.put("source",1);
Response dataRes = network.getResponse(paramsList,HOME_companyGetContentList);
int totalCount = dataRes.jsonPath().getInt("data.totalCount");
Assert.assertEquals(totalCount,1,network.message(paramsList,HOME_companyGetContentList,"获取公司专区内容列表数据错误",dataRes.body().asString()));
}
//管理后台新增成功案例
@Test(description = "管理后台_新增成功案例",priority = 22)
public void 新增成功案例(){
//根据内容ID匹配内容标题
......@@ -283,7 +447,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(addSuccess, network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_获取成功案例列表",priority = 16)
@Test(description = "管理后台_获取成功案例列表",priority = 23)
public void 获取成功案例列表(){
Response response = network.getResponse(MANAGER_caseList);
Object list = response.jsonPath().getJsonObject("data.list");
......@@ -291,7 +455,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(list,network.message(MANAGER_caseList,"获取成功案例列表失败",response.body().asString()));
}
@Test(description = "管理后台_获取案例详情",priority = 17)
@Test(description = "管理后台_获取案例详情",priority = 24)
public void 获取案例详情(){
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
......@@ -300,7 +464,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(data,network.message(params,MANAGER_successCaseDetail,"获取案例详情失败",response.body().asString()));
}
@Test(description = "管理后台_编辑案例",priority = 18)
@Test(description = "管理后台_编辑案例",priority = 25)
public void 编辑案例(){
//编辑成功案例
Map<String,Object> params = new HashMap<>();
......@@ -319,7 +483,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(addSuccess, network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_上架/下架成功案例",priority = 19)
@Test(description = "管理后台_上架/下架成功案例",priority = 26)
public void 上架成功案例(){
//上架成功案例 status = 2
Map<String,Object> params = new HashMap<>();
......@@ -343,7 +507,7 @@ public class HomePage implements Authorization {
}
//个人中心—我的反馈
@Test(description = "个人中心_我的反馈",priority = 20)
@Test(description = "个人中心_我的反馈",priority = 27)
public void 我的反馈(){
//tku 切换为访客的
network.agentCookies.put("tku", VISITOR_TKU);
......@@ -359,7 +523,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(success,network.message(params,HOME_feedBackSave,"反馈意见提交成功",response.body().asString()));
}
//管理后台-集客助手反馈
@Test(description = "管理后台_集客助手反馈",priority = 21)
@Test(description = "管理后台_集客助手反馈",priority = 28)
public void 集客助手反馈结果(){
//验证管理后台是否接收到消息
Response manageRes = network.getResponse(MANAGER_feedBackList);
......@@ -370,7 +534,7 @@ public class HomePage implements Authorization {
//***********************文章配置素材*******************************
@Test(description = "代理人_访问文章未配置互动素材", priority = 26)
@Test(description = "代理人_访问文章未配置互动素材", priority = 29)
public void 代理人_访问文章未配置互动素材() {
agentTku();
Map<String, Object> params = new HashMap<String, Object>();
......@@ -389,7 +553,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(scid, network.message(params, GETSCID, "获取文章的scid失败", response.body().asString()));
}
@Test(description = "管理后台_新增互动方案", priority = 27)
@Test(description = "管理后台_新增互动方案", priority = 30)
public void 管理后台_新增互动方案() {
ssoLogin();
Map<String, Object> params = new HashMap<String, Object>();
......@@ -448,7 +612,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(activity2, network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_修改互动方案", priority = 28)
@Test(description = "管理后台_修改互动方案", priority = 31)
public void 管理后台_修改互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
......@@ -475,7 +639,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(activityName, "快来摆摊测试吧",network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_通过方案id查找方案是否存在", priority = 29)
@Test(description = "管理后台_通过方案id查找方案是否存在", priority = 32)
public void 管理后台_通过方案id查找方案是否存在() {
Map<String, Object> params = new HashMap<String, Object>();
//存在
......@@ -495,7 +659,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(data,null, network.message(params, MANAGER_activityName, "此方案存在", response.body().asString()));
}
@Test(description = "管理后台_新增文章关联互动方案", priority = 30)
@Test(description = "管理后台_新增文章关联互动方案", priority = 33)
public void 管理后台_新增文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
......@@ -527,7 +691,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(aolutionId, activity2,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_互动方案使用中会删除失败", priority = 31)
@Test(description = "管理后台_互动方案使用中会删除失败", priority = 34)
public void 管理后台_互动方案使用中会删除失败() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
......@@ -548,7 +712,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(data, network.message(params, MANAGER_solutionPageList, "有文章使用互动方案删除成功", response.body().asString()));
}
@Test(description = "代理人_访问文章新增配置互动素材", priority = 32)
@Test(description = "代理人_访问文章新增配置互动素材", priority = 35)
public void 代理人_访问文章新增配置互动素材() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -566,7 +730,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(activityId,answer2, network.message(params, ARTICLE_interact, "访问文章配置素材ID与实际配置不一致", response.body().asString()));
}
@Test(description = "管理后台_修改文章关联互动方案", priority = 33)
@Test(description = "管理后台_修改文章关联互动方案", priority = 36)
public void 管理后台_修改文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
......@@ -595,7 +759,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(aolutionId, activity1,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "代理人_访问文章修改配置互动素材并转发", priority = 34)
@Test(description = "代理人_访问文章修改配置互动素材并转发", priority = 37)
public void 代理人_访问文章修改配置互动素材并转发() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -624,7 +788,7 @@ public class HomePage implements Authorization {
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
}
@Test(description = "访客_访问文章并参与测评", priority = 34)
@Test(description = "访客_访问文章并参与测评", priority = 38)
public void 访客_访问文章并参与测评() {
//切换为新用户小葡萄,每次都会产生线索
network.agentCookies.put("tku", tku);
......@@ -691,7 +855,7 @@ public class HomePage implements Authorization {
Assert.assertTrue(result, network.message(params, GAME_sendInfoForRisk, "申请领取食谱失败", response.body().asString()));
}
@Test(description = "管理后台_删除文章关联互动方案", priority = 35)
@Test(description = "管理后台_删除文章关联互动方案", priority = 39)
public void 管理后台_删除文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("articleId", articleId);
......@@ -715,7 +879,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(size, 0, network.message(params, MANAGER_articlePageList, "删除失败", response.body().asString()));
}
@Test(description = "代理人_访问文章删除配置互动素材", priority = 36)
@Test(description = "代理人_访问文章删除配置互动素材", priority = 40)
public void 代理人_访问文章删除配置互动素材() {
agentTku();
sleep(10000);
......@@ -728,7 +892,7 @@ public class HomePage implements Authorization {
Assert.assertEquals(size, 0, network.message(params, ARTICLE_interact, "返回数据不为空", response.body().asString()));
}
@Test(description = "管理后台_删除互动方案成功", priority = 37)
@Test(description = "管理后台_删除互动方案成功", priority = 41)
public void 管理后台_删除互动方案成功() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity1);
......
......@@ -33,6 +33,7 @@ public class Agent implements Authorization {
public String jobNumber;
public String teamName;
public String sellerName;
public static String encodeAgentId;
@BeforeClass
public void setUp() { agentAuth(); }
......@@ -44,6 +45,8 @@ public class Agent implements Authorization {
System.out.println(response.body().asString());
Object jobNumber = response.jsonPath().getJsonObject("data.jobNumber");
Assert.assertNotNull(jobNumber, network.message(params, BasicConfig.MOBILE_userInfo1, "用户非代理人", response.body().asString()));
encodeAgentId = response.jsonPath().getString("data.agentId");
}
......@@ -448,6 +451,7 @@ public class Agent implements Authorization {
params.put("shortType",2);
Response response =null;
for (int i = 0; i < 10; i++) {
ThreadSleepUtils.sleep(1000);
response = network.postResponse(params,MOBILE_getShortUrl);
String data = response.jsonPath().getString("data");
System.out.println(data);
......
......@@ -26,9 +26,9 @@ public class LiveBefore implements Authorization {
int allNum = response.jsonPath().getInt("data.allNum");
Assert.assertTrue(allNum>0, network.message(params, BasicConfig.MOBILE_customerStat, "客户总数为null", response.body().asString()));
int newCustomNum = response.jsonPath().getInt("data.newCustomNum");
Assert.assertTrue(newCustomNum>0, network.message(params, BasicConfig.MOBILE_customerStat, "新客户数量未null", response.body().asString()));
Assert.assertTrue(newCustomNum>0, network.message(params, BasicConfig.MOBILE_customerStat, "老客户数量为null", response.body().asString()));
int oldCustomNum = response.jsonPath().getInt("data.oldCustomNum");
Assert.assertTrue(oldCustomNum>0, network.message(params, BasicConfig.MOBILE_customerStat, "老客户数量null", response.body().asString()));
Assert.assertTrue(oldCustomNum>0, network.message(params, BasicConfig.MOBILE_customerStat, "老客户数量null", response.body().asString()));
}
......
......@@ -329,4 +329,28 @@ public class LiveLater implements Authorization {
System.out.println(clueList);
Assert.assertNotNull(clueList,network.message(params,BasicConfig.MOBILE_clueChanceList,"跟进机会获取失败",response.body().asString()));
}
// 直播结束页
@Test(description = "本场直播线索统计", priority = 19)
public void 本场直播线索统计() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = null;
int liveStatus;
try {
for (int i = 0; i < 10; i++){
response = network.getResponse(params, BasicConfig.AGENT_liveEnd);
liveStatus = response.jsonPath().getInt("data.liveStatus");
System.out.println(liveStatus);
if (liveStatus == 5) break;
}
System.out.println(response.body().asString());
int lotteryCount = response.jsonPath().getInt("data.lotteryCount");
int submitFormCount = response.jsonPath().getInt("data.submitFormCount");
Assert.assertTrue(lotteryCount > 0, network.message(params, BasicConfig.AGENT_liveEnd, "直播内中奖用户数错误", response.body().asString()));
Assert.assertTrue(submitFormCount > 0, network.message(params, BasicConfig.AGENT_liveEnd, "直播内提交表单用户数错误", response.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
}
......@@ -26,6 +26,7 @@ public class LiveVisitors implements Authorization
public String confId_free;
public String id;
public List<ResourcePushList>PushList;
public static String resourceReceiveRecordId;
/*助播端端权益列表*/
@Test(description = "助播端权益列表", priority = 1)
......@@ -168,6 +169,8 @@ public class LiveVisitors implements Authorization
Response response = network.getResponse(params, BasicConfig.MOBILE_Link);
boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BasicConfig.MOBILE_Link,"领取免费领资料失败",response.body().asString()));
resourceReceiveRecordId = response.jsonPath().getString("data");
}
/*访客端链接小程序资料-查询*/
......@@ -366,4 +369,14 @@ public class LiveVisitors implements Authorization
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agreeStatus, "客跟进机会同意状态为false", response.body().asString()));
}
@Test(description = "访客端获取直播间实时数据", priority = 23)
public void 访客端获取直播间实时数据(){
Map<String, Object> clueInfoDataPar = new HashMap<>();
clueInfoDataPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response clueInfoDataRes = network.getResponse(clueInfoDataPar, BasicConfig.USER_clueInfoData);
Assert.assertTrue(clueInfoDataRes.jsonPath().getBoolean("success"), network.message(clueInfoDataPar, BasicConfig.USER_clueInfoData, "接口调用失败", clueInfoDataRes.body().asString()));
Object data = clueInfoDataRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(clueInfoDataPar, BasicConfig.USER_clueInfoData, "获取直播间实时数据失败", clueInfoDataRes.body().asString()));
}
}
package com.kjj.cases.live.customer;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.agent.Agent;
import com.kjj.cases.live.lottery.Lottery;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class AfterLive implements Authorization {
private Map<String, Object> params;
private String encodeLiveId;
@BeforeClass
public void SetUp(){ visitorAuth(); }
// 获取访客直播结束页样式
@Test(description = "获取访客直播结束页样式", priority = 1)
public void 获取访客直播结束页样式(){
encodeLiveId = LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()); // 获取直播ID
params = new HashMap<>();
params.put("liveId", encodeLiveId);
Response response = network.getResponse(params, BasicConfig.USER_liveEnd);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_liveEnd, "接口调用失败", response.body().asString()));
System.out.println(response.body().asString());
String welfareName = response.jsonPath().getString("data.welfareName");
Assert.assertEquals(welfareName, Lottery.welfareName, network.message(params, BasicConfig.USER_liveEnd, "展示奖品名称与实际中奖不符", response.body().asString()));
}
// 查询访客预约状态
@Test(description = "查询访客预约状态", priority = 2)
public void 查询访客预约状态(){
params.clear();
params.put("bizId", encodeLiveId);
params.put("bizType", 3);
Response response = network.getResponse(params, BasicConfig.USER_Appointment);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_Appointment, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params, BasicConfig.USER_Appointment, "返回预约状态失败", response.body().asString()));
}
// 获取代理人二维码信息
@Test(description = "获取代理人二维码信息", priority = 3)
public void 获取代理人二维码信息() {
params.clear();
params.put("agentId", Agent.encodeAgentId);
Response response = network.getResponse(params, BasicConfig.USER_getAgentQrCode);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_getAgentQrCode, "接口请求失败", response.body().asString()));
int pollingResult = response.jsonPath().getInt("data.pollingResult");
while (pollingResult == 2){
response = network.getResponse(params, BasicConfig.USER_getAgentQrCode);
pollingResult = response.jsonPath().getInt("data.pollingResult");
}
Object syntheticAvatar = response.jsonPath().getJsonObject("data.syntheticAvatar");
Assert.assertNotNull(syntheticAvatar, network.message(params, BasicConfig.USER_getAgentQrCode, "轮训代理人二维码失败", response.body().asString()));
}
}
package com.kjj.cases.live.customer;
import com.kjj.bean.whoSawMe.LiveList;
import com.kjj.bean.whoSawMe.ResourceList;
import com.kjj.bean.whoSawMe.WelfareList;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.anchor.LiveVisitors;
import com.kjj.cases.live.lottery.Lottery;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PersonalPage implements Authorization {
private Map<String, Object> params;
private String companyName; // 最近观看公司名称
private String encodeCompanyId; // 加密的公司id
private String welfareRecordId; // 福利领取记录id
private String sourceRecordId; // 资料领取记录id
@BeforeClass
public void setUp(){visitorAuth();
BaseUtils.ssoLogin();
}
// 个人首页
@Test(description = "访客查看我的福利", priority = 4)
public void 访客查看我的福利() {
params = new HashMap<>();
params.put("pageSize", 10);
params.put("pageIndex", 1);
Response response = network.getResponse(params, BasicConfig.USER_welfareList);
System.out.println("访客福利列表:" + response.body().asString());
List<WelfareList> welfareLists = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
// WelfareList welfareList = welfareLists.get(0);
// Assert.assertEquals(welfareList.getLiveId(), LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_welfareList, "最新福利对应直播id不正确", response.body().asString()));
Map<String, Object> getLotteryDetailPar = new HashMap<>();
getLotteryDetailPar.put("confId", Lottery.lotteryConfId);
Response getLotteryDetailRes = network.getResponse(getLotteryDetailPar, BasicConfig.USER_findLottryDetail);
welfareRecordId = getLotteryDetailRes.jsonPath().getString("data.recordId");
Assert.assertNotNull(welfareRecordId, network.message(getLotteryDetailPar, BasicConfig.USER_findLottryDetail, "获取福利领取记录id获取失败", getLotteryDetailRes.body().asString()));
// Assert.assertEquals(welfareList.getRecordId(), welfareRecordId, network.message(params, BasicConfig.USER_welfareList, "最新福利对应领取记录id不正确", response.body().asString()));
boolean hasRecord = false;
for (WelfareList welfareList : welfareLists){
if(welfareList.getLiveId().equals(LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()))){
System.out.println("本场直播获得福利有:" + welfareList);
if (welfareList.getRecordId().equals(welfareRecordId)){ hasRecord = true; }
}
}
Assert.assertTrue(hasRecord, network.message(params, BasicConfig.USER_welfareList, "上场直播有抽奖福利未记录", response.body().asString()));
}
@Test(description = "访客查看我的资料", priority = 5)
public void 访客查看我的资料() {
System.out.println("params:" + params);
Response response = network.getResponse(params, BasicConfig.USER_resourceList);
System.out.println("访客资料列表: " + response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_resourceList, "接口调用失败", response.body().asString()));
List<ResourceList> resourceLists = JsonUtil.parseResponseToPageBean(response, ResourceList.class);
ResourceList resourceList = resourceLists.get(0);
sourceRecordId = resourceList.getRecordId();
Assert.assertEquals(sourceRecordId, LiveVisitors.resourceReceiveRecordId, network.message(params, BasicConfig.USER_resourceList, "资料领取记录id不正确", response.body().asString()));
String liveId = resourceList.getLiveId();
Assert.assertEquals(liveId, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_resourceList, "资料领取直播id不正确", response.body().asString()));
companyName = resourceList.getCompanyName(); // 获取领取资料的公司名称
}
@Test(description = "获取访客最近观看的公司", priority = 6)
public void 获取访客最近观看的公司() {
// 管理后台根据公司名称查询公司id
Map<String, Object> searchCompanyPar = new HashMap<>();
searchCompanyPar.put("companyName", companyName);
Response searchCompanyRes = network.getResponse(searchCompanyPar, BasicConfig.MANAGER_searchCompany);
Assert.assertTrue(searchCompanyRes.jsonPath().getBoolean("success"), network.message(searchCompanyPar, BasicConfig.MANAGER_searchCompany, "接口调用失败", searchCompanyRes.body().asString()));
long companyId = searchCompanyRes.jsonPath().getInt("data[0].id");
// 加密公司id
String companyIdEncode = IdMakeUtil.managerEncodingId(companyId);
Response response = network.getResponse(BasicConfig.USER_lastCompany);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_lastCompany, "接口请求失败", response.body().asString()));
encodeCompanyId = response.jsonPath().getString("data.companyId");
Assert.assertEquals(encodeCompanyId, companyIdEncode, network.message(BasicConfig.USER_lastCompany, "访客最近观看公司id错误", response.body().asString()));
}
// 访客主页视角
@Test(description = "访客视角查看公司详情", priority = 7)
public void 访客视角查看公司详情(){
params.clear();
params.put("companyId", encodeCompanyId);
Response getCompanyDetailRes = network.getResponse(params, BasicConfig.USER_getCompanyInfo);
Assert.assertTrue(getCompanyDetailRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_getCompanyInfo, "接口请求失败", getCompanyDetailRes.body().asString()));
Object data = getCompanyDetailRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params, BasicConfig.USER_getCompanyInfo, "查看公司详情失败", getCompanyDetailRes.body().asString()));
}
@Test(description = "查看公司直播列表", priority = 8)
public void 查看公司直播列表(){
// 访客端查看公司正在直播列表
params.clear();
params.put("companyId", encodeCompanyId);
params.put("searchType", 1);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response liveOnListRes = network.getResponse(params, BasicConfig.USER_getLiveList);
Assert.assertTrue(liveOnListRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_getLiveList, "接口请求失败", liveOnListRes.body().asString()));
boolean hasLiveOn = true;
try {
List liveList = liveOnListRes.jsonPath().getList("data.list");
if (liveList.size() == 0){
hasLiveOn = false;
}
Assert.assertTrue(hasLiveOn, network.message(params, BasicConfig.USER_getLiveList, "公司无未结束直播", liveOnListRes.body().asString()));
} catch (NullPointerException e){
System.out.println("接口返回数据为空");
e.printStackTrace();
}
}
@Test(description = "获取公司已结束直播列表", priority = 9)
public void 获取公司已结束直播列表() {
params.clear();
params.put("companyId", encodeCompanyId);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response liveOffListRes = network.getResponse(params, BasicConfig.USER_getLiveOverList);
Assert.assertTrue(liveOffListRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_getLiveOverList,"接口请求失败", liveOffListRes.body().asString()));
try {
List<LiveList> liveLists = JsonUtil.parseResponseToPageBean(liveOffListRes, LiveList.class);
LiveList liveList = liveLists.get(0);
String liveId = liveList.getLiveId();
Assert.assertEquals(liveId, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_getLiveOverList, "最近一场直播id错误", liveOffListRes.body().asString()));
}catch (Exception e){
e.printStackTrace();
}
}
@Test(description = "获取公司首页分享信息", priority = 10)
public void 获取公司首页分享信息() {
params.clear();
params.put("companyId", encodeCompanyId);
Response companyShareInfoRes = network.getResponse(params, BasicConfig.USER_companyShareInfo);
Assert.assertTrue(companyShareInfoRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_companyShareInfo, "接口请求失败", companyShareInfoRes.body().asString()));
Object data = companyShareInfoRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params, BasicConfig.USER_companyShareInfo, "生成分享卡片失败", companyShareInfoRes.body().asString()));
}
/*
精彩视频
*/
@Test(description = "精彩视频包含代理人卡片信息", priority = 11)
public void 精彩视频包含代理人卡片信息() {
params.clear();
params.put("companyId", encodeCompanyId);
Response response = network.getResponse(params, BasicConfig.USER_videoAgentCard);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_videoAgentCard, "接口请求失败", response.body().asString()));
try {
String agentName = response.jsonPath().getString("data.name");
Assert.assertEquals(agentName, "线索员", network.message(params, BasicConfig.USER_videoAgentCard, "代理人id错误", response.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
@Test(description = "获取公司最近一场直播中直播", priority = 12)
public void 获取公司最近一场直播中直播() {
Response getLivingRes = network.getResponse(params, BasicConfig.USER_companyLiving);
Assert.assertTrue(getLivingRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_companyLiving, "接口请求失败", getLivingRes.body().asString()));
Object data = getLivingRes.jsonPath().getJsonObject("data");
if(data == null){ System.out.println("无正在直播中直播");}
else {System.out.println(data);}
}
@Test(description = "查看福利详情", priority = 13)
public void 查看福利详情() {
params.clear();
params.put("recordId", welfareRecordId);
Response welfareDetailRes = network.getResponse(params, BasicConfig.USER_welfareDetail);
Assert.assertTrue(welfareDetailRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_welfareDetail, "接口请求失败", welfareDetailRes.body().asString()));
try {
String confId = welfareDetailRes.jsonPath().getString("data.confId");
String liveId = welfareDetailRes.jsonPath().getString("data.liveId");
Assert.assertEquals(confId, Lottery.lotteryConfId, network.message(params, BasicConfig.USER_welfareDetail, "福利配置id错误", welfareDetailRes.body().asString()));
Assert.assertEquals(liveId, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_welfareDetail, "福利记录对应直播id错误", welfareDetailRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
@Test(description = "查看资料详情", priority = 14)
public void 查看资料详情() {
params.clear();
params.put("recordId", sourceRecordId);
Response resourceDetailRes = network.getResponse(params, BasicConfig.USER_sourceDetail);
Assert.assertTrue(resourceDetailRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_sourceDetail, "接口请求失败", resourceDetailRes.body().asString()));
try {
String liveId = resourceDetailRes.jsonPath().getString("data.liveId");
Assert.assertEquals(liveId, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
}
......@@ -20,6 +20,8 @@ public class Lottery implements Authorization {
public List<ConfIdList> List_ConfId;
public String shareSign;
public static String welfareName;
public static String lotteryConfId;
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
......@@ -103,6 +105,8 @@ public class Lottery implements Authorization {
System.out.println(data);
Assert.assertNotNull(data, network.message(infoParam, BasicConfig.USER_info, "获取正在抽奖的福利失败", infoRes.body().asString()));
welfareName = infoRes.jsonPath().getString("data.welfareName");
lotteryConfId = infoRes.jsonPath().getString("data.confId");
}
......
......@@ -225,6 +225,9 @@ public class BasicConfig {
public static final String MANAGER_videoSwitch = MANAGER_HOST + "/kjy/manager/live/trans/video/conf/status/switch";
public static final String MANAGER_videoDetail = MANAGER_HOST + "/kjy/manager/live/trans/video/conf/detail";
// *************** 新版预告页 ***************
// *************** 猜数字红包 ***************
public static final String MANAGER_getSurplusAmount = MANAGER_HOST + "/kjy/manager/red/conf/getSurplusAmount";
public static final String MANAGER_saveOrUpdate1 = MANAGER_HOST + "/kjy/manager/red/guess/saveOrUpdate";
......@@ -341,6 +344,24 @@ public class BasicConfig {
public static final String USER_savePoster = MOBILE_HOST + "/kjy/live/user/share/savePoster";
public static final String USER_myCount = MOBILE_HOST + "/kjy/live/user/lottery/myCount";
public static final String USER_wxIdAllList = HOST + "/kjy/mp/msg/config/live/user/wxIdAllList";
public static final String USER_Appointment = MOBILE_HOST + "/kjy/live/user/appointment/find";
public static final String USER_clueInfoData = MOBILE_HOST + "/clue/info/data";
public static final String USER_getAgentQrCode = MOBILE_HOST + "/kjy/live/agent/getAgentQrCode";
public static final String USER_findLottryDetail = MOBILE_HOST + "/kjy/live/user/lottery/findDetailByConfId";
// 直播结束
public static final String USER_liveEnd = MOBILE_HOST + "/kjy/live/user/liveEnd";
// *************** 个人主页 ***************
public static final String USER_welfareList = MOBILE_HOST + "/kjy/live/user/welfare/getList";
public static final String USER_resourceList = MOBILE_HOST + "/kjy/live/user/resource/getResourceList";
public static final String USER_lastCompany = MOBILE_HOST + "/kjy/live/user/index/latest";
public static final String USER_getCompanyInfo = MOBILE_HOST + "/kjy/live/company/getLiveInfo";
public static final String USER_getLiveList = MOBILE_HOST + "/kjy/live/company/userLiveList";
public static final String USER_companyShareInfo = MOBILE_HOST + "/kjy/live/company/getHomeShareInfo";
public static final String USER_getLiveOverList = MOBILE_HOST + "/kjy/live/company/userLiveEndList";
public static final String USER_videoAgentCard = MOBILE_HOST + "/kjy/live/card/user/video";
public static final String USER_companyLiving = MOBILE_HOST + "/kjy/live/company/living";
public static final String USER_welfareDetail = MOBILE_HOST + "/kjy/live/user/welfare/findDetailByRecordId";
public static final String USER_sourceDetail = MOBILE_HOST + "/kjy/live/user/resource/findDetailByRecordId";
// *************** 直播管理端 ***************
public static final String MANAGER_saveAndUpdate_0 = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......@@ -447,6 +468,9 @@ public class BasicConfig {
public static final String MOBILE_clueList = MOBILE_HOST + "/kjy/live/agent/clue/list";
public static final String MOBILE_livingClueStatistic = MOBILE_HOST + "/kjy/live/agent/clue/livingClueStatistic";
//直播结束页
public static final String AGENT_liveEnd = MOBILE_HOST + "/kjy/live/agent/liveEnd";
//排行榜
public static final String MOBILE_allRewardList = MOBILE_HOST + "/kjy/live/reward/allRewardList";
public static final String MOBILE_companyTotalData = MOBILE_HOST + "/kjy/live/team/companyTotalData";
......@@ -875,6 +899,8 @@ public class BasicConfig {
public static final String HOME_dailyProgress = HOST + "/kjy/mp/clockIn/task/dailyProgress";
public static final String HOME_statistic = HOST + "/kjy/mp/clockIn/task/statistic";
public static final String HOME_record = HOST + "/kjy/mp/clockIn/task/record";
public static final String HOME_getGrassTagByName = HOST + "/kjy/mp/grassContent/getGrassTagByName";
public static final String HOME_companyGetContentList = HOST + "/kjy/mp/companyArea/getContentList";
//******************个人中心**********************
public static final String USINGSTRATAGY_index = HOST + "/kjy/mp/usingStrategy/index";
public static final String USINGSTRATAGY_strategyList = HOST + "/kjy/mp/usingStrategy/strategyList";
......@@ -1042,4 +1068,11 @@ public class BasicConfig {
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";
public static final String MANAGER_grassContentEdit = MANAGER_HOST + "/kjy/manager/grassContent/edit";
public static final String MANAGER_videoOpen = MANAGER_HOST + "/kjy/manager/content/video/open";
public static final String MANAGER_simpleInfo = MANAGER_HOST + "/kjy/manager/content/simpleInfo";
public static final String MANAGER_itemAddOrUpdate = MANAGER_HOST + "/kjy/manager/exclusiveItem/addOrUpdate";
public static final String MANAGER_exclusiveItemPage = MANAGER_HOST + "/kjy/manager/exclusiveItem/page";
public static final String MANAGER_exclusiveItemDel = MANAGER_HOST + "/kjy/manager/exclusiveItem/del";
public static final String MANAGER_searchCompany = MANAGER_HOST + "/kjy/manager/live/company/search";
}
package com.kjj.utils;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.testng.Assert;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
/**
* Created by dugq on 2019-10-23.
......@@ -16,7 +22,7 @@ import java.util.Base64;
* base64加密效率: 加密 1 - 2千万 1s以内完成
*/
public class IdMakeUtil {
public class IdMakeUtil implements Authorization {
private static final Base64.Encoder encoder = Base64.getEncoder();
private static final Base64.Decoder decoder = Base64.getDecoder();
......@@ -46,5 +52,15 @@ public class IdMakeUtil {
}
}
public static String managerEncodingId(long id) {
BaseUtils.ssoLogin();
Map<String, Object> ids = new HashMap<>();
ids.put("code", id);
Response encodeIdRes = network.getResponse(ids, BasicConfig.MANAGER_ID_ENCODE);
String encodeId = encodeIdRes.jsonPath().getString("data");
Assert.assertNotNull(encodeId, network.message(ids, BasicConfig.MANAGER_ID_ENCODE, "加密id失败", encodeIdRes.body().asString()));
return encodeId;
}
}
......@@ -207,5 +207,16 @@
<class name="com.kjj.cases.live.agent.Customer"/>
</classes>
</test>
<test preserve-order="true" name="访客端直播结束页">
<classes>
<class name="com.kjj.cases.live.customer.AfterLive" />
</classes>
</test>
<test preserve-order="true" name="访客端个人主页">
<classes>
<class name="com.kjj.cases.live.customer.PersonalPage" />
</classes>
</test>
</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