Commit 5d0aa5da authored by 别湘灵's avatar 别湘灵

代理人首页

parent 9c33f7aa
......@@ -6,6 +6,7 @@ import com.kjj.bean.answer.*;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
......@@ -18,6 +19,8 @@ import java.util.Map;
public class QuestionAwards implements AdminAuthorization{
public String confId_ques;
public String confId_reward;
public String wronganswer;
public String rightanswer;
......@@ -30,6 +33,16 @@ public class QuestionAwards implements AdminAuthorization{
return null;
}
private QuseRewardList.QuesList getaward(List<QuseRewardList.QuesList> lists){
for (QuseRewardList.QuesList quesaward : lists) {
if (quesaward.getRewardStatus()==0 && quesaward.getQuesType()==2){
return quesaward;
}
}
return null;
}
private RewardDetail.QuestionLists getwrongques(List<RewardDetail.QuestionLists> list){
for (RewardDetail.QuestionLists ques1 : list) {
if (ques1.getOptionType()==2){
......@@ -48,23 +61,21 @@ public class QuestionAwards implements AdminAuthorization{
return null;
}
/*主播端添加有奖答题-现金红包*/
@Test(description = "主播端添加有奖答题现金红包", priority = 1)
public void 主播端添加有奖答题现金红包()
/*主播端添加有奖答题-奖品奖励*/
@Test(description = "主播端添加有奖答题奖品奖励", priority = 2)
public void 主播端添加有奖答题奖品奖励()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("quesType","1");
params.put("quesType","2");
AddAnswer RedDetail = new AddAnswer();
RedDetail.setTotalAmount(100);
RedDetail.setShowAmount(100);
RedDetail.setTotalNum(3);
params.put("redDetail",RedDetail);
WelfareDetail welfareDetail = new WelfareDetail();
welfareDetail.setRewardId("Kj22MTU0Mw");
welfareDetail.setRewardNum("2");
params.put("welfareDetail",welfareDetail);
QuesConf quesConf=new QuesConf();
quesConf.setQuestionDetail("问题");
quesConf.setQuestionDetail("盲盒锦鲤奖品");
List<Option> optionlist=new ArrayList<>();
quesConf.setOptionList(optionlist);
......@@ -75,9 +86,9 @@ public class QuestionAwards implements AdminAuthorization{
optionlist.add(option1);
Option option2=new Option();
option2.setOptionDetail("错误");
option2.setOptionDetail("错误1");
option2.setOptionType(2);
option2.setAnswerLen(2);
option2.setAnswerLen(3);
optionlist.add(option2);
params.put("questionConf",quesConf);
......@@ -90,22 +101,22 @@ public class QuestionAwards implements AdminAuthorization{
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesSaveOrUpdate, "主播端添加有奖答题现金红包失败", response.body().asString()));
}
/*主播端添加有奖答题-奖品奖励*/
@Test(description = "主播端添加有奖答题奖品奖励", priority = 2)
public void 主播端添加有奖答题奖品奖励()
/*主播端添加有奖答题-现金红包*/
@Test(description = "主播端添加有奖答题现金红包", priority = 1)
public void 主播端添加有奖答题现金红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("quesType","2");
params.put("quesType","1");
WelfareDetail welfareDetail = new WelfareDetail();
welfareDetail.setRewardId("Kj22MTU0Mw");
welfareDetail.setRewardNum("2");
params.put("welfareDetail",welfareDetail);
AddAnswer RedDetail = new AddAnswer();
RedDetail.setTotalAmount(100);
RedDetail.setShowAmount(100);
RedDetail.setTotalNum(3);
params.put("redDetail",RedDetail);
QuesConf quesConf=new QuesConf();
quesConf.setQuestionDetail("盲盒锦鲤奖品");
quesConf.setQuestionDetail("问题");
List<Option> optionlist=new ArrayList<>();
quesConf.setOptionList(optionlist);
......@@ -116,14 +127,14 @@ public class QuestionAwards implements AdminAuthorization{
optionlist.add(option1);
Option option2=new Option();
option2.setOptionDetail("错误1");
option2.setOptionDetail("错误");
option2.setOptionType(2);
option2.setAnswerLen(3);
option2.setAnswerLen(2);
optionlist.add(option2);
params.put("questionConf",quesConf);
params.put("confId","");
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
System.out.println("params = "+JSON.toJSONString(params));
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesSaveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
......@@ -131,8 +142,6 @@ public class QuestionAwards implements AdminAuthorization{
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesSaveOrUpdate, "主播端添加有奖答题现金红包失败", response.body().asString()));
}
/*查询主播端有奖答题列表*/
@Test(description = "查询主播端有奖答题列表", priority = 3)
public void 主播端有奖答题列表()
......@@ -273,7 +282,136 @@ public class QuestionAwards implements AdminAuthorization{
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString()));
}
//*****************有奖答题福利类型*****************//
//*****************有奖答题福利类型*****************//
//*****************有奖答题福利类型*****************//
/*查询主播端有奖答题列表*/
@Test(description = "再次查询主播端有奖答题列表", priority = 12)
public void 再次查询主播端有奖答题列表()
{
ThreadSleepUtils.sleep(70000);
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex", 1);
params.put("pageSize", 50);
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesRewardList);
QuseRewardList Beans=JsonUtil.parseResponseToBean(response, QuseRewardList.class);
QuseRewardList.QuesList notPublishQues=getaward(Beans.getList());
confId_ques=notPublishQues.getQuesConfId();
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesRewardList, "查询主播端有奖答题列表失败", response.body().asString()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test(description = "上架答题为福利", priority = 13)
public void 上架答题为福利()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_ques);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardUp);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardUp, "上架答题红包失败", response.body().asString()));
}
/*主播端发放福利类型的有奖答题*/
@Test(description = "主播端发放福利类型的有奖答题", priority = 14)
public void 主播端发放福利类型的有奖答题()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_ques);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesRewardStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuesRewardStart, "发放答题红包失败", response.body().asString()));
}
/*查询访客端有奖答题配置详情*/
@Test(description = "查询访客端有奖答题-福利类型的配置详情", priority = 15)
public void 查询访客端有奖答题福利类型配置详情()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesDetail);
RewardDetail Beans=JsonUtil.parseResponseToBean(response, RewardDetail.class);
confId_reward=Beans.getQuesConfId();
RewardDetail.QuestionLists WrongAnswer=getwrongques(Beans.getQuestionList());
wronganswer=WrongAnswer.getId();
RewardDetail.QuestionLists RightAnswer=getrightques(Beans.getQuestionList());
rightanswer =RightAnswer.getId();
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesDetail, "查询访客端有奖答题配置详情失败", response.body().asString()));
}
/*领取有奖答题福利类型-错误选项*/
@Test(description = "领取有奖答题福利类型-错误选项", priority = 16)
public void 领取有奖答题福利类型选择错误()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", confId_reward);
params.put("optionId", wronganswer);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
AnswerQues Beans=JsonUtil.parseResponseToBean(response, AnswerQues.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
/*领取有奖答题福利类型-选择正确选项*/
@Test(description = "领取有奖答题福利类型-答题正确", priority = 17)
public void 领取有奖答题福利类型()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId", confId_reward);
params.put("optionId", rightanswer);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
AnswerQues Beans=JsonUtil.parseResponseToBean(response, AnswerQues.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
/*代理人领取有奖答题福利类型*/
@Test(description = "代理人领取有奖答题福利类型", priority = 18)
public void 代理人领取有奖答题福利类型()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",confId_reward );
params.put("optionId", rightanswer);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
AnswerQues Beans=JsonUtil.parseResponseToBean(response, AnswerQues.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesParticipate, "领取答题红包失败", response.body().asString()));
}
/*领取有奖答题福利类型结果*/
@Test(description = "领取有奖答题福利类型结果", priority = 19)
public void 领取有奖答题福利类型结果()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",confId_reward );
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
ParticipateInfo Beans=JsonUtil.parseResponseToBean(response, ParticipateInfo.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "查询答题红包结果失败", response.body().asString()));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment