Commit f8da03ea authored by xiamengchen's avatar xiamengchen

Merge branch 'master' into feature/20210823-xmc

parents 8cccbce9 cf51bd64
......@@ -2,6 +2,8 @@ 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.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......@@ -100,9 +102,69 @@ public class Answer implements Authorization {
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesSaveOrUpdate, "主播端添加有奖答题现金红包失败", response.body().asString()));
}
@Test(description = "管理后台添加有奖答题现金红包",priority = 3)
public void 管理后台添加有奖答题现金红包(){
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",5708);
Params.put("quesType", "1");
Params.put("supportInvite",0); //是否支持邀请,0不支持,1支持(默认)
Params.put("agentReceiveType",1); //代理人能否参与抽奖,0不支持(默认),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("直播中答题现金红包");
bean1.setOptionList(Answers1);
Params.put("questionConf", bean1);
AddReward redConf1 = new AddReward();
redConf1.setAmount(3000);
redConf1.setShowAmount(3000);
redConf1.setNum(100);
Params.put("redConf", redConf1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_add);
boolean data1 = response.jsonPath().getJsonObject("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(Params, BasicConfig.MANAGER_add, "答题红包配置失败", response.body().asString()));
}
@Test(description = "管理后台添加有奖答题福利",priority = 4)
public void 管理后台添加有奖答题福利(){
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("quesType", "2");
Params.put("supportInvite",0); //是否支持邀请,0不支持,1支持(默认)
Params.put("agentReceiveType",1); //代理人能否参与抽奖,0不支持(默认),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);
Params.put("redConf", null);
AddWelfareConf welfareConf = new AddWelfareConf();
welfareConf.setWelfareId(190);
welfareConf.setNum(100);
Params.put("welfareConf", welfareConf);
Response response = network.postResponse(Params, BasicConfig.MANAGER_add);
boolean data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_add, "新增答题实物奖品配置失败", response.body().asString()));
}
/*查询主播端有奖答题列表*/
@Test(description = "查询主播端有奖答题列表", priority = 3)
@Test(description = "查询主播端有奖答题列表", priority = 5)
public void 查询主播端有奖答题列表()
{
adminAuth();
......@@ -118,7 +180,7 @@ public class Answer implements Authorization {
}
/*查询主播端未上架的有奖答题配置详情*/
@Test(description = "查询第一轮答题现金红包", priority = 4)
@Test(description = "查询第一轮答题现金红包", priority = 6)
public void 查询第一轮答题现金红包()
{
adminAuth();
......@@ -132,7 +194,7 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题*/
@Test(description = "上架第一轮答题现金红包", priority = 5)
@Test(description = "上架第一轮答题现金红包", priority = 7)
public void 上架第一轮答题现金红包()
{
adminAuth();
......@@ -149,7 +211,7 @@ public class Answer implements Authorization {
}
/*主播端发放答题红包*/
@Test(description = "发放第一轮现金红包", priority = 6)
@Test(description = "发放第一轮现金红包", priority = 8)
public void 发放第一轮现金红包()
{
adminAuth();
......@@ -167,7 +229,17 @@ public class Answer implements Authorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询答题红包配置", priority = 7)
@Test(description = "代理人关系绑定", priority = 11)
public void 代理人关系绑定() {
agentAuth();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客A查询答题红包配置", priority = 12)
public void 访客A查询答题红包配置()
{
visitorAuth9();
......@@ -185,7 +257,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-错误选项*/
@Test(description = "访客领取答题红包错误选项", priority = 8)
@Test(description = "访客领取答题红包错误选项", priority = 13)
public void 访客领取答题红包错误选项()
{
visitorAuth2();
......@@ -206,7 +278,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "领取答题红包答题正确", priority = 9)
@Test(description = "领取答题红包答题正确", priority = 14)
public void 访客A领取答题红包答题正确()
{
visitorAuth9();
......@@ -226,7 +298,7 @@ public class Answer implements Authorization {
/*领取答题红包结果*/
@Test(description = "查询用户A领取答题红包结果", priority = 10)
@Test(description = "查询用户A领取答题红包结果", priority = 15)
public void 查询用户A领取答题红包结果()
{
visitorAuth9();
......@@ -250,7 +322,7 @@ public class Answer implements Authorization {
/*领取答题红包-黑名单用户选择正确选项*/
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 11)
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 16)
public void 黑名单用户领取答题红包()
{
visitorAuth7();
......@@ -269,7 +341,7 @@ public class Answer implements Authorization {
}
/*领取答题红包结果*/
@Test(description = "黑名单用户领取答题红包结果", priority = 12)
@Test(description = "黑名单用户领取答题红包结果", priority = 17)
public void 黑名单用户领取答题红包结果()
{
visitorAuth7();
......@@ -290,7 +362,7 @@ public class Answer implements Authorization {
/*代理人领取答题红包*/
@Test(description = "代理人领取答题现金红包", priority = 13)
@Test(description = "代理人领取答题现金红包", priority = 18)
public void 代理人领取答题现金红包()
{
agentAuth();
......@@ -308,7 +380,7 @@ public class Answer implements Authorization {
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
@Test(description = "代理人领取答题红包结果", priority = 14)
@Test(description = "代理人领取答题红包结果", priority = 19)
public void 代理人领取答题红包结果()
{
agentAuth();
......@@ -328,7 +400,7 @@ public class Answer implements Authorization {
}
/*查询主播端未上架的有奖答题配置详情*/
@Test(description = "查询第二轮答题现金红包", priority = 15)
@Test(description = "查询第二轮答题现金红包", priority = 20)
public void 查询第二轮答题现金红包()
{
adminAuth();
......@@ -342,7 +414,7 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题*/
@Test(description = "上架第二轮答题现金红包", priority = 16)
@Test(description = "上架第二轮答题现金红包", priority = 21)
public void 上架第二轮答题现金红包()
{
ThreadSleepUtils.sleep(100000);
......@@ -357,7 +429,7 @@ public class Answer implements Authorization {
}
/*主播端发放答题红包*/
@Test(description = "发放第二轮现金红包", priority = 17)
@Test(description = "发放第二轮现金红包", priority = 22)
public void 发放第二轮现金红包()
{
adminAuth();
......@@ -372,7 +444,7 @@ public class Answer implements Authorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询第二轮红包配置详情", priority = 18)
@Test(description = "访客A查询第二轮红包配置详情", priority = 23)
public void 访客A查询第二轮红包配置详情()
{
visitorAuth9();
......@@ -390,7 +462,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "访客A领取第二轮答题红包", priority = 19)
@Test(description = "访客A领取第二轮答题红包", priority = 24)
public void 访客A领取第二轮答题红包()
{
visitorAuth9();
......@@ -410,7 +482,7 @@ public class Answer implements Authorization {
/*领取答题红包结果*/
@Test(description = "第二轮领取答题红包结果", priority = 20)
@Test(description = "第二轮领取答题红包结果", priority = 25)
public void 第二轮领取答题红包结果()
{
visitorAuth9();
......@@ -432,7 +504,7 @@ public class Answer implements Authorization {
//*****************有奖答题福利类型*****************//
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第一轮答题福利", priority = 21)
@Test(description = "上架第一轮答题福利", priority = 26)
public void 上架第一轮答题福利()
{
adminAuth();
......@@ -447,7 +519,7 @@ public class Answer implements Authorization {
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "发放第一轮答题福利", priority = 22)
@Test(description = "发放第一轮答题福利", priority = 27)
public void 发放第一轮答题福利()
{
adminAuth();
......@@ -461,7 +533,7 @@ public class Answer implements Authorization {
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
@Test(description = "访客查询第一轮答题福利", priority = 23)
@Test(description = "访客查询第一轮答题福利", priority = 28)
public void 访客查询第一轮答题福利()
{
visitorAuth9();
......@@ -479,7 +551,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 24)
@Test(description = "领取有奖答题福利类型-错误选项", priority = 29)
public void 领取有奖答题福利选择错误()
{
visitorAuth9();
......@@ -500,7 +572,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "领取有奖答题福利-访客A答题正确", priority = 25)
@Test(description = "领取有奖答题福利-访客A答题正确", priority = 30)
public void 访客A领取有奖答题福利()
{
visitorAuth3();
......@@ -520,7 +592,8 @@ public class Answer implements Authorization {
}
/*领取有奖答题福利类型结果*/
@Test(description = "查询访客A领取有奖答题福利结果", priority = 26)
@Test(description = "查询访客A领取有奖答题福利结果", priority = 31)
public void 查询访客A领取有奖答题福利结果()
{
visitorAuth3();
......@@ -541,7 +614,7 @@ public class Answer implements Authorization {
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "非指定团队用户领取有奖答题福利-答题正确", priority = 27)
@Test(description = "非指定团队用户领取有奖答题福利-答题正确", priority = 32)
public void 非指定团队用户领取有奖答题福利()
{
visitorAuth8();
......@@ -561,7 +634,7 @@ public class Answer implements Authorization {
}
/*领取有奖答题福利类型结果*/
@Test(description = "查询非指定团队用户领取有奖答题结果", priority = 28)
@Test(description = "查询非指定团队用户领取有奖答题结果", priority = 33)
public void 查询非指定团队用户领取有奖答题结果()
{
visitorAuth8();
......@@ -584,7 +657,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-黑名单用户选择正确选项*/
@Test(description = "黑名单用户领取有奖答题福利-答题正确", priority = 29)
@Test(description = "黑名单用户领取有奖答题福利-答题正确", priority = 34)
public void 黑名单用户领取有奖答题福利()
{
visitorAuth7();
......@@ -604,7 +677,7 @@ public class Answer implements Authorization {
}
/*领取有奖答题福利类型结果*/
@Test(description = "查询黑名单用户领取有奖答题福利结果", priority = 30)
@Test(description = "查询黑名单用户领取有奖答题福利结果", priority = 35)
public void 查询黑名单用户领取有奖答题福利结果()
{
visitorAuth7();
......@@ -626,7 +699,7 @@ public class Answer implements Authorization {
/*代理人领取有奖答题福利类型*/
@Test(description = "代理人领取有奖答题福利", priority = 31)
@Test(description = "代理人领取有奖答题福利", priority = 36)
public void 代理人领取有奖答题福利() {
agentAuth();
Map<String, Object> params = new HashMap<>();
......@@ -645,7 +718,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型结果*/
@Test(description = "查询代理人领取有奖答题福利结果", priority = 32)
@Test(description = "查询代理人领取有奖答题福利结果", priority = 37)
public void 查询代理人领取有奖答题福利结果()
{
agentAuth();
......@@ -665,7 +738,7 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第二轮答题福利", priority = 33)
@Test(description = "上架第二轮答题福利", priority = 38)
public void 上架第二轮答题福利()
{
adminAuth();
......@@ -681,7 +754,7 @@ public class Answer implements Authorization {
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "发放第二轮答题福利", priority = 34)
@Test(description = "发放第二轮答题福利", priority = 39)
public void 发放第二轮答题福利()
{
adminAuth();
......@@ -695,7 +768,7 @@ public class Answer implements Authorization {
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
@Test(description = "访客查询第二轮答题福利", priority = 35)
@Test(description = "访客查询第二轮答题福利", priority = 40)
public void 访客查询第二轮答题福利()
{
visitorAuth3();
......@@ -714,7 +787,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "访客A第二轮领取有奖答题福利-答题正确", priority = 36)
@Test(description = "访客A第二轮领取有奖答题福利-答题正确", priority = 41)
public void 访客A第二轮领取有奖答题福利()
{
visitorAuth3();
......@@ -733,7 +806,7 @@ public class Answer implements Authorization {
}
/*领取有奖答题福利类型结果*/
@Test(description = "查询访客A第二轮有奖答题福利类型结果", priority = 37)
@Test(description = "查询访客A第二轮有奖答题福利类型结果", priority = 42)
public void 查询访客A第二轮有奖答题福利类型结果()
{
visitorAuth3();
......@@ -758,7 +831,7 @@ public class Answer implements Authorization {
* 有奖答题无限制中奖
*/
@Test(description = "修改本场答题规则为无限制", priority = 38)
@Test(description = "修改本场答题规则为无限制", priority = 43)
public void 修改本场答题规则为无限制() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -772,7 +845,7 @@ public class Answer implements Authorization {
}
@Test(description = "查询答题规则无限制是否配置成功", priority = 39)
@Test(description = "查询答题规则无限制是否配置成功", priority = 44)
public void 查询答题规则无限制是否配置成功() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -793,7 +866,7 @@ public class Answer implements Authorization {
*/
/*查询主播端有奖答题列表*/
@Test(description = "查询有奖答题列表", priority = 40)
@Test(description = "查询有奖答题列表", priority = 45)
public void 查询有奖答题列表()
{
adminAuth();
......@@ -809,7 +882,7 @@ public class Answer implements Authorization {
}
/*查询主播端未上架的有奖答题配置详情*/
@Test(description = "主播端查询第三轮答题现金红包", priority = 41)
@Test(description = "主播端查询第三轮答题现金红包", priority = 46)
public void 主播端查询第三轮答题现金红包()
{
adminAuth();
......@@ -823,7 +896,7 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题*/
@Test(description = "上架第三轮答题现金红包", priority = 42)
@Test(description = "上架第三轮答题现金红包", priority = 47)
public void 上架第三轮答题现金红包()
{
adminAuth();
......@@ -838,7 +911,7 @@ public class Answer implements Authorization {
}
/*主播端发放答题红包*/
@Test(description = "发放第三轮现金红包", priority = 43)
@Test(description = "发放第三轮现金红包", priority = 48)
public void 发放第三轮现金红包()
{
adminAuth();
......@@ -854,7 +927,7 @@ public class Answer implements Authorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询第三轮答题红包配置", priority = 44)
@Test(description = "访客A查询第三轮答题红包配置", priority = 49)
public void 访客A查询第三轮答题红包配置()
{
visitorAuth9();
......@@ -872,7 +945,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-错误选项*/
@Test(description = "访客领取答题红包-错误选项", priority = 45)
@Test(description = "访客领取答题红包-错误选项", priority = 50)
public void 访客领取答题红包_错误选项()
{
visitorAuth2();
......@@ -893,7 +966,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-访客A选择正确选项*/
@Test(description = "领取答题红包_答题正确", priority = 46)
@Test(description = "领取答题红包_答题正确", priority = 51)
public void 访客A领取答题红包_答题正确()
{
visitorAuth9();
......@@ -915,7 +988,7 @@ public class Answer implements Authorization {
}
/*领取答题红包结果*/
@Test(description = "查询访客A领取答题红包结果", priority = 47)
@Test(description = "查询访客A领取答题红包结果", priority = 52)
public void 查询访客A领取答题红包结果()
{
visitorAuth9();
......@@ -937,7 +1010,7 @@ public class Answer implements Authorization {
}
/*领取答题红包-黑名单用户选择正确选项*/
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 48)
@Test(description = "领取答题红包-黑名单用户答题正确", priority = 53)
public void 黑名单用户领取答题红包成功()
{
visitorAuth7();
......@@ -958,7 +1031,7 @@ public class Answer implements Authorization {
}
/*领取答题红包结果*/
@Test(description = "查询黑名单用户领取答题红包结果", priority = 49)
@Test(description = "查询黑名单用户领取答题红包结果", priority = 54)
public void 查询黑名单用户领取答题红包结果()
{
visitorAuth7();
......@@ -980,7 +1053,7 @@ public class Answer implements Authorization {
}
/*代理人领取答题红包*/
@Test(description = "代理人领取答题红包", priority = 50)
@Test(description = "代理人领取答题红包", priority = 55)
public void 代理人领取答题红包()
{
agentAuth();
......@@ -1001,7 +1074,7 @@ public class Answer implements Authorization {
}
/*领取答题红包结果*/
@Test(description = "查询代理人领取答题红包结果", priority = 51)
@Test(description = "查询代理人领取答题红包结果", priority = 56)
public void 查询代理人领取答题红包结果()
{
agentAuth();
......@@ -1024,7 +1097,7 @@ public class Answer implements Authorization {
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第三轮答题福利", priority = 52)
@Test(description = "上架第三轮答题福利", priority = 57)
public void 上架第三轮答题福利()
{
adminAuth();
......@@ -1039,7 +1112,7 @@ public class Answer implements Authorization {
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "发放第三轮答题福利", priority = 53)
@Test(description = "发放第三轮答题福利", priority = 58)
public void 发放第三轮答题福利()
{
adminAuth();
......@@ -1053,7 +1126,7 @@ public class Answer implements Authorization {
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
@Test(description = "访客查询第三轮答题福利", priority = 54)
@Test(description = "访客查询第三轮答题福利", priority = 59)
public void 访客查询第三轮答题福利()
{
visitorAuth9();
......@@ -1072,7 +1145,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 55)
@Test(description = "领取有奖答题福利类型-错误选项", priority = 60)
public void 领取有奖答题福利类型选择错误()
{
visitorAuth9();
......@@ -1093,7 +1166,7 @@ public class Answer implements Authorization {
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "领取有奖答题福利类型-访客A答题正确", priority = 56)
@Test(description = "领取有奖答题福利类型-访客A答题正确", priority = 61)
public void 访客A领取有奖答题福利类型()
{
visitorAuth3();
......@@ -1111,14 +1184,14 @@ public class Answer implements Authorization {
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
@Test(description = "访客A领取有奖答题福利结果", priority = 57)
@Test(description = "访客A领取有奖答题福利结果", priority = 62)
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() );
params.put("quesConfId",this.quesConfId.get(5).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
......@@ -1130,5 +1203,179 @@ public class Answer implements Authorization {
}
/*上架主播端未发放的有奖答题-红包*/
@Test(description = "上架第四轮有奖答题红包", priority = 63)
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(6).getQuesConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
System.out.println(response.body().asString());
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 = 64)
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(6).getQuesConfId());
// params.put("liveId","Kj21NDU2NzE");
// params.put("confId",this.quesConfId.get(10).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 = 65)
public void 代理人查询第四轮有奖答题红包()
{
agentAuth();
ThreadSleepUtils.sleep(3000);
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();
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString()));
//校验该题目是否允许邀请,0为不支持
System.out.println(response.body().asString());
boolean supportInvite = response.jsonPath().getBoolean("data.supportInvite");
System.out.println(supportInvite);
Assert.assertFalse(supportInvite,network.message(params, BasicConfig.MOBILE_QuesDetail,"不支持邀请配置有误",response.body().asString()));
}
/*代理人领取答题红包*/
@Test(description = "代理人领取第四轮答题现金红包", priority = 66)
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(6).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()));
System.out.println( response.body().asString());
}
@Test(description = "代理人领取第四轮答题红包结果", priority = 67)
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(6).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()));
Object amount = response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNotNull(amount,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取失败", response.body().asString()));
System.out.println( response.body().asString());
}
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第四轮答题福利", priority = 68)
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(7).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 = 69)
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(7).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 = 70)
public void 代理人查询第四轮答题福利()
{
adminAuth();
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()));
//校验该题目是否允许邀请,0为不支持
System.out.println( response.body().asString());
boolean supportInvite = response.jsonPath().getBoolean("data.supportInvite");
System.out.println(supportInvite);
Assert.assertFalse(supportInvite,network.message(params, BasicConfig.MOBILE_QuesDetail,"不支持邀请配置有误",response.body().asString()));
}
@Test(description = "代理人第四轮领取答题福利-答题正确",priority = 71)
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(7).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params,BasicConfig.MOBILE_QuesParticipate);
System.out.println(response);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
@Test(description = "查询代理人第四轮有奖答题福利类型结果",priority = 72)
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(7).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
System.out.println(response);
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()));
System.out.println( response.body().asString());
}
}
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