Commit dc993508 authored by 别湘灵's avatar 别湘灵

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/test/liveTestNG.xml
parents c017c078 73cb6da5
package com.kjj.bean;
import lombok.Data;
@Data
public class ConfidList {
private String welfareConfId;
}
package com.kjj.bean;
import lombok.Data;
import java.util.List;
@Data
public class LotteryList {
private List<List_Lottery> LotteryList;
private String welfareId;
private String configId;
@Data
public static class List_Lottery
{
private String id;
private String name;
}
}
package com.kjj.cases.basics;
public class Video {
}
......@@ -24,14 +24,25 @@ public interface AdminAuthorization {
// 创建用户 并传到network里
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
/**
* 访客授权
* 访客(嘿保险)授权
*/
}
default void visitorAuth() {
network.agentCookies.put("authKey", VISITORKEY);
System.out.println("用户AUTH_KEY:" + VISITORKEY);
}
/**
* 访客(🍗)授权
*/
default void visitorAuth2() {
network.agentCookies.put("authKey", VISITORKEY1);
System.out.println("用户AUTH_KEY:" + VISITORKEY1);
}
}
package com.kjj.cases.live;
import com.kjj.bean.LotteryList;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DesignatedWinner implements AdminAuthorization{
@BeforeClass
public void setUp() {
public List<LotteryList.List_Lottery> List_Lottery;
public List<LotteryList> welfareId;
@Test(description = "直播前获取权益列表", priority = 1)
public void 直播前获取权益列表() {
adminAuth();
Map<String, Object> List4AdminParam = new HashMap<>();
List4AdminParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List4AdminParam.put("welfareType",6);
List4AdminParam.put("pageIndex",1);
List4AdminParam.put("pageSize",50);
Response List4AdminRes = network.getResponse(List4AdminParam, BasicConfig.ANCHOR_getList4Admin);
Object data = List4AdminRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<LotteryList.List_Lottery> list= JsonUtil.parseResponseToPageBean(List4AdminRes,LotteryList.List_Lottery.class);
System.out.println(list);
this.List_Lottery=list;
Assert.assertNotNull(list, network.message(List4AdminParam, BasicConfig.ANCHOR_getList4Admin, "获取权益列表失败", List4AdminRes.body().asString()));
}
@Test(description = "新增直播前抽奖配置", priority = 2)
public void 新增直播前抽奖配置() {
adminAuth();
Map<String, Object> preAddParam = new HashMap<>();
preAddParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
preAddParam.put("welfareId",this.List_Lottery.get(3).getId());
preAddParam.put("showInteractNum",20);
preAddParam.put("interactNum",20);
long startTime = DateUtils.addHours(new Date(), 3).getTime();
preAddParam.put("startTime", startTime);
Response preAddRes = network.postResponse(preAddParam, BasicConfig.ANCHOR_preAdd);
Object data = preAddRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(preAddParam, BasicConfig.ANCHOR_preAdd, "新增直播前抽奖配置失败", preAddRes.body().asString()));
}
@Test(description = "查询新增直播前抽奖配置", priority = 3)
public void 查询新增直播前抽奖配置() {
adminAuth();
Map<String, Object> preListParam = new HashMap<>();
preListParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response preListRes = network.getResponse(preListParam, BasicConfig.ANCHOR_List);
List<LotteryList> list2= JsonUtil.parseResponseToListBean(preListRes,LotteryList.class);
this.welfareId=list2;
System.out.println(list2);
Assert.assertNotNull(list2, network.message(preListParam, BasicConfig.ANCHOR_List, "查询新增直播前抽奖配置失败", preListRes.body().asString()));
}
@Test(description = "修改直播前抽奖配置", priority = 4)
public void 修改直播前抽奖配置() {
adminAuth();
Map<String, Object> preAddParam = new HashMap<>();
preAddParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
preAddParam.put("welfareId",this.welfareId.get(0).getWelfareId());
preAddParam.put("configId",this.welfareId.get(0).getConfigId());
preAddParam.put("showInteractNum",20);
preAddParam.put("interactNum",20);
long startTime = DateUtils.addHours(new Date(), 3).getTime();
preAddParam.put("startTime", startTime);
Response preAddRes = network.postResponse(preAddParam, BasicConfig.ANCHOR_preModify);
boolean success = preAddRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(preAddParam, BasicConfig.ANCHOR_preModify, "修改直播前抽奖配置失败", preAddRes.body().asString()));
}
@Test(description = "删除直播前抽奖配置", priority = 5)
public void 删除直播前抽奖配置() {
adminAuth();
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
addParam.put("configId",this.welfareId.get(0).getConfigId());
Response addRes = network.postResponse(addParam, BasicConfig.ANCHOR_preDelete);
boolean success = addRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(addParam, BasicConfig.ANCHOR_preDelete, "删除直播前抽奖配置失败", addRes.body().asString()));
}
@Test(description = "获取直播中权益列表", priority = 6)
public void 获取直播中权益列表() {
adminAuth();
Map<String, Object> List4AdminParam = new HashMap<>();
List4AdminParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List4AdminParam.put("welfareType",6);
List4AdminParam.put("pageIndex",1);
List4AdminParam.put("pageSize",50);
Response List4AdminRes = network.getResponse(List4AdminParam, BasicConfig.ANCHOR_getList4Admin);
Object data = List4AdminRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<LotteryList.List_Lottery> list= JsonUtil.parseResponseToPageBean(List4AdminRes,LotteryList.List_Lottery.class);
System.out.println(list);
this.List_Lottery=list;
Assert.assertNotNull(list, network.message(List4AdminParam, BasicConfig.ANCHOR_getList4Admin, "获取直播中权益列表失败", List4AdminRes.body().asString()));
}
@Test(description = "添加直播中抽奖配置", priority = 7)
public void 添加直播中抽奖配置() {
adminAuth();
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
addParam.put("lotteryType",1);
addParam.put("welfareId",this.List_Lottery.get(0).getId());
addParam.put("afterMin",20);
addParam.put("showInteractNum",200);
addParam.put("interactNum",200);
Response addRes = network.postResponse(addParam, BasicConfig.ANCHOR_add);
Object data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(addParam, BasicConfig.ANCHOR_add, "添加直播中抽奖配置失败", addRes.body().asString()));
}
@Test(description = "查询新增直播中抽奖配置列表", priority = 8)
public void 查询新增直播中抽奖配置列表() {
adminAuth();
Map<String, Object> list1Param = new HashMap<>();
list1Param.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response list1Res = network.getResponse(list1Param, BasicConfig.ANCHOR_list1);
Object data = list1Res.jsonPath().getJsonObject("data");
System.out.println(data);
List<LotteryList> list1= JsonUtil.parseResponseToListBean(list1Res,LotteryList.class);
this.welfareId=list1;
Assert.assertNotNull(list1, network.message(list1Param, BasicConfig.ANCHOR_list1, "查询直播中抽奖配置失败", list1Res.body().asString()));
}
@Test(description = "修改直播中抽奖配置", priority = 9)
public void 修改直播中抽奖配置() {
adminAuth();
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
addParam.put("welfareId",this.welfareId.get(3).getWelfareId());
addParam.put("configId",this.welfareId.get(3).getConfigId());
addParam.put("afterMin",30);
addParam.put("showInteractNum",200);
addParam.put("interactNum",200);
Response addRes = network.postResponse(addParam, BasicConfig.ANCHOR_Modify);
boolean success = addRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertNotNull(success, network.message(addParam, BasicConfig.ANCHOR_Modify, "修改直播中抽奖配置失败", addRes.body().asString()));
}
@Test(description = "删除直播中抽奖配置", priority = 10)
public void 删除直播中抽奖配置() {
adminAuth();
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
addParam.put("configId",this.welfareId.get(3).getConfigId());
Response addRes = network.postResponse(addParam, BasicConfig.ANCHOR_delete);
boolean success = addRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(addParam, BasicConfig.ANCHOR_delete, "删除直播中抽奖配置失败", addRes.body().asString()));
}
@Test(description = "根据直播间id查询指定中奖配置", priority = 11)
public void 根据直播间id查询指定中奖配置() {
adminAuth();
Map<String, Object> SpecifyAwardConfParam = new HashMap<>();
SpecifyAwardConfParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response SpecifyAwardConfRes = network.getResponse(SpecifyAwardConfParam, BasicConfig.MOBILE_getSpecifyAwardConf);
Object data = SpecifyAwardConfRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(SpecifyAwardConfParam, BasicConfig.MOBILE_getSpecifyAwardConf, "根据直播间id查询指定中奖配置失败", SpecifyAwardConfRes.body().asString()));
}
@Test(description = "根据直播间id查询代理人参与条件", priority = 12)
public void 根据直播间id查询代理人参与条件() {
adminAuth();
Map<String, Object> AgentParticipateCondParam = new HashMap<>();
AgentParticipateCondParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response AgentParticipateCondRes = network.getResponse(AgentParticipateCondParam, BasicConfig.MOBILE_getAgentParticipateCond);
Object data = AgentParticipateCondRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(AgentParticipateCondParam, BasicConfig.MOBILE_getAgentParticipateCond, "根据直播间id查询代理人参与条件失败", AgentParticipateCondRes.body().asString()));
}
@Test(description = "根据直播id查询抽奖奖品列表", priority = 13)
public void 根据直播id查询抽奖奖品列表() {
adminAuth();
Map<String, Object> LiveAwardListParam = new HashMap<>();
LiveAwardListParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response LiveAwardListRes = network.getResponse(LiveAwardListParam, BasicConfig.MOBILE_getLiveAwardList);
Object data = LiveAwardListRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(LiveAwardListParam, BasicConfig.MOBILE_getLiveAwardList, "根据直播id查询抽奖奖品列表失败", LiveAwardListRes.body().asString()));
}
@Test(description = "获取直播状态", priority = 14)
public void 获取直播状态() {
agentAuth();
Map<String, Object> statusParam = new HashMap<>();
statusParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response statusRes = network.getResponse(statusParam, BasicConfig.MOBILE_status1);
Map<String, Object> data = statusRes.jsonPath().getJsonObject("data");
System.out.println(data);
int liveStatus = (int) data.get("liveStatus");
boolean lotteryFlag = (boolean)data.get("lotteryFlag");
Assert.assertEquals(liveStatus,1, network.message(statusParam, BasicConfig.MOBILE_status1, "直播状态查询失败", statusRes.body().asString()));
Assert.assertTrue(lotteryFlag, network.message(statusParam, BasicConfig.MOBILE_status1, "抽奖标记为false", statusRes.body().asString()));
}
@Test(description = "查询指定中奖配置", priority = 1)
@Test(description = "查询指定中奖配置", priority = 15)
public void 查询指定中奖配置() {
agentAuth();
Map<String, Object> awardConfParam = new HashMap<>();
awardConfParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response awardConfRes = network.getResponse(awardConfParam, BasicConfig.MOBILE_AgentSpecifyAwardConf);
......@@ -24,19 +229,66 @@ public class DesignatedWinner implements AdminAuthorization{
Assert.assertNotNull(data, network.message(awardConfParam, BasicConfig.MOBILE_AgentSpecifyAwardConf, "中奖配置查询失败", awardConfRes.body().asString()));
}
@Test(description = "查询指定中奖用户列表", priority = 16)
public void 查询指定中奖用户列表() {
agentAuth();
Map<String, Object> UserSelectListParam = new HashMap<>();
UserSelectListParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response UserSelectListRes = network.getResponse(UserSelectListParam, BasicConfig.MOBILE_SpecifyAwardUserSelectList);
Object data = UserSelectListRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(UserSelectListParam, BasicConfig.MOBILE_SpecifyAwardUserSelectList, "查询指定中奖用户失败", UserSelectListRes.body().asString()));
}
@Test(description = "代理人指定访客中奖表单提交", priority = 17)
public void 代理人指定访客中奖表单提交() {
Map<String, Object> SubmitParam = new HashMap<>();
SubmitParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
SubmitParam.put("visitorId","Kj22NzI2Mw");
Response SubmitRes = network.postResponse(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit);
Object data = SubmitRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit, "代理人指定中奖提交失败", SubmitRes.body().asString()));
// @Test(description = "代理人指定访客中奖表单提交", priority = 2)
// public void 代理人指定访客中奖表单提交() {
// Map<String, Object> SubmitParam = new HashMap<>();
// SubmitParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// SubmitParam.put("visitorId","Kj21NDE0NTU");
//
// Response SubmitRes = network.getResponse(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit);
// Object data = SubmitRes.jsonPath().getJsonObject("data");
// System.out.println(data);
// Assert.assertNotNull(data, network.message(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit, "代理人指定中奖失败", SubmitRes.body().asString()));
//
// }
}
@Test(description = "被代理人指定中奖的用户列表", priority = 18)
public void 被代理人指定中奖的用户列表() {
agentAuth();
Map<String, Object> AwardUserListParam = new HashMap<>();
AwardUserListParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response AwardUserListRes = network.getResponse(AwardUserListParam, BasicConfig.MOBILE_agentSpecifyAwardUserList);
Object data = AwardUserListRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(AwardUserListParam, BasicConfig.MOBILE_agentSpecifyAwardUserList, "查询指定中奖用户列表失败", AwardUserListRes.body().asString()));
}
@Test(description = "代理人指定中奖信息查询", priority = 19)
public void 代理人指定中奖信息查询() {
agentAuth();
Map<String, Object> AwardInfoParam = new HashMap<>();
AwardInfoParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response AAwardInfoRes = network.getResponse(AwardInfoParam, BasicConfig.MOBILE_agentSpecifyAwardInfo);
Object data = AAwardInfoRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(AwardInfoParam, BasicConfig.MOBILE_agentSpecifyAwardInfo, "查询指定中奖信息失败", AAwardInfoRes.body().asString()));
}
@Test(description = "代理人指定中奖配置查询", priority = 20)
public void 代理人指定中奖配置查询() {
agentAuth();
Map<String, Object> AwardConfParam = new HashMap<>();
AwardConfParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response AwardConfRes = network.getResponse(AwardConfParam, BasicConfig.MOBILE_agentSpecifyAwardConf);
Object data = AwardConfRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(AwardConfParam, BasicConfig.MOBILE_agentSpecifyAwardConf, "代理人指定中奖配置查询失败", AwardConfRes.body().asString()));
}
......
package com.kjj.cases.live;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.AgentEndList;
import com.kjj.bean.ConfidList;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Lottery implements AdminAuthorization{
@BeforeClass
public void setUp() {
agentAuth();
}
public List<ConfidList> List_Confid;
@Test(description = "抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
Map<String, Object> listLiveLotterParam = new HashMap<>();
listLiveLotterParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response listLiveLotterRes = network.getResponse(listLiveLotterParam, BasicConfig.USER_listLiveLottery);
Object data = listLiveLotterRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listLiveLotterParam, BasicConfig.USER_listLiveLottery, "抽奖活动弹层福利列表查询失败", listLiveLotterRes.body().asString()));
}
@Test(description = "查询抽奖奖品列表", priority = 2)
public void 查询抽奖奖品列表() {
Map<String, Object> getLiveAwardListParam = new HashMap<>();
getLiveAwardListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response getLiveAwardListRes = network.getResponse(getLiveAwardListParam, BasicConfig.USER_getLiveAwardList);
List<ConfidList> list= JsonUtil.parseResponseToListBean(getLiveAwardListRes,ConfidList.class);
System.out.println(list);
this.List_Confid=list;
Assert.assertNotNull(list, network.message(getLiveAwardListParam, BasicConfig.USER_getLiveAwardList, "抽奖标记为false", getLiveAwardListRes.body().asString()));
}
@Test(description = "开始第一轮抽奖", priority = 3)
public void 开始第一轮抽奖() {
Map<String, Object> startParam = new HashMap<>();
startParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
startParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
Response startRes = network.postResponse(startParam, BasicConfig.ANCHOR_start);
Object data = startRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(startParam, BasicConfig.ANCHOR_start, "开启第一轮抽奖失败", startRes.body().asString()));
}
@Test(description = "助播视角_权益列表", priority = 4)
public void 助播端权益列表() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response listRes = network.getResponse(listParam, BasicConfig.ANCHOR_list);
Object data = listRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listParam, BasicConfig.ANCHOR_list, "主播端权益列表查询失败", listRes.body().asString()));
}
@Test(description = "抽奖状态查询", priority = 5)
public void 抽奖状态查询() {
Map<String, Object> statusParam = new HashMap<>();
statusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
statusParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
Response statusRes = network.postResponse(statusParam, BasicConfig.ANCHOR_status);
boolean data = statusRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(statusParam, BasicConfig.ANCHOR_status, "抽奖状态查询失败", statusRes.body().asString()));
}
@Test(description = "结束第一轮抽奖", priority = 6)
public void 结束第一轮抽奖() {
try {
Thread.sleep(1000);
Map<String, Object> endParam = new HashMap<>();
endParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
endParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
Response endRes = network.postResponse(endParam, BasicConfig.ANCHOR_end);
Boolean data = endRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(endParam, BasicConfig.ANCHOR_end, "结束第一轮抽奖失败", endRes.body().asString()));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
......@@ -4,8 +4,6 @@ import com.kjj.utils.NetworkUtils;
/**
* 管理员后台授权
* @author zhanghuifeng
* date 2021/2/20-13:46
*/
public interface MngAuthorization {
......
......@@ -13,8 +13,18 @@ public class OpenLive implements AdminAuthorization {
public void setUp() {
adminAuth();
}
@Test(description = "获取直播配置详情", priority = 1)
public void 获取直播配置详情() {
Map<String, Object> ConfDetailParam = new HashMap<>();
ConfDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response ConfDetailRes = network.getResponse(ConfDetailParam, BasicConfig.ANCHOR_getConfDetail);
Object data = ConfDetailRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(ConfDetailParam, BasicConfig.ANCHOR_getConfDetail, "获取直播配置详情失败", ConfDetailRes.body().asString()));
}
@Test(description = "开始直播", priority = 1)
@Test(description = "开始直播", priority = 2)
public void 开启直播() {
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......
......@@ -13,23 +13,68 @@ import java.util.Map;
public class User implements AdminAuthorization{
@BeforeClass
public void setUp() {
visitorAuth();
}
public void setUp() { visitorAuth(); }
public String token;
public String shareSign;
@Test(description = "邀请关系绑定", priority = 1)
//代理人邀请绑定
@Test(description = "代理人邀请关系绑定", priority = 1)
public void 邀请关系绑定() {
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareType",LiveConstants.getValue(LiveConstants.StringKeyEnum.shareSign.getKey()));
bindingParam.put("shareSign",LiveConstants.getValue(LiveConstants.StringKeyEnum.shareSign.getKey()));
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "获取绑定结果和绑定凭证", priority = 2)
public void 获取绑定结果和绑定凭证() {
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Object token = tokenRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "根据绑定凭证发放抽奖码", priority = 3)
public void 根据绑定凭证发放抽奖码() {
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "查询用户自己的抽奖券列表", priority = 4)
public void 查询用户自己的抽奖券列表() {
try{
agentAuth();
Thread.sleep(500);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
} catch(InterruptedException e){
e.printStackTrace();
}finally {
visitorAuth();
}
@Test(description = "预约直播间", priority = 2)
}
@Test(description = "预约直播间", priority = 5)
public void 预约直播间() {
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -45,7 +90,7 @@ public class User implements AdminAuthorization{
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "关注直播间", priority = 3)
@Test(description = "关注直播间", priority = 6)
public void 关注直播间() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -59,7 +104,7 @@ public class User implements AdminAuthorization{
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "查询关注状态", priority = 4)
@Test(description = "查询关注状态", priority = 7)
public void 查询关注状态() {
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -70,7 +115,7 @@ public class User implements AdminAuthorization{
}
@Test(description = "保存海报获得抽奖码", priority = 5)
@Test(description = "保存海报获得抽奖码", priority = 8)
public void 保存海报获得抽奖码() {
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -81,7 +126,7 @@ public class User implements AdminAuthorization{
}
@Test(description = "我的抽奖码数量", priority = 6)
@Test(description = "我的抽奖码数量", priority = 9)
public void 我的抽奖码数量() {
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -93,4 +138,159 @@ public class User implements AdminAuthorization{
}
//访客分享直播间
@Test(description = "访客分享直播间", priority = 10)
public void 访客分享直播间() {
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
//访客邀请绑定
@Test(description = "访客邀请关系绑定", priority = 11)
public void 访客邀请关系绑定() {
visitorAuth2();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客获取绑定结果和绑定凭证", priority = 12)
public void 访客获取绑定结果和绑定凭证() {
visitorAuth2();
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Object token = tokenRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客根据绑定凭证发放抽奖码", priority = 13)
public void 访客根据绑定凭证发放抽奖码() {
visitorAuth2();
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "获取直播所有的订阅消息模板", priority = 14)
public void 获取直播所有的订阅消息模板() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("appid","wx4d7276f866bd24c8");
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "访客预约直播间", priority = 15)
public void 访客预约直播间() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds2 = new ArrayList<>();
markIds2.add(142L);
markIds2.add(143L);
markIds2.add(140L);
sycParam.put("markIds", markIds2);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客关注直播间", priority = 16)
public void 访客关注直播间() {
visitorAuth2();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "访客关注状态查询", priority = 17)
public void 访客关注状态查询() {
visitorAuth2();
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "访客保存海报获得抽奖码", priority = 18)
public void 访客保存海报获得抽奖码() {
visitorAuth2();
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_savePoster);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_savePoster, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "查询访客抽奖码数量", priority = 19)
public void 查询访客抽奖码数量() {
visitorAuth2();
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
@Test(description = "访客查询抽奖券列表", priority = 20)
public void 访客查询抽奖券列表() {
visitorAuth();
try{
Thread.sleep(500);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
} catch(InterruptedException e){
e.printStackTrace();
}
}
}
......@@ -14,6 +14,8 @@ public class BasicConfig {
public static String AUTH_KEY ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKorVWS9R85xTeuUZzyc2boHSYWYU56ttSUbcAb9ngEb3LJBB3qZ7a9eCkEoPV5yu";
//直播访客 (嘿 保险)
public static String VISITORKEY ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKnNHmHY52FxaDfigK3U4NQpLsQrodQUPUXwmumQ1kr3xsfZoGw7cEswYryWfUtMW";
//直播访客 (🍗)
public static String VISITORKEY1 ="LEH7epeHVDJWzhZ6DiexTHnsYWTEo46qxbPUiJ1xnTqmCJPHLGsoTuy5C2psyH1j5t5ppr3BNQLrBXrBmsmJUDJcXSivb";
// 基础线代理人 TKU
public static String AGENT_TKU = "T3gM31f18jCFEcfoYxvVk1LsF5T1YkcBNDbUaryi3TgvwatuP6mroJjZ2k7iCHjC9Srujh7k311i3vFuZm";
// 基础线访客 TKU
......@@ -36,22 +38,39 @@ public class BasicConfig {
//手机端地址
public static final String MOBILE_HOST = "https://live.duibatest.com.cn";
public static final String MOBILE_HOST1 = "https://kjj.m.duibatest.com.cn";
// *************** 主播端 ***************
public static final String ANCHOR_OPEN = MOBILE_HOST + "/conf/live/open";
public static final String ANCHOR_getConfDetail = MOBILE_HOST + "/conf/pre/getConfDetail";
public static final String ANCHOR_CLOSE = MOBILE_HOST + "/conf/live/close";
public static final String ANCHOR_ADDQUESTION = MOBILE_HOST + "/kjy/live/assist/question/addQuestion";
public static final String ANCHOR_LIVECARD = MOBILE_HOST + "/kjy/mp/liveCard/getLiveEndSellerCard";
public static final String MOBILE_getSpecifyAwardConf = MOBILE_HOST + "/conf/pre/specifyAward/getSpecifyAwardConf";
public static final String MOBILE_getAgentParticipateCond = MOBILE_HOST + "/conf/pre/specifyAward/getAgentParticipateCond";
public static final String MOBILE_getLiveAwardList = MOBILE_HOST + "/conf/pre/specifyAward/getLiveAwardList";
public static final String ANCHOR_start = MOBILE_HOST + "/conf/live/lottery/start";
public static final String ANCHOR_status = MOBILE_HOST + "/conf/live/lottery/status";
public static final String ANCHOR_end = MOBILE_HOST + "/conf/live/lottery/end";
public static final String ANCHOR_list = MOBILE_HOST + "/conf/live/lottery/list";
public static final String ANCHOR_List = MOBILE_HOST + "/conf/pre/lottery/pre/list";
public static final String ANCHOR_add = MOBILE_HOST + "/conf/pre/lottery/add";
public static final String ANCHOR_preModify = MOBILE_HOST + "/conf/pre/lottery/pre/modify";
public static final String ANCHOR_Modify = MOBILE_HOST + "/conf/pre/lottery/modify";
public static final String ANCHOR_delete = MOBILE_HOST + "/conf/pre/lottery/delete";
public static final String ANCHOR_getList4Admin = MOBILE_HOST + "/conf/pre/welfare/getList4Admin";
public static final String ANCHOR_list1 = MOBILE_HOST + "/conf/pre/lottery/list";
public static final String ANCHOR_preAdd = MOBILE_HOST + "/conf/pre/lottery/pre/add";
public static final String ANCHOR_preDelete = MOBILE_HOST + "/conf/pre/lottery/pre/delete";
// *************** 直播抽奖 ***************
public static final String USER_getLiveAwardList = MOBILE_HOST + "/kjy/live/conf/specifyAward/getLiveAwardList";
public static final String USER_listLiveLottery = MOBILE_HOST + "/kjy/live/lottery/listLiveLottery";
// *************** 访客端 ***************
public static final String USER_SUBSCRIBE = MOBILE_HOST + "/kjy/live/user/appointment/subscribe";
public static final String USER_FIND = MOBILE_HOST + "/kjy/live/user/subscribe/find";
public static final String USER_SYCAPPOINTMENT = MOBILE_HOST + "/kjy/live/user/sycAppointment";
public static final String USER_START = MOBILE_HOST + "/kjy/live/assist/lottery/start";
public static final String USER_DRAW = MOBILE_HOST + "/kjy/live/user/lottery/draw";
public static final String USER_END = MOBILE_HOST + "/kjy/live/assist/lottery/end";
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 = MOBILE_HOST1 + "/kjy/mp/msg/config/live/user/wxIdAllList";
// *************** 直播管理端 ***************
public static final String MANAGER_SAVEANDUPDATE = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......@@ -183,6 +202,15 @@ public class BasicConfig {
public static final String MOBILE_GETSHARESIGN = MOBILE_HOST + "/kjy/live/getShareSign";
public static final String MOBILE_binding = MOBILE_HOST + "/clue/invitation/binding";
public static final String MOBILE_AgentSpecifyAwardConf = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardConf";
public static final String MOBILE_Token = MOBILE_HOST + "/clue/invitation/token";
public static final String MOBILE_Code = MOBILE_HOST + "/clue/invitation/code";
public static final String MOBILE_MyLotteryCode = MOBILE_HOST + "/kjy/live/lottery/myLotteryCode";
public static final String MOBILE_SpecifyAwardUserSelectList = MOBILE_HOST + "/kjy/live/agent/specifyAwardUserSelectList";
public static final String MOBILE_status1 = MOBILE_HOST + "/index/status";
public static final String MOBILE_agentSpecifyAwardUserList = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardUserList";
public static final String MOBILE_agentSpecifyAwardInfo = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardInfo";
public static final String MOBILE_agentSpecifyAwardConf = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardConf";
//***************直播素材*****************
......
......@@ -19,6 +19,7 @@
<class name="com.kjj.cases.live.Procurator"/>
</classes>
</test>
<test preserve-order="true" name="代理人分享直播间">
<classes>
<class name="com.kjj.cases.live.Agent"/>
......@@ -26,12 +27,6 @@
</test>
<test preserve-order="true" name="助播-开启直播">
<classes>
<class name="com.kjj.cases.live.OpenLive"/>
</classes>
</test>
<test preserve-order="true" name="访客券码领取">
<classes>
<class name="com.kjj.cases.live.User"/>
......@@ -42,6 +37,16 @@
<classes>
<class name="com.kjj.cases.live.DesignatedWinner"/>
</classes>
</test>
<test preserve-order="true" name="助播-开启直播">
<classes>
<class name="com.kjj.cases.live.OpenLive"/>
</classes>
</test>
<test preserve-order="true" name="直播中抽奖">
<classes>
<class name="com.kjj.cases.live.Lottery"/>
</classes>
</test>
<test preserve-order="true" name="访客领取资料">
<classes>
......@@ -53,6 +58,7 @@
<class name="com.kjj.cases.live.LiveAgent"/>
</classes>
</test>
<test preserve-order="true" name="红包领取">
<classes>
<class name="com.kjj.cases.live.LiveVistorRed"/>
......@@ -63,9 +69,5 @@
<class name="com.kjj.cases.live.CloseLive"/>
</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