Commit b4a0dc18 authored by 别湘灵's avatar 别湘灵

代理人首页

parent 1e29d713
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class Ansernum {
private String answerId;
private int num;
}
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class AnswerList {
private String answer;
private int num;
private String resourceTitle;
}
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class AnswerVosList {
private String id;
private String answer;
private String relationResourcePushVo;
}
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class ChoiceList {
private String answer;
private String relationResourceId;
}
package com.kjj.bean.choice;
import lombok.Data;
import java.util.List;
@Data
public class GetChoiceArray {
private String id;
private String question;
private List<AnswerList> answerList;
private String resourceTitleList;
}
\ No newline at end of file
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class GetChoiceList {
private GetChoiceArray list;
private boolean hasNext;
}
package com.kjj.bean.choice;
import lombok.Data;
import java.util.List;
@Data
public class GetChoiceQues {
private QuestionVo questionVo;
private List<AnswerVosList> answerVos;
}
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class QuestionVo {
private String id;
private String question;
}
package com.kjj.bean.choice;
import lombok.Data;
@Data
public class answer {
private String answer;
private int num;
private String resourceTitle;
}
package com.kjj.cases.live.choice;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.choice.Ansernum;
import com.kjj.bean.choice.ChoiceList;
import com.kjj.bean.choice.GetChoiceArray;
import com.kjj.bean.choice.GetChoiceQues;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Choice implements AdminAuthorization {
public String id;
public String answerid;
public String questionid;
//************助播端************//
/*助播端添加投票*/
@Test(description = "助播端添加投票", priority = 1)
public void 助播端添加投票()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("question", "投票问题");
List<ChoiceList> choicelist=new ArrayList<>();
ChoiceList list=new ChoiceList();
list.setAnswer("答案一");
list.setRelationResourceId("");
choicelist.add(list);
ChoiceList list1=new ChoiceList();
list1.setAnswer("答案二");
list1.setRelationResourceId("");
choicelist.add(list1);
params.put("answerList", choicelist);
System.out.println("params = "+ JSON.toJSONString(params));
Response response = network.postResponse(params, BasicConfig.MOBILE_AddChoice);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AddChoice, "主播端添加投票失败", response.body().asString()));
}
/*助播端获取投票详情*/
@Test(description = "助播端获取投票详情", priority = 2)
public void 助播端获取投票详情()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_ChoiceCurrentDetail);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ChoiceCurrentDetail, "助播端获取投票详情失败", response.body().asString()));
}
/*助播端获取投票列表*/
@Test(description = "助播端获取投票列表", priority = 3)
public void 助播端获取投票列表()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageSize", 30);
params.put("pageIndex", 1);
Response response = network.getResponse(params, BasicConfig.MOBILE_ChoiceGetList);
List<GetChoiceArray> getchoicelist= JsonUtil.parseResponseToPageBean(response, GetChoiceArray.class);
GetChoiceArray one=getchoicelist.get(0);
id=one.getId();
System.out.println(id);
System.out.println(getchoicelist);
Assert.assertNotNull(getchoicelist, network.message(params, BasicConfig.MOBILE_ChoiceGetList, "助播端获取投票详情失败", response.body().asString()));
}
/*助播端上架*/
@Test(description = "助播端上架投票", priority = 4)
public void 助播端上架投票()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("id", id);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params, BasicConfig.MOBILE_ChoiceSend);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ChoiceSend, "助播端上架投票失败", response.body().asString()));
}
//访客端
/*访客端获取正在答题中的选择题*/
@Test(description = "访客端获取正在答题中的选择题", priority = 5)
public void 访客端获取正在答题中的选择题()
{
ThreadSleepUtils.sleep(5000);
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_GetChoiceQuestion);
GetChoiceQues data=JsonUtil.parseResponseToBean(response, GetChoiceQues.class);
questionid=data.getQuestionVo().getId();
answerid=data.getAnswerVos().get(0).getId();
System.out.println(questionid);
System.out.println(answerid);
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_GetChoiceQuestion, "访客端获取正在答题中的选择题失败", response.body().asString()));
}
/*访客端提交答案*/
@Test(description = "访客端提交答案", priority = 6)
public void 访客端提交答案()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("answerId", answerid);
params.put("questionId", questionid);
Response response = network.postResponse(params, BasicConfig.MOBILE_SubmitAnswer);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_SubmitAnswer, "访客端提交答案失败", response.body().asString()));
}
/*访客端获取答案的数量*/
@Test(description = "访客端获取答案的数量", priority = 7)
public void 访客端获取答案的数量()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("questionId", questionid);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_AnswerNum);
List<Ansernum> data=JsonUtil.parseResponseToListBean(response, Ansernum.class);
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AnswerNum, "访客端获取答案的数量失败", response.body().asString()));
}
//代理人端
/*代理人端获取正在答题中的选择题*/
@Test(description = "代理人端获取正在答题中的选择题", priority = 8)
public void 代理人端获取正在答题中的选择题()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_GetChoiceQuestion);
GetChoiceQues data=JsonUtil.parseResponseToBean(response, GetChoiceQues.class);
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_GetChoiceQuestion, "代理人端获取正在答题中的选择题失败", response.body().asString()));
}
/*代理人端提交答案*/
@Test(description = "代理人端提交答案", priority = 9)
public void 代理人端提交答案()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("answerId", answerid);
params.put("questionId", questionid);
Response response = network.postResponse(params, BasicConfig.MOBILE_SubmitAnswer);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_SubmitAnswer, "代理人端提交答案失败", response.body().asString()));
}
/*代理人端获取答案的数量*/
@Test(description = "代理人端获取答案的数量", priority = 10)
public void 代理人端获取答案的数量()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("questionId", questionid);
Response response = network.getResponse(params, BasicConfig.MOBILE_AnswerNum);
List<Ansernum> data=JsonUtil.parseResponseToListBean(response, Ansernum.class);
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AnswerNum, "代理人端获取答案的数量失败", response.body().asString()));
}
/*助播端下架投票*/
@Test(description = "助播端下架投票", priority = 11)
public void 助播端下架投票()
{
ThreadSleepUtils.sleep(5000);
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("id", id);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params, BasicConfig.MOBILE_ChoiceClose);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ChoiceClose, "助播端下架投票失败", response.body().asString()));
}
}
......@@ -141,7 +141,6 @@ public class BasicConfig {
public static final String MOBILE_MyCustomerList = MOBILE_HOST + "/kjy/live/agent/clue/myCustomerList";
public static final String MOBILE_RewardAgentList = MOBILE_HOST + "/kjy/live/reward/agent/list";
//查询资料列表//
public static final String MOBILE_Resource = MOBILE_HOST + "/clue/resource/list";
public static final String MOBILE_ResourceOn = MOBILE_HOST + "/conf/live/push/on";
......@@ -164,14 +163,15 @@ public class BasicConfig {
public static final String MOBILE_Code = MOBILE_HOST + "/clue/invitation/code";
public static final String MOBILE_MyLotteryCode = MOBILE_HOST + "/kjy/live/lottery/myLotteryCode";
//投票
public static final String MOBILE_ChoiceCurrentDetail = MOBILE_HOST + "/conf/live/choice/currentDetail";
public static final String MOBILE_AddChoice = MOBILE_HOST + "/conf/live/choice/addChoice";
public static final String MOBILE_ChoiceGetList = MOBILE_HOST + "/conf/live/choice/getList";
public static final String MOBILE_ChoiceSend = MOBILE_HOST + "/conf/live/choice/send";
public static final String MOBILE_ChoiceClose = MOBILE_HOST + "/conf/live/choice/close";
public static final String MOBILE_GetChoiceQuestion = MOBILE_HOST + "/clue/choice/getChoiceQuestion";
public static final String MOBILE_SubmitAnswer = MOBILE_HOST + "/clue/choice/submitAnswer";
public static final String MOBILE_AnswerNum = MOBILE_HOST + "/clue/choice/answerNum";
//红包//
public static final String MOBILE_AnchorRedList = MOBILE_HOST + "/conf/live/red/findRedList";
......
......@@ -84,6 +84,11 @@
<class name="com.kjj.cases.live.red.QuestionAwards"/>
</classes>
</test>
<test preserve-order="true" name="投票">
<classes>
<class name="com.kjj.cases.live.choice.Choice"/>
</classes>
</test>
<test preserve-order="true" name="助播-结束直播">
<classes>
<class name="com.kjj.cases.live.anchor.CloseLive"/>
......
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