Commit 47136cd2 authored by 张艳玲's avatar 张艳玲

Merge branch 'featrue/20210702-zhangyl' into 'master'

update

See merge request test-group/kejiji!59
parents c5c32ef1 94b2de84
package com.kjj.bean.answer;
import lombok.Data;
@Data
public class QuesList {
private String quesId;
private String id;
}
...@@ -222,12 +222,28 @@ public interface Authorization { ...@@ -222,12 +222,28 @@ public interface Authorization {
} }
/** /**
* 访客V(谢翊美)ID:791 * 访客V(zzz666)ID:849
*/ */
default void visitorAuth22() { default void visitorAuth22() {
network.agentCookies.put("authKey", visitorAuth22); network.agentCookies.put("authKey", visitorAuth22);
System.out.println("用户AUTH_KEY:" + visitorAuth22); System.out.println("用户AUTH_KEY:" + visitorAuth22);
} }
/**
* 访客u(七凉)ID:179
*/
default void visitorAuth23() {
network.agentCookies.put("authKey", visitorAuth23);
System.out.println("用户AUTH_KEY:" + visitorAuth23);
}
/**
* 访客S(奶汪)ID:1170 实名
*/
default void visitorAuth24() {
network.agentCookies.put("authKey", visitorAuth24);
System.out.println("用户AUTH_KEY:" + visitorAuth24);
}
} }
package com.kjj.cases.live.answer;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.answer.QuesList;
import com.kjj.bean.answer.QuestionList;
import com.kjj.bean.answer.QuseRewardList;
import com.kjj.bean.manager.PassQues;
import com.kjj.cases.admin.Authorization;
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.*;
public class passQues implements Authorization {
public List<QuesList> quesId;
public String confId;
public QuestionList.question wrongAnswer;
public QuestionList.question rightAnswer;
@BeforeClass
public void setUp() { adminAuth();}
@Test(description = "根据直播id查询配置", priority = 1)
public void 根据直播id查询配置() {
Map<String, Object> confInfoParam = new HashMap<>();
confInfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(confInfoParam, BasicConfig.ANCHOR_confInfo);
int confStatus =response.jsonPath().getInt("data.confStatus");
System.out.println(confStatus);
Assert.assertTrue(confStatus==1, network.message(confInfoParam, BasicConfig.ANCHOR_confInfo, "闯关答题未开启", response.body().asString()));
}
public List<QuesList>id;
@Test(description = "主播端获取问题列表", priority = 2)
public void 主播端获取问题列表() {
Map<String, Object> quesListParam = new HashMap<>();
quesListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(quesListParam, BasicConfig.ANCHOR_quesList);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
List<QuesList> quesLists=JsonUtil.parseResponseToListBean(response,QuesList.class);
this.id=quesLists;
Assert.assertNotNull(quesLists, network.message(quesListParam, BasicConfig.ANCHOR_quesList, "主播端获取问题列表失败", response.body().asString()));
}
@Test(description = "主播端获取问题详情", priority = 3)
public void 主播端获取问题详情() {
Map<String, Object> quesInfoParam = new HashMap<>();
quesInfoParam.put("quesId",this.id.get(0).getId());
Response response = network.getResponse(quesInfoParam, BasicConfig.ANCHOR_quesInfo);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(quesInfoParam, BasicConfig.ANCHOR_quesInfo, "主播端获取问题详情失败", response.body().asString()));
}
@Test(description = "主播端编辑问题", priority = 4)
public void 主播端编辑问题() {
Map<String, Object> updateQuesParam = new HashMap<>();
updateQuesParam.put("id",this.id.get(0).getId());
updateQuesParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
updateQuesParam.put("openTime",10);
updateQuesParam.put("passQuestion","闯关答题配置new");
List<PassQues> optionLists =new ArrayList<>();
PassQues optionList =new PassQues();
optionList.setOptionDetail("正确选项");
optionList.setOptionType(1);
optionLists.add(optionList);
PassQues optionList1 =new PassQues();
optionList1.setOptionDetail("错误选项");
optionList1.setOptionType(2);
optionLists.add(optionList1);
updateQuesParam.put("optionList",optionLists);
Response response = network.postResponse(updateQuesParam, BasicConfig.ANCHOR_updateQues);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateQuesParam, BasicConfig.ANCHOR_updateQues, "主播端编辑问题失败", response.body().asString()));
}
@Test(description = "开启第1轮答题", priority = 5)
public void 开启第1轮答题() {
Map<String, Object> openNextParam = new HashMap<>();
openNextParam.put("quesId",this.id.get(0).getId());
openNextParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(openNextParam, BasicConfig.ANCHOR_openNext);
boolean success =response.jsonPath().getBoolean("success");
System.out.println(success);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(openNextParam, BasicConfig.ANCHOR_openNext, "开启第1轮答题失败", response.body().asString()));
}
@Test(description = "闯关答题配置信息", priority = 6)
public void 闯关答题配置信息() {
visitorAuth9();
Map<String, Object> redParam = new HashMap<>();
redParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(redParam, BasicConfig.ANCHOR_quesRedConf);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
confId=response.jsonPath().getJsonObject("data.confId");
List<QuesList> quesLists = JsonUtil.parseResponseToPageBean(response,QuesList.class,"quesList");
this.quesId=quesLists;
Assert.assertNotNull(quesLists, network.message(redParam, BasicConfig.ANCHOR_quesRedConf, "闯关答题配置信息获取失败", response.body().asString()));
}
public String shareSign;
@Test(description = "访客H分享直播间", priority = 7)
public void 访客H分享直播间() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_sign);
String data = signRes.jsonPath().getString("data");
this.shareSign = data;
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_sign, "分享失败", signRes.body().asString()));
}
@Test(description = "访客u给访客H助力", priority = 8)
public void 访客u给访客H助力() {
Map<String, Object> assistParam = new HashMap<>();
assistParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
assistParam.put("shareSign",shareSign);
assistParam.put("shareType",11);
assistParam.put("confId",confId);
visitorAuth23();
ThreadSleepUtils.sleep(1000);
Response response = network.postResponse(assistParam, BasicConfig.MOBILE_assist);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(assistParam, BasicConfig.MOBILE_assist, "访客C给访客A助力失败", response.body().asString()));
visitorAuth24();
ThreadSleepUtils.sleep(1000);
Response assistRes = network.postResponse(assistParam, BasicConfig.MOBILE_assist);
boolean data1 = assistRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(assistParam, BasicConfig.MOBILE_assist, "访客C给访客A助力失败", assistRes.body().asString()));
}
@Test(description = "获取第1轮问题详情信息", priority = 9)
public void 获取第1轮问题详情信息() {
visitorAuth9();
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("quesId",this.quesId.get(0).getQuesId());
Response response = network.getResponse(detailParam, BasicConfig.ANCHOR_quesRedDetail);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
List<QuestionList.question> quesOptionList = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.quesOptionList")), QuestionList.question.class);
Optional<QuestionList.question> wrongAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wrongAnswer= wrongAnswerOption.get();
System.out.println(wrongAnswer);
Optional<QuestionList.question> correctAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightAnswer=correctAnswerOption.get();
System.out.println(rightAnswer);
Assert.assertNotNull(quesOptionList, network.message(detailParam, BasicConfig.ANCHOR_quesRedDetail, "获取问题详情失败", response.body().asString()));
}
@Test(description = "第1轮提交答题", priority = 10)
public void 1轮提交答题() {
visitorAuth9();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("quesConfId",this.quesId.get(0).getQuesId());
Params.put("optionId",this.wrongAnswer.getId());
Params.put("submitType",1);//1正常答题2放弃答题3补答
Response response = network.postResponse(Params, BasicConfig.ANCHOR_participate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_participate, "第1轮提交答题失败", response.body().asString()));
visitorAuth13();
Map<String, Object> participateParam = new HashMap<>();
participateParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
participateParam.put("quesConfId",this.quesId.get(0).getQuesId());
participateParam.put("optionId",this.rightAnswer.getId());
participateParam.put("submitType",1);//1正常答题2放弃答题3补答
Response participateRes = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data1 =participateRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(participateParam, BasicConfig.ANCHOR_participate, "第1轮提交答题失败", participateRes.body().asString()));
}
//复活卡需要用户助力获得
@Test(description = "第1轮用户答题结果", priority = 11)
public void 1轮用户答题结果() {
ThreadSleepUtils.sleep(5000);
Map<String, Object> ResultParam = new HashMap<>();
ResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
ResultParam.put("quesId",this.quesId.get(0).getQuesId());
visitorAuth9();
Response response = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
boolean result =response.jsonPath().getBoolean("data.result");
Assert.assertFalse(result, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果正确", response.body().asString()));
long reviveCardCount =response.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount==2, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", response.body().asString()));
visitorAuth13();
Response ResultRes = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data1 =ResultRes.jsonPath().getJsonObject("data");
System.out.println(data1);
boolean result1 =ResultRes.jsonPath().getBoolean("data.result");
Assert.assertTrue(result1, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", ResultRes.body().asString()));
long reviveCardCount1 =ResultRes.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount1==0, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "剩余复活卡数量异常", ResultRes.body().asString()));
}
@Test(description = "获取第1轮题目正确答案", priority = 12)
public void 获取第1轮题目正确答案() {
visitorAuth9();
Map<String, Object> answerParam = new HashMap<>();
answerParam.put("quesId",this.quesId.get(0).getQuesId());
Response response = network.getResponse(answerParam, BasicConfig.ANCHOR_answer);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(answerParam, BasicConfig.ANCHOR_answer, "获取当前题目正确答案失败", response.body().asString()));
}
@Test(description = "获取第1轮用户答题列表", priority = 13)
public void 获取第1轮用户答题列表() {
visitorAuth9();
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.ANCHOR_quesRedList);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listParam, BasicConfig.ANCHOR_quesRedList, "获取用户答题列表失败", response.body().asString()));
}
@Test(description = "第1轮复活", priority = 14)
public void 1轮复活() {
visitorAuth9();
Map<String, Object> reviveParam = new HashMap<>();
reviveParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(reviveParam, BasicConfig.ANCHOR_revive);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(reviveParam, BasicConfig.ANCHOR_revive, "第1轮复活失败", response.body().asString()));
}
@Test(description = "第1轮复活提交答题", priority = 15)
public void 1轮复活提交答题() {
visitorAuth9();
Map<String, Object> participateParam = new HashMap<>();
participateParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
participateParam.put("quesConfId",this.quesId.get(0).getQuesId());
participateParam.put("optionId",this.rightAnswer.getId());
participateParam.put("submitType",3);//1正常答题2放弃答题3补答
Response response = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(participateParam, BasicConfig.ANCHOR_participate, "提交答题失败", response.body().asString()));
}
@Test(description = "第1轮复活答题结果", priority = 16)
public void 1轮复活答题结果() {
visitorAuth9();
ThreadSleepUtils.sleep(5000);
Map<String, Object> ResultParam = new HashMap<>();
ResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
ResultParam.put("quesId",this.quesId.get(0).getQuesId());
Response response = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
boolean result =response.jsonPath().getBoolean("data.result");
Assert.assertTrue(result, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", response.body().asString()));
long reviveCardCount =response.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount==1, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", response.body().asString()));
}
@Test(description = "开启第2轮答题", priority = 17)
public void 开启第2轮答题() {
Map<String, Object> openNextParam = new HashMap<>();
openNextParam.put("quesId",this.id.get(1).getId());
openNextParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(openNextParam, BasicConfig.ANCHOR_openNext);
boolean success =response.jsonPath().getBoolean("success");
System.out.println(success);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(openNextParam, BasicConfig.ANCHOR_openNext, "开启第2轮答题失败", response.body().asString()));
}
@Test(description = "获取第2轮问题详情信息", priority = 18)
public void 获取第2轮问题详情信息() {
visitorAuth9();
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("quesId",this.quesId.get(1).getQuesId());
Response response = network.getResponse(detailParam, BasicConfig.ANCHOR_quesRedDetail);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
List<QuestionList.question> quesOptionList = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.quesOptionList")), QuestionList.question.class);
System.out.println(quesOptionList);
Optional<QuestionList.question> wrongAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wrongAnswer= wrongAnswerOption.get();
System.out.println(wrongAnswer);
Optional<QuestionList.question> correctAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightAnswer=correctAnswerOption.get();
System.out.println(rightAnswer);
Assert.assertNotNull(quesOptionList, network.message(detailParam, BasicConfig.ANCHOR_quesRedDetail, "获取第2轮问题详情信息失败", response.body().asString()));
}
@Test(description = "第2轮提交答题", priority = 19)
public void 2轮提交答题() {
visitorAuth9();
Map<String, Object> participateParam = new HashMap<>();
participateParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
participateParam.put("quesConfId",this.quesId.get(1).getQuesId());
participateParam.put("optionId",null);
participateParam.put("submitType",2);//1正常答题2放弃答题3补答
Response response = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(participateParam, BasicConfig.ANCHOR_participate, "第2轮提交答题失败", response.body().asString()));
visitorAuth13();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("quesConfId",this.quesId.get(1).getQuesId());
Params.put("optionId",this.rightAnswer.getId());
Params.put("submitType",1);//1正常答题2放弃答题3补答
Response participateRes = network.postResponse(Params, BasicConfig.ANCHOR_participate);
boolean data1 =participateRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(Params, BasicConfig.ANCHOR_participate, "第2轮提交答题失败", participateRes.body().asString()));
}
@Test(description = "第2轮用户答题结果", priority = 20)
public void 2轮用户答题结果() {
ThreadSleepUtils.sleep(5000);
Map<String, Object> ResultParam = new HashMap<>();
ResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
ResultParam.put("quesId",this.quesId.get(1).getQuesId());
visitorAuth9();
Response response = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
boolean result =response.jsonPath().getBoolean("data.result");
Assert.assertFalse(result, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", response.body().asString()));
long reviveCardCount =response.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount==1, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", response.body().asString()));
visitorAuth13();
Response resultRes = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
boolean result1 =resultRes.jsonPath().getBoolean("data.result");
Assert.assertTrue(result1, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", resultRes.body().asString()));
long reviveCardCount1 =resultRes.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount1==0, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", resultRes.body().asString()));
}
@Test(description = "第2轮复活", priority = 21)
public void 2轮复活() {
visitorAuth9();
Map<String, Object> reviveParam = new HashMap<>();
reviveParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(reviveParam, BasicConfig.ANCHOR_revive);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(reviveParam, BasicConfig.ANCHOR_revive, "第2轮复活失败", response.body().asString()));
}
@Test(description = "第2轮复活提交答题", priority = 22)
public void 2轮复活提交答题() {
visitorAuth9();
Map<String, Object> participateParam = new HashMap<>();
participateParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
participateParam.put("quesConfId",this.quesId.get(1).getQuesId());
participateParam.put("optionId",this.rightAnswer.getId());
participateParam.put("submitType",3);//1正常答题2放弃答题3补答
Response response = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(participateParam, BasicConfig.ANCHOR_participate, "第2轮提交答题失败", response.body().asString()));
}
@Test(description = "第2轮复活答题结果", priority = 23)
public void 2轮复活答题结果() {
visitorAuth9();
ThreadSleepUtils.sleep(5000);
Map<String, Object> ResultParam = new HashMap<>();
ResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
ResultParam.put("quesId",this.quesId.get(1).getQuesId());
Response response = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
boolean result =response.jsonPath().getBoolean("data.result");
Assert.assertTrue(result, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", response.body().asString()));
long reviveCardCount =response.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount==0, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", response.body().asString()));
}
@Test(description = "获取第2轮题目正确答案", priority = 24)
public void 获取第2轮题目正确答案() {
visitorAuth9();
Map<String, Object> answerParam = new HashMap<>();
answerParam.put("quesId",this.quesId.get(1).getQuesId());
Response response = network.getResponse(answerParam, BasicConfig.ANCHOR_answer);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(answerParam, BasicConfig.ANCHOR_answer, "获取第2轮题目正确答案失败", response.body().asString()));
}
@Test(description = "获取用户第2轮答题列表", priority = 25)
public void 获取用户第2轮答题列表() {
visitorAuth9();
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.ANCHOR_quesRedList);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listParam, BasicConfig.ANCHOR_quesRedList, "获取用户第2轮答题列表", response.body().asString()));
}
@Test(description = "开启第3轮答题", priority = 26)
public void 开启第3轮答题() {
Map<String, Object> openNextParam = new HashMap<>();
openNextParam.put("quesId",this.id.get(2).getId());
openNextParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(openNextParam, BasicConfig.ANCHOR_openNext);
boolean success =response.jsonPath().getBoolean("success");
System.out.println(success);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(openNextParam, BasicConfig.ANCHOR_openNext, "开启第3轮答题失败", response.body().asString()));
}
@Test(description = "获取第3轮问题详情信息", priority = 27)
public void 获取第3轮问题详情信息() {
visitorAuth9();
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("quesId",this.quesId.get(2).getQuesId());
Response response = network.getResponse(detailParam, BasicConfig.ANCHOR_quesRedDetail);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
List<QuestionList.question> quesOptionList = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.quesOptionList")), QuestionList.question.class);
System.out.println(quesOptionList);
Optional<QuestionList.question> wrongAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 2)).findAny();
this.wrongAnswer= wrongAnswerOption.get();
System.out.println(wrongAnswer);
Optional<QuestionList.question> correctAnswerOption = quesOptionList.stream().filter(option -> Objects.equals(option.getOptionType(), 1)).findFirst();
this.rightAnswer=correctAnswerOption.get();
System.out.println(rightAnswer);
Assert.assertNotNull(quesOptionList, network.message(detailParam, BasicConfig.ANCHOR_quesRedDetail, "获取第3轮问题详情信息失败", response.body().asString()));
}
@Test(description = "第3轮提交答题", priority = 28)
public void 3轮提交答题() {
Map<String, Object> participateParam = new HashMap<>();
participateParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
participateParam.put("quesConfId",this.quesId.get(2).getQuesId());
participateParam.put("optionId",this.rightAnswer.getId());
participateParam.put("submitType",1);//1正常答题2放弃答题3补答
visitorAuth9();
Response response = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(participateParam, BasicConfig.ANCHOR_participate, "第3轮提交答题失败", response.body().asString()));
visitorAuth13();
Response participateRes = network.postResponse(participateParam, BasicConfig.ANCHOR_participate);
boolean data1 =participateRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(participateParam, BasicConfig.ANCHOR_participate, "第3轮提交答题失败", participateRes.body().asString()));
}
@Test(description = "第3轮用户答题结果", priority = 29)
public void 3轮用户答题结果() {
ThreadSleepUtils.sleep(5000);
Map<String, Object> ResultParam = new HashMap<>();
ResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
ResultParam.put("quesId",this.quesId.get(2).getQuesId());
visitorAuth9();
Response response = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
boolean result =response.jsonPath().getBoolean("data.result");
Assert.assertTrue(result, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", response.body().asString()));
long reviveCardCount =response.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount==0, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", response.body().asString()));
visitorAuth13();
Response resultRes = network.getResponse(ResultParam, BasicConfig.ANCHOR_participateResult);
Object data1 =resultRes.jsonPath().getJsonObject("data");
System.out.println(data1);
boolean result1 =resultRes.jsonPath().getBoolean("data.result");
Assert.assertTrue(result1, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "当前答题结果错误", resultRes.body().asString()));
long reviveCardCount1 =resultRes.jsonPath().getLong("data.reviveCardCount");
Assert.assertTrue(reviveCardCount1==0, network.message(ResultParam, BasicConfig.ANCHOR_participateResult, "无剩余复活卡数量", resultRes.body().asString()));
}
@Test(description = "获取第3轮题目正确答案", priority = 30)
public void 获取第3轮题目正确答案() {
visitorAuth9();
Map<String, Object> answerParam = new HashMap<>();
answerParam.put("quesId",this.quesId.get(2).getQuesId());
Response response = network.getResponse(answerParam, BasicConfig.ANCHOR_answer);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(answerParam, BasicConfig.ANCHOR_answer, "获取第3轮题目正确答案失败", response.body().asString()));
}
@Test(description = "获取用户第3轮答题列表", priority = 31)
public void 获取用户第3轮答题列表() {
visitorAuth9();
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.ANCHOR_quesRedList);
String data =response.jsonPath().getString("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listParam, BasicConfig.ANCHOR_quesRedList, "获取用户第3轮答题列表", response.body().asString()));
}
@Test(description = "开红包", priority = 32)
public void 开红包() {
ThreadSleepUtils.sleep(100000);
Map<String, Object> openRedParam = new HashMap<>();
openRedParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
visitorAuth9();
Response response = network.postResponse(openRedParam, BasicConfig.ANCHOR_openRed);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(openRedParam, BasicConfig.ANCHOR_openRed, "开红包失败", response.body().asString()));
visitorAuth13();
Response openRedRes = network.postResponse(openRedParam, BasicConfig.ANCHOR_openRed);
boolean data1 =openRedRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(openRedParam, BasicConfig.ANCHOR_openRed, "开红包失败", openRedRes.body().asString()));
}
@Test(description = "红包领取结果", priority = 33)
public void 红包领取结果() {
ThreadSleepUtils.sleep(5000);
Map<String, Object> redResultParam = new HashMap<>();
redResultParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
visitorAuth9();
Response response = network.getResponse(redResultParam, BasicConfig.ANCHOR_redResult);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer status =response.jsonPath().getInt("data.status");
System.out.println(status);
Assert.assertTrue(status==2, network.message(redResultParam, BasicConfig.ANCHOR_redResult, "红包领取失败", response.body().asString()));
int amount =response.jsonPath().getInt("data.amount");
System.out.println(amount);
Assert.assertTrue(amount==30, network.message(redResultParam, BasicConfig.ANCHOR_redResult, "红包领取金额为空", response.body().asString()));
visitorAuth13();
Response resultRes = network.getResponse(redResultParam, BasicConfig.ANCHOR_redResult);
Object data1 =resultRes.jsonPath().getJsonObject("data");
System.out.println(data1);
Integer status1 =resultRes.jsonPath().getInt("data.status");
System.out.println(status1);
Assert.assertTrue(status1==3, network.message(redResultParam, BasicConfig.ANCHOR_redResult, "红包领取失败", resultRes.body().asString()));
int amount1 =resultRes.jsonPath().getInt("data.amount");
System.out.println(amount1);
Assert.assertTrue(amount1==30, network.message(redResultParam, BasicConfig.ANCHOR_redResult, "红包领取金额为空", resultRes.body().asString()));
}
}
...@@ -1768,7 +1768,7 @@ public class SaveLive implements Authorization { ...@@ -1768,7 +1768,7 @@ public class SaveLive implements Authorization {
optionList1.setOptionType(2); optionList1.setOptionType(2);
optionLists.add(optionList1); optionLists.add(optionList1);
Params.put("optionList",optionLists); Params.put("optionList",optionLists);
Params.put("passQuestion","闯关答题配置"); Params.put("passQuestion","闯关答题配置1");
Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateQues); Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateQues);
boolean data =response.jsonPath().getBoolean("data"); boolean data =response.jsonPath().getBoolean("data");
System.out.println(data); System.out.println(data);
...@@ -1776,7 +1776,7 @@ public class SaveLive implements Authorization { ...@@ -1776,7 +1776,7 @@ public class SaveLive implements Authorization {
Map<String, Object> addPassParam = new HashMap<>(); Map<String, Object> addPassParam = new HashMap<>();
addPassParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); addPassParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addPassParam.put("openTime",10); addPassParam.put("openTime",20);
List<PassQues> optionLists1 =new ArrayList<>(); List<PassQues> optionLists1 =new ArrayList<>();
PassQues optionList2 =new PassQues(); PassQues optionList2 =new PassQues();
optionList2.setOptionDetail("正确选项"); optionList2.setOptionDetail("正确选项");
...@@ -1787,13 +1787,50 @@ public class SaveLive implements Authorization { ...@@ -1787,13 +1787,50 @@ public class SaveLive implements Authorization {
optionList3.setOptionType(2); optionList3.setOptionType(2);
optionLists1.add(optionList3); optionLists1.add(optionList3);
addPassParam.put("optionList",optionLists1); addPassParam.put("optionList",optionLists1);
addPassParam.put("passQuestion","闯关答题配置"); addPassParam.put("passQuestion","闯关答题配置2");
Response passRes = network.postResponse(addPassParam, BasicConfig.MANAGER_addOrUpdateQues); Response passRes = network.postResponse(addPassParam, BasicConfig.MANAGER_addOrUpdateQues);
boolean data1 =passRes.jsonPath().getBoolean("data"); boolean data1 =passRes.jsonPath().getBoolean("data");
System.out.println(data1); System.out.println(data1);
Assert.assertTrue(data1, network.message(addPassParam, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", passRes.body().asString())); Assert.assertTrue(data1, network.message(addPassParam, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", passRes.body().asString()));
Map<String, Object> addPassParam1 = new HashMap<>();
addPassParam1.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addPassParam1.put("openTime",30);
List<PassQues> optionLists2 =new ArrayList<>();
PassQues optionList4 =new PassQues();
optionList4.setOptionDetail("正确选项");
optionList4.setOptionType(1);
optionLists2.add(optionList4);
PassQues optionList5 =new PassQues();
optionList5.setOptionDetail("错误选项");
optionList5.setOptionType(2);
optionLists2.add(optionList5);
addPassParam1.put("optionList",optionLists2);
addPassParam1.put("passQuestion","闯关答题配置3");
Response passRes1 = network.postResponse(addPassParam1, BasicConfig.MANAGER_addOrUpdateQues);
boolean data2 =passRes1.jsonPath().getBoolean("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(addPassParam1, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", passRes1.body().asString()));
Map<String, Object> addPassParam2 = new HashMap<>();
addPassParam2.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addPassParam2.put("openTime",40);
List<PassQues> optionLists3 =new ArrayList<>();
PassQues optionList6 =new PassQues();
optionList6.setOptionDetail("正确选项");
optionList6.setOptionType(1);
optionLists3.add(optionList6);
PassQues optionList7 =new PassQues();
optionList7.setOptionDetail("错误选项");
optionList7.setOptionType(2);
optionLists3.add(optionList7);
addPassParam2.put("optionList",optionLists3);
addPassParam2.put("passQuestion","闯关答题配置4");
Response passRes2 = network.postResponse(addPassParam2, BasicConfig.MANAGER_addOrUpdateQues);
boolean data3 =passRes2.jsonPath().getBoolean("data");
System.out.println(data3);
Assert.assertTrue(data3, network.message(addPassParam2, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", passRes2.body().asString()));
} }
...@@ -1826,7 +1863,7 @@ public class SaveLive implements Authorization { ...@@ -1826,7 +1863,7 @@ public class SaveLive implements Authorization {
public void 删除闯关答题配置() { public void 删除闯关答题配置() {
Map<String, Object> Params = new HashMap<>(); Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("quesId", this.quesId.get(1).getId()); Params.put("quesId", this.quesId.get(3).getId());
Response response = network.postResponse(Params, BasicConfig.MANAGER_deleteQues); Response response = network.postResponse(Params, BasicConfig.MANAGER_deleteQues);
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
System.out.println(data); System.out.println(data);
...@@ -1849,9 +1886,9 @@ public class SaveLive implements Authorization { ...@@ -1849,9 +1886,9 @@ public class SaveLive implements Authorization {
public void 新增闯关红包配置() { public void 新增闯关红包配置() {
Map<String, Object> Params = new HashMap<>(); Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("amount",1000); Params.put("amount",30);
Params.put("carveTime",1); Params.put("carveTime",1);
Params.put("showAmount",1000); Params.put("showAmount",30);
Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateConf); Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateConf);
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
System.out.println(data); System.out.println(data);
......
...@@ -58,7 +58,10 @@ public class BasicConfig { ...@@ -58,7 +58,10 @@ public class BasicConfig {
public static String visitorAuth21 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oX4LYmRiH4EYLayw7oTtnaZ4YpLUcVaMTnAUuz5jSPcnRQgDm7R2XRS6AQgJqtta"; public static String visitorAuth21 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oX4LYmRiH4EYLayw7oTtnaZ4YpLUcVaMTnAUuz5jSPcnRQgDm7R2XRS6AQgJqtta";
//直播访客 (zzz666)ID:849 //直播访客 (zzz666)ID:849
public static String visitorAuth22 ="LEH7epeHVDJWzhZ6DiexTHnsaMYwdGZ6gcwfZgyDxbCXekMNKoXXNy7hieT2Bt6KwShiHYjnNViCm9EmjvN1msbTomJta"; public static String visitorAuth22 ="LEH7epeHVDJWzhZ6DiexTHnsaMYwdGZ6gcwfZgyDxbCXekMNKoXXNy7hieT2Bt6KwShiHYjnNViCm9EmjvN1msbTomJta";
//直播访客 (七凉)ID:179
public static String visitorAuth23 ="LEH7epeHVDJWzhZ6DiexTHnsaRU4euCKXGmUiCDXuHaG6DznL4Mfk9SGwWCnwMvA6urFmXu4Qe9sCCcXMdojZMU4xN39V";
//直播访客 (奶汪)ID:1170 实名用户
public static String visitorAuth24 ="2Tsc8MwHZmXJKPfze38rXm37UEX1EtfvfjxjLr1GZDVAdRXD3hSK2j6WjZQgFaqHHJcT5yk3tB64Ebu38fmuJymWQtPcAdr";
//*********************************************************************** //***********************************************************************
// 基础线代理人 TKU,sid:2991 // 基础线代理人 TKU,sid:2991
...@@ -99,6 +102,22 @@ public class BasicConfig { ...@@ -99,6 +102,22 @@ public class BasicConfig {
public static final String MANAGER_redConfInfo = MANAGER_HOST + "/kjy/manager/pass/ques/redConfInfo"; public static final String MANAGER_redConfInfo = MANAGER_HOST + "/kjy/manager/pass/ques/redConfInfo";
public static final String MANAGER_switchOpen = MANAGER_HOST + "/kjy/manager/pass/ques/switchOpen"; public static final String MANAGER_switchOpen = MANAGER_HOST + "/kjy/manager/pass/ques/switchOpen";
public static final String ANCHOR_quesRedConf = MOBILE_HOST + "/clue/pass/ques/red/conf";
public static final String ANCHOR_quesRedDetail = MOBILE_HOST + "/clue/pass/ques/red/detail";
public static final String ANCHOR_participate = MOBILE_HOST + "/clue/pass/ques/red/participate";
public static final String ANCHOR_participateResult = MOBILE_HOST + "/clue/pass/ques/red/participateResult";
public static final String ANCHOR_answer = MOBILE_HOST + "/clue/pass/ques/red/answer";
public static final String ANCHOR_quesRedList = MOBILE_HOST + "/clue/pass/ques/red/list";
public static final String ANCHOR_revive = MOBILE_HOST + "/clue/pass/ques/red/revive";
public static final String ANCHOR_openRed = MOBILE_HOST + "/clue/pass/ques/red/openRed";
public static final String ANCHOR_redResult= MOBILE_HOST + "/clue/pass/ques/red/redResult";
public static final String ANCHOR_confInfo= MOBILE_HOST + "/conf/live/pass/ques/confInfo";
public static final String ANCHOR_quesList= MOBILE_HOST + "/conf/live/pass/ques/quesList";
public static final String ANCHOR_updateQues= MOBILE_HOST + "/conf/live/pass/ques/updateQues";
public static final String ANCHOR_openNext= MOBILE_HOST + "/conf/live/pass/ques/openNext";
public static final String ANCHOR_quesInfo= MOBILE_HOST + "/conf/live/pass/ques/quesInfo";
// *************** 看直播攒现金红包 *************** // *************** 看直播攒现金红包 ***************
public static final String MANAGER_timeRed = MANAGER_HOST + "/kjy/manager/live/time/red/saveOrUpdateFirst"; public static final String MANAGER_timeRed = MANAGER_HOST + "/kjy/manager/live/time/red/saveOrUpdateFirst";
......
...@@ -114,6 +114,13 @@ ...@@ -114,6 +114,13 @@
</classes> </classes>
</test> </test>
<test preserve-order="true" name="闯关答题">
<classes>
<class name="com.kjj.cases.live.answer.passQues"/>
</classes>
</test>
<test preserve-order="true" name="看直播攒现金"> <test preserve-order="true" name="看直播攒现金">
<classes> <classes>
<class name="com.kjj.cases.live.treasure.TimeRed"/> <class name="com.kjj.cases.live.treasure.TimeRed"/>
......
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