Commit e3161dbe authored by 张艳玲's avatar 张艳玲

奖品签收

parent 7b95cd47
package com.kjj.bean.answer;
import lombok.Data;
import java.util.List;
@Data
public class QuestionList {
public List<QuestionList.question> list;
@Data
public static class question {
private String id;
private int optionType;
private String optionDetail;
}
}
...@@ -157,7 +157,7 @@ public class Add implements AdminAuthorization { ...@@ -157,7 +157,7 @@ public class Add implements AdminAuthorization {
AnswerBean Answer_1 = new AnswerBean(); AnswerBean Answer_1 = new AnswerBean();
Answer_1.setOptionDetail("错误"); Answer_1.setOptionDetail("错误");
Answer_1.setOptionType(2); Answer_1.setOptionType(2);
Answers.add(Answer_1); Answers1.add(Answer_1);
AnswerListBean bean1 = new AnswerListBean(); AnswerListBean bean1 = new AnswerListBean();
bean1.setQuestionDetail("答题现金红包2"); bean1.setQuestionDetail("答题现金红包2");
bean1.setOptionList(Answers1); bean1.setOptionList(Answers1);
......
...@@ -13,14 +13,15 @@ import org.testng.Assert; ...@@ -13,14 +13,15 @@ import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import javax.xml.crypto.Data; import javax.xml.crypto.Data;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
public class Limited implements AdminAuthorization { public class Limited implements AdminAuthorization {
private List<QuseRewardList.QuesList> quesConfId; private List<QuseRewardList.QuesList> quesConfId;
private QuestionList.question wronganswer;
private QuestionList.question rightanswer;
/*主播端添加有奖答题-现金红包*/ /*主播端添加有奖答题-现金红包*/
@Test(description = "主播端添加有奖答题现金红包", priority = 1) @Test(description = "主播端添加有奖答题现金红包", priority = 1)
...@@ -118,9 +119,9 @@ public class Limited implements AdminAuthorization { ...@@ -118,9 +119,9 @@ public class Limited implements AdminAuthorization {
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(0).getQuesConfId()); params.put("confId",this.quesConfId.get(0).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail);
RewardGetDetail Beans=JsonUtil.parseResponseToBean(response, RewardGetDetail.class); Object data=response.jsonPath().getJsonObject("data");
System.out.println(JSON.toJSONString(Beans)); System.out.println(data);
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString())); Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString()));
} }
/*上架主播端未发放的有奖答题*/ /*上架主播端未发放的有奖答题*/
...@@ -161,9 +162,14 @@ public class Limited implements AdminAuthorization { ...@@ -161,9 +162,14 @@ public class Limited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
Object quesType=response.jsonPath().getJsonObject("data.quesType"); List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(quesType); System.out.println(list);
Assert.assertEquals(quesType,1, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString())); 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()));
} }
/*领取答题红包-错误选项*/ /*领取答题红包-错误选项*/
...@@ -174,11 +180,17 @@ public class Limited implements AdminAuthorization { ...@@ -174,11 +180,17 @@ public class Limited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(0).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(0).getQuesConfId());
params.put("optionId", "Kj21MjM"); params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "用户答题失败", response.body().asString()));
} }
/*领取答题红包-访客A选择正确选项*/ /*领取答题红包-访客A选择正确选项*/
...@@ -189,11 +201,36 @@ public class Limited implements AdminAuthorization { ...@@ -189,11 +201,36 @@ public class Limited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(0).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(0).getQuesConfId());
params.put("optionId","Kj21MTU"); params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
}
/*领取答题红包结果*/
@Test(description = "查询用户A领取答题红包结果", priority = 10)
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.rightanswer.getId());
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()));
} }
...@@ -205,45 +242,78 @@ public class Limited implements AdminAuthorization { ...@@ -205,45 +242,78 @@ public class Limited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(0).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(0).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*领取答题红包结果*/
@Test(description = "查询黑名单用户领取答题红包结果", priority = 12)
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(0).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.assertNull(amount,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取失败", response.body().asString()));
}
/*代理人领取答题红包*/ /*代理人领取答题红包*/
@Test(description = "代理人领取答题红包", priority = 12) @Test(description = "代理人领取答题红包", priority = 13)
public void 代理人领取答题红包() public void 代理人领取答题红包()
{ {
agentAuth(); agentAuth();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(0).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(0).getQuesConfId() );
params.put("optionId", "Kj21MTU"); params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
} }
/*领取答题红包结果*/ @Test(description = "查询代理人领取答题红包结果", priority = 14)
@Test(description = "领取答题红包结果", priority = 13) public void 查询代理人领取答题红包结果()
public void 领取答题红包结果()
{ {
visitorAuth9(); agentAuth();
ThreadSleepUtils.sleep(500); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(0).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(0).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNotNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Object 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 = 14) @Test(description = "查询第二轮答题现金红包", priority = 15)
public void 查询第二轮答题现金红包() public void 查询第二轮答题现金红包()
{ {
adminAuth(); adminAuth();
...@@ -251,13 +321,13 @@ public class Limited implements AdminAuthorization { ...@@ -251,13 +321,13 @@ public class Limited implements AdminAuthorization {
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(1).getQuesConfId()); params.put("confId",this.quesConfId.get(1).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail);
RewardGetDetail Beans=JsonUtil.parseResponseToBean(response, RewardGetDetail.class); Object data=response.jsonPath().getJsonObject("data");
System.out.println(JSON.toJSONString(Beans)); System.out.println(data);
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString())); Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString()));
} }
/*上架主播端未发放的有奖答题*/ /*上架主播端未发放的有奖答题*/
@Test(description = "上架第二轮答题现金红包", priority = 15) @Test(description = "上架第二轮答题现金红包", priority = 16)
public void 上架第二轮答题现金红包() public void 上架第二轮答题现金红包()
{ {
ThreadSleepUtils.sleep(100000); ThreadSleepUtils.sleep(100000);
...@@ -272,7 +342,7 @@ public class Limited implements AdminAuthorization { ...@@ -272,7 +342,7 @@ public class Limited implements AdminAuthorization {
} }
/*主播端发放答题红包*/ /*主播端发放答题红包*/
@Test(description = "发放第二轮现金红包", priority = 16) @Test(description = "发放第二轮现金红包", priority = 17)
public void 发放第二轮现金红包() public void 发放第二轮现金红包()
{ {
adminAuth(); adminAuth();
...@@ -287,7 +357,7 @@ public class Limited implements AdminAuthorization { ...@@ -287,7 +357,7 @@ public class Limited implements AdminAuthorization {
//访客端 //访客端
/*查询访客端有奖答题配置详情*/ /*查询访客端有奖答题配置详情*/
@Test(description = "访客A查询有奖答题配置详情", priority = 17) @Test(description = "访客A查询有奖答题配置详情", priority = 18)
public void 访客A查询有奖答题配置详情() public void 访客A查询有奖答题配置详情()
{ {
visitorAuth9(); visitorAuth9();
...@@ -300,22 +370,27 @@ public class Limited implements AdminAuthorization { ...@@ -300,22 +370,27 @@ public class Limited implements AdminAuthorization {
} }
/*领取答题红包-访客A选择正确选项*/ /*领取答题红包-访客A选择正确选项*/
@Test(description = "访客A领取第二轮答题红包", priority = 18) @Test(description = "访客A领取第二轮答题红包", priority = 19)
public void 访客A领取第二轮答题红包() public void 访客A领取第二轮答题红包()
{ {
visitorAuth9(); visitorAuth9();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(1).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(1).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId",this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*领取答题红包结果*/ /*领取答题红包结果*/
@Test(description = "第二轮领取答题红包结果", priority = 19) @Test(description = "第二轮领取答题红包结果", priority = 20)
public void 第二轮领取答题红包结果() public void 第二轮领取答题红包结果()
{ {
visitorAuth9(); visitorAuth9();
...@@ -325,14 +400,19 @@ public class Limited implements AdminAuthorization { ...@@ -325,14 +400,19 @@ public class Limited implements AdminAuthorization {
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
ThreadSleepUtils.sleep(30000);
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 = 20) @Test(description = "上架第一轮答题福利", priority = 21)
public void 上架第一轮答题福利() public void 上架第一轮答题福利()
{ {
adminAuth(); adminAuth();
...@@ -347,7 +427,7 @@ public class Limited implements AdminAuthorization { ...@@ -347,7 +427,7 @@ public class Limited implements AdminAuthorization {
} }
/*主播端发放福利类型的有奖答题*/ /*主播端发放福利类型的有奖答题*/
@Test(description = "发放第一轮答题福利", priority = 21) @Test(description = "发放第一轮答题福利", priority = 22)
public void 发放第一轮答题福利() public void 发放第一轮答题福利()
{ {
adminAuth(); adminAuth();
...@@ -361,96 +441,168 @@ public class Limited implements AdminAuthorization { ...@@ -361,96 +441,168 @@ public class Limited implements AdminAuthorization {
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString())); Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
} }
@Test(description = "访客查询第一轮答题福利", priority = 22) @Test(description = "访客查询第一轮答题福利", priority = 23)
public void 访客查询第一轮答题福利() public void 访客查询第一轮答题福利()
{ {
visitorAuth9(); visitorAuth9();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
Object quesType=response.jsonPath().getJsonObject("data.quesType"); List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(quesType); System.out.println(list);
Assert.assertEquals(quesType,2, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString())); 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()));
} }
/*领取有奖答题福利类型-错误选项*/ /*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 23) @Test(description = "领取有奖答题福利类型-错误选项", priority = 24)
public void 领取有奖答题福利类型选择错误() public void 领取有奖答题福利类型选择错误()
{ {
visitorAuth9(); visitorAuth9();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(2).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(2).getQuesConfId());
params.put("optionId", "Kj21MjM"); params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*领取有奖答题福利类型-访客A选择正确选项*/ /*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "领取有奖答题福利类型-访客A答题正确", priority = 24) @Test(description = "领取有奖答题福利-访客A答题正确", priority = 25)
public void 访客A领取有奖答题福利类型() public void 访客A领取有奖答题福利()
{ {
visitorAuth3(); visitorAuth3();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(2).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(2).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
/*领取有奖答题福利类型结果*/
@Test(description = "查询访客A领取有奖答题福利结果", priority = 26)
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 openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, 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()));
} }
/*领取有奖答题福利类型-黑名单用户选择正确选项*/ /*领取有奖答题福利类型-黑名单用户选择正确选项*/
@Test(description = "黑名单用户领取有奖答题福利-答题正确", priority = 25) @Test(description = "黑名单用户领取有奖答题福利-答题正确", priority = 27)
public void 黑名单用户领取有奖答题福利() public void 黑名单用户领取有奖答题福利()
{ {
visitorAuth7(); visitorAuth7();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(2).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(2).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); 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"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*代理人领取有奖答题福利类型*/ /*领取有奖答题福利类型结果*/
@Test(description = "代理人领取有奖答题福利类型", priority = 26) @Test(description = "查询黑名单用户领取有奖答题福利结果", priority = 28)
public void 代理人领取有奖答题福利类型() public void 查询黑名单用户领取有奖答题福利结果()
{ {
agentAuth(); visitorAuth7();
ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() );
params.put("optionId", "Kj21MTU"); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer welfareStatus=response.jsonPath().getJsonObject("data.welfareStatus");
System.out.println(welfareStatus);
Assert.assertTrue(welfareStatus==3, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
}
/*代理人领取有奖答题福利类型*/
@Test(description = "代理人领取有奖答题福利", priority = 29)
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(2).getQuesConfId());
params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); 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); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*领取有奖答题福利类型结果*/ /*领取有奖答题福利类型结果*/
@Test(description = "领取有奖答题福利类型结果", priority = 27) @Test(description = "查询代理人领取有奖答题福利结果", priority = 30)
public void 领取有奖答题福利类型结果() public void 查询代理人领取有奖答题福利结果()
{ {
visitorAuth3(); agentAuth();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(2).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNotNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString())); 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==3, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
} }
/*上架主播端未发放的有奖答题-福利*/ /*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第二轮答题福利", priority = 28) @Test(description = "上架第二轮答题福利", priority = 31)
public void 上架第二轮答题福利() public void 上架第二轮答题福利()
{ {
adminAuth(); adminAuth();
...@@ -466,7 +618,7 @@ public class Limited implements AdminAuthorization { ...@@ -466,7 +618,7 @@ public class Limited implements AdminAuthorization {
} }
/*主播端发放福利类型的有奖答题*/ /*主播端发放福利类型的有奖答题*/
@Test(description = "发放第二轮答题福利", priority = 29) @Test(description = "发放第二轮答题福利", priority = 32)
public void 发放第二轮答题福利() public void 发放第二轮答题福利()
{ {
adminAuth(); adminAuth();
...@@ -480,7 +632,7 @@ public class Limited implements AdminAuthorization { ...@@ -480,7 +632,7 @@ public class Limited implements AdminAuthorization {
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString())); Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
} }
@Test(description = "访客查询第二轮答题福利", priority = 30) @Test(description = "访客查询第二轮答题福利", priority = 33)
public void 访客查询第二轮答题福利() public void 访客查询第二轮答题福利()
{ {
visitorAuth9(); visitorAuth9();
...@@ -495,32 +647,44 @@ public class Limited implements AdminAuthorization { ...@@ -495,32 +647,44 @@ public class Limited implements AdminAuthorization {
/*领取有奖答题福利类型-访客A选择正确选项*/ /*领取有奖答题福利类型-访客A选择正确选项*/
@Test(description = "访客A第二轮领取有奖答题福利类型-答题正确", priority = 31) @Test(description = "访客A第二轮领取有奖答题福利-答题正确", priority = 34)
public void 访客A第二轮领取有奖答题福利类型() public void 访客A第二轮领取有奖答题福利()
{ {
visitorAuth3(); visitorAuth3();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(3).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(3).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertFalse(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
} }
/*领取有奖答题福利类型结果*/ /*领取有奖答题福利类型结果*/
@Test(description = "领取第二轮有奖答题福利类型结果", priority = 32) @Test(description = "查询访客A第二轮有奖答题福利类型结果", priority = 35)
public void 领取第二轮有奖答题福利类型结果() public void 查询访客A第二轮有奖答题福利类型结果()
{ {
visitorAuth3(); visitorAuth3();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(3).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(3).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result"); boolean Result=response.jsonPath().getBoolean("data.Result");
System.out.println(result); System.out.println(Result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString())); Assert.assertFalse(Result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer welfareStatus=response.jsonPath().getJsonObject("data.welfareStatus");
System.out.println(welfareStatus);
Assert.assertTrue(welfareStatus==3, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取异常", response.body().asString()));
} }
......
...@@ -21,7 +21,6 @@ public class QuestionAwards implements AdminAuthorization { ...@@ -21,7 +21,6 @@ public class QuestionAwards implements AdminAuthorization {
public String confId_ques; public String confId_ques;
public String confId_reward; public String confId_reward;
public String wronganswer; public String wronganswer;
public String rightanswer; public String rightanswer;
......
package com.kjj.cases.live.red; package com.kjj.cases.live.red;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.kjj.bean.answer.QuestionList;
import com.kjj.bean.answer.QuseRewardList; import com.kjj.bean.answer.QuseRewardList;
import com.kjj.bean.answer.RewardGetDetail; import com.kjj.bean.answer.RewardGetDetail;
import com.kjj.cases.live.admin.AdminAuthorization; import com.kjj.cases.live.admin.AdminAuthorization;
...@@ -15,10 +16,14 @@ import org.testng.annotations.Test; ...@@ -15,10 +16,14 @@ import org.testng.annotations.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
public class Unlimited implements AdminAuthorization { public class Unlimited implements AdminAuthorization {
private List<QuseRewardList.QuesList> quesConfId; private List<QuseRewardList.QuesList> quesConfId;
private List<QuestionList.question> wronganswer;
private List<QuestionList.question> rightanswer;
/*查询主播端有奖答题列表*/ /*查询主播端有奖答题列表*/
@Test(description = "查询主播端有奖答题列表", priority = 1) @Test(description = "查询主播端有奖答题列表", priority = 1)
public void 查询主播端有奖答题列表() public void 查询主播端有奖答题列表()
...@@ -44,9 +49,9 @@ public class Unlimited implements AdminAuthorization { ...@@ -44,9 +49,9 @@ public class Unlimited implements AdminAuthorization {
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId()); params.put("confId",this.quesConfId.get(4).getQuesConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardGetDetail);
RewardGetDetail Beans= JsonUtil.parseResponseToBean(response, RewardGetDetail.class); Object data=response.jsonPath().getJsonObject("data");
System.out.println(JSON.toJSONString(Beans)); System.out.println(data);
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString())); Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardGetDetail, "查询主播端有奖答题配置失败", response.body().asString()));
} }
/*上架主播端未发放的有奖答题*/ /*上架主播端未发放的有奖答题*/
...@@ -62,7 +67,6 @@ public class Unlimited implements AdminAuthorization { ...@@ -62,7 +67,6 @@ public class Unlimited implements AdminAuthorization {
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
System.out.println(data); System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString())); Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
ThreadSleepUtils.sleep(3000);
} }
/*主播端发放答题红包*/ /*主播端发放答题红包*/
...@@ -70,7 +74,7 @@ public class Unlimited implements AdminAuthorization { ...@@ -70,7 +74,7 @@ public class Unlimited implements AdminAuthorization {
public void 发放第三轮现金红包() public void 发放第三轮现金红包()
{ {
adminAuth(); adminAuth();
ThreadSleepUtils.sleep(500); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(4).getQuesConfId()); params.put("confId",this.quesConfId.get(4).getQuesConfId());
...@@ -89,9 +93,11 @@ public class Unlimited implements AdminAuthorization { ...@@ -89,9 +93,11 @@ public class Unlimited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
Object quesType=response.jsonPath().getJsonObject("data.quesType"); List<QuestionList.question> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.questionList")), QuestionList.question.class);
System.out.println(quesType); System.out.println(list);
Assert.assertEquals(quesType,1, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString())); this.wronganswer=list;
this.rightanswer=list;
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString()));
} }
/*领取答题红包-错误选项*/ /*领取答题红包-错误选项*/
...@@ -102,11 +108,16 @@ public class Unlimited implements AdminAuthorization { ...@@ -102,11 +108,16 @@ public class Unlimited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", "Kj21MjM"); params.put("optionId", this.wronganswer.stream().filter(a->a.getOptionType()==2).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "参与失败", response.body().asString()));
} }
/*领取答题红包-访客A选择正确选项*/ /*领取答题红包-访客A选择正确选项*/
...@@ -117,62 +128,126 @@ public class Unlimited implements AdminAuthorization { ...@@ -117,62 +128,126 @@ public class Unlimited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId","Kj21MTU"); params.put("optionId",this.rightanswer.stream().filter(a->a.getOptionType()==1).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, 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 = 8) @Test(description = "领取答题红包-黑名单用户答题正确", priority = 9)
public void 黑名单用户领取答题红包成功() public void 黑名单用户领取答题红包成功()
{ {
visitorAuth7(); visitorAuth7();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(4).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(4).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.stream().filter(a->a.getOptionType()==1).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "答题失败", response.body().asString()));
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, 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 = 9) @Test(description = "代理人领取答题红包", priority = 11)
public void 代理人领取答题红包() public void 代理人领取答题红包()
{ {
agentAuth(); agentAuth();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.stream().filter(a->a.getOptionType()==1).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertFalse(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
} }
/*领取答题红包结果*/ /*领取答题红包结果*/
@Test(description = "领取答题红包结果", priority = 10) @Test(description = "查询代理人领取答题红包结果", priority = 12)
public void 领取答题红包结果() public void 查询代理人领取答题红包结果()
{ {
visitorAuth9(); agentAuth();
ThreadSleepUtils.sleep(500); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() ); params.put("quesConfId",this.quesConfId.get(4).getQuesConfId() );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo); Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertNotNull(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Integer amount=response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
} }
/*上架主播端未发放的有奖答题-福利*/ /*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架第一轮答题福利", priority = 11) @Test(description = "上架第一轮答题福利", priority = 13)
public void 上架第一轮答题福利() public void 上架第一轮答题福利()
{ {
adminAuth(); adminAuth();
...@@ -187,11 +262,11 @@ public class Unlimited implements AdminAuthorization { ...@@ -187,11 +262,11 @@ public class Unlimited implements AdminAuthorization {
} }
/*主播端发放福利类型的有奖答题*/ /*主播端发放福利类型的有奖答题*/
@Test(description = "发放第一轮答题福利", priority = 12) @Test(description = "发放第一轮答题福利", priority = 14)
public void 发放第一轮答题福利() public void 发放第一轮答题福利()
{ {
adminAuth(); adminAuth();
ThreadSleepUtils.sleep(500); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",this.quesConfId.get(5).getQuesConfId()); params.put("confId",this.quesConfId.get(5).getQuesConfId());
...@@ -201,7 +276,7 @@ public class Unlimited implements AdminAuthorization { ...@@ -201,7 +276,7 @@ public class Unlimited implements AdminAuthorization {
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString())); Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
} }
@Test(description = "访客查询第一轮答题福利", priority = 13) @Test(description = "访客查询第一轮答题福利", priority = 15)
public void 访客查询第一轮答题福利() public void 访客查询第一轮答题福利()
{ {
visitorAuth9(); visitorAuth9();
...@@ -215,14 +290,14 @@ public class Unlimited implements AdminAuthorization { ...@@ -215,14 +290,14 @@ public class Unlimited implements AdminAuthorization {
/*领取有奖答题福利类型-错误选项*/ /*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 14) @Test(description = "领取有奖答题福利类型-错误选项", priority = 16)
public void 领取有奖答题福利类型选择错误() public void 领取有奖答题福利类型选择错误()
{ {
visitorAuth9(); visitorAuth9();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", "Kj21MjM"); params.put("optionId", this.wronganswer.stream().filter(a->a.getOptionType()==2).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
...@@ -238,14 +313,32 @@ public class Unlimited implements AdminAuthorization { ...@@ -238,14 +313,32 @@ public class Unlimited implements AdminAuthorization {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", this.quesConfId.get(5).getQuesConfId()); params.put("quesConfId", this.quesConfId.get(5).getQuesConfId());
params.put("optionId", "Kj21MTU"); params.put("optionId", this.rightanswer.stream().filter(a->a.getOptionType()==1).collect(Collectors.toList()).get(0).getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate); Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
boolean result=response.jsonPath().getBoolean("data.result"); boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result); System.out.println(result);
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
} }
@Test(description = "查询访客A领取有奖答题福利结果", priority = 16)
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 openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, 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()));
}
} }
...@@ -19,11 +19,11 @@ public class BasicConfig { ...@@ -19,11 +19,11 @@ public class BasicConfig {
//直播访客 (刘超) //直播访客 (刘超)
public static String VISITORKEY3 ="LEH7epeHVDJWzhZ6DiexTHnsaP3ed5NWb7fwGDRPzUCcfxMKyEZr5fYSmKv5AZVQu1w2FRoEvz6mP3RzfeKLqjV8Kq1XE"; public static String VISITORKEY3 ="LEH7epeHVDJWzhZ6DiexTHnsaP3ed5NWb7fwGDRPzUCcfxMKyEZr5fYSmKv5AZVQu1w2FRoEvz6mP3RzfeKLqjV8Kq1XE";
//直播访客 (李执) //直播访客 (李执)
public static String VISITORKEY4 ="5MgSyboxqzAQZZJEsTf43nVX8FkunrWfgVgxhR9mmo6thaPjMjfgUM62TrCUYvnSdn3kTGsGvJsSaiS4m5LS1up5twWa"; public static String VISITORKEY4 ="DyGoVEPj7nANppy7P8NS4Z4mtMsJhG8DmhaSQPam9aBfp49QoDsHkMeQEFDqHgpbfXt2ESodJMJrGEDiTxk687Kcq";
//直播访客 (吉吉) //直播访客 (吉吉)
public static String VISITORKEY9 ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKnNHmHY52FxaDfigK3U4NQpLsQrodQUPUXwmumQ1kr3xsfZoGw7cEswYryWfUtMW"; public static String VISITORKEY9 ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKnNHmHY52FxaDfigK3U4NQpLsQrodQUPUXwmumQ1kr3xsfZoGw7cEswYryWfUtMW";
//直播访客 (周成) //直播访客 (周成)
public static String VISITORKEY5 ="LEH7epeHVDJWzhZ6DiexTHnsy28uMFcnMj6a1Nh76ZtqrBohi2vbvjsoksZjyRcqFdSgh5zddoi95S8gKvBbuggy6Bhku"; public static String VISITORKEY5 ="zFNkBc7JtvLPL6ifAfXbcgXf7k83YNaKjHreYoVN6SLoZF8WsHX87aGwwxpLiGDXLfX4GvfvDzp9uJsxooF5ZPLVrn";
//直播访客 (新强) //直播访客 (新强)
public static String VISITORKEY6 ="DyGoVEPj7nANppy7P8NS4Z4v3PAwxeqJodqYrmwYkoHYMsV4yAxbTXwZ5wWmGQTddQgxdWoNCmN43P8fzhcuWRmdE"; public static String VISITORKEY6 ="DyGoVEPj7nANppy7P8NS4Z4v3PAwxeqJodqYrmwYkoHYMsV4yAxbTXwZ5wWmGQTddQgxdWoNCmN43P8fzhcuWRmdE";
//直播访客 (熊二) //直播访客 (熊二)
......
...@@ -119,11 +119,6 @@ ...@@ -119,11 +119,6 @@
<class name="com.kjj.cases.live.red.LiveVistorRed"/> <class name="com.kjj.cases.live.red.LiveVistorRed"/>
</classes> </classes>
</test> </test>
<!-- <test preserve-order="true" name="有奖答题">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.red.QuestionAwards"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="有奖答题限制1次中奖"> <test preserve-order="true" name="有奖答题限制1次中奖">
<classes> <classes>
......
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