Commit 21b77680 authored by 张艳玲's avatar 张艳玲

新增猜数字红包

parent aaff3875
package com.kjj.bean.lottery;
import lombok.Data;
@Data
public class ConfIdList {
private String welfareConfId;
private Integer confId;
private Integer specifyStatus;
private Integer afterMin;
private Integer specNum;
private String importExcelUrl;
private Integer teamConfStatus;
private Integer areaConfStatus;
private String name;
private Long broadcastTime;
}
package com.kjj.bean.lottery;
import lombok.Data;
@Data
public class ConfidList {
private String welfareConfId;
}
......@@ -78,9 +78,9 @@ public class Procurator implements AdminAuthorization {
public void 编辑代理人信息() {
Map<String, Object> params = new HashMap<>();
params.put("sellerName", "你好测试"+ RandomUtils.nextInt(1, 100));
params.put("sellerName", "小智"+ RandomUtils.nextInt(1, 100));
params.put("phoneNumber", "152588101691");
params.put("jobNumber", "TTTTTT");
params.put("jobNumber", "技术");
params.put("wechatQrCode", "//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png");
Response response = network.postResponse(params, BasicConfig.MOBILE_AgentEditCardInfo);
Boolean agentBeans = JsonUtil.parseResponseToBean(response, Boolean.class);
......
package com.kjj.cases.live.red;
package com.kjj.cases.live.answer;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.answer.*;
import com.kjj.bean.manager.AnswerBean;
import com.kjj.bean.manager.AnswerListBean;
import com.kjj.bean.manager.TeamAssignmentList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import freemarker.template.utility.DateUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.xml.crypto.Data;
import java.util.*;
import java.util.stream.Collectors;
public class Limited implements AdminAuthorization {
public class Answer implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public int id;
/**
* 主播端配置有奖答题
*/
private List<QuseRewardList.QuesList> quesConfId;
private QuestionList.question wronganswer;
private QuestionList.question rightanswer;
/*主播端添加有奖答题-现金红包*/
@Test(description = "主播端添加有奖答题现金红包", priority = 1)
public void 主播端添加有奖答题现金红包()
......@@ -179,8 +189,8 @@ public class Limited implements AdminAuthorization {
}
/*领取答题红包-错误选项*/
@Test(description = "访客领取答题红包-错误选项", priority = 8)
public void 访客领取答题红包_错误选项()
@Test(description = "访客领取答题红包错误选项", priority = 8)
public void 访客领取答题红包错误选项()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
......@@ -200,8 +210,8 @@ public class Limited implements AdminAuthorization {
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "领取答题红包_答题正确", priority = 9)
public void 访客A领取答题红包_答题正确()
@Test(description = "领取答题红包答题正确", priority = 9)
public void 访客A领取答题红包答题正确()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
......@@ -245,7 +255,7 @@ public class Limited implements AdminAuthorization {
/*领取答题红包-黑名单用户选择正确选项*/
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 11)
public void 黑名单用户领取答题红包成功()
public void 黑名单用户领取答题红包()
{
visitorAuth7();
Map<String, Object> params = new HashMap<>();
......@@ -263,8 +273,8 @@ public class Limited implements AdminAuthorization {
}
/*领取答题红包结果*/
@Test(description = "查询黑名单用户领取答题红包结果", priority = 12)
public void 查询黑名单用户领取答题红包结果()
@Test(description = "黑名单用户领取答题红包结果", priority = 12)
public void 黑名单用户领取答题红包结果()
{
visitorAuth7();
ThreadSleepUtils.sleep(3000);
......@@ -284,8 +294,8 @@ public class Limited implements AdminAuthorization {
/*代理人领取答题红包*/
@Test(description = "代理人领取答题红包", priority = 13)
public void 代理人领取答题红包()
@Test(description = "代理人领取答题现金红包", priority = 13)
public void 代理人领取答题现金红包()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
......@@ -302,8 +312,8 @@ public class Limited implements AdminAuthorization {
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
@Test(description = "查询代理人领取答题红包结果", priority = 14)
public void 查询代理人领取答题红包结果()
@Test(description = "代理人领取答题红包结果", priority = 14)
public void 代理人领取答题红包结果()
{
agentAuth();
ThreadSleepUtils.sleep(3000);
......@@ -474,7 +484,7 @@ public class Limited implements AdminAuthorization {
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 24)
public void 领取有奖答题福利类型选择错误()
public void 领取有奖答题福利选择错误()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
......@@ -638,7 +648,7 @@ public class Limited implements AdminAuthorization {
}
/*领取有奖答题福利类型结果*/
/*领取有奖答题福利类型结果*/
@Test(description = "查询代理人领取有奖答题福利结果", priority = 32)
public void 查询代理人领取有奖答题福利结果()
{
......@@ -748,4 +758,381 @@ public class Limited implements AdminAuthorization {
}
/**
* 有奖答题无限制中奖
*/
@Test(description = "修改本场答题规则为无限制", priority = 38)
public void 修改本场答题规则为无限制() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 1);
updateParam.put("welfareRuleType", 1);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "查询答题规则无限制是否配置成功", priority = 39)
public void 查询答题规则无限制是否配置成功() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题红包无限制规则配置失败", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题实物无限制规则配置失败", response.body().asString()));
}
/**
* 修改答题为无限制规则后的领取
*/
/*查询主播端有奖答题列表*/
@Test(description = "查询有奖答题列表", priority = 40)
public void 查询有奖答题列表()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex", 1);
params.put("pageSize", 50);
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardList);
List<QuseRewardList.QuesList> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")), QuseRewardList.QuesList.class);
System.out.println(list);
this.quesConfId=list;
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesRewardList, "查询主播端有奖答题列表失败", response.body().asString()));
}
/*查询主播端未上架的有奖答题配置详情*/
@Test(description = "主播端查询第三轮答题现金红包", priority = 41)
public void 主播端查询第三轮答题现金红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString()));
}
/*上架主播端未发放的有奖答题*/
@Test(description = "上架第三轮答题现金红包", priority = 42)
public void 上架第三轮答题现金红包()
{
adminAuth();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
}
/*主播端发放答题红包*/
@Test(description = "发放第三轮现金红包", priority = 43)
public void 发放第三轮现金红包()
{
adminAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询第三轮答题红包配置", priority = 44)
public void 访客A查询第三轮答题红包配置()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(list);
Optional<QuestionList.question> wrongAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wronganswer= wrongAnswerOption.get();
Optional<QuestionList.question> correctAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightanswer=correctAnswerOption.get();
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString()));
}
/*领取答题红包-错误选项*/
@Test(description = "访客领取答题红包-错误选项", priority = 45)
public void 访客领取答题红包_错误选项()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "领取答题红包_答题正确", priority = 46)
public void 访客A领取答题红包_答题正确()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询访客A领取答题红包结果", priority = 47)
public void 查询访客A领取答题红包结果()
{
visitorAuth9();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertTrue(amount>0, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取失败", response.body().asString()));
}
/*领取答题红包-黑名单用户选择正确选项*/
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 48)
public void 黑名单用户领取答题红包成功()
{
visitorAuth7();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询黑名单用户领取答题红包结果", priority = 49)
public void 查询黑名单用户领取答题红包结果()
{
visitorAuth7();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
/*代理人领取答题红包*/
@Test(description = "代理人领取答题红包", priority = 50)
public void 代理人领取答题红包()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询代理人领取答题红包结果", priority = 51)
public void 查询代理人领取答题红包结果()
{
agentAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第三轮答题福利", priority = 52)
public void 上架第三轮答题福利()
{
adminAuth();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(5).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "发放第三轮答题福利", priority = 53)
public void 发放第三轮答题福利()
{
adminAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(5).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
@Test(description = "访客查询第三轮答题福利", priority = 54)
public void 访客查询第三轮答题福利()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(list);
Optional<QuestionList.question> wrongAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wronganswer= wrongAnswerOption.get();
Optional<QuestionList.question> correctAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightanswer=correctAnswerOption.get();
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询第三轮福利失败", response.body().asString()));
}
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 55)
public void 领取有奖答题福利类型选择错误()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "领取有奖答题福利类型-访客A答题正确", priority = 56)
public void 访客A领取有奖答题福利类型()
{
visitorAuth3();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
@Test(description = "访客A领取有奖答题福利结果", priority = 57)
public void 访客A领取有奖答题福利结果()
{
visitorAuth3();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer welfareStatus=response.jsonPath().getJsonObject("data.welfareStatus");
System.out.println(welfareStatus);
Assert.assertTrue(welfareStatus==2, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
}
package com.kjj.cases.live.guess;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.GuessList;
import com.kjj.bean.manager.WelfareList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import groovy.json.JsonBuilder;
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 ManagerGuess implements AdminAuthorization {
@BeforeClass
public void setUp() { BaseUtils.ssoLogin();}
public List<GuessList> confid;
//查询剩余可配金额
@Test(description = "查询剩余可配金额", priority = 1)
public void 查询剩余可配金额() {
Map<String, Object> AmountParam = new HashMap<>();
AmountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(AmountParam, BasicConfig.MANAGER_getSurplusAmount);
Integer data =response.jsonPath().getInt("data");
System.out.println(data);
Assert.assertTrue(data>0, network.message(AmountParam, BasicConfig.MANAGER_getSurplusAmount, "查询剩余可配金额失败", response.body().asString()));
}
@Test(description = "新增猜数字红包", priority = 2)
public void 新增猜数字红包() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("redAmount",66);
saveParam.put("redRealNum",1);
saveParam.put("redShowNum",1);
saveParam.put("guessMinNum",1);
saveParam.put("guessMaxNum",10);
saveParam.put("guessLeastTime",4);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", response.body().asString()));
Map<String, Object> saveguessParam = new HashMap<>();
saveguessParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveguessParam.put("redAmount",88);
saveguessParam.put("redRealNum",1);
saveguessParam.put("redShowNum",1);
saveguessParam.put("guessMinNum",1);
saveguessParam.put("guessMaxNum",10);
saveguessParam.put("guessLeastTime",4);
Response saveguessRes = network.postResponse(saveguessParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data1 =saveguessRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(saveguessParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", saveguessRes.body().asString()));
}
@Test(description = "查询猜数字红包列表", priority = 3)
public void 查询猜数字红包列表() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list_1);
List<GuessList>list=JsonUtil.parseResponseToListBean(response,GuessList.class);
System.out.println(list);
this.confid=list;
Assert.assertNotNull(list, network.message(listParam, BasicConfig.MANAGER_list_1, "查询猜数字红包列表失败", response.body().asString()));
}
@Test(description = "查询猜数字红包详情页", priority = 4)
public void 查询猜数字红包详情页() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
detailParam.put("confId", this.confid.get(0).getConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail_1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail_1, "查询猜数字红包详情页失败", response.body().asString()));
}
@Test(description = "编辑猜数字红包", priority = 5)
public void 编辑猜数字红包() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
updateParam.put("redAmount",88);
updateParam.put("redRealNum",1);
updateParam.put("redShowNum",1);
updateParam.put("guessMinNum",1);
updateParam.put("guessMaxNum",10);
updateParam.put("guessLeastTime",4);
updateParam.put("confId", this.confid.get(0).getConfId());
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", response.body().asString()));
}
@Test(description = "删除猜数字红包", priority = 6)
public void 删除猜数字红包() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
delParam.put("confId", this.confid.get(0).getConfId());
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del_1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del_1, "删除猜数字红包失败", response.body().asString()));
}
//助播端-直播前配置
@Test(description = "助播直播前新增猜数字红包", priority = 7)
public void 助播直播前新增猜数字红包() {
adminAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
saveParam.put("redAmount",88);
saveParam.put("redRealNum",1);
saveParam.put("redShowNum",1);
saveParam.put("guessMinNum",1);
saveParam.put("guessMaxNum",10);
saveParam.put("guessLeastTime",4);
Response response = network.postResponse(saveParam, BasicConfig.MOBILE_saveOrUpdate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MOBILE_saveOrUpdate, "助播直播前新增猜数字红包失败", response.body().asString()));
}
@Test(description = "助播端查询直播红包配置", priority = 8)
public void 助播端查询直播红包配置() {
adminAuth();
ThreadSleepUtils.sleep(2000);
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MOBILE_findDetail);
boolean hasGuessRed =response.jsonPath().getBoolean("data.hasGuessRed");
System.out.println(hasGuessRed);
Assert.assertTrue(hasGuessRed, network.message(listParam, BasicConfig.MOBILE_findDetail, "助播端查询直播红包配置失败", response.body().asString()));
}
@Test(description = "助播直播前猜数字红包列表", priority = 9)
public void 助播直播前猜数字红包列表() {
adminAuth();
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MOBILE_list);
List<GuessList>list=JsonUtil.parseResponseToListBean(response,GuessList.class, "guessList");
System.out.println(list);
this.confid=list;
Assert.assertNotNull(list, network.message(listParam, BasicConfig.MOBILE_list, "助播直播前猜数字红包列表查询失败", response.body().asString()));
}
@Test(description = "助播直播前猜数字红包详情页", priority = 10)
public void 助播直播前猜数字红包详情页() {
adminAuth();
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
detailParam.put("confId", this.confid.get(0).getConfId());
Response response = network.getResponse(detailParam, BasicConfig.MOBILE_detail);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MOBILE_detail, "助播直播前猜数字红包详情页查询失败", response.body().asString()));
}
@Test(description = "直播前编辑猜数字红包", priority = 11)
public void 直播前编辑猜数字红包() {
adminAuth();
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
updateParam.put("redAmount",99);
updateParam.put("redRealNum",1);
updateParam.put("redShowNum",10);
updateParam.put("guessMinNum",1);
updateParam.put("guessMaxNum",10);
updateParam.put("guessLeastTime",4);
updateParam.put("confId", this.confid.get(0).getConfId());
Response response = network.postResponse(updateParam, BasicConfig.MOBILE_saveOrUpdate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MOBILE_saveOrUpdate, "直播前编辑猜数字红包失败", response.body().asString()));
}
@Test(description = "直播前删除猜数字红包", priority = 12)
public void 直播前删除猜数字红包() {
adminAuth();
Map<String, Object> delParam = new HashMap<>();
delParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
delParam.put("confId", this.confid.get(0).getConfId());
Response response = network.postResponse(delParam, BasicConfig.MOBILE_delete);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MOBILE_delete, "直播前删除猜数字红包失败", response.body().asString()));
}
}
\ No newline at end of file
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.VoteBean;
import com.kjj.bean.manager.VoteListBean;
......@@ -24,44 +24,41 @@ public class LiveMaterial implements AdminAuthorization {
@Test(description = "添加奖品", priority = 1)
public void 添加奖品() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("useDesc", "盲盒锦鲤");
saveOrUpdateParam.put("welfareImg", "https://yun.dui88.com/kjy/image/20210304/1614844180065.jpg");
saveOrUpdateParam.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
saveOrUpdateParam.put("welfareName", "盲盒锦鲤");
saveOrUpdateParam.put("welfarePictures", "https://yun.dui88.com/kjy/image/20210304/1614844198545.jpeg");
saveOrUpdateParam.put("welfarePicturesArr", "https://yun.dui88.com/kjy/image/20210304/1614844198545.jpeg");
saveOrUpdateParam.put("companyId", 101);
Response saveOrUpdatePes = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_SAVEORUPDATE6);
Map<String, Object> Params = new HashMap<>();
Params.put("useDesc", "盲盒锦鲤");
Params.put("welfareImg", "https://yun.dui88.com/kjy/image/20210304/1614844180065.jpg");
Params.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
Params.put("welfareName", "盲盒锦鲤");
Params.put("welfarePictures", "https://yun.dui88.com/kjy/image/20210304/1614844198545.jpeg");
Params.put("welfarePicturesArr", "https://yun.dui88.com/kjy/image/20210304/1614844198545.jpeg");
Params.put("companyId", 101);
Response saveOrUpdatePes = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdate_6);
boolean data = saveOrUpdatePes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_SAVEORUPDATE6, "添加奖品失败", saveOrUpdatePes.body().asString()));
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveOrUpdate_6, "添加奖品失败", saveOrUpdatePes.body().asString()));
}
@Test(description = "查询福利并删除", priority = 2)
public void 查询福利并删除() {
Map<String, Object> params = new HashMap<>();
params.put("companyId", 101);
params.put("pageIndex", 1);
params.put("pageSize", 1);
Response response = network.getResponse(params, BasicConfig.MANAGER_welfareList);
WelfareListBean data = JsonUtil.parseResponseToBean(response, WelfareListBean.class);
Response response = network.getResponse(params, BasicConfig.MANAGER_WELFARELIST);
WelfareListBean data1 = JsonUtil.parseResponseToBean(response, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(params, BasicConfig.MANAGER_WELFARELIST, "查询福利失败", response.body().asString()));
if (data.getTotalCount() > 0) {
WelfareBean bean = data.getList().get(0);
Assert.assertNotNull(bean, network.message(params, BasicConfig.MANAGER_welfareList, "查询福利失败", response.body().asString()));
//删除福利
int id = bean.getId();
Map<String, Object> delParam = new HashMap<>();
delParam.put("id", id);
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_DEL);
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_welfareDel);
boolean data2 = delRes.jsonPath().getBoolean("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(delParam, BasicConfig.MANAGER_DEL, "删除福利失败", delRes.body().asString()));
Assert.assertTrue(data2, network.message(delParam, BasicConfig.MANAGER_welfareDel, "删除福利失败", delRes.body().asString()));
}
......@@ -72,9 +69,9 @@ public class LiveMaterial implements AdminAuthorization {
@Test(description = "添加投票", priority = 3)
public void 添加投票() {
Map<String, Object> choiceParam = new HashMap<>();
choiceParam.put("companyId", 101);
choiceParam.put("question", "投票测试一");
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("question", "投票测试一");
List<VoteListBean> votes = new ArrayList<>();
VoteListBean vote = new VoteListBean();
vote.setAnswer("选项一");
......@@ -88,78 +85,77 @@ public class LiveMaterial implements AdminAuthorization {
VoteListBean vote2 = new VoteListBean();
vote2.setAnswer("选项二");
votes.add(vote2);
choiceParam.put("answerList", votes);
Response choiceRes = network.postResponse(choiceParam, BasicConfig.MANAGER_CHOICE);
Boolean data3 = choiceRes.jsonPath().getBoolean("data");
System.out.println(data3);
Assert.assertTrue(data3, network.message(choiceParam, BasicConfig.MANAGER_CHOICE, "投票创建失败", choiceRes.body().asString()));
Params.put("answerList", votes);
Response response = network.postResponse(Params, BasicConfig.MANAGER_choiceSave);
Boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_choiceSave, "投票创建失败", response.body().asString()));
}
@Test(description = "查询投票并删除", priority = 4)
public void 查询投票并删除() {
Map<String, Object> choiceListPram = new HashMap<>();
choiceListPram.put("companyId", 101);
choiceListPram.put("pageIndex", 1);
choiceListPram.put("pageSize", 1);
Map<String, Object> Prams = new HashMap<>();
Prams.put("companyId", 101);
Prams.put("pageIndex", 1);
Prams.put("pageSize", 1);
Response choiceListRes = network.getResponse(choiceListPram, BasicConfig.MANAGER_GETLIST);
WelfareListBean data1 = JsonUtil.parseResponseToBean(choiceListRes, WelfareListBean.class);
Response response = network.getResponse(Prams, BasicConfig.MANAGER_getList);
WelfareListBean data = JsonUtil.parseResponseToBean(response, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(choiceListPram, BasicConfig.MANAGER_GETLIST, "查询投票失败", choiceListRes.body().asString()));
if (data.getTotalCount() > 0) {
WelfareBean bean = data.getList().get(0);
Assert.assertNotNull(bean, network.message(Prams, BasicConfig.MANAGER_getList, "查询投票失败", response.body().asString()));
//删除投票
int id = bean.getId();
Map<String, Object> delParam = new HashMap<>();
delParam.put("id", id);
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_DELCHOICE);
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_delChoice);
boolean data4 = delRes.jsonPath().getBoolean("data");
System.out.println(data4);
Assert.assertTrue(data4, network.message(delParam, BasicConfig.MANAGER_DELCHOICE, "删除投票失败", delRes.body().asString()));
Assert.assertTrue(data4, network.message(delParam, BasicConfig.MANAGER_delChoice, "删除投票失败", delRes.body().asString()));
}
}
@Test(description = "问题管理", priority = 5)
public void 添加问题() {
Map<String, Object> questionParam = new HashMap<>();
questionParam.put("companyId", 101);
questionParam.put("question", "测试问题");
Response questionRes = network.postResponse(questionParam, BasicConfig.MANAGER_QUESTION);
Object data5 = questionRes.jsonPath().getJsonObject("data");
System.out.println(data5);
Assert.assertNotNull(data5, network.message(questionParam, BasicConfig.MANAGER_QUESTION, "新增问题失败", questionRes.body().asString()));
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("question", "测试问题");
Response questionRes = network.postResponse(Params, BasicConfig.MANAGER_questionSave);
Object data = questionRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_questionSave, "新增问题失败", questionRes.body().asString()));
}
@Test(description = "查询问题并删除", priority = 6)
public void 查询问题并删除() {
Map<String, Object> question1Param = new HashMap<>();
question1Param.put("companyId", 101);
question1Param.put("pageIndex", 1);
question1Param.put("pageSize", 1);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 1);
Response question1Res = network.getResponse(question1Param, BasicConfig.MANAGER_LIST1);
Response question1Res = network.getResponse(Params, BasicConfig.MANAGER_questionList);
WelfareListBean data1 = JsonUtil.parseResponseToBean(question1Res, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(question1Param, BasicConfig.MANAGER_LIST1, "查询福利失败", question1Res.body().asString()));
Assert.assertNotNull(bean, network.message(Params, BasicConfig.MANAGER_questionList, "查询福利失败", question1Res.body().asString()));
//删除问题
int id = bean.getId();
Map<String, Object> delParam = new HashMap<>();
delParam.put("id", id);
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_DEL1);
boolean data6 = delRes.jsonPath().getBoolean("data");
System.out.println(data6);
Assert.assertTrue(data6, network.message(delParam, BasicConfig.MANAGER_DEL1, "删除问题失败", delRes.body().asString()));
Response delRes = network.postResponse(delParam, BasicConfig.MANAGER_questionDel);
boolean data = delRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_questionDel, "删除问题失败", delRes.body().asString()));
}
......@@ -168,66 +164,65 @@ public class LiveMaterial implements AdminAuthorization {
@Test(description = "添加图文资料", priority = 7)
public void 添加图文资料() {
Map<String, Object> resourceParam = new HashMap<>();
resourceParam.put("companyId", 101);
resourceParam.put("resourceTitle", "图文资料2");
resourceParam.put("resourceButtonTitle", "我要报名");
resourceParam.put("resourceImg", "https://yun.dui88.com/kjy/image/20210306/1615023456356.jpeg");
resourceParam.put("resourcePictures", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
resourceParam.put("resourcePicturesArr", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
Response resourceRes = network.postResponse(resourceParam, BasicConfig.MANAGER_RESOURCE);
Object data7 = resourceRes.jsonPath().getJsonObject("data");
System.out.println(data7);
Assert.assertNotNull(data7, network.message(resourceParam, BasicConfig.MANAGER_RESOURCE, "新增权益失败", resourceRes.body().asString()));
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("resourceTitle", "图文资料2");
Params.put("resourceButtonTitle", "我要报名");
Params.put("resourceImg", "https://yun.dui88.com/kjy/image/20210306/1615023456356.jpeg");
Params.put("resourcePictures", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
Params.put("resourcePicturesArr", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
Response response = network.postResponse(Params, BasicConfig.MANAGER_resource);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_resource, "新增权益失败", response.body().asString()));
}
@Test(description = "查询图文并删除", priority = 8)
public void 查询图文并删除() {
Map<String, Object> imageTextParam = new HashMap<>();
imageTextParam.put("companyId", 101);
imageTextParam.put("pageIndex", 1);
imageTextParam.put("pageSize", 1);
imageTextParam.put("resourceTypeList", 1);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 1);
Params.put("resourceTypeList", 1);
Response imageTextRes = network.getResponse(imageTextParam, BasicConfig.MANAGER_RESOURCELIST);
Response imageTextRes = network.getResponse(Params, BasicConfig.MANAGER_resourceList);
WelfareListBean data1 = JsonUtil.parseResponseToBean(imageTextRes, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(imageTextParam, BasicConfig.MANAGER_RESOURCELIST, "查询图文失败", imageTextRes.body().asString()));
Assert.assertNotNull(bean, network.message(Params, BasicConfig.MANAGER_resourceList, "查询图文失败", imageTextRes.body().asString()));
//删除图文
int id = bean.getId();
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", id);
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_GELRESOURCE);
boolean data8 = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data8);
Assert.assertTrue(data8, network.message(delResourceParam, BasicConfig.MANAGER_GELRESOURCE, "删除图文失败", elResourceRes.body().asString()));
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
boolean data = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除图文失败", elResourceRes.body().asString()));
}
}
@Test(description = "添加链接资料", priority = 9)
public void 添加链接资料() {
Map<String, Object> saveOrUpdateLinkParam = new HashMap<>();
saveOrUpdateLinkParam.put("companyId", 101);
saveOrUpdateLinkParam.put("resourceTitle", "图文资料2");
saveOrUpdateLinkParam.put("resourceButtonTitle", "我要报名");
saveOrUpdateLinkParam.put("outLinkType", 2);
saveOrUpdateLinkParam.put("outLink", "http://www.baidu.com");
saveOrUpdateLinkParam.put("resourceImg", "https://yun.dui88.com/kjy/image/20210306/1615026240244.jpeg");
Response saveOrUpdateLinkRes = network.postResponse(saveOrUpdateLinkParam, BasicConfig.MANAGER_SAVEORUPDATELINK);
Object data9 = saveOrUpdateLinkRes.jsonPath().getJsonObject("data");
System.out.println(data9);
Assert.assertNotNull(data9, network.message(saveOrUpdateLinkParam, BasicConfig.MANAGER_SAVEORUPDATELINK, "新增链接资料失败", saveOrUpdateLinkRes.body().asString()));
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("resourceTitle", "图文资料2");
Params.put("resourceButtonTitle", "我要报名");
Params.put("outLinkType", 2);
Params.put("outLink", "http://www.baidu.com");
Params.put("resourceImg", "https://yun.dui88.com/kjy/image/20210306/1615026240244.jpeg");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveLink);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveLink, "新增链接资料失败", response.body().asString()));
}
......@@ -240,22 +235,22 @@ public class LiveMaterial implements AdminAuthorization {
linkParam.put("pageSize", 1);
linkParam.put("resourceTypeList", 9);
Response linkRes = network.getResponse(linkParam, BasicConfig.MANAGER_RESOURCELIST);
Response linkRes = network.getResponse(linkParam, BasicConfig.MANAGER_resourceList);
System.out.println(JSON.toJSON(linkRes.jsonPath()));
WelfareListBean data1 = JsonUtil.parseResponseToBean(linkRes, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(linkParam, BasicConfig.MANAGER_RESOURCELIST, "查询链接失败", linkRes.body().asString()));
Assert.assertNotNull(bean, network.message(linkParam, BasicConfig.MANAGER_resourceList, "查询链接失败", linkRes.body().asString()));
//删除链接
int id = bean.getId();
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", id);
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_GELRESOURCE);
boolean data10 = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data10);
Assert.assertTrue(data10, network.message(delResourceParam, BasicConfig.MANAGER_GELRESOURCE, "删除链接失败", elResourceRes.body().asString()));
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
boolean data = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除链接失败", elResourceRes.body().asString()));
}
......@@ -273,10 +268,10 @@ public class LiveMaterial implements AdminAuthorization {
formParam.put("formBanner", "https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg");
formParam.put("fieldIds", "1,2");
Response formRes = network.postResponse(formParam, BasicConfig.MANAGER_FORM);
Object data11 = formRes.jsonPath().getJsonObject("data");
System.out.println(data11);
Assert.assertNotNull(data11, network.message(formParam, BasicConfig.MANAGER_FORM, "新增表单失败", formRes.body().asString()));
Response formRes = network.postResponse(formParam, BasicConfig.MANAGER_saveForm);
Object data = formRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(formParam, BasicConfig.MANAGER_saveForm, "新增表单失败", formRes.body().asString()));
}
......@@ -289,21 +284,21 @@ public class LiveMaterial implements AdminAuthorization {
form1Param.put("pageSize", 1);
form1Param.put("resourceTypeList", 12);
Response linkRes = network.getResponse(form1Param, BasicConfig.MANAGER_RESOURCELIST);
Response linkRes = network.getResponse(form1Param, BasicConfig.MANAGER_resourceList);
WelfareListBean data1 = JsonUtil.parseResponseToBean(linkRes, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(form1Param, BasicConfig.MANAGER_RESOURCELIST, "查询表单失败", linkRes.body().asString()));
Assert.assertNotNull(bean, network.message(form1Param, BasicConfig.MANAGER_resourceList, "查询表单失败", linkRes.body().asString()));
//删除表单
int id = bean.getId();
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", id);
Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_GELRESOURCE);
boolean data12 = delResourceRes.jsonPath().getBoolean("data");
System.out.println(data12);
Assert.assertTrue(data12, network.message(delResourceParam, BasicConfig.MANAGER_GELRESOURCE, "删除链接失败", delResourceRes.body().asString()));
Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
boolean data = delResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除链接失败", delResourceRes.body().asString()));
}
......@@ -321,10 +316,10 @@ public class LiveMaterial implements AdminAuthorization {
freeParam.put("resourcePictures", "https://yun.dui88.com/kjy/image/20210306/1615039670425.jpg");
Response FreeRes = network.postResponse(freeParam, BasicConfig.MANAGER_FREE);
Object data13 = FreeRes.jsonPath().getJsonObject("data");
System.out.println(data13);
Assert.assertNotNull(data13, network.message(freeParam, BasicConfig.MANAGER_FREE, "新增免费资料失败", FreeRes.body().asString()));
Response FreeRes = network.postResponse(freeParam, BasicConfig.MANAGER_saveFree);
Object data = FreeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(freeParam, BasicConfig.MANAGER_saveFree, "新增免费资料失败", FreeRes.body().asString()));
}
......@@ -337,21 +332,21 @@ public class LiveMaterial implements AdminAuthorization {
form1Param.put("pageSize", 1);
form1Param.put("resourceTypeList", 11);
Response linkRes = network.getResponse(form1Param, BasicConfig.MANAGER_RESOURCELIST);
Response linkRes = network.getResponse(form1Param, BasicConfig.MANAGER_resourceList);
WelfareListBean data1 = JsonUtil.parseResponseToBean(linkRes, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(form1Param, BasicConfig.MANAGER_RESOURCELIST, "查询免费领资料失败", linkRes.body().asString()));
Assert.assertNotNull(bean, network.message(form1Param, BasicConfig.MANAGER_resourceList, "查询免费领资料失败", linkRes.body().asString()));
//删除表单
int id = bean.getId();
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", id);
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_GELRESOURCE);
boolean data14 = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data14);
Assert.assertTrue(data14, network.message(delResourceParam, BasicConfig.MANAGER_GELRESOURCE, "删除免费领资料失败", elResourceRes.body().asString()));
Response elResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
boolean data = elResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除免费领资料失败", elResourceRes.body().asString()));
}
......@@ -372,10 +367,10 @@ public class LiveMaterial implements AdminAuthorization {
testParam.put("resourceButtonTitle", "我要报名");
testParam.put("tradeIntroducePictures", "https://yun.dui88.com/kjy/image/20210306/1615040918512.jpeg");
Response testRes = network.postResponse(testParam, BasicConfig.MANAGER_TEST);
Object data15 = testRes.jsonPath().getJsonObject("data");
System.out.println(data15);
Assert.assertNotNull(data15, network.message(testParam, BasicConfig.MANAGER_TEST, "新增秒薪失败", testRes.body().asString()));
Response testRes = network.postResponse(testParam, BasicConfig.MANAGER_saveTest);
Object data = testRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(testParam, BasicConfig.MANAGER_saveTest, "新增秒薪失败", testRes.body().asString()));
}
......@@ -388,21 +383,20 @@ public class LiveMaterial implements AdminAuthorization {
test1Param.put("pageSize", 1);
test1Param.put("resourceTypeList", 13);
Response test1Res = network.getResponse(test1Param, BasicConfig.MANAGER_RESOURCELIST);
Response test1Res = network.getResponse(test1Param, BasicConfig.MANAGER_resourceList);
WelfareListBean data1 = JsonUtil.parseResponseToBean(test1Res, WelfareListBean.class);
if (data1.getTotalCount() > 0) {
WelfareBean bean = data1.getList().get(0);
Assert.assertNotNull(bean, network.message(test1Param, BasicConfig.MANAGER_RESOURCELIST, "查询测试失败", test1Res.body().asString()));
Assert.assertNotNull(bean, network.message(test1Param, BasicConfig.MANAGER_resourceList, "查询测试失败", test1Res.body().asString()));
int id = bean.getId();
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", id);
Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_GELRESOURCE);
boolean data16 = delResourceRes.jsonPath().getBoolean("data");
System.out.println(data16);
Assert.assertTrue(data16, network.message(delResourceParam, BasicConfig.MANAGER_GELRESOURCE, "删除测试失败", delResourceRes.body().asString()));
Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
boolean data = delResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除测试失败", delResourceRes.body().asString()));
}
......
package com.kjj.cases.live.liveConfig;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.bean.answer.AddReward;
import com.kjj.bean.answer.AddWelfareConf;
import com.kjj.bean.answer.RewardList;
import com.kjj.bean.lottery.ConfIdList;
import com.kjj.bean.manager.*;
import com.kjj.cases.live.admin.AdminAuthorization;
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 com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
public class SaveLive implements AdminAuthorization {
public String liveID;
public String EncodeLiveID;
public long welfareConfId;
private Integer taskId;
@BeforeClass
public void setUp() { BaseUtils.ssoLogin(); }
/**
* 创建直播
*/
@Test(description = "创建直播", priority = 1)
public void 创建直播() {
Map<String, Object> Params = new HashMap<>();
Params.put("posterUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/e36cb31828e14a3ebb9d01e6be79ad66.jpg");
Params.put("videoUrl", "http://streamimg.kjjcrm.com/kjy/image/20210201/1612171657348.mp4");
Params.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
Params.put("coverUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/d4093b24aaca49da8f0e3e276721feea.jpg");
Params.put("mpShareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/182f3659e39b4ea6898af781cc6344a1.jpg");
Params.put("title", "直播测试"+ RandomUtils.nextInt(1,100));
Params.put("mpShareTitle", "自动化直播");
Params.put("companyId", 101);
Params.put("agentInviteAuthType", 1);
Params.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
Params.put("noticeTime", noticeTime);
Params.put("broadcastTime", broadcastTime);
Params.put("shareContent", "自动化直播");
Params.put("shelfStatus", 2);
Params.put("secondPoster", "https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg");
Params.put("regionType", 2);
Params.put("distributionType", 0);
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
ProvinceCityCodeList save =new ProvinceCityCodeList();
save.setProvinceCode(110000);
save.setCityCode(null);
provinceCityCode.add(save);
ProvinceCityCodeList save1 =new ProvinceCityCodeList();
save1.setProvinceCode(420000);
save1.setCityCode(420900);
provinceCityCode.add(save1);
ProvinceCityCodeList save2 =new ProvinceCityCodeList();
save2.setProvinceCode(330000);
save2.setCityCode(330100);
provinceCityCode.add(save2);
Params.put("provinceCityCodeList", provinceCityCode);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_0);
liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey(),EncodeLiveID);
Assert.assertNotNull(liveID, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_0, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
}
/**
* 基础配置
*/
@Test(description = "查询直播配置", priority = 2)
public void 查询直播配置() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", liveID);
Response response = network.getResponse(params, BasicConfig.MANAGER_getConfDetail);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MANAGER_getConfDetail, "查询配置失败", response.body().asString()));
}
@Test(description = "单场红包配置", priority = 3)
public void 单场红包配置() {
//单场红包限额
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("maxAmount", 100000);
Response response = network.postResponse(Params, BasicConfig.MANAGER_MaxAmount);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_MaxAmount, "单场红包限额配置失败", response.body().asString()));
}
@Test(description = "展示红包金额", priority = 4)
public void 展示红包金额() {
//展示红包金额
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("showAmount", 100000);
Response response = network.postResponse(Params, BasicConfig.MANAGER_ShowAmount);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_ShowAmount, "展示红包配置失败", response.body().asString()));
}
@Test(description = "互动问题", priority = 7)
public void 互动问题() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("ids", Arrays.asList(293,294));
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_1);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_1, "互动问题配置失败", response.body().asString()));
}
@Test(description = "投票", priority = 20)
public void 投票() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
List<Long> ids1 = new ArrayList<>();
ids1.add(378L);
ids1.add(380L);
Params.put("ids", ids1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_2);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_2, "投票配置失败", response.body().asString()));
}
@Test(description = "直播资料", priority = 5)
public void 直播资料() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
List<Long> ids2 = new ArrayList<>();
ids2.add(355L);
ids2.add(356L);
ids2.add(357L);
ids2.add(358L);
ids2.add(359L);
ids2.add(652L);
ids2.add(960L);
Params.put("ids", ids2);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_3);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_3, "产品资料配置失败", response.body().asString()));
}
@Test(description = "问卷", priority = 8)
public void 问卷() {
Map<String, Object> Params = new HashMap<>();
Params.put("id",null);
Params.put("liveId", liveID);
Params.put("surveyDesc", "问卷调研");
Params.put("surveyLink", "https://kjj.m.duibatest.com.cn/live/pages/survey/index?id=41");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_4);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_4, "问卷配置失败", response.body().asString()));
}
/**
* 直播中奖品
*/
//直播中奖品配置
@Test(description = "直播中抽奖", priority = 9)
public void 直播中抽奖() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("interactNum", 1);
Params.put("showInteractNum", 1);
Params.put("welfareId", 191);
Params.put("afterMin", 20);
Response response = network.postResponse(Params, BasicConfig.MANAGER_add_1);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_add_1, "直播中抽奖配置失败", response.body().asString()));
Map<String, Object> add2Param = new HashMap<>();
add2Param.put("liveId", liveID);
add2Param.put("interactNum", 100);
add2Param.put("showInteractNum", 100);
add2Param.put("welfareId", 192);
add2Param.put("afterMin", 30);
Response add2Res = network.postResponse(add2Param, BasicConfig.MANAGER_add_1);
Object data1 = add2Res.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertNotNull(data1, network.message(add2Param, BasicConfig.MANAGER_add_1, "直播中抽奖配置失败", add2Res.body().asString()));
Map<String, Object> add3Param = new HashMap<>();
add3Param.put("liveId", liveID);
add3Param.put("interactNum", 100);
add3Param.put("showInteractNum", 100);
add3Param.put("welfareId", 193);
add3Param.put("afterMin", 35);
Response add3Res = network.postResponse(add3Param, BasicConfig.MANAGER_add_1);
Object data2 = add3Res.jsonPath().getJsonObject("data");
System.out.println(data2);
Assert.assertNotNull(data2, network.message(add3Param, BasicConfig.MANAGER_add_1, "直播中抽奖配置失败", add3Res.body().asString()));
Map<String, Object> add4Param = new HashMap<>();
add4Param.put("liveId", liveID);
add4Param.put("interactNum", 2);
add4Param.put("showInteractNum", 2);
add4Param.put("welfareId", 194);
add4Param.put("afterMin", 40);
Response add4Res = network.postResponse(add4Param, BasicConfig.MANAGER_add_1);
Object data3 = add4Res.jsonPath().getJsonObject("data");
System.out.println(data3);
Assert.assertNotNull(data3, network.message(add4Param, BasicConfig.MANAGER_add_1, "直播中抽奖配置失败", add4Res.body().asString()));
}
@Test(description = "查询抽奖奖品列表", priority = 10)
public void 查询抽奖奖品列表() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Response response = network.getResponse(Params, BasicConfig.MANAGER_getLiveAwardList);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("welfareConfId"));
welfareConfId =Long.parseLong(resultMap.get("welfareConfId").toString());
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_getLiveAwardList, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "指定中奖配置", priority = 11)
public void 指定中奖配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("specifyAwardType", 1);//1:统一采购,2:自行准备
Params.put("totalCount", 5);
Params.put("unitPrice", 2990);
Params.put("maxCanSpecifyCount", 0);
Params.put("privilegeScope", 1);
Params.put("inviteCount", 1);
Params.put("welfareConfId",welfareConfId);
System.out.println("Params" + JSON.toJSONString(Params));
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveSpecifyAward);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveSpecifyAward, "指定中奖配置失败", response.body().asString()));
}
@Test(description = "个人PK奖励", priority = 12)
public void 个人PK奖励() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("rewardType", 1);//1:个人,2:团队
List<RewardPkBean> rewardPks = new ArrayList<>();
RewardPkBean rewardPk = new RewardPkBean();
rewardPk.setPrizeName("1");
rewardPk.setRanking(1);
rewardPks.add(rewardPk);
RewardPkBean rewardPk1 = new RewardPkBean();
rewardPk1.setPrizeName("2");
rewardPk1.setRanking(2);
rewardPks.add(rewardPk1);
RewardPkBean rewardPk2 = new RewardPkBean();
rewardPk2.setPrizeName("3");
rewardPk2.setRanking(3);
rewardPks.add(rewardPk2);
Params.put("rewardPkParamList", rewardPks);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_5);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_5, "个人pk奖励配置失败", response.body().asString()));
}
@Test(description = "团队PK奖励", priority = 13)
public void 团队PK奖励() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("rewardType", 2);//1:个人,2:团队
List<RewardPkBean> rewardPks3 = new ArrayList<>();
RewardPkBean rewardPk3 = new RewardPkBean();
rewardPk3.setPrizeName("10000");
rewardPk3.setRanking(1);
rewardPks3.add(rewardPk3);
RewardPkBean rewardPk4 = new RewardPkBean();
rewardPk4.setPrizeName("2500");
rewardPk4.setRanking(2);
rewardPks3.add(rewardPk4);
RewardPkBean rewardPk5 = new RewardPkBean();
rewardPk5.setPrizeName("1000");
rewardPk5.setRanking(3);
rewardPks3.add(rewardPk5);
Params.put("rewardPkParamList", rewardPks3);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_5);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_5, "团队pk奖励配置失败", response.body().asString()));
}
/**
* 普通红包配置
*/
@Test(description = "获取剩余红包金额", priority = 14)
public void 获取剩余红包金额() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Response response = network.getResponse(Params, BasicConfig.MANAGER_SurplusAmount);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_SurplusAmount, "获取剩余红包金额失败", response.body().asString()));
}
@Test(description = "新增红包配置", priority = 15)
public void 新增红包配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("confId", "null");
Params.put("showAmount", 1000);
Params.put("totalAmount", 1000);
Params.put("luckNum", 0);
Params.put("luckHelpNum", 0);
Params.put("luckAmount", 0);
Params.put("generalNum", 33);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_6);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_6, "普通红包配置失败", response.body().asString()));
}
/**
* 免费领奖品
*/
@Test(description = "配置免费福利", priority = 16)
public void 配置免费福利() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("interactNum", -1);
Params.put("welfare", 1);
Params.put("welfareId", 190);
Params.put("welfareName", "萌娃锦鲤");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_7);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_7, "免费福利配置失败", response.body().asString()));
}
/**
* 奖品配送
*/
@Test(description = "上传发奖团队名单", priority = 17)
public void 上传发奖团队名单() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210425/45c95c5bf7d8fb8aeb40c2ab307e0681.xlsx");
Params.put("fileName", "团队发奖人模板");
Response response = network.postResponse(Params, BasicConfig.MANAGER_importGroupProvider);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(Params, BasicConfig.MANAGER_importGroupProvider, "上传发奖团队名单", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 18)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result1);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result1, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "获取奖品配送相关配置详情", priority = 19)
public void 获取奖品配送相关配置详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_provideDetail);
boolean data = response.jsonPath().getBoolean("data.groupProviderFlag");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_provideDetail, "获取奖品配送相关配置详情失败", response.body().asString()));
}
/**
* 裂变宝箱配置
*/
public List<WelfareList> id;
public JSONObject treasureConf;
@Test(description = "查询配置奖品列表", priority = 20)
public void 查询配置奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "宝箱实物中奖限制1次", priority = 21)
public void 宝箱实物中奖限制1() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("openCondition", 1);
saveParam.put("openNum",10);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setWelfareId(this.id.get(0).getId());
treasureAward.setAwardName("宝箱锦鲤");
treasureAward.setTreasureProbability(10000);
treasureAward.setTreasureType(3);
treasureAward.setRuleType(1);
treasureAward.setTotalNum(3);
treasureAward.setWinLimitCount(1);
saveParam.put("treasureAward",treasureAward);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(2);
treasureRed.setTotalNum(2);
treasureRed.setTreasureProbability(0);
treasureRed.setTreasureType(2);
treasureRed.setWinLimitCount(1);
treasureRed.setShowAmount(200);
saveParam.put("treasureRed",treasureRed);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
treasureCode.setTreasureProbability(0);
treasureCode.setTreasureType(1);
saveParam.put("treasureCode",treasureCode);
saveParam.put("treasurePeriod",3);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveTreasureConf, "新增宝箱裂变配置失败", response.body().asString()));
}
@Test(description = "查询宝箱配置详情", priority = 22)
public void 查询宝箱配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(confDetailParam, BasicConfig.MANAGER_confDetail);
System.out.println(response);
Integer openCondition =response.jsonPath().getInt("data.openCondition");
System.out.println(openCondition);
Assert.assertTrue(openCondition>0, network.message(confDetailParam, BasicConfig.MANAGER_confDetail, "查询宝箱配置详情失败", response.body().asString()));
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "开启宝箱配置", priority = 23)
public void 开启宝箱配置() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
switchStatusParam.put("confStatus", 1);
Response response = network.postResponse(switchStatusParam, BasicConfig.MANAGER_switchStatus);
boolean data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(switchStatusParam, BasicConfig.MANAGER_switchStatus, "开启宝箱失败", response.body().asString()));
}
/**
* 时长宝箱配置
*/
public List<TreasureList> ConfId;
@Test(description = "获取直播中停留时长宝箱列表", priority = 24)
public void 获取直播中停留时长宝箱列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_list1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
List<TreasureList> list = JsonUtil.parseResponseToListBean(response,TreasureList.class);
System.out.println(list);
this.ConfId = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_list1, "获取直播中停留时长宝箱列表失败", response.body().asString()));
}
@Test(description = "停留时长1分钟固定抽奖码", priority = 25)
public void 停留时长1分钟固定抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",1);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(0);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长1分钟固定抽奖码", response.body().asString()));
}
@Test(description = "获取第1轮宝箱配置详情", priority = 26)
public void 获取第1轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第1轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长2分钟现金红包", priority = 27)
public void 停留时长2分钟现金红包() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
updateParam.put("boxConfType",2);
updateParam.put("openCondition",2);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(1);
treasureRed.setTotalNum(1);
treasureRed.setFixedNum(30);
updateParam.put("treasureRed",treasureRed);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长2分钟现金红包配置失败", response.body().asString()));
}
@Test(description = "获取第2轮宝箱配置详情", priority = 28)
public void 获取第2轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第2轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "查询奖品列表", priority = 29)
public void 查询奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "停留时长3分钟实物奖品", priority = 30)
public void 停留时长3分钟实物奖品() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
updateParam.put("boxConfType",3);
updateParam.put("openCondition",3);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setAwardName("萌娃锦鲤");
treasureAward.setBizConfId(0);
treasureAward.setIsLimit(2);
treasureAward.setTotalNum(1);
treasureAward.setWelfareId(this.id.get(5).getId());
updateParam.put("treasureAward",treasureAward);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第3轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第3轮宝箱配置详情", priority = 31)
public void 获取第三轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第三轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长4分钟随机抽奖码", priority = 32)
public void 停留时长4分钟随机抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",4);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第四轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第4轮宝箱配置详情", priority = 33)
public void 获取第四轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第四轮宝箱配置详情失败", response.body().asString()));
}
/**
* 猜数字红包
*/
public List<GuessList> confId;
//查询剩余可配金额
@Test(description = "查询剩余可配金额", priority = 34)
public void 查询剩余可配金额() {
Map<String, Object> AmountParam = new HashMap<>();
AmountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(AmountParam, BasicConfig.MANAGER_getSurplusAmount);
Integer data =response.jsonPath().getInt("data");
System.out.println(data);
Assert.assertTrue(data>0, network.message(AmountParam, BasicConfig.MANAGER_getSurplusAmount, "查询剩余可配金额失败", response.body().asString()));
}
@Test(description = "新增猜数字红包", priority = 35)
public void 新增猜数字红包() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("redAmount",66);
saveParam.put("redRealNum",1);
saveParam.put("redShowNum",1);
saveParam.put("guessMinNum",1);
saveParam.put("guessMaxNum",10);
saveParam.put("guessLeastTime",4);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", response.body().asString()));
Map<String, Object> saveguessParam = new HashMap<>();
saveguessParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveguessParam.put("redAmount",88);
saveguessParam.put("redRealNum",1);
saveguessParam.put("redShowNum",1);
saveguessParam.put("guessMinNum",1);
saveguessParam.put("guessMaxNum",10);
saveguessParam.put("guessLeastTime",4);
Response guessRes = network.postResponse(saveguessParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data1 =guessRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(saveguessParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", guessRes.body().asString()));
}
@Test(description = "查询猜数字红包列表", priority = 36)
public void 查询猜数字红包列表() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list_1);
List<GuessList>list=JsonUtil.parseResponseToListBean(response,GuessList.class);
System.out.println(list);
this.confId=list;
Assert.assertNotNull(list, network.message(listParam, BasicConfig.MANAGER_list_1, "查询猜数字红包列表失败", response.body().asString()));
}
@Test(description = "查询猜数字红包详情页", priority = 37)
public void 查询猜数字红包详情页() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
detailParam.put("confId", this.confId.get(0).getConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail_1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail_1, "查询猜数字红包详情页失败", response.body().asString()));
}
@Test(description = "编辑猜数字红包", priority = 38)
public void 编辑猜数字红包() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
updateParam.put("redAmount",88);
updateParam.put("redRealNum",1);
updateParam.put("redShowNum",1);
updateParam.put("guessMinNum",1);
updateParam.put("guessMaxNum",10);
updateParam.put("guessLeastTime",4);
updateParam.put("confId", this.confId.get(0).getConfId());
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_saveOrUpdate1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_saveOrUpdate1, "新增猜数字红包失败", response.body().asString()));
}
@Test(description = "删除猜数字红包", priority = 39)
public void 删除猜数字红包() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
delParam.put("confId", this.confId.get(0).getConfId());
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del_1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del_1, "删除猜数字红包失败", response.body().asString()));
}
//助播端-直播前配置
@Test(description = "助播直播前新增猜数字红包", priority = 40)
public void 助播直播前新增猜数字红包() {
adminAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
saveParam.put("redAmount",88);
saveParam.put("redRealNum",1);
saveParam.put("redShowNum",1);
saveParam.put("guessMinNum",1);
saveParam.put("guessMaxNum",10);
saveParam.put("guessLeastTime",4);
Response response = network.postResponse(saveParam, BasicConfig.MOBILE_saveOrUpdate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MOBILE_saveOrUpdate, "助播直播前新增猜数字红包失败", response.body().asString()));
}
@Test(description = "助播端查询直播红包配置", priority = 41)
public void 助播端查询直播红包配置() {
adminAuth();
ThreadSleepUtils.sleep(2000);
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MOBILE_findDetail);
boolean hasGuessRed =response.jsonPath().getBoolean("data.hasGuessRed");
System.out.println(hasGuessRed);
Assert.assertTrue(hasGuessRed, network.message(listParam, BasicConfig.MOBILE_findDetail, "助播端查询直播红包配置失败", response.body().asString()));
}
@Test(description = "助播直播前猜数字红包列表", priority = 42)
public void 助播直播前猜数字红包列表() {
adminAuth();
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MOBILE_list);
List<GuessList>list=JsonUtil.parseResponseToListBean(response,GuessList.class, "guessList");
System.out.println(list);
this.confId=list;
Assert.assertNotNull(list, network.message(listParam, BasicConfig.MOBILE_list, "助播直播前猜数字红包列表查询失败", response.body().asString()));
}
@Test(description = "助播直播前猜数字红包详情页", priority = 43)
public void 助播直播前猜数字红包详情页() {
adminAuth();
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
detailParam.put("confId", this.confId.get(0).getConfId());
Response response = network.getResponse(detailParam, BasicConfig.MOBILE_detail);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MOBILE_detail, "助播直播前猜数字红包详情页查询失败", response.body().asString()));
}
@Test(description = "直播前编辑猜数字红包", priority = 44)
public void 直播前编辑猜数字红包() {
adminAuth();
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
updateParam.put("redAmount",99);
updateParam.put("redRealNum",1);
updateParam.put("redShowNum",10);
updateParam.put("guessMinNum",1);
updateParam.put("guessMaxNum",10);
updateParam.put("guessLeastTime",4);
updateParam.put("confId", this.confId.get(0).getConfId());
Response response = network.postResponse(updateParam, BasicConfig.MOBILE_saveOrUpdate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MOBILE_saveOrUpdate, "直播前编辑猜数字红包失败", response.body().asString()));
}
@Test(description = "直播前删除猜数字红包", priority = 45)
public void 直播前删除猜数字红包() {
adminAuth();
Map<String, Object> delParam = new HashMap<>();
delParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
delParam.put("confId", this.confId.get(0).getConfId());
Response response = network.postResponse(delParam, BasicConfig.MOBILE_delete);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MOBILE_delete, "直播前删除猜数字红包失败", response.body().asString()));
}
/**
* 定时投票配置
*/
public List<ConfIdList> confIdList;
@Test(description = "添加定时投票",priority = 46)
public void 添加定时投票(){
Map<String,Object> Params =new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("minutes",0);
Params.put("seconds",15);
Params.put("questionId",781);
Response response=network.postResponse(Params,BasicConfig.MANAGER_saveTimedChoice);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveTimedChoice, "定时投票添加失败", response.body().asString()));
Map<String,Object> saveParam =new HashMap<>();
saveParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("minutes",1);
saveParam.put("seconds",15);
saveParam.put("questionId",782);
Response saveRes=network.postResponse(saveParam,BasicConfig.MANAGER_saveTimedChoice);
boolean data1=saveRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(saveParam, BasicConfig.MANAGER_saveTimedChoice, "定时投票添加失败", saveRes.body().asString()));
}
@Test(description = "查询定时推送投票列表",priority = 47)
public void 定时推送投票列表(){
Map<String,Object> Params =new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("pageIndex",1);
Params.put("pageSize",20);
Response response=network.getResponse(Params,BasicConfig.MANAGER_timedChoice);
confIdList =JSON.parseArray(JSON.toJSONString(response.jsonPath().getList("data")), ConfIdList.class);
System.out.println(confIdList);
Assert.assertNotNull(confIdList, network.message(Params, BasicConfig.MANAGER_timedChoice, "定时投票列表查询失败", response.body().asString()));
}
@Test(description = "查看定时推送投票详情",priority = 48)
public void 查看定时推送投票详情(){
Map<String,Object> Params =new HashMap<>();
Params.put("confId",confIdList.get(0).getConfId());
Response response=network.getResponse(Params,BasicConfig.MANAGER_getDetail);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_getDetail, "定时投票详情查询失败", response.body().asString()));
}
@Test(description = "删除定时投票",priority = 49)
public void 删除定时投票(){
Map<String,Object> Params =new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId());
Response response=network.postResponse(Params,BasicConfig.MANAGER_timedChoiceDel);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_timedChoiceDel, "定时投票删除失败", response.body().asString()));
}
@Test(description = "开启定时投票",priority = 50)
public void 开启定时投票(){
Map<String,Object> Params =new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confStatus",1);
Response response=network.postResponse(Params,BasicConfig.MANAGER_switchStatus1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_switchStatus1, "定时投票开启失败", response.body().asString()));
}
/**
* 有奖答题配置
*/
public int rewardId;
@Test(description = "添加答题现金红包", priority = 51)
public void 添加答题现金红包() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("quesType", "1");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题现金红包");
bean.setOptionList(Answers);
Params.put("questionConf", bean);
AddReward redConf =new AddReward();
redConf.setAmount(100);
redConf.setShowAmount(100);
redConf.setNum(3);
Params.put("redConf", redConf);
Response addRes = network.postResponse(Params, BasicConfig.MANAGER_add);
boolean data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_add, "答题红包配置失败", addRes.body().asString()));
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "1");
List<AnswerBean> Answers1 = new ArrayList<>();
AnswerBean Answer1 = new AnswerBean();
Answer1.setOptionDetail("正确");
Answer1.setOptionType(1);
Answers1.add(Answer1);
AnswerBean Answer3 = new AnswerBean();
Answer3.setOptionDetail("错误");
Answer3.setOptionType(2);
Answers1.add(Answer3);
AnswerListBean bean1 = new AnswerListBean();
bean1.setQuestionDetail("答题现金红包1");
bean1.setOptionList(Answers1);
addParam.put("questionConf", bean1);
AddReward redConf1 =new AddReward();
redConf1.setAmount(100);
redConf1.setShowAmount(100);
redConf1.setNum(3);
addParam.put("redConf", redConf1);
Response response = network.postResponse(addParam, BasicConfig.MANAGER_add);
boolean data1 = response.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(addParam, BasicConfig.MANAGER_add, "答题红包配置失败", response.body().asString()));
Map<String, Object> add1Param = new HashMap<>();
add1Param.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
add1Param.put("quesType", "1");
List<AnswerBean> Answers2 = new ArrayList<>();
AnswerBean Answer4 = new AnswerBean();
Answer4.setOptionDetail("正确");
Answer4.setOptionType(1);
Answers2.add(Answer4);
AnswerBean Answer_1 = new AnswerBean();
Answer_1.setOptionDetail("错误");
Answer_1.setOptionType(2);
Answers2.add(Answer_1);
AnswerListBean bean2 = new AnswerListBean();
bean2.setQuestionDetail("答题现金红包2");
bean2.setOptionList(Answers2);
add1Param.put("questionConf", bean2);
AddReward redConf2 =new AddReward();
redConf2.setAmount(100);
redConf2.setShowAmount(100);
redConf2.setNum(3);
add1Param.put("redConf", redConf2);
Response add1Res = network.postResponse(add1Param, BasicConfig.MANAGER_add);
boolean data2 = addRes.jsonPath().getJsonObject("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(add1Param, BasicConfig.MANAGER_add, "答题红包配置失败", add1Res.body().asString()));
}
@Test(description = "查询新增答题现金红包", priority = 52)
public void 查询新增答题现金红包() {
Map<String, Object> rewardParam = new HashMap<>();
rewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response rewardRes = network.getResponse(rewardParam, BasicConfig.MANAGER_rewardList);
Object data = rewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<RewardList.Reward_List> list= JsonUtil.parseResponseToListBean(rewardRes, RewardList.Reward_List.class);
RewardList.Reward_List reward = list.get(list.size()-1);
boolean red = reward.getQuesType() == 1;
rewardId =reward.getId();
Assert.assertTrue(red, network.message(rewardParam, BasicConfig.MANAGER_rewardList, "获取答题现金红包配置失败", rewardRes.body().asString()));
}
@Test(description = "修改答题现金红包", priority = 53)
public void 修改答题现金红包() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("id", rewardId);
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "1");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确选项");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误选项");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题现金红包");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
AddReward redConf =new AddReward();
redConf.setAmount(100);
redConf.setShowAmount(100);
redConf.setNum(3);
addParam.put("redConf", redConf);
addParam.put("welfareConf", null);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_update);
boolean data = addRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_update, "修改答题红包配置失败", addRes.body().asString()));
}
@Test(description = "删除新增答题现金红包", priority = 54)
public void 删除新增答题现金红包() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("id", rewardId);
Response delRes = network.getResponse(delParam, BasicConfig.MANAGER_delete);
boolean data = delRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_delete, "删除答题现金红包", delRes.body().asString()));
}
//有奖答题_实物奖品
@Test(description = "新增答题实物奖品", priority = 55)
public void 新增答题实物奖品() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "2");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确选项");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误选项");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题实物奖品1");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
addParam.put("redConf", null);
AddWelfareConf welfareConf = new AddWelfareConf();
welfareConf.setWelfareId(190);
welfareConf.setNum(100);
addParam.put("welfareConf", welfareConf);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_add);
boolean data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_add, "新增答题实物奖品配置失败", addRes.body().asString()));
Map<String, Object> add1Param = new HashMap<>();
add1Param.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
add1Param.put("quesType", "2");
List<AnswerBean> Answers1 = new ArrayList<>();
AnswerBean Answer1 = new AnswerBean();
Answer1.setOptionDetail("正确选项");
Answer1.setOptionType(1);
Answers1.add(Answer1);
AnswerBean Answer_2 = new AnswerBean();
Answer_2.setOptionDetail("错误选项");
Answer_2.setOptionType(2);
Answers1.add(Answer_2);
AnswerListBean bean1 = new AnswerListBean();
bean1.setQuestionDetail("答题实物奖品2");
bean1.setOptionList(Answers);
add1Param.put("questionConf", bean1);
add1Param.put("redConf", null);
AddWelfareConf welfareConf1 = new AddWelfareConf();
welfareConf1.setWelfareId(191);
welfareConf1.setNum(100);
add1Param.put("welfareConf", welfareConf1);
Response add1Res = network.postResponse(add1Param, BasicConfig.MANAGER_add);
boolean data1 = add1Res.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(add1Param, BasicConfig.MANAGER_add, "新增答题实物奖品配置失败", add1Res.body().asString()));
}
//有奖答题实物奖品列表数据查询
@Test(description = "查询答题实物奖品", priority = 56)
public void 查询答题实物奖品() {
Map<String, Object> rewardParam = new HashMap<>();
rewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response rewardRes = network.getResponse(rewardParam, BasicConfig.MANAGER_rewardList);
Object data = rewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<RewardList.Reward_List> list= JsonUtil.parseResponseToListBean(rewardRes, RewardList.Reward_List.class);
RewardList.Reward_List reward = list.get(list.size()-1);
boolean red = reward.getQuesType() == 2;
Assert.assertTrue(red, network.message(rewardParam, BasicConfig.MANAGER_rewardList, "获取答题实物奖品失败", rewardRes.body().asString()));
}
/**
*本场答题有奖规则:仅限1次
*/
@Test(description = "本场答题仅限1次规则", priority = 57)
public void 本场答题仅限1次规则() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 2);
updateParam.put("welfareRuleType", 2);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "本场答题仅限1次规则配置失败", response.body().asString()));
}
@Test(description = "查询本场答题配置_限1次", priority = 58)
public void 查询本场答题配置_1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
/**
*有奖答题按团队分配奖品
*/
public List<com.kjj.bean.manager.QuesReward> ListConfId;
public List<TeamAssignmentList.team_List> teamID;
@Test(description = "获取有奖答题列表信息", priority = 59)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
List<com.kjj.bean.manager.QuesReward> list = JsonUtil.parseResponseToListBean(response, com.kjj.bean.manager.QuesReward.class);
System.out.println(list);
this.ListConfId = list;
Assert.assertNotNull(list, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "获取答题按团队分配的团队列表", priority = 60)
public void 获取答题按团队分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfId.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "添加团队", priority = 61)
public void 添加团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfId.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3837,3324,3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加团队失败", response.body().asString()));
}
@Test(description = "获取答题已分配的团队列表", priority = 62)
public void 获取答题已分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfId.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
List<TeamAssignmentList.team_List> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")),TeamAssignmentList.team_List.class);
System.out.println(list);
this.teamID = list;
Assert.assertNotNull(list, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "单个团队删除", priority = 63)
public void 单个团队删除() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfId.get(2).getId());
TeamParam.put("id",this.teamID.get(0).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_delTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_delTeam, "单个团队删除", response.body().asString()));
}
@Test(description = "一键清空团队", priority = 64)
public void 一键清空团队() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfId.get(2).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_deleteAll);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_deleteAll, "一键清空团队失败", response.body().asString()));
}
@Test(description = "添加指定中奖团队", priority = 65)
public void 添加指定中奖团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfId.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加指定中奖团队失败", response.body().asString()));
}
@Test(description = "开启团队配置开关", priority = 66)
public void 开启团队配置开关() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfId.get(2).getId());
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_updateTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addTeamParam, BasicConfig.MANAGER_updateTeam, "开启团队配置开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......@@ -21,30 +21,30 @@ public class Share implements AdminAuthorization {
@Test(description = "新增常规小程序分享", priority = 1)
public void 新增常规小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」常规分享文案{{name}}");
saveParam.put("shareType", 1);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」常规分享文案{{name}}");
Params.put("shareType", 1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增常规小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增常规小程序分享失败", response.body().asString()));
}
@Test(description = "新增红包小程序分享", priority = 2)
public void 新增红包宝箱小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」红包分享文案{{name}}");
saveParam.put("shareType", 2);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」红包分享文案{{name}}");
Params.put("shareType", 2);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增红包小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增红包小程序分享失败", response.body().asString()));
}
......@@ -52,30 +52,30 @@ public class Share implements AdminAuthorization {
@Test(description = "新增直播宝箱小程序分享", priority = 3)
public void 新增直播宝箱小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」宝箱裂变分享文案{{name}}");
saveParam.put("shareType", 4);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」宝箱裂变分享文案{{name}}");
Params.put("shareType", 4);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增直播宝箱小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增直播宝箱小程序分享失败", response.body().asString()));
}
@Test(description = "新增猜数红包小程序分享", priority = 4)
public void 新增猜数红包小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」猜数字红包分享文案{{name}}");
saveParam.put("shareType", 5);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」猜数字红包分享文案{{name}}");
Params.put("shareType", 5);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增猜数红包小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增猜数红包小程序分享失败", response.body().asString()));
}
......
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.bean.manager.TeamList;
import com.kjj.cases.live.admin.AdminAuthorization;
......@@ -24,104 +24,104 @@ public class Team implements AdminAuthorization {
@Test(description = "新增团队", priority = 1)
public void 新增团队() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("teamName", "测试团队");
saveOrUpdateParam.put("expectedNum", 100);
saveOrUpdateParam.put("id", "");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("teamName", "测试团队");
Params.put("expectedNum", 100);
Params.put("id", "");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "新增团队失败", response.body().asString()));
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveOrUpdate, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队列表", priority = 2)
public void 查询团队列表() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询新增团队失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询新增团队失败", response.body().asString()));
}
@Test(description = "修改团队", priority = 3)
public void 修改团队() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("id", this.id.get(0).getId());
saveOrUpdateParam.put("teamName", "测试团队");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("id", this.id.get(0).getId());
Params.put("teamName", "测试团队");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "修改新增团队失败", response.body().asString()));
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveOrUpdate, "修改新增团队失败", response.body().asString()));
}
@Test(description = "删除团队", priority = 4)
public void 删除团队() {
Map<String, Object> deleteParam = new HashMap<>();
deleteParam.put("id", this.id.get(0).getId());
Response response = network.postResponse(deleteParam, BasicConfig.MANAGER_del);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Response response = network.postResponse(Params, BasicConfig.MANAGER_del);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(deleteParam, BasicConfig.MANAGER_del, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_del, "查询新增团队失败", response.body().asString()));
}
@Test(description = "设置内勤标识", priority = 5)
public void 设置内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 1);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Params.put("teamFlag", 1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询设置团队内勤标识", priority = 6)
public void 查询设置团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询设置团队内勤标识失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询设置团队内勤标识失败", response.body().asString()));
}
@Test(description = "取消团队内勤标识", priority = 7)
public void 取消内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 0);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Params.put("teamFlag", 0);
Response response = network.postResponse(Params, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询取消团队内勤标识", priority = 8)
public void 查询取消团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询取消内勤标识失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询取消内勤标识失败", response.body().asString()));
}
......
package com.kjj.cases.live.liveConfig;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfIdList;
import com.kjj.bean.manager.RuleBean;
import com.kjj.bean.manager.SaveLimitBean;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils;
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 WinningRules implements AdminAuthorization {
public Integer taskId;
public long Id;
public List<ConfIdList> confIdList;
@BeforeClass
public void setUp() { BaseUtils.ssoLogin(); }
/**
* 按企业指定中奖
*/
@Test(description = "获取初始抽奖轮次信息", priority = 1)
public void 获取初始抽奖轮次信息() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_list);
confIdList = JSON.parseArray(JSON.toJSONString(response.jsonPath().getList("data")), ConfIdList.class);
System.out.println(confIdList);
Assert.assertNotNull(confIdList, network.message(Params, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "上传企业指定中奖名单", priority = 2)
public void 上传企业指定中奖名单() {
Map<String, Object> Params = new HashMap<>();
Params.put("confId",confIdList.get(2).getConfId());
Params.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210420/51716f59605424332f50a26f0a5d531f.xlsx");
Params.put("fileName", "指定中奖名单");
Response response = network.postResponse(Params, BasicConfig.MANAGER_import);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(Params, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取导入企业指定名单结果", priority = 3)
public void 获取导入企业指定名单结果() throws InterruptedException {
Map<String, Object> Params = new HashMap<>();
Params.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(Params, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(Params, BasicConfig.MANAGER_result, "获取导入企业指定名单结果失败", response.body().asString()));
}
@Test(description = "删除企业指定中奖名单", priority = 4)
public void 删除企业指定中奖名单() {
Map<String, Object> Params = new HashMap<>();
Params.put("confId",confIdList.get(2).getConfId());
Response response = network.postResponse(Params, BasicConfig.MANAGER_del1);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_del1, "删除企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "上传新的企业指定中奖名单", priority = 5)
public void 上传新的企业指定中奖名单() {
Map<String, Object> Params = new HashMap<>();
Params.put("confId",confIdList.get(2).getConfId());
Params.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210421/14cfc6260713bc97e7cd6a9b27b0e763.xlsx");
Params.put("fileName", "指定中奖名单");
Response response = network.postResponse(Params, BasicConfig.MANAGER_import);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(Params, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取新的导入任务结果", priority = 6)
public void 获取新的导入任务结果() {
Map<String, Object> Params = new HashMap<>();
Params.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(Params, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
}
Assert.fail(network.message(Params, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
/**
* 按地区分配奖品
*/
@Test(description = "未配置区域开启开关", priority = 7)
public void 未配置区域开启开关() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId() );
Params.put("status",1 );
Response response = network.postResponse(Params, BasicConfig.MANAGER_changeStatus);
boolean success = response.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertFalse(success, network.message(Params, BasicConfig.MANAGER_changeStatus, "查询没有区域中奖配置记录失败", response.body().asString()));
}
@Test(description = "获取省市区数据", priority = 8)
public void 获取省市区数据() {
Map<String, Object> Params = new HashMap<>();
Params.put("areaType",2);
Response response = network.getResponse(Params, BasicConfig.MANAGER_area);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_area, "获取省市区数据失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次配置头部信息", priority = 9)
public void 获取抽奖轮次配置头部信息() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId() );
Response response = network.getResponse(Params, BasicConfig.MANAGER_header);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_header, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次信息配置的中奖地区配置", priority = 10)
public void 获取抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId() );
Response response = network.getResponse(Params, BasicConfig.MANAGER_confList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_confList, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "保存抽奖轮次信息配置的中奖地区配置", priority = 11)
public void 保存抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId() );
List<RuleBean> Rule = new ArrayList<>();
RuleBean save = new RuleBean();
save.setProvinceCode(110000);
save.setCityCode(null);
save.setTotalNum(50);
Rule.add(save);
RuleBean save1 = new RuleBean();
save1.setProvinceCode(420000);
save1.setCityCode(null);
save1.setTotalNum(50);
Rule.add(save1);
RuleBean save2 = new RuleBean();
save2.setProvinceCode(420000);
save2.setCityCode(420900);
save2.setTotalNum(50);
Rule.add(save2);
Params.put("list",Rule);
Response response = network.postResponse(Params, BasicConfig.MANAGER_save);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_save, "保存抽奖轮次信息配置的中奖地区配置失败", response.body().asString()));
}
@Test(description = "已配置区域开启开关", priority = 12)
public void 已配置区域开启开关() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(1).getConfId() );
Params.put("status",1 );
Response response = network.postResponse(Params, BasicConfig.MANAGER_changeStatus);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_changeStatus, "已配置区域开启开关失败", response.body().asString()));
}
@Test(description = "查询中奖限制", priority = 13)
public void 查询中奖限制() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_limit, "查询中奖限制失败", response.body().asString()));
}
@Test(description = "修改中奖规则限制", priority = 14)
public void 修改中奖规则限制() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveLimitBean> savelimit = new ArrayList<>();
SaveLimitBean limitlist = new SaveLimitBean();
limitlist.setConfName(3);
limitlist.setConfValue("1");
savelimit.add(limitlist);
SaveLimitBean limitlist1 = new SaveLimitBean();
limitlist1.setConfName(4);
limitlist1.setConfValue("1");
savelimit.add(limitlist1);
SaveLimitBean limitlist2 = new SaveLimitBean();
limitlist2.setConfName(11);
limitlist2.setConfValue("1");
savelimit.add(limitlist2);
SaveLimitBean limitlist3 = new SaveLimitBean();
limitlist3.setConfName(12);
limitlist3.setConfValue("0");
savelimit.add(limitlist3);
Params.put("list",savelimit);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveLimit);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveLimit, "修改中奖规则限制失败", response.body().asString()));
}
@Test(description = "查询修改中奖限制是否成功", priority = 15)
public void 查询修改中奖限制是否成功() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_limit, "未查询到修改后的中奖规则", response.body().asString()));
}
/**
* 按团队配置份数
*/
@Test(description = "查询新增时团队列表", priority = 16)
public void 查询新增时团队列表() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(3).getConfId());
Params.put("pageSize",20);
Params.put("pageIndex",1);
Response response = network.getResponse(Params, BasicConfig.MANAGER_search);
Object data=response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_search, "查询新增时团队列表失败", response.body().asString()));
}
@Test(description = "新增团队配置", priority = 17)
public void 新增团队配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(3).getConfId());
Params.put("teamId",3817);
Params.put("totalNum",1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveteam);
System.out.println(response.jsonPath());
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveteam, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队份数配置列表", priority = 18)
public void 查询团队份数配置列表() {
ThreadSleepUtils.sleep(500);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(3).getConfId());
Params.put("pageSize",20);
Params.put("pageIndex",1);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(Params, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "修改团队份数", priority = 19)
public void 修改团队份数() {
Map<String, Object> Params = new HashMap<>();
Params.put("id",Id);
Params.put("totalNum",2);
Response response = network.postResponse(Params, BasicConfig.MANAGER_changeNum);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_changeNum, "修改团队份数失败", response.body().asString()));
}
@Test(description = "删除团队奖品配置", priority = 20)
public void 删除团队奖品配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("id",Id);
Response response = network.postResponse(Params, BasicConfig.MANAGER_del0);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_del0, "删除团队配置失败", response.body().asString()));
}
@Test(description = "批量导入团队份数配置", priority = 21)
public void 批量导入团队份数配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("bizId",confIdList.get(3).getConfId());
Params.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210512/d6cd0ef5b4808d8e5d608433079296a2.xlsx");
Params.put("fileName", "团队配置份数模板.xlsx");
Response response = network.postResponse(Params, BasicConfig.MANAGER_import0);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(Params, BasicConfig.MANAGER_import0, "批量导入团队份数配置失败", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 22)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> Params = new HashMap<>();
Params.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(Params, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(Params, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "查询新增团队份数配置列表", priority = 23)
public void 查询新增团队份数配置列表() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(3).getConfId());
Params.put("pageSize",20);
Params.put("pageIndex",1);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(Params, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "开启按团队配置份数开关", priority = 24)
public void 开启按团队配置份数开关() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("confId",confIdList.get(3).getConfId());
Params.put("status",1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_changeStatus1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_changeStatus1, "开启按团队配置份数开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......@@ -22,37 +22,37 @@ public class spec implements AdminAuthorization {
@Test(description = "根据直播间id查询指定中奖配置", priority = 1)
public void 根据直播间id查询指定中奖配置() {
Map<String, Object> AwardConfParam = new HashMap<>();
AwardConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()) );
Response response = network.getResponse(AwardConfParam, BasicConfig.MANAGER_getSpecifyAwardConf);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()) );
Response response = network.getResponse(Params, BasicConfig.MANAGER_getSpecifyAwardConf);
id = response.jsonPath().getLong("data.id");
System.out.println(id);
Assert.assertNotNull(id, network.message(AwardConfParam, BasicConfig.MANAGER_getSpecifyAwardConf, "根据直播间id查询指定中奖配置失败", response.body().asString()));
Assert.assertNotNull(id, network.message(Params, BasicConfig.MANAGER_getSpecifyAwardConf, "根据直播间id查询指定中奖配置失败", response.body().asString()));
}
@Test(description = "查询指定中奖信息", priority = 2)
public void 查询指定中奖信息() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("specifyAwardConfId",id );
Response response = network.getResponse(saveParam, BasicConfig.MANAGER_findById);
Map<String, Object> Params = new HashMap<>();
Params.put("specifyAwardConfId",id );
Response response = network.getResponse(Params, BasicConfig.MANAGER_findById);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveParam, BasicConfig.MANAGER_findById, "查询指定中奖信息失败", response.body().asString()));
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_findById, "查询指定中奖信息失败", response.body().asString()));
}
@Test(description = "新增指定中奖付款码配置", priority = 3)
public void 新增指定中奖付款码配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("id", id);
saveParam.put("payCodeImg", "//yun.dui88.com/kjy/image/20210425/1619328741809.jpeg");
saveParam.put("supplierName", "yl");
saveParam.put("supplierPhone", "15558005636");
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveSpecifyAwardConf);
Map<String, Object> Params = new HashMap<>();
Params.put("id", id);
Params.put("payCodeImg", "//yun.dui88.com/kjy/image/20210425/1619328741809.jpeg");
Params.put("supplierName", "yl");
Params.put("supplierPhone", "15558005636");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveSpecifyAwardConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveSpecifyAwardConf, "新增指定中奖付款码失败", response.body().asString()));
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveSpecifyAwardConf, "新增指定中奖付款码失败", response.body().asString()));
}
......
package com.kjj.cases.live.lottery;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfidList;
import com.kjj.bean.lottery.ConfIdList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......@@ -18,18 +18,18 @@ import java.util.Objects;
public class Lottery implements AdminAuthorization {
public List<ConfidList> List_Confid;
public List<ConfIdList> List_Confid;
public String shareSign;
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
agentAuth();
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");
Map<String, Object> lotterParam = new HashMap<>();
lotterParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(lotterParam, BasicConfig.USER_listLiveLottery);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listLiveLotterParam, BasicConfig.USER_listLiveLottery, "抽奖活动弹层福利列表查询失败", listLiveLotterRes.body().asString()));
Assert.assertNotNull(data, network.message(lotterParam, BasicConfig.USER_listLiveLottery, "抽奖活动弹层福利列表查询失败", response.body().asString()));
}
@Test(description = "代理人查询抽奖奖品列表", priority = 2)
......@@ -38,7 +38,7 @@ public class Lottery implements AdminAuthorization {
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);
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()));
......@@ -259,9 +259,9 @@ public class Lottery implements AdminAuthorization {
submitInfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
submitInfoParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
submitInfoParam.put("winnerName", "中奖姓名XX");
submitInfoParam.put("region", "");
submitInfoParam.put("location", "");
submitInfoParam.put("phoneNum", "");
// submitInfoParam.put("region", "");
// submitInfoParam.put("location", "");
// submitInfoParam.put("phoneNum", "");
Response submitInfoRes = network.postResponse(submitInfoParam, BasicConfig.USER_submitInfo);
Boolean result = submitInfoRes.jsonPath().getBoolean("success");
System.out.println(result);
......
package com.kjj.cases.live.LotteryCode;
package com.kjj.cases.live.lotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......
package com.kjj.cases.live.LotteryCode;
package com.kjj.cases.live.lotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......
package com.kjj.cases.live.manager;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 LiveLottery implements AdminAuthorization {
public long confId;
public Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(2);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "上传企业指定中奖名单", priority = 2)
public void 上传企业指定中奖名单() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("confId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210420/51716f59605424332f50a26f0a5d531f.xlsx");
importParam.put("fileName", "指定中奖名单");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 3)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "删除企业指定中奖名单", priority = 4)
public void 删除企业指定中奖名单() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("confId",confId);
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del1);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del1, "删除企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "上传新的企业指定中奖名单", priority = 5)
public void 上传新的企业指定中奖名单() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("confId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210421/14cfc6260713bc97e7cd6a9b27b0e763.xlsx");
importParam.put("fileName", "指定中奖名单");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import);
System.out.println(response);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取新的导入任务结果", priority = 6)
public void 获取新的导入任务结果() {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.kjj.bean.manager.RewardPkBean;
import com.kjj.bean.manager.RuleBean;
import com.kjj.bean.manager.SaveLimitBean;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 LotteryRule implements AdminAuthorization {
public long confId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(1);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "未配置区域开启开关", priority = 2)
public void 未配置区域开启开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId );
changeStatusParam.put("status",1 );
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus);
boolean success = response.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertFalse(success, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus, "查询没有区域中奖配置记录失败", response.body().asString()));
}
@Test(description = "获取省市区数据", priority = 3)
public void 获取省市区数据() {
Map<String, Object> areaParam = new HashMap<>();
areaParam.put("areaType",2);
Response response = network.getResponse(areaParam, BasicConfig.MANAGER_area);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(areaParam, BasicConfig.MANAGER_area, "获取省市区数据失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次配置头部信息", priority = 4)
public void 获取抽奖轮次配置头部信息() {
Map<String, Object> headerParam = new HashMap<>();
headerParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
headerParam.put("confId",confId );
Response response = network.getResponse(headerParam, BasicConfig.MANAGER_header);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(headerParam, BasicConfig.MANAGER_header, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次信息配置的中奖地区配置", priority = 5)
public void 获取抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> confListParam = new HashMap<>();
confListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
confListParam.put("confId",confId );
Response response = network.getResponse(confListParam, BasicConfig.MANAGER_confList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(confListParam, BasicConfig.MANAGER_confList, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "保存抽奖轮次信息配置的中奖地区配置", priority = 6)
public void 保存抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("confId",confId );
List<RuleBean> Rule = new ArrayList<>();
RuleBean save = new RuleBean();
save.setProvinceCode(110000);
save.setCityCode(null);
save.setTotalNum(50);
Rule.add(save);
RuleBean save1 = new RuleBean();
save1.setProvinceCode(420000);
save1.setCityCode(null);
save1.setTotalNum(50);
Rule.add(save1);
RuleBean save2 = new RuleBean();
save2.setProvinceCode(420000);
save2.setCityCode(420900);
save2.setTotalNum(50);
Rule.add(save2);
saveParam.put("list",Rule);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_save);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_save, "保存抽奖轮次信息配置的中奖地区配置失败", response.body().asString()));
}
@Test(description = "已配置区域开启开关", priority = 7)
public void 已配置区域开启开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId );
changeStatusParam.put("status",1 );
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus, "已配置区域开启开关失败", response.body().asString()));
}
@Test(description = "查询中奖限制", priority = 8)
public void 查询中奖限制() {
Map<String, Object> limitParam = new HashMap<>();
limitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(limitParam, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(limitParam, BasicConfig.MANAGER_limit, "查询中奖限制失败", response.body().asString()));
}
@Test(description = "修改中奖规则限制", priority = 9)
public void 修改中奖规则限制() {
Map<String, Object> savelimitParam = new HashMap<>();
savelimitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveLimitBean> savelimit = new ArrayList<>();
SaveLimitBean limitlist = new SaveLimitBean();
limitlist.setConfName(3);
limitlist.setConfValue("1");
savelimit.add(limitlist);
SaveLimitBean limitlist1 = new SaveLimitBean();
limitlist1.setConfName(4);
limitlist1.setConfValue("1");
savelimit.add(limitlist1);
SaveLimitBean limitlist2 = new SaveLimitBean();
limitlist2.setConfName(11);
limitlist2.setConfValue("1");
savelimit.add(limitlist2);
SaveLimitBean limitlist3 = new SaveLimitBean();
limitlist3.setConfName(12);
limitlist3.setConfValue("0");
savelimit.add(limitlist3);
savelimitParam.put("list",savelimit);
Response response = network.postResponse(savelimitParam, BasicConfig.MANAGER_saveLimit);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savelimitParam, BasicConfig.MANAGER_saveLimit, "修改中奖规则限制失败", response.body().asString()));
}
@Test(description = "查询修改中奖限制是否成功", priority = 10)
public void 查询修改中奖限制是否成功() {
Map<String, Object> limitParam = new HashMap<>();
limitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(limitParam, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(limitParam, BasicConfig.MANAGER_limit, "未查询到修改后的中奖规则", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 Provide implements AdminAuthorization {
private Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "上传发奖团队名单", priority = 1)
public void 上传发奖团队名单() {
Map<String, Object> importGroupProviderParam = new HashMap<>();
importGroupProviderParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// importGroupProviderParam.put("liveId", 3107);
importGroupProviderParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210425/45c95c5bf7d8fb8aeb40c2ab307e0681.xlsx");
importGroupProviderParam.put("fileName", "团队发奖人模板");
Response response = network.postResponse(importGroupProviderParam, BasicConfig.MANAGER_importGroupProvider);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importGroupProviderParam, BasicConfig.MANAGER_importGroupProvider, "上传发奖团队名单", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 2)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result1);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result1, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "获取奖品配送相关配置详情", priority = 3)
public void 获取奖品配送相关配置详情() {
Map<String, Object> provideDetailParam = new HashMap<>();
provideDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// provideDetailParam.put("liveId", 3107);
Response response = network.getResponse(provideDetailParam, BasicConfig.MANAGER_provideDetail);
boolean data = response.jsonPath().getBoolean("data.groupProviderFlag");
System.out.println(data);
Assert.assertTrue(data, network.message(provideDetailParam, BasicConfig.MANAGER_provideDetail, "获取奖品配送相关配置详情失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.kjj.bean.answer.AddReward;
import com.kjj.bean.answer.AddWelfareConf;
import com.kjj.bean.answer.RewardList;
import com.kjj.bean.manager.AnswerBean;
import com.kjj.bean.manager.AnswerListBean;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 Add implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public int id;
@Test(description = "答题现金红包", priority = 1)
public void 答题现金红包() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "1");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题现金红包");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
AddReward redConf =new AddReward();
redConf.setAmount(100);
redConf.setShowAmount(100);
redConf.setNum(3);
addParam.put("redConf", redConf);
addParam.put("welfareConf", null);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_add);
boolean data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_add, "答题红包配置失败", addRes.body().asString()));
}
@Test(description = "查询新增答题现金红包", priority = 2)
public void 查询新增答题现金红包() {
Map<String, Object> rewardParam = new HashMap<>();
rewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response rewardRes = network.getResponse(rewardParam, BasicConfig.MANAGER_rewardList);
Object data = rewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<RewardList.Reward_List> list= JsonUtil.parseResponseToListBean(rewardRes, RewardList.Reward_List.class);
RewardList.Reward_List reward = list.get(list.size()-1);
boolean red = reward.getQuesType() == 1;
id =reward.getId();
Assert.assertTrue(red, network.message(rewardParam, BasicConfig.MANAGER_rewardList, "获取答题现金红包配置失败", rewardRes.body().asString()));
}
@Test(description = "修改答题现金红包", priority = 3)
public void 修改答题现金红包() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("id", id);
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "1");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确选项");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误选项");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题现金红包");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
AddReward redConf =new AddReward();
redConf.setAmount(100);
redConf.setShowAmount(100);
redConf.setNum(3);
addParam.put("redConf", redConf);
addParam.put("welfareConf", null);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_update);
boolean data = addRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_update, "修改答题红包配置失败", addRes.body().asString()));
}
@Test(description = "删除新增答题现金红包", priority = 4)
public void 删除新增答题现金红包() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("id", id);
Response delRes = network.getResponse(delParam, BasicConfig.MANAGER_delete);
boolean data = delRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_delete, "删除答题现金红包", delRes.body().asString()));
}
@Test(description = "新增答题现金红包", priority = 5)
public void 新增答题现金红包() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "1");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题现金红包1");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
AddReward redConf =new AddReward();
redConf.setAmount(100);
redConf.setShowAmount(100);
redConf.setNum(3);
addParam.put("redConf", redConf);
addParam.put("welfareConf", null);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_add);
boolean data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_add, "答题红包配置失败", addRes.body().asString()));
Map<String, Object> add1Param = new HashMap<>();
add1Param.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
add1Param.put("quesType", "1");
List<AnswerBean> Answers1 = new ArrayList<>();
AnswerBean Answer1 = new AnswerBean();
Answer1.setOptionDetail("正确");
Answer1.setOptionType(1);
Answers1.add(Answer1);
AnswerBean Answer_1 = new AnswerBean();
Answer_1.setOptionDetail("错误");
Answer_1.setOptionType(2);
Answers1.add(Answer_1);
AnswerListBean bean1 = new AnswerListBean();
bean1.setQuestionDetail("答题现金红包2");
bean1.setOptionList(Answers1);
add1Param.put("questionConf", bean1);
AddReward redConf1 =new AddReward();
redConf1.setAmount(100);
redConf1.setShowAmount(100);
redConf1.setNum(3);
add1Param.put("redConf", redConf1);
add1Param.put("welfareConf", null);
Response add1Res = network.postResponse(add1Param, BasicConfig.MANAGER_add);
boolean data1 = addRes.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(add1Param, BasicConfig.MANAGER_add, "答题红包配置失败", add1Res.body().asString()));
}
@Test(description = "查询答题现金红包", priority = 6)
public void 查询答题现金红包() {
Map<String, Object> rewardParam = new HashMap<>();
rewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response rewardRes = network.getResponse(rewardParam, BasicConfig.MANAGER_rewardList);
Object data = rewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<RewardList.Reward_List> list= JsonUtil.parseResponseToListBean(rewardRes, RewardList.Reward_List.class);
RewardList.Reward_List reward = list.get(list.size()-1);
boolean red = reward.getQuesType() == 1;
Assert.assertTrue(red, network.message(rewardParam, BasicConfig.MANAGER_rewardList, "获取答题现金红包配置失败", rewardRes.body().asString()));
}
//有奖答题_实物奖品
@Test(description = "新增答题实物奖品", priority = 7)
public void 新增答题实物奖品() {
Map<String, Object> addParam = new HashMap<>();
addParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addParam.put("quesType", "2");
List<AnswerBean> Answers = new ArrayList<>();
AnswerBean Answer = new AnswerBean();
Answer.setOptionDetail("正确选项");
Answer.setOptionType(1);
Answers.add(Answer);
AnswerBean Answer2 = new AnswerBean();
Answer2.setOptionDetail("错误选项");
Answer2.setOptionType(2);
Answers.add(Answer2);
AnswerListBean bean = new AnswerListBean();
bean.setQuestionDetail("答题实物奖品1");
bean.setOptionList(Answers);
addParam.put("questionConf", bean);
addParam.put("redConf", null);
AddWelfareConf welfareConf = new AddWelfareConf();
welfareConf.setWelfareId(190);
welfareConf.setNum(100);
addParam.put("welfareConf", welfareConf);
Response addRes = network.postResponse(addParam, BasicConfig.MANAGER_add);
boolean data = addRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addParam, BasicConfig.MANAGER_add, "新增答题实物奖品配置失败", addRes.body().asString()));
Map<String, Object> add1Param = new HashMap<>();
add1Param.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
add1Param.put("quesType", "2");
List<AnswerBean> Answers1 = new ArrayList<>();
AnswerBean Answer1 = new AnswerBean();
Answer1.setOptionDetail("正确选项");
Answer1.setOptionType(1);
Answers1.add(Answer1);
AnswerBean Answer_2 = new AnswerBean();
Answer_2.setOptionDetail("错误选项");
Answer_2.setOptionType(2);
Answers1.add(Answer_2);
AnswerListBean bean1 = new AnswerListBean();
bean1.setQuestionDetail("答题实物奖品2");
bean1.setOptionList(Answers);
add1Param.put("questionConf", bean1);
add1Param.put("redConf", null);
AddWelfareConf welfareConf1 = new AddWelfareConf();
welfareConf1.setWelfareId(191);
welfareConf1.setNum(100);
add1Param.put("welfareConf", welfareConf1);
Response add1Res = network.postResponse(add1Param, BasicConfig.MANAGER_add);
boolean data1 = add1Res.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(add1Param, BasicConfig.MANAGER_add, "新增答题实物奖品配置失败", add1Res.body().asString()));
}
//有奖答题实物奖品列表数据查询
@Test(description = "查询答题实物奖品", priority = 8)
public void 查询答题实物奖品() {
Map<String, Object> rewardParam = new HashMap<>();
rewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response rewardRes = network.getResponse(rewardParam, BasicConfig.MANAGER_rewardList);
Object data = rewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
List<RewardList.Reward_List> list= JsonUtil.parseResponseToListBean(rewardRes, RewardList.Reward_List.class);
RewardList.Reward_List reward = list.get(list.size()-1);
boolean red = reward.getQuesType() == 2;
Assert.assertTrue(red, network.message(rewardParam, BasicConfig.MANAGER_rewardList, "获取答题实物奖品失败", rewardRes.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfidList;
import com.kjj.bean.manager.QuesReward;
import com.kjj.bean.manager.TeamAssignmentList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TeamAssignment implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<QuesReward> ListConfid;
public List<TeamAssignmentList.team_List> teamID;
@Test(description = "获取有奖答题列表信息", priority = 1)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
List<QuesReward> list = JsonUtil.parseResponseToListBean(response, QuesReward.class);
System.out.println(list);
this.ListConfid = list;
Assert.assertNotNull(list, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "获取答题按团队分配的团队列表", priority = 2)
public void 获取答题按团队分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "添加团队", priority = 3)
public void 添加团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3837,3324,3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加团队失败", response.body().asString()));
}
@Test(description = "获取答题已分配的团队列表", priority = 4)
public void 获取答题已分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
List<TeamAssignmentList.team_List> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")),TeamAssignmentList.team_List.class);
System.out.println(list);
this.teamID = list;
Assert.assertNotNull(list, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "单个团队删除", priority = 5)
public void 单个团队删除() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("id",this.teamID.get(0).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_delTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_delTeam, "单个团队删除", response.body().asString()));
}
@Test(description = "一键清空团队", priority = 6)
public void 一键清空团队() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_deleteAll);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_deleteAll, "一键清空团队失败", response.body().asString()));
}
@Test(description = "添加指定中奖团队", priority = 7)
public void 添加指定中奖团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加指定中奖团队失败", response.body().asString()));
}
@Test(description = "开启团队配置开关", priority = 8)
public void 开启团队配置开关() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_updateTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addTeamParam, BasicConfig.MANAGER_updateTeam, "开启团队配置开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 Unlimited implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "修改本场答题规则仅一次中奖", priority = 1)
public void 修改本场答题规则仅一次中奖() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 1);
updateParam.put("welfareRuleType", 1);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "答题有奖限制中奖1次", priority = 2)
public void 答题有奖限制中奖1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
@Test(description = "获取有奖答题列表信息", priority = 3)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "本场答题无限制中奖规则", priority = 4)
public void 本场答题无限制中奖规则() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖实物规则无限制", response.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 limited implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "修改本场答题规则仅一次中奖", priority = 1)
public void 修改本场答题规则仅一次中奖() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 2);
updateParam.put("welfareRuleType", 2);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "答题有奖限制中奖1次", priority = 2)
public void 答题有奖限制中奖1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.AnswerBean;
import com.kjj.bean.manager.AnswerListBean;
import com.kjj.bean.manager.ProvinceCityCodeList;
import com.kjj.bean.manager.RewardPkBean;
import com.kjj.bean.answer.*;
import com.kjj.cases.live.admin.AdminAuthorization;
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.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
public class SaveAndUpdate implements AdminAuthorization {
public String liveID;
public String EncodeLiveID;
public long welfareConfId;
@BeforeClass
public void setUp() { BaseUtils.ssoLogin(); }
@Test(description = "创建直播", priority = 1)
public void 创建直播() {
Map<String, Object> saveAndUpdateParam = new HashMap<>();
saveAndUpdateParam.put("posterUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/e36cb31828e14a3ebb9d01e6be79ad66.jpg");
saveAndUpdateParam.put("videoUrl", "http://streamimg.kjjcrm.com/kjy/image/20210201/1612171657348.mp4");
saveAndUpdateParam.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
saveAndUpdateParam.put("coverUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/d4093b24aaca49da8f0e3e276721feea.jpg");
saveAndUpdateParam.put("mpShareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/182f3659e39b4ea6898af781cc6344a1.jpg");
saveAndUpdateParam.put("title", "自动化直播");
saveAndUpdateParam.put("mpShareTitle", "自动化直播");
saveAndUpdateParam.put("companyId", 101);
saveAndUpdateParam.put("agentInviteAuthType", 1);
saveAndUpdateParam.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
saveAndUpdateParam.put("noticeTime", noticeTime);
saveAndUpdateParam.put("broadcastTime", broadcastTime);
saveAndUpdateParam.put("shareContent", "自动化直播");
saveAndUpdateParam.put("shelfStatus", 2);
saveAndUpdateParam.put("secondPoster", "https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg");
saveAndUpdateParam.put("regionType", 2);
saveAndUpdateParam.put("distributionType", 0);
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
ProvinceCityCodeList save =new ProvinceCityCodeList();
save.setProvinceCode(110000);
save.setCityCode(null);
provinceCityCode.add(save);
ProvinceCityCodeList save1 =new ProvinceCityCodeList();
save1.setProvinceCode(420000);
save1.setCityCode(420900);
provinceCityCode.add(save1);
ProvinceCityCodeList save2 =new ProvinceCityCodeList();
save2.setProvinceCode(330000);
save2.setCityCode(330100);
provinceCityCode.add(save2);
saveAndUpdateParam.put("provinceCityCodeList", provinceCityCode);
Response response = network.postResponse(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE);
liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey(),EncodeLiveID);
Assert.assertNotNull(liveID, network.message(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
}
@Test(description = "查询直播配置", priority = 2)
public void 查询直播配置() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", liveID);
Response response = network.getResponse(params, BasicConfig.MANAGER_GETCONFDETAIL);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MANAGER_GETCONFDETAIL, "查询配置失败", response.body().asString()));
}
@Test(description = "单场红包配置", priority = 3)
public void 单场红包配置() {
//单场红包限额
Map<String, Object> maxAmountParam = new HashMap<>();
maxAmountParam.put("liveId", liveID);
maxAmountParam.put("maxAmount", 100000);
Response maxAmountRes = network.postResponse(maxAmountParam, BasicConfig.MANAGER_SAVEORUPDATEMAXAMOUNT);
boolean data = maxAmountRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(maxAmountParam, BasicConfig.MANAGER_SAVEORUPDATEMAXAMOUNT, "单场红包限额配置失败", maxAmountRes.body().asString()));
}
@Test(description = "展示红包金额", priority = 4)
public void 展示红包金额() {
//展示红包金额
Map<String, Object> saveOrUpdateShowAmountParam = new HashMap<>();
saveOrUpdateShowAmountParam.put("liveId", liveID);
saveOrUpdateShowAmountParam.put("showAmount", 100000);
Response saveOrUpdateShowAmountRes = network.postResponse(saveOrUpdateShowAmountParam, BasicConfig.MANAGER_SAVEORUPDATESHOWEAMOUNT);
boolean data1 = saveOrUpdateShowAmountRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(saveOrUpdateShowAmountParam, BasicConfig.MANAGER_SAVEORUPDATESHOWEAMOUNT, "展示红包配置失败", saveOrUpdateShowAmountRes.body().asString()));
}
@Test(description = "互动问题", priority = 7)
public void 互动问题() {
Map<String, Object> param = new HashMap<>();
param.put("liveId", liveID);
param.put("ids", Arrays.asList(293,294));
Response saveOrUpdateRes = network.postResponse(param, BasicConfig.MANAGER_SAVEORUPDATE);
boolean data2 = saveOrUpdateRes.jsonPath().getBoolean("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(param, BasicConfig.MANAGER_SAVEORUPDATE, "互动问题配置失败", saveOrUpdateRes.body().asString()));
}
@Test(description = "投票", priority = 20)
public void 投票() {
Map<String, Object> saveOrUpdate2Param = new HashMap<>();
saveOrUpdate2Param.put("liveId", liveID);
List<Long> ids1 = new ArrayList<>();
ids1.add(378L);
ids1.add(380L);
saveOrUpdate2Param.put("ids", ids1);
Response saveOrUpdate2Res = network.postResponse(saveOrUpdate2Param, BasicConfig.MANAGER_SAVEORUPDATE2);
boolean data3 = saveOrUpdate2Res.jsonPath().getBoolean("data");
System.out.println(data3);
Assert.assertTrue(data3, network.message(saveOrUpdate2Param, BasicConfig.MANAGER_SAVEORUPDATE2, "投票配置失败", saveOrUpdate2Res.body().asString()));
}
@Test(description = "直播间权益", priority = 5)
public void 直播间权益() {
Map<String, Object> saveOrUpdate3Param = new HashMap<>();
saveOrUpdate3Param.put("liveId", liveID);
List<Long> ids2 = new ArrayList<>();
ids2.add(355L);
ids2.add(356L);
ids2.add(357L);
ids2.add(358L);
ids2.add(359L);
ids2.add(652L);
ids2.add(960L);
saveOrUpdate3Param.put("ids", ids2);
Response saveOrUpdate3Res = network.postResponse(saveOrUpdate3Param, BasicConfig.MANAGER_SAVEORUPDATE3);
boolean data4 = saveOrUpdate3Res.jsonPath().getBoolean("data");
System.out.println(data4);
Assert.assertTrue(data4, network.message(saveOrUpdate3Param, BasicConfig.MANAGER_SAVEORUPDATE3, "产品资料配置失败", saveOrUpdate3Res.body().asString()));
}
@Test(description = "问卷", priority = 8)
public void 问卷() {
Map<String, Object> saveOrUpdate4Param = new HashMap<>();
saveOrUpdate4Param.put("id", "null");
saveOrUpdate4Param.put("liveId", liveID);
saveOrUpdate4Param.put("surveyDesc", "问卷调研");
saveOrUpdate4Param.put("surveyLink", "https://kjj.m.duibatest.com.cn/live/pages/survey/index?id=41");
Response saveOrUpdate4Res = network.postResponse(saveOrUpdate4Param, BasicConfig.MANAGER_SAVEORUPDATE4);
boolean data = saveOrUpdate4Res.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveOrUpdate4Param, BasicConfig.MANAGER_SAVEORUPDATE4, "问卷配置失败", saveOrUpdate4Res.body().asString()));
}
//直播中奖品配置
@Test(description = "直播中抽奖", priority = 9)
public void 直播中抽奖() {
Map<String, Object> add1Param = new HashMap<>();
add1Param.put("liveId", liveID);
add1Param.put("interactNum", 1);
add1Param.put("showInteractNum", 1);
add1Param.put("welfareId", 191);
add1Param.put("afterMin", 20);
Response add1Res = network.postResponse(add1Param, BasicConfig.MANAGER_ADD1);
Object data = add1Res.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(add1Param, BasicConfig.MANAGER_ADD1, "直播中抽奖配置失败", add1Res.body().asString()));
Map<String, Object> add2Param = new HashMap<>();
add2Param.put("liveId", liveID);
add2Param.put("interactNum", 100);
add2Param.put("showInteractNum", 100);
add2Param.put("welfareId", 192);
add2Param.put("afterMin", 30);
Response add2Res = network.postResponse(add2Param, BasicConfig.MANAGER_ADD1);
Object data1 = add2Res.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertNotNull(data1, network.message(add2Param, BasicConfig.MANAGER_ADD1, "直播中抽奖配置失败", add2Res.body().asString()));
Map<String, Object> add3Param = new HashMap<>();
add3Param.put("liveId", liveID);
add3Param.put("interactNum", 100);
add3Param.put("showInteractNum", 100);
add3Param.put("welfareId", 193);
add3Param.put("afterMin", 35);
Response add3Res = network.postResponse(add3Param, BasicConfig.MANAGER_ADD1);
Object data2 = add3Res.jsonPath().getJsonObject("data");
System.out.println(data2);
Assert.assertNotNull(data2, network.message(add3Param, BasicConfig.MANAGER_ADD1, "直播中抽奖配置失败", add3Res.body().asString()));
Map<String, Object> add4Param = new HashMap<>();
add4Param.put("liveId", liveID);
add4Param.put("interactNum", 2);
add4Param.put("showInteractNum", 2);
add4Param.put("welfareId", 194);
add4Param.put("afterMin", 40);
Response add4Res = network.postResponse(add4Param, BasicConfig.MANAGER_ADD1);
Object data3 = add4Res.jsonPath().getJsonObject("data");
System.out.println(data3);
Assert.assertNotNull(data3, network.message(add4Param, BasicConfig.MANAGER_ADD1, "直播中抽奖配置失败", add4Res.body().asString()));
}
@Test(description = "查询抽奖奖品列表", priority = 10)
public void 查询抽奖奖品列表() {
Map<String, Object> getLiveAwardListParam = new HashMap<>();
getLiveAwardListParam.put("liveId", liveID);
Response getLiveAwardListRes = network.getResponse(getLiveAwardListParam, BasicConfig.MANAGER_getLiveAwardList);
List data = getLiveAwardListRes.jsonPath().getList("data");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("welfareConfId"));
welfareConfId =Long.parseLong(resultMap.get("welfareConfId").toString());
System.out.println(data);
Assert.assertNotNull(data, network.message(getLiveAwardListParam, BasicConfig.MANAGER_getLiveAwardList, "查询奖品列表失败", getLiveAwardListRes.body().asString()));
}
@Test(description = "指定中奖配置", priority = 11)
public void 指定中奖配置() {
Map<String, Object> saveSpecifyAwardParam = new HashMap<>();
saveSpecifyAwardParam.put("Id", "");
saveSpecifyAwardParam.put("liveId", liveID);
saveSpecifyAwardParam.put("specifyAwardType", 1);//1:统一采购,2:自行准备
saveSpecifyAwardParam.put("totalCount", 5);
saveSpecifyAwardParam.put("unitPrice", 2990);
saveSpecifyAwardParam.put("maxCanSpecifyCount", 0);
saveSpecifyAwardParam.put("privilegeScope", 1);
saveSpecifyAwardParam.put("inviteCount", 1);
saveSpecifyAwardParam.put("welfareConfId",welfareConfId);
System.out.println("saveSpecifyAwardParam------------------------" + JSON.toJSONString(saveSpecifyAwardParam));
Response saveSpecifyAwardRes = network.postResponse(saveSpecifyAwardParam, BasicConfig.MANAGER_SAVESPECIFYAWARD);
boolean data7 = saveSpecifyAwardRes.jsonPath().getBoolean("data");
System.out.println(data7);
Assert.assertTrue(data7, network.message(saveSpecifyAwardParam, BasicConfig.MANAGER_SAVESPECIFYAWARD, "指定中奖配置失败", saveSpecifyAwardRes.body().asString()));
}
@Test(description = "个人PK奖励", priority = 12)
public void 个人PK奖励() {
Map<String, Object> saveOrUpdate5Param = new HashMap<>();
saveOrUpdate5Param.put("liveId", liveID);
saveOrUpdate5Param.put("rewardType", 1);//1:个人,2:团队
List<RewardPkBean> rewardPks = new ArrayList<>();
RewardPkBean rewardPk = new RewardPkBean();
rewardPk.setPrizeName("1");
rewardPk.setRanking(1);
rewardPks.add(rewardPk);
RewardPkBean rewardPk1 = new RewardPkBean();
rewardPk1.setPrizeName("2");
rewardPk1.setRanking(2);
rewardPks.add(rewardPk1);
RewardPkBean rewardPk2 = new RewardPkBean();
rewardPk2.setPrizeName("3");
rewardPk2.setRanking(3);
rewardPks.add(rewardPk2);
saveOrUpdate5Param.put("rewardPkParamList", rewardPks);
Response saveOrUpdate5Res = network.postResponse(saveOrUpdate5Param, BasicConfig.MANAGER_SAVEORUPDATE5);
boolean data8 = saveOrUpdate5Res.jsonPath().getBoolean("data");
System.out.println(data8);
Assert.assertTrue(data8, network.message(saveOrUpdate5Param, BasicConfig.MANAGER_SAVEORUPDATE5, "个人pk奖励配置失败", saveOrUpdate5Res.body().asString()));
}
@Test(description = "团队PK奖励", priority = 13)
public void 团队PK奖励() {
Map<String, Object> saveOrUpdate6Param = new HashMap<>();
saveOrUpdate6Param.put("liveId", liveID);
saveOrUpdate6Param.put("rewardType", 2);//1:个人,2:团队
List<RewardPkBean> rewardPks3 = new ArrayList<>();
RewardPkBean rewardPk3 = new RewardPkBean();
rewardPk3.setPrizeName("10000");
rewardPk3.setRanking(1);
rewardPks3.add(rewardPk3);
RewardPkBean rewardPk4 = new RewardPkBean();
rewardPk4.setPrizeName("2500");
rewardPk4.setRanking(2);
rewardPks3.add(rewardPk4);
RewardPkBean rewardPk5 = new RewardPkBean();
rewardPk5.setPrizeName("1000");
rewardPk5.setRanking(3);
rewardPks3.add(rewardPk5);
saveOrUpdate6Param.put("rewardPkParamList", rewardPks3);
Response saveOrUpdate6Res = network.postResponse(saveOrUpdate6Param, BasicConfig.MANAGER_SAVEORUPDATE5);
boolean data9 = saveOrUpdate6Res.jsonPath().getBoolean("data");
System.out.println(data9);
Assert.assertTrue(data9, network.message(saveOrUpdate6Param, BasicConfig.MANAGER_SAVEORUPDATE5, "团队pk奖励配置失败", saveOrUpdate6Res.body().asString()));
}
@Test(description = "获取剩余红包金额", priority = 14)
public void 获取剩余红包金额() {
Map<String, Object> getSurplusAmountParam = new HashMap<>();
getSurplusAmountParam.put("liveId", liveID);
Response getSurplusAmountRes = network.getResponse(getSurplusAmountParam, BasicConfig.MANAGER_GETSURPLUSAMOUNT);
Object data = getSurplusAmountRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getSurplusAmountParam, BasicConfig.MANAGER_GETSURPLUSAMOUNT, "获取剩余红包金额失败", getSurplusAmountRes.body().asString()));
}
//添加红包配置
@Test(description = "新增红包配置", priority = 15)
public void 新增红包配置() {
Map<String, Object> saveOrUpdateRedParam = new HashMap<>();
saveOrUpdateRedParam.put("liveId", liveID);
saveOrUpdateRedParam.put("confId", "null");
saveOrUpdateRedParam.put("showAmount", 1000);
saveOrUpdateRedParam.put("totalAmount", 1000);
saveOrUpdateRedParam.put("luckNum", 0);
saveOrUpdateRedParam.put("luckHelpNum", 0);
saveOrUpdateRedParam.put("luckAmount", 0);
saveOrUpdateRedParam.put("generalNum", 33);
Response saveOrUpdateRedRes = network.postResponse(saveOrUpdateRedParam, BasicConfig.MANAGER_SAVEORUPDATERED);
Object data = saveOrUpdateRedRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateRedParam, BasicConfig.MANAGER_SAVEORUPDATERED, "普通红包配置失败", saveOrUpdateRedRes.body().asString()));
}
//配置免费福利
@Test(description = "配置免费福利", priority = 16)
public void 配置免费福利() {
Map<String, Object> saveOrUpdate8Param = new HashMap<>();
saveOrUpdate8Param.put("liveId", liveID);
saveOrUpdate8Param.put("interactNum", -1);
saveOrUpdate8Param.put("welfare", 1);
saveOrUpdate8Param.put("welfareId", 190);
saveOrUpdate8Param.put("welfareName", "萌娃锦鲤");
Response saveOrUpdate8Res = network.postResponse(saveOrUpdate8Param, BasicConfig.MANAGER_SAVEORUPDATE7);
Object data = saveOrUpdate8Res.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdate8Param, BasicConfig.MANAGER_SAVEORUPDATE7, "免费福利配置失败", saveOrUpdate8Res.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.TeamList;
import com.kjj.bean.manager.TreasureList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
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 TeamLottery implements AdminAuthorization {
public long confId;
public long Id;
public Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(3);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "查询新增时团队列表", priority = 2)
public void 查询新增时团队列表() {
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_search);
Object data=response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(searchParam, BasicConfig.MANAGER_search, "查询新增时团队列表失败", response.body().asString()));
}
@Test(description = "新增团队配置", priority = 3)
public void 新增团队配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("confId",confId);
saveParam.put("teamId",3817);
saveParam.put("totalNum",1);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveteam);
System.out.println(response.jsonPath());
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveteam, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队份数配置列表", priority = 4)
public void 查询团队份数配置列表() {
ThreadSleepUtils.sleep(500);
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(searchParam, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "修改团队份数", priority = 5)
public void 修改团队份数() {
Map<String, Object> changeNumParam = new HashMap<>();
changeNumParam.put("id",Id);
changeNumParam.put("totalNum",2);
Response response = network.postResponse(changeNumParam, BasicConfig.MANAGER_changeNum);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeNumParam, BasicConfig.MANAGER_changeNum, "修改团队份数失败", response.body().asString()));
}
@Test(description = "删除团队奖品配置", priority = 6)
public void 删除团队奖品配置() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("id",Id);
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del0);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del0, "删除团队配置失败", response.body().asString()));
}
@Test(description = "批量导入团队份数配置", priority = 7)
public void 批量导入团队份数配置() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("bizId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210512/d6cd0ef5b4808d8e5d608433079296a2.xlsx");
importParam.put("fileName", "团队配置份数模板.xlsx");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import0);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import0, "批量导入团队份数配置失败", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 8)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "查询新增团队份数配置列表", priority = 9)
public void 查询新增团队份数配置列表() {
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(searchParam, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "开启按团队配置份数开关", priority = 10)
public void 开启按团队配置份数开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId);
changeStatusParam.put("status",1);
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus1, "开启按团队配置份数开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.kjj.bean.manager.*;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 TreasureTime implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<TreasureList> ConfId;
public List<WelfareList> id;
@Test(description = "获取直播中停留时长宝箱列表", priority = 1)
public void 获取直播中停留时长宝箱列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_list1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
List<TreasureList> list = JsonUtil.parseResponseToListBean(response,TreasureList.class);
System.out.println(list);
this.ConfId = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_list1, "获取直播中停留时长宝箱列表失败", response.body().asString()));
}
@Test(description = "停留时长1分钟固定抽奖码", priority = 2)
public void 停留时长1分钟固定抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",1);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(0);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长1分钟固定抽奖码", response.body().asString()));
}
@Test(description = "获取第1轮宝箱配置详情", priority = 3)
public void 获取第1轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第1轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长2分钟现金红包", priority = 4)
public void 停留时长2分钟现金红包() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
updateParam.put("boxConfType",2);
updateParam.put("openCondition",2);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(1);
treasureRed.setTotalNum(1);
treasureRed.setFixedNum(30);
updateParam.put("treasureRed",treasureRed);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长2分钟现金红包配置失败", response.body().asString()));
}
@Test(description = "获取第2轮宝箱配置详情", priority = 5)
public void 获取第2轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第2轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "查询奖品列表", priority = 6)
public void 查询奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "停留时长3分钟实物奖品", priority = 7)
public void 停留时长3分钟实物奖品() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
updateParam.put("boxConfType",3);
updateParam.put("openCondition",3);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setAwardName("萌娃锦鲤");
treasureAward.setBizConfId(0);
treasureAward.setIsLimit(2);
treasureAward.setTotalNum(1);
treasureAward.setWelfareId(this.id.get(5).getId());
updateParam.put("treasureAward",treasureAward);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第3轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第三轮宝箱配置详情", priority = 8)
public void 获取第三轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第三轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长4分钟随机抽奖码", priority = 9)
public void 停留时长4分钟随机抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",4);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第四轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第四轮宝箱配置详情", priority = 10)
public void 获取第四轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第四轮宝箱配置详情失败", response.body().asString()));
}
}
package com.kjj.cases.live.red;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.answer.QuestionList;
import com.kjj.bean.answer.QuseRewardList;
import com.kjj.bean.answer.RewardGetDetail;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.*;
import java.util.stream.Collectors;
public class Unlimited implements AdminAuthorization {
private List<QuseRewardList.QuesList> quesConfId;
private QuestionList.question wronganswer;
private QuestionList.question rightanswer;
/*查询主播端有奖答题列表*/
@Test(description = "查询主播端有奖答题列表", priority = 1)
public void 查询主播端有奖答题列表()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex", 1);
params.put("pageSize", 50);
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardList);
List<QuseRewardList.QuesList> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")), QuseRewardList.QuesList.class);
System.out.println(list);
this.quesConfId=list;
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesRewardList, "查询主播端有奖答题列表失败", response.body().asString()));
}
/*查询主播端未上架的有奖答题配置详情*/
@Test(description = "主播端查询第三轮答题现金红包", priority = 2)
public void 主播端查询第三轮答题现金红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString()));
}
/*上架主播端未发放的有奖答题*/
@Test(description = "上架第三轮答题现金红包", priority = 3)
public void 上架第三轮答题现金红包()
{
adminAuth();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
}
/*主播端发放答题红包*/
@Test(description = "发放第三轮现金红包", priority = 4)
public void 发放第三轮现金红包()
{
adminAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询第三轮答题红包配置", priority = 5)
public void 访客A查询第三轮答题红包配置()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(list);
Optional<QuestionList.question> wrongAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wronganswer= wrongAnswerOption.get();
Optional<QuestionList.question> correctAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightanswer=correctAnswerOption.get();
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString()));
}
/*领取答题红包-错误选项*/
@Test(description = "访客领取答题红包-错误选项", priority = 6)
public void 访客领取答题红包_错误选项()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "领取答题红包_答题正确", priority = 7)
public void 访客A领取答题红包_答题正确()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询访客A领取答题红包结果", priority = 8)
public void 查询访客A领取答题红包结果()
{
visitorAuth9();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertTrue(amount>0, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取失败", response.body().asString()));
}
/*领取答题红包-黑名单用户选择正确选项*/
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 9)
public void 黑名单用户领取答题红包成功()
{
visitorAuth7();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询黑名单用户领取答题红包结果", priority = 10)
public void 查询黑名单用户领取答题红包结果()
{
visitorAuth7();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
/*代理人领取答题红包*/
@Test(description = "代理人领取答题红包", priority = 11)
public void 代理人领取答题红包()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询代理人领取答题红包结果", priority = 12)
public void 查询代理人领取答题红包结果()
{
agentAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第三轮答题福利", priority = 13)
public void 上架第三轮答题福利()
{
adminAuth();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(5).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "发放第三轮答题福利", priority = 14)
public void 发放第三轮答题福利()
{
adminAuth();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(5).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
@Test(description = "访客查询第三轮答题福利", priority = 15)
public void 访客查询第三轮答题福利()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(list);
Optional<QuestionList.question> wrongAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wronganswer= wrongAnswerOption.get();
Optional<QuestionList.question> correctAnswerOption = list.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightanswer=correctAnswerOption.get();
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询第三轮福利失败", response.body().asString()));
}
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 16)
public void 领取有奖答题福利类型选择错误()
{
visitorAuth9();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "领取有奖答题福利类型-访客A答题正确", priority = 17)
public void 访客A领取有奖答题福利类型()
{
visitorAuth3();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
@Test(description = "查询访客A领取有奖答题福利结果", priority = 18)
public void 查询访客A领取有奖答题福利结果()
{
visitorAuth3();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer welfareStatus=response.jsonPath().getJsonObject("data.welfareStatus");
System.out.println(welfareStatus);
Assert.assertTrue(welfareStatus==2, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
}
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
......
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.SaveRewardConfig;
......@@ -7,7 +7,6 @@ import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.apache.commons.math3.analysis.function.Add;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -29,7 +28,6 @@ public class NuclearAward implements AdminAuthorization {
public void 不开启核奖() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3031);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -54,7 +52,6 @@ public class NuclearAward implements AdminAuthorization {
public void 获取不开启核奖配置是否正确() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3031);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
......@@ -26,7 +26,6 @@ public class SignAward implements AdminAuthorization {
public void 扫码签收核奖_不开启红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3058);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -53,7 +52,6 @@ public class SignAward implements AdminAuthorization {
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3058);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......@@ -65,7 +63,6 @@ public class SignAward implements AdminAuthorization {
public void 获取奖品签收小程序码() {
Map<String, Object> CodeParam = new HashMap<>();
CodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// CodeParam.put("liveId", 3058);
Response response = network.getResponse(CodeParam, BasicConfig.MANAGER_rewardSignQrCode);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
......@@ -27,7 +27,6 @@ public class UserOpen implements AdminAuthorization {
public void 扫码签收核奖_代理人得红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3031);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -55,7 +54,6 @@ public class UserOpen implements AdminAuthorization {
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3031);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
......@@ -27,74 +27,12 @@ import java.util.Map;
public class Treasure implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<WelfareList> id;
public void setUp() { BaseUtils.ssoLogin(); }
public String ConfId;
public String shareSign;
public JSONObject treasureConf;
@Test(description = "查询奖品列表", priority = 1)
public void 查询奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "宝箱实物中奖限制1次", priority = 2)
public void 宝箱实物中奖限制1() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("openCondition", 1);
saveParam.put("openNum",10);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setWelfareId(this.id.get(0).getId());
treasureAward.setAwardName("宝箱锦鲤");
treasureAward.setTreasureProbability(10000);
treasureAward.setTreasureType(3);
treasureAward.setRuleType(1);
treasureAward.setTotalNum(3);
treasureAward.setWinLimitCount(1);
saveParam.put("treasureAward",treasureAward);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(2);
treasureRed.setTotalNum(2);
treasureRed.setTreasureProbability(0);
treasureRed.setTreasureType(2);
treasureRed.setWinLimitCount(1);
treasureRed.setShowAmount(200);
saveParam.put("treasureRed",treasureRed);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
treasureCode.setTreasureProbability(0);
treasureCode.setTreasureType(1);
saveParam.put("treasureCode",treasureCode);
saveParam.put("treasurePeriod",3);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveTreasureConf, "新增宝箱裂变配置失败", response.body().asString()));
}
@Test(description = "查询宝箱配置详情", priority = 3)
@Test(description = "查询宝箱配置详情", priority = 1)
public void 查询宝箱配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -106,21 +44,7 @@ public class Treasure implements AdminAuthorization {
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "开启宝箱配置", priority = 4)
public void 开启宝箱配置() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
switchStatusParam.put("confStatus", 1);
Response response = network.postResponse(switchStatusParam, BasicConfig.MANAGER_switchStatus);
boolean data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(switchStatusParam, BasicConfig.MANAGER_switchStatus, "开启宝箱失败", response.body().asString()));
}
@Test(description = "查询直播前宝箱配置状态", priority = 5)
@Test(description = "查询直播前宝箱配置状态", priority = 2)
public void 查询宝箱配置状态() {
visitorAuth9();
Map<String, Object> statusParam = new HashMap<>();
......@@ -132,7 +56,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "查询直播前宝箱配置信息", priority = 6)
@Test(description = "查询直播前宝箱配置信息", priority = 3)
public void 查询直播前宝箱配置信息() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -148,7 +72,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "选择宝箱", priority = 7)
@Test(description = "选择宝箱", priority = 4)
public void 选择宝箱() {
visitorAuth9();
Map<String, Object> chooseAwardParam = new HashMap<>();
......@@ -162,7 +86,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H获取分享加密串", priority = 8)
@Test(description = "访客H获取分享加密串", priority = 5)
public void 访客H获取分享加密串() {
visitorAuth9();
Map<String, Object> signParam = new HashMap<>();
......@@ -176,7 +100,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "根据分享类型获取分享内容", priority = 9)
@Test(description = "根据分享类型获取分享内容", priority = 6)
public void 根据分享类型获取分享内容() {
visitorAuth2();
Map<String, Object> infoParam = new HashMap<>();
......@@ -189,7 +113,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H与访客B邀请关系绑定", priority = 10)
@Test(description = "访客H与访客B邀请关系绑定", priority = 7)
public void 访客H与访客B邀请关系绑定() {
visitorAuth2();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -201,7 +125,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客B获取绑定结果和绑定凭证", priority = 11)
@Test(description = "访客B获取绑定结果和绑定凭证", priority = 8)
public void 访客B获取绑定结果和绑定凭证() {
visitorAuth2();
ThreadSleepUtils.sleep(2000);
......@@ -215,7 +139,7 @@ public class Treasure implements AdminAuthorization {
//助力流程
@Test(description = "未登录查询分享人头像昵称", priority = 12)
@Test(description = "未登录查询分享人头像昵称", priority = 9)
public void 未登录查询分享人头像昵称() {
visitorAuth2();
Map<String, Object> simpleParam = new HashMap<>();
......@@ -229,7 +153,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertNotNull(data, network.message(simpleParam, BasicConfig.MOBILE_simple, "未登录查询分享人头像昵称失败", response.body().asString()));
}
@Test(description = "已登录查询分享人头像昵称", priority = 13)
@Test(description = "已登录查询分享人头像昵称", priority = 10)
public void 已登录查询分享人头像昵称() {
visitorAuth2();
Map<String, Object> infoParam = new HashMap<>();
......@@ -244,7 +168,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "用户B给用户H助力", priority = 14)
@Test(description = "用户B给用户H助力", priority = 11)
public void 用户B给用户H助力() {
visitorAuth2();
Map<String, Object> infoParam = new HashMap<>();
......@@ -259,7 +183,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客B获取直播所有的订阅消息模板", priority = 15)
@Test(description = "访客B获取直播所有的订阅消息模板", priority = 12)
public void 获取B直播所有的订阅消息模板() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
......@@ -270,7 +194,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "访客B预约直播间", priority = 16)
@Test(description = "访客B预约直播间", priority = 13)
public void 访客B预约直播间() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
......@@ -287,7 +211,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客B关注直播间", priority = 17)
@Test(description = "访客B关注直播间", priority = 14)
public void 访客B关注直播间() {
visitorAuth2();
Map<String, Object> subscribeParam = new HashMap<>();
......@@ -302,7 +226,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "访客B关注状态查询", priority = 18)
@Test(description = "访客B关注状态查询", priority = 15)
public void 访客B关注状态查询() {
visitorAuth2();
Map<String, Object> findParam = new HashMap<>();
......@@ -314,7 +238,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客B保存海报获得抽奖码", priority = 19)
@Test(description = "访客B保存海报获得抽奖码", priority = 16)
public void 访客B保存海报获得抽奖码() {
visitorAuth2();
Map<String, Object> savePosterParam = new HashMap<>();
......@@ -326,7 +250,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "查询访客B抽奖码数量", priority = 20)
@Test(description = "查询访客B抽奖码数量", priority = 17)
public void 查询访客B抽奖码数量() {
visitorAuth2();
Map<String, Object> myCountParam = new HashMap<>();
......@@ -338,7 +262,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客K邀请关系绑定", priority = 21)
@Test(description = "访客K邀请关系绑定", priority = 18)
public void 访客K邀请关系绑定() {
visitorAuth11();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -350,7 +274,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", response.body().asString()));
}
@Test(description = "访客K获取绑定结果和绑定凭证", priority = 22)
@Test(description = "访客K获取绑定结果和绑定凭证", priority = 19)
public void 访客K获取绑定结果和绑定凭证() {
visitorAuth11();
ThreadSleepUtils.sleep(2000);
......@@ -362,7 +286,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "用户K给用户H助力", priority = 23)
@Test(description = "用户K给用户H助力", priority = 20)
public void 用户K给用户H助力() {
visitorAuth11();
Map<String, Object> infoParam = new HashMap<>();
......@@ -378,7 +302,7 @@ public class Treasure implements AdminAuthorization {
@Test(description = "访客L邀请关系绑定", priority = 24)
@Test(description = "访客L邀请关系绑定", priority = 21)
public void 访客L邀请关系绑定() {
visitorAuth12();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -390,7 +314,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客L获取绑定结果和绑定凭证", priority = 25)
@Test(description = "访客L获取绑定结果和绑定凭证", priority = 22)
public void 访客L获取绑定结果和绑定凭证() {
visitorAuth12();
ThreadSleepUtils.sleep(2000);
......@@ -402,7 +326,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "用户L给用户H助力", priority = 26)
@Test(description = "用户L给用户H助力", priority = 23)
public void 用户L给用户H助力() {
visitorAuth12();
Map<String, Object> infoParam = new HashMap<>();
......@@ -418,7 +342,7 @@ public class Treasure implements AdminAuthorization {
@Test(description = "访客M邀请关系绑定", priority = 27)
@Test(description = "访客M邀请关系绑定", priority = 24)
public void 访客M邀请关系绑定() {
visitorAuth13();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -430,7 +354,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客M获取绑定结果和绑定凭证", priority = 28)
@Test(description = "访客M获取绑定结果和绑定凭证", priority = 25)
public void 访客M获取绑定结果和绑定凭证() {
visitorAuth13();
ThreadSleepUtils.sleep(2000);
......@@ -442,7 +366,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "用户M给用户H助力", priority = 29)
@Test(description = "用户M给用户H助力", priority = 26)
public void 用户M给用户H助力() {
visitorAuth13();
Map<String, Object> infoParam = new HashMap<>();
......@@ -457,7 +381,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客P邀请关系绑定", priority = 30)
@Test(description = "访客P邀请关系绑定", priority = 27)
public void 访客P邀请关系绑定() {
visitorAuth16();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -469,7 +393,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客P获取绑定结果和绑定凭证", priority = 31)
@Test(description = "访客P获取绑定结果和绑定凭证", priority = 28)
public void 访客P获取绑定结果和绑定凭证() {
visitorAuth16();
ThreadSleepUtils.sleep(2000);
......@@ -481,7 +405,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "用户P给用户H助力", priority = 32)
@Test(description = "用户P给用户H助力", priority = 29)
public void 用户P给用户H助力() {
visitorAuth16();
Map<String, Object> infoParam = new HashMap<>();
......@@ -496,7 +420,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客Q邀请关系绑定", priority = 33)
@Test(description = "访客Q邀请关系绑定", priority = 30)
public void 访客Q邀请关系绑定() {
visitorAuth17();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -508,7 +432,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客Q获取绑定结果和绑定凭证", priority = 34)
@Test(description = "访客Q获取绑定结果和绑定凭证", priority = 31)
public void 访客Q获取绑定结果和绑定凭证() {
visitorAuth17();
ThreadSleepUtils.sleep(2000);
......@@ -520,7 +444,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "用户Q给用户H助力", priority = 35)
@Test(description = "用户Q给用户H助力", priority = 32)
public void 用户Q给用户H助力() {
visitorAuth17();
Map<String, Object> infoParam = new HashMap<>();
......@@ -535,7 +459,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H查询第1次参与详情的进度显示", priority = 36)
@Test(description = "访客H查询第1次参与详情的进度显示", priority = 33)
public void 访客H查询第1次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -549,7 +473,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H开启第1轮宝箱获得实物", priority = 37)
@Test(description = "访客H开启第1轮宝箱获得实物", priority = 34)
public void 访客H开启第1轮宝箱获得实物() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......@@ -564,7 +488,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第1轮开宝箱参与详情", priority = 38)
@Test(description = "访客H第1轮开宝箱参与详情", priority = 35)
public void 访客H1轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -584,7 +508,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第2次参与详情的进度显示", priority = 39)
@Test(description = "访客H第2次参与详情的进度显示", priority = 36)
public void 访客H2次参与详情的进度显示() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......@@ -598,7 +522,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H开启第2轮宝箱降级抽奖码", priority = 40)
@Test(description = "访客H开启第2轮宝箱降级抽奖码", priority = 37)
public void 访客H开启第2轮宝箱降级抽奖码() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......@@ -614,7 +538,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第2轮开宝箱参与详情", priority = 41)
@Test(description = "访客H第2轮开宝箱参与详情", priority = 38)
public void 访客H2轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -634,7 +558,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "宝箱实物中奖无限制", priority = 42)
@Test(description = "宝箱实物中奖无限制", priority = 39)
public void 宝箱实物中奖无限制() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("winLimitCount",-1);//-1无限制,1限制1次
......@@ -645,7 +569,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第3次参与详情的进度显示", priority = 43)
@Test(description = "访客H第3次参与详情的进度显示", priority = 40)
public void 访客H3次参与详情的进度显示() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......@@ -658,7 +582,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第3次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第3轮宝箱获得实物", priority = 44)
@Test(description = "访客H开启第3轮宝箱获得实物", priority = 41)
public void 访客H开启第3轮宝箱获得实物() {
visitorAuth9();
ThreadSleepUtils.sleep(3000);
......@@ -673,7 +597,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第3轮开宝箱参与详情", priority = 45)
@Test(description = "访客H第3轮开宝箱参与详情", priority = 42)
public void 访客H3轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -693,7 +617,7 @@ public class Treasure implements AdminAuthorization {
//B 用户邀请
@Test(description = "访客M获取分享加密串", priority = 46)
@Test(description = "访客M获取分享加密串", priority = 43)
public void 访客M获取分享加密串() {
visitorAuth13();
Map<String, Object> signParam = new HashMap<>();
......@@ -706,7 +630,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_sign, "分享失败", signRes.body().asString()));
}
@Test(description = "访客M与访客N邀请关系绑定", priority = 47)
@Test(description = "访客M与访客N邀请关系绑定", priority = 44)
public void 访客M与访客N邀请关系绑定() {
visitorAuth14();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -718,7 +642,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客N获取绑定结果和绑定凭证", priority = 48)
@Test(description = "访客N获取绑定结果和绑定凭证", priority = 45)
public void 访客N获取绑定结果和绑定凭证() {
visitorAuth14();
ThreadSleepUtils.sleep(2000);
......@@ -731,7 +655,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客N给访客M助力", priority = 49)
@Test(description = "访客N给访客M助力", priority = 46)
public void 访客N给访客M助力() {
visitorAuth14();
Map<String, Object> infoParam = new HashMap<>();
......@@ -745,7 +669,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(data, network.message(infoParam, BasicConfig.MOBILE_assist, "访客N给访客M助力失败", response.body().asString()));
}
@Test(description = "访客M与访客R邀请关系绑定", priority = 50)
@Test(description = "访客M与访客R邀请关系绑定", priority = 47)
public void 访客M与访客R邀请关系绑定() {
visitorAuth18();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -757,7 +681,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客R获取绑定结果和绑定凭证", priority = 51)
@Test(description = "访客R获取绑定结果和绑定凭证", priority = 48)
public void 访客R获取绑定结果和绑定凭证() {
visitorAuth18();
ThreadSleepUtils.sleep(2000);
......@@ -769,7 +693,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客R给访客M助力", priority = 52)
@Test(description = "访客R给访客M助力", priority = 49)
public void 访客R给访客M助力() {
visitorAuth18();
Map<String, Object> infoParam = new HashMap<>();
......@@ -785,7 +709,7 @@ public class Treasure implements AdminAuthorization {
//验证实物奖品数量是否会超发
@Test(description = "访客H第4次参与详情的进度显示", priority = 53)
@Test(description = "访客H第4次参与详情的进度显示", priority = 50)
public void 访客H4次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -798,7 +722,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客M第1次参与详情的进度显示", priority = 54)
@Test(description = "访客M第1次参与详情的进度显示", priority = 51)
public void 访客M1次参与详情的进度显示() {
visitorAuth13();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -812,7 +736,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H和访客M开启第4轮宝箱实物是否超发", priority = 55)
@Test(description = "访客H和访客M开启第4轮宝箱实物是否超发", priority = 52)
public void 访客H和访客M开启第4轮宝箱实物是否超发() {
ThreadSleepUtils.sleep(3000);
Map<String, Object> openParam = new HashMap<>();
......@@ -836,7 +760,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H和访客M第4轮开宝箱参与详情", priority = 56)
@Test(description = "访客H和访客M第4轮开宝箱参与详情", priority = 53)
public void 访客H和访客M4轮开宝箱参与详情() {
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId", ConfId);
......@@ -869,7 +793,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "宝箱红包限制1次", priority = 57)
@Test(description = "宝箱红包限制1次", priority = 54)
public void 宝箱红包限制1() {
JSONObject treasureRed = treasureConf.getJSONObject("treasureRed");
......@@ -884,7 +808,7 @@ public class Treasure implements AdminAuthorization {
}
//访客A领取红包
@Test(description = "访客H第5次参与详情的进度显示", priority = 58)
@Test(description = "访客H第5次参与详情的进度显示", priority = 55)
public void 访客H5次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -896,7 +820,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第5次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第5次宝箱获得红包", priority = 59)
@Test(description = "访客H开启第5次宝箱获得红包", priority = 56)
public void 访客H开启第5次宝箱获得红包() {
visitorAuth9();
ThreadSleepUtils.sleep(15000);
......@@ -912,7 +836,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第5轮开宝箱参与详情", priority = 60)
@Test(description = "访客H第5轮开宝箱参与详情", priority = 57)
public void 访客H5轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -932,7 +856,7 @@ public class Treasure implements AdminAuthorization {
//访客A降级抽奖码
@Test(description = "访客H第6次参与详情的进度显示", priority = 61)
@Test(description = "访客H第6次参与详情的进度显示", priority = 58)
public void 访客H6次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -944,7 +868,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第6次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第6次宝箱降级抽奖码", priority = 62)
@Test(description = "访客H开启第6次宝箱降级抽奖码", priority = 59)
public void 访客H开启第6次宝箱降级抽奖码() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......@@ -959,7 +883,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H第6轮开宝箱参与详情", priority = 63)
@Test(description = "访客H第6轮开宝箱参与详情", priority = 60)
public void 访客H6轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
......@@ -978,7 +902,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客N获取分享加密串", priority = 64)
@Test(description = "访客N获取分享加密串", priority = 61)
public void 访客N获取分享加密串() {
visitorAuth14();
Map<String, Object> signParam = new HashMap<>();
......@@ -992,7 +916,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客N与访客O邀请关系绑定", priority = 65)
@Test(description = "访客N与访客O邀请关系绑定", priority = 62)
public void 访客N与访客O邀请关系绑定() {
visitorAuth15();
Map<String, Object> bindingParam = new HashMap<>();
......@@ -1004,7 +928,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客O获取绑定结果和绑定凭证", priority = 66)
@Test(description = "访客O获取绑定结果和绑定凭证", priority = 63)
public void 访客O获取绑定结果和绑定凭证() {
visitorAuth15();
ThreadSleepUtils.sleep(2000);
......@@ -1016,7 +940,7 @@ public class Treasure implements AdminAuthorization {
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客O给访客N助力", priority = 67)
@Test(description = "访客O给访客N助力", priority = 64)
public void 访客O给访客N助力() {
visitorAuth15();
Map<String, Object> infoParam = new HashMap<>();
......@@ -1033,7 +957,7 @@ public class Treasure implements AdminAuthorization {
//访客M和N同时抢红包
@Test(description = "访客M参与详情的进度显示", priority = 68)
@Test(description = "访客M参与详情的进度显示", priority = 65)
public void 访客M参与详情的进度显示() {
visitorAuth13();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -1046,7 +970,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客N参与详情的进度显示", priority = 69)
@Test(description = "访客N参与详情的进度显示", priority = 66)
public void 访客N参与详情的进度显示() {
visitorAuth14();
Map<String, Object> InfoParam = new HashMap<>();
......@@ -1060,7 +984,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客M和访客N同时开启宝箱验证红包是否超发", priority = 70)
@Test(description = "访客M和访客N同时开启宝箱验证红包是否超发", priority = 67)
public void 访客M和访客N同时开启宝箱验证红包是否超发() {
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -1084,7 +1008,7 @@ public class Treasure implements AdminAuthorization {
@Test(description = "访客M和访客N第7轮开宝箱参与详情", priority = 71)
@Test(description = "访客M和访客N第7轮开宝箱参与详情", priority = 68)
public void 访客M和访客N7轮开宝箱参与详情() {
ThreadSleepUtils.sleep(3000);
Map<String, Object> infoParam = new HashMap<>();
......@@ -1115,7 +1039,7 @@ public class Treasure implements AdminAuthorization {
}
@Test(description = "访客H宝箱领取记录", priority = 72)
@Test(description = "访客H宝箱领取记录", priority = 69)
public void 访客H宝箱领取记录() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
......
package com.kjj.cases.live.lottery;
package com.kjj.cases.live.treasure;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.CondDetail;
import com.kjj.bean.manager.GuessList;
import com.kjj.bean.manager.*;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
......@@ -18,9 +20,14 @@ import java.util.Map;
public class TreasureTime implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<CondDetail> treasureConfId ;
@Test(description = "获取宝箱配置详情", priority = 1)
public void 获取宝箱配置详情() {
visitorAuth9();
......
......@@ -3,9 +3,9 @@ package com.kjj.config;
public class BasicConfig {
public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送
public static final boolean isPushReport = true; //true
public static final boolean isPushReport =true; //true
// 代理人微信昵称
public static final String WECHAT_NAME = "吉吉"; //true
public static final String WECHAT_NAME = "吉吉";
// 代理人的openid(固定)
public static final String OPEN_ID = "osi5w5ggFiEXk0tPJH9b0KO_XU08";
//直播管理员(吉吉)
......@@ -97,18 +97,15 @@ public class BasicConfig {
public static final String MANAGER_list_1 = MANAGER_HOST + "/kjy/manager/red/guess/list";
public static final String MANAGER_detail_1 = MANAGER_HOST + "/kjy/manager/red/guess/detail";
public static final String MANAGER_del_1 = MANAGER_HOST + "/kjy/manager/red/guess/delete";
public static final String MOBILE_guessList = MOBILE_HOST + "/conf/live/red/guess/list";
public static final String MOBILE_saveOrUpdate2 = MOBILE_HOST + "/conf/live/red/guess/saveOrUpdate";
public static final String MOBILE_detail1 = MOBILE_HOST + "/conf/live/red/guess/detail";
public static final String MOBILE_startOrEnd = MOBILE_HOST + "/conf/live/red/guess/startOrEnd";
public static final String MOBILE_saveOrUpdate = MOBILE_HOST + "/conf/pre/red/guess/saveOrUpdate";
public static final String MOBILE_findDetail = MOBILE_HOST + "/conf/pre/red/findDetail";
public static final String MOBILE_list = MOBILE_HOST + "/conf/pre/red/guess/list";
public static final String MOBILE_detail = MOBILE_HOST + "/conf/pre/red/guess/detail";
public static final String MOBILE_delete = MOBILE_HOST + "/conf/pre/red/guess/delete";
public static final String MOBILE_confDetail = MOBILE_HOST + "/clue/guess/number/red/confDetail";
public static final String MOBILE_userDetail = MOBILE_HOST + "/clue/guess/number/red/userDetail";
public static final String MOBILE_guess = MOBILE_HOST + "/clue/guess/number/red/guess";
......@@ -193,7 +190,7 @@ public class BasicConfig {
public static final String ANCHOR_end = MOBILE_HOST + "/conf/live/lottery/end";
public static final String ANCHOR_luckDetail = MOBILE_HOST + "/clue/lottery/task/luckDetail";
public static final String ANCHOR_inviteDrawDetail = MOBILE_HOST + "/clue/lottery/task/inviteDrawDetail";
public static final String ANCHOR_flag = MOBILE_HOST + "/clue/lottery/flag";
// *************** 访客端 ***************
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";
......@@ -203,28 +200,31 @@ public class BasicConfig {
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";
public static final String MANAGER_GETCONFDETAIL = MANAGER_HOST + "/kjy/manager/live/conf/getConfDetail";
public static final String MANAGER_SAVEORUPDATEMAXAMOUNT = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateMaxAmount";
public static final String MANAGER_SAVEORUPDATESHOWEAMOUNT = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateShowAmount";
public static final String MANAGER_SAVEORUPDATE = MANAGER_HOST + "/kjy/manager/question/conf/saveOrUpdate";
public static final String MANAGER_SAVEORUPDATE2 = MANAGER_HOST + "/kjy/manager/live/choice/pre/conf/saveOrUpdate";
public static final String MANAGER_SAVEORUPDATE3 = MANAGER_HOST + "/kjy/manager/live/resource/pre/conf/saveOrUpdate";
public static final String MANAGER_SAVEORUPDATE4 = MANAGER_HOST + "/kjy/manager/live/survey/saveOrUpdate";
public static final String MANAGER_SAVEAGENTPARTICIPATE = MANAGER_HOST + "/kjy/manager/specifyAward/pre/conf/saveAgentParticipate";
public static final String MANAGER_SAVESPECIFYAWARD = MANAGER_HOST + "/kjy/manager/specifyAward/pre/conf/saveSpecifyAward";
public static final String MANAGER_SAVEORUPDATE5 = MANAGER_HOST + "/kjy/manager/live/pk/reward/conf/saveOrUpdate";
public static final String MANAGER_GETSURPLUSAMOUNT = MANAGER_HOST + "/kjy/manager/red/conf/getSurplusAmount";
public static final String MANAGER_SAVEORUPDATERED = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateRed";
public static final String MANAGER_SAVEORUPDATE9 = MANAGER_HOST + "/kjy/manager/live/ques/red/pre/conf/saveOrUpdate";
public static final String MANAGER_saveAndUpdate_0 = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
public static final String MANAGER_getConfDetail = MANAGER_HOST + "/kjy/manager/live/conf/getConfDetail";
public static final String MANAGER_MaxAmount = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateMaxAmount";
public static final String MANAGER_ShowAmount = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateShowAmount";
public static final String MANAGER_saveAndUpdate_1 = MANAGER_HOST + "/kjy/manager/question/conf/saveOrUpdate";
public static final String MANAGER_saveAndUpdate_2 = MANAGER_HOST + "/kjy/manager/live/choice/pre/conf/saveOrUpdate";
public static final String MANAGER_saveAndUpdate_3 = MANAGER_HOST + "/kjy/manager/live/resource/pre/conf/saveOrUpdate";
public static final String MANAGER_saveAndUpdate_4 = MANAGER_HOST + "/kjy/manager/live/survey/saveOrUpdate";
public static final String MANAGER_saveSpecifyAward = MANAGER_HOST + "/kjy/manager/specifyAward/pre/conf/saveSpecifyAward";
public static final String MANAGER_saveAndUpdate_5 = MANAGER_HOST + "/kjy/manager/live/pk/reward/conf/saveOrUpdate";
public static final String MANAGER_SurplusAmount = MANAGER_HOST + "/kjy/manager/red/conf/getSurplusAmount";
public static final String MANAGER_saveAndUpdate_6 = MANAGER_HOST + "/kjy/manager/red/conf/saveOrUpdateRed";
public static final String MANAGER_add = MANAGER_HOST + "/kjy/manager/live/ques/reward/add";
public static final String MANAGER_ADD = MANAGER_HOST + "/kjy/manager/lottery/pre/conf/add";
public static final String MANAGER_ADD1 = MANAGER_HOST + "/kjy/manager/lottery/conf/add";
public static final String MANAGER_SAVEORUPDATE7 = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/saveOrUpdate";
public static final String MANAGER_add_1 = MANAGER_HOST + "/kjy/manager/lottery/conf/add";
public static final String MANAGER_saveAndUpdate_7 = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/saveOrUpdate";
public static final String MANAGER_getLiveAwardList = MANAGER_HOST + "/kjy/manager/specifyAward/pre/conf/getLiveAwardList";
public static final String MANAGER_rewardList = MANAGER_HOST + "/kjy/manager/live/ques/reward/list";
public static final String MANAGER_delete = MANAGER_HOST + "/kjy/manager/live/ques/reward/delete";
public static final String MANAGER_update = MANAGER_HOST + "/kjy/manager/live/ques/reward/update";
//定时投票
public static final String MANAGER_timedChoice = MANAGER_HOST + "/kjy/manager/live/timedChoice/getList";
public static final String MANAGER_saveTimedChoice = MANAGER_HOST + "/kjy/manager/live/timedChoice/saveOrUpdate";
public static final String MANAGER_timedChoiceDel = MANAGER_HOST + "/kjy/manager/live/timedChoice/delete";
public static final String MANAGER_switchStatus1 = MANAGER_HOST + "/kjy/manager/live/timedChoice/switchStatus";
public static final String MANAGER_getDetail = MANAGER_HOST + "/kjy/manager/live/timedChoice/getDetail";
//小程序分享
public static final String MANAGER_saveOrUpdateMpShare = MANAGER_HOST + "/kjy/manager/live/share/saveOrUpdateMpShare";
......@@ -287,6 +287,7 @@ public class BasicConfig {
public static final String MOBILE_SubmitAnswer = MOBILE_HOST + "/clue/choice/submitAnswer";
public static final String MOBILE_AnswerNum = MOBILE_HOST + "/clue/choice/answerNum";
//问题
public static final String MOBILE_QuestionAdd = MOBILE_HOST + "/conf/live/question/addQuestion";
public static final String MOBILE_QuestionList = MOBILE_HOST + "/conf/live/question/list";
......@@ -335,22 +336,22 @@ public class BasicConfig {
public static final String MOBILE_QuesParticipateInfo = MOBILE_HOST + "/clue/ques/reward/participateInfo";
//***************直播素材*****************
public static final String MANAGER_SAVEORUPDATE6 = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/saveOrUpdate";
public static final String MANAGER_WELFARELIST = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/list";
public static final String MANAGER_DEL = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/del";
public static final String MANAGER_CHOICE = MANAGER_HOST+ "/kjy/manager/conf/base/choice/saveOrUpdate";
public static final String MANAGER_GETLIST = MANAGER_HOST+ "/kjy/manager/conf/base/choice/getList";
public static final String MANAGER_DELCHOICE= MANAGER_HOST+ "/kjy/manager/conf/base/choice/delChoice";
public static final String MANAGER_LIST1= MANAGER_HOST+ "/kjy/manager/conf/base/question/list";
public static final String MANAGER_DEL1= MANAGER_HOST+ "/kjy/manager/conf/base/question/del";
public static final String MANAGER_QUESTION= MANAGER_HOST+ "/kjy/manager/conf/base/question/saveOrUpdate";
public static final String MANAGER_RESOURCE= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdatePic";
public static final String MANAGER_RESOURCELIST= MANAGER_HOST+ "/kjy/manager/live/resource/list";
public static final String MANAGER_GELRESOURCE= MANAGER_HOST+ "/kjy/manager/live/resource/delResource";
public static final String MANAGER_SAVEORUPDATELINK= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateLink";
public static final String MANAGER_FORM= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateForm";
public static final String MANAGER_FREE= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateFree";
public static final String MANAGER_TEST= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateTest";
public static final String MANAGER_saveOrUpdate_6 = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/saveOrUpdate";
public static final String MANAGER_welfareList = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/list";
public static final String MANAGER_welfareDel = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/del";
public static final String MANAGER_choiceSave = MANAGER_HOST+ "/kjy/manager/conf/base/choice/saveOrUpdate";
public static final String MANAGER_getList = MANAGER_HOST+ "/kjy/manager/conf/base/choice/getList";
public static final String MANAGER_delChoice= MANAGER_HOST+ "/kjy/manager/conf/base/choice/delChoice";
public static final String MANAGER_questionList= MANAGER_HOST+ "/kjy/manager/conf/base/question/list";
public static final String MANAGER_questionDel= MANAGER_HOST+ "/kjy/manager/conf/base/question/del";
public static final String MANAGER_questionSave= MANAGER_HOST+ "/kjy/manager/conf/base/question/saveOrUpdate";
public static final String MANAGER_resource= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdatePic";
public static final String MANAGER_resourceList= MANAGER_HOST+ "/kjy/manager/live/resource/list";
public static final String MANAGER_delResource= MANAGER_HOST+ "/kjy/manager/live/resource/delResource";
public static final String MANAGER_saveLink= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateLink";
public static final String MANAGER_saveForm= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateForm";
public static final String MANAGER_saveFree= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateFree";
public static final String MANAGER_saveTest= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateTest";
//***************直播团队管理*****************
public static final String MANAGER_teamList = MANAGER_HOST+ "/kjy/manager/live/company/team/teamList";
......@@ -362,7 +363,7 @@ public class BasicConfig {
public static final String MANAGER_saveSpecifyAwardConf = MANAGER_HOST+ "/kjy/manager/live/spec/saveSpecifyAwardConf";
public static final String MANAGER_findById = MANAGER_HOST+ "/kjy/manager/live/spec/findById";
public static final String MANAGER_getSpecifyAwardConf = MANAGER_HOST+ "/kjy/manager/specifyAward/pre/conf/getSpecifyAwardConf";
// public static final String MANAGER_teamFlag = MANAGER_HOST+ "/kjy/manager/live/company/team/teamFlag";
//***************奖品配送*****************
public static final String MANAGER_provideDetail = MANAGER_HOST+ "/kjy/manager/live/prize/provide/conf/provideDetail";
......@@ -417,8 +418,6 @@ public class BasicConfig {
public static final String GAME_CONTENTID = "Kj21NjIxNTk";
public static final String UPLOAD_CONTENTID = "Kj21NjA1NTE";
// *************** 公共 ***************
public static final String CREATE_USER = HOST + "/kjy/mp/autotest/create/user";
public static final String AUTOTEST_UNSUBSCRIBE = HOST + "/kjy/mp/autotest/unsubscribe";
......
......@@ -4,30 +4,30 @@
<test preserve-order="true" name="直播素材">
<classes>
<class name="com.kjj.cases.live.manager.LiveMaterial"/>
<class name="com.kjj.cases.live.liveConfig.LiveMaterial"/>
</classes>
</test>
<test preserve-order="true" name="团队管理">
<classes>
<class name="com.kjj.cases.live.manager.Team"/>
<class name="com.kjj.cases.live.liveConfig.Team"/>
</classes>
</test>
<test preserve-order="true" name="创建直播">
<classes>
<class name="com.kjj.cases.live.manager.SaveAndUpdate"/>
<class name="com.kjj.cases.live.liveConfig.SaveLive"/>
</classes>
</test>
<test preserve-order="true" name="小程序分享">
<classes>
<class name="com.kjj.cases.live.manager.Share"/>
<class name="com.kjj.cases.live.liveConfig.Share"/>
</classes>
</test>
<test preserve-order="true" name="获取抽奖码校验">
<classes>
<class name="com.kjj.cases.live.LotteryCode.LotteryCode"/>
<class name="com.kjj.cases.live.lotteryCode.LotteryCode"/>
</classes>
</test>
......@@ -37,56 +37,12 @@
</classes>
</test>
<test preserve-order="true" name="直播前猜数字红包配置">
<classes>
<class name="com.kjj.cases.live.guess.ManagerGuess"/>
</classes>
</test>
<test preserve-order="true" name="宝箱时长">
<classes>
<class name="com.kjj.cases.live.manager.TreasureTime"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题配置">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.Add"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题团队配置">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.TeamAssignment"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题限制中奖">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.limited"/>
</classes>
</test>
<test preserve-order="true" name="中奖规则配置">
<classes>
<class name="com.kjj.cases.live.manager.LotteryRule"/>
<class name="com.kjj.cases.live.liveConfig.WinningRules"/>
</classes>
</test>
<test preserve-order="true" name="按团队配置份数">
<classes>
<class name="com.kjj.cases.live.manager.TeamLottery"/>
</classes>
</test>
<test preserve-order="true" name="企业指定中奖名单上传">
<classes>
<class name="com.kjj.cases.live.manager.LiveLottery"/>
</classes>
</test>
<test preserve-order="true" name="代理人首页">
<classes>
<class name="com.kjj.cases.live.agent.Procurator"/>
......@@ -116,7 +72,7 @@
<test preserve-order="true" name="访客签到">
<classes>
<class name="com.kjj.cases.live.LotteryCode.SignIn"/>
<class name="com.kjj.cases.live.lotteryCode.SignIn"/>
</classes>
</test>
......@@ -155,21 +111,9 @@
</classes>
</test>
<test preserve-order="true" name="有奖答题限制1次中奖">
<classes>
<class name="com.kjj.cases.live.red.Limited"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题无限制配置">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.Unlimited"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题限制无限制中奖">
<test preserve-order="true" name="有奖答题">
<classes>
<class name="com.kjj.cases.live.red.Unlimited"/>
<class name="com.kjj.cases.live.answer.Answer"/>
</classes>
</test>
......@@ -178,6 +122,7 @@
<class name="com.kjj.cases.live.choice.Choice"/>
</classes>
</test>
<test preserve-order="true" name="问题">
<classes>
<class name="com.kjj.cases.live.question.Question"/>
......@@ -186,7 +131,7 @@
<test preserve-order="true" name="直播中时长宝箱">
<classes>
<class name="com.kjj.cases.live.lottery.TreasureTime"/>
<class name="com.kjj.cases.live.treasure.TreasureTime"/>
</classes>
</test>
......@@ -204,37 +149,31 @@
<test preserve-order="true" name="奖品发放配置-不开启核奖">
<classes>
<class name="com.kjj.cases.live.manager.signing.NuclearAward"/>
<class name="com.kjj.cases.live.signing.NuclearAward"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_不开启红包">
<classes>
<class name="com.kjj.cases.live.manager.signing.SignAward"/>
<class name="com.kjj.cases.live.signing.SignAward"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_代理人得红包">
<classes>
<class name="com.kjj.cases.live.manager.signing.AgentOpen"/>
<class name="com.kjj.cases.live.signing.AgentOpen"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_客户得红包">
<classes>
<class name="com.kjj.cases.live.manager.signing.UserOpen"/>
</classes>
</test>
<test preserve-order="true" name="奖品配送">
<classes>
<class name="com.kjj.cases.live.manager.Provide"/>
<class name="com.kjj.cases.live.signing.UserOpen"/>
</classes>
</test>
<test preserve-order="true" name="指定中奖付款码">
<classes>
<class name="com.kjj.cases.live.manager.spec"/>
<class name="com.kjj.cases.live.liveConfig.spec"/>
</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