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

代理人首页

parent f696cd5d
package com.kjj.bean.issue;
import lombok.Data;
@Data
public class HistoryList {
}
package com.kjj.bean.issue;
import lombok.Data;
@Data
public class LastList {
private String id;
private String question;
private String askNum;
}
package com.kjj.bean.issue;
import lombok.Data;
import java.util.List;
@Data
public class QuestionList {
private List<HistoryList> historyList;
private List<LastList> lastList;
}
package com.kjj.bean.issue;
import lombok.Data;
@Data
public class issuelist {
private String id;
private String question;
private String askNum;
}
package com.kjj.cases.live.question;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.issue.QuestionList;
import com.kjj.bean.issue.issuelist;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
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 Question implements AdminAuthorization {
List<String> questionIds = new ArrayList<>();
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", "测试问题六");
Response response = network.postResponse(params, BasicConfig.MOBILE_QuestionAdd);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuestionAdd, "助播端添加问题失败", 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_QuestionList);
List<issuelist> list= JsonUtil.parseResponseToListBean(response, issuelist.class);
list.forEach(issue -> questionIds.add(issue.getId()));
System.out.println(questionIds);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuestionList, "助播端查询问题列表失败", 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("questionIds", questionIds);
Response response = network.postResponse(params, BasicConfig.MOBILE_QuestionSend);
System.out.println("params = "+ JSON.toJSONString(params));
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_QuestionSend, "助播端上架问题失败", response.body().asString()));
}
//访客端
/*访客端查询问题列表*/
@Test(description = "访客端查询问题列表", priority = 4)
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_QuesClueList);
QuestionList list= JsonUtil.parseResponseToBean(response, QuestionList.class);
questionId=list.getLastList().get(0).getId();
System.out.println(questionIds);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesClueList, "助播端查询问题列表失败", response.body().asString()));
}
@Test(description = "访客端发起问题", priority = 5)
public void 访客端发起问题()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("questionIds", questionIds);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params, BasicConfig.MOBILE_AskQuestion);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AskQuestion, "访客端发起问题失败", response.body().asString()));
}
//代理端
/*代理端查询问题列表*/
@Test(description = "代理端查询问题列表", priority = 6)
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_QuesClueList);
QuestionList list= JsonUtil.parseResponseToBean(response, QuestionList.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_QuesClueList, "助播端查询问题列表失败", response.body().asString()));
}
@Test(description = "代理端发起问题", priority = 7)
public void 代理端发起问题()
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("questionIds", questionIds);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params, BasicConfig.MOBILE_AskQuestion);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AskQuestion, "代理端发起问题失败", response.body().asString()));
}
@Test(description = "助播端发送公告", priority = 8)
public void 助播端发送公告()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("content", "上架公告");
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params, BasicConfig.MOBILE_LiveNotice);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_LiveNotice, "助播端发送公告失败", response.body().asString()));
}
@Test(description = "助播端公告查询", priority = 9)
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_LiveNotice);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ClueNotice, "助播端公告查询失败", response.body().asString()));
}
@Test(description = "访客端公告查询", priority = 10)
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_ClueNotice);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ClueNotice, "访客端公告查询失败", response.body().asString()));
}
@Test(description = "代理人端公告查询", priority = 11)
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_ClueNotice);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ClueNotice, "代理人端公告查询失败", response.body().asString()));
}
}
...@@ -183,6 +183,17 @@ public class BasicConfig { ...@@ -183,6 +183,17 @@ public class BasicConfig {
public static final String MOBILE_SubmitAnswer = MOBILE_HOST + "/clue/choice/submitAnswer"; 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_AnswerNum = MOBILE_HOST + "/clue/choice/answerNum";
//问题
public static final String MOBILE_QuestionAdd = MOBILE_HOST + "/conf/live/question/addQuestion";
public static final String MOBILE_QuestionList = MOBILE_HOST + "/conf/live/question/list";
public static final String MOBILE_QuestionSend = MOBILE_HOST + "/conf/live/question/send";
public static final String MOBILE_QuesClueList = MOBILE_HOST + "/clue/question/list";
public static final String MOBILE_AskQuestion = MOBILE_HOST + "/kjy/live/user/askQuestion";
public static final String MOBILE_LiveNotice = MOBILE_HOST + "/conf/live/info/notice";
public static final String MOBILE_ClueNotice = MOBILE_HOST + "/clue/info/notice";
//红包// //红包//
public static final String MOBILE_AnchorRedList = MOBILE_HOST + "/conf/live/red/findRedList"; public static final String MOBILE_AnchorRedList = MOBILE_HOST + "/conf/live/red/findRedList";
public static final String MOBILE_FindRedList = MOBILE_HOST + "/clue/red/findRedList"; public static final String MOBILE_FindRedList = MOBILE_HOST + "/clue/red/findRedList";
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<classes> <classes>
<class name="com.kjj.cases.live.anchor.OpenLive"/> <class name="com.kjj.cases.live.anchor.OpenLive"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="直播中抽奖"> <test preserve-order="true" name="直播中抽奖">
<classes> <classes>
<class name="com.kjj.cases.live.lottery.Lottery"/> <class name="com.kjj.cases.live.lottery.Lottery"/>
...@@ -89,6 +89,11 @@ ...@@ -89,6 +89,11 @@
<class name="com.kjj.cases.live.choice.Choice"/> <class name="com.kjj.cases.live.choice.Choice"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="问题">
<classes>
<class name="com.kjj.cases.live.question.Question"/>
</classes>
</test>
<test preserve-order="true" name="助播-结束直播"> <test preserve-order="true" name="助播-结束直播">
<classes> <classes>
<class name="com.kjj.cases.live.anchor.CloseLive"/> <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