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

新增猜数字红包

parent 32c5dced
......@@ -6,6 +6,6 @@ import java.util.List;
@Data
public class SpokeList {
private String now;
private long now;
private List<Vo> vo;
}
......@@ -6,6 +6,6 @@ import java.util.List;
@Data
public class Vo {
private String time;
private long time;
private List<VoList> list;
}
......@@ -9,6 +9,7 @@ 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;
......@@ -89,7 +90,7 @@ public class Question implements AdminAuthorization {
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("questionIds", questionIds);
params.put("questionId", questionId);
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");
......@@ -118,11 +119,11 @@ public class Question implements AdminAuthorization {
{
agentAuth();
Map<String, Object> params = new HashMap<>();
params.put("questionIds", questionIds);
params.put("questionId", questionId);
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);
System.out.println(System.currentTimeMillis() + "," + data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AskQuestion, "代理端发起问题失败", response.body().asString()));
}
......@@ -179,20 +180,22 @@ public class Question implements AdminAuthorization {
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ClueNotice, "代理人端公告查询失败", response.body().asString()));
}
public String time;
public long time;
//***************评论***************//
//助播端历史评论200条
@Test(description = "助播端历史评论200条", priority = 12)
public void 助播端查询历史评论()
{
ThreadSleepUtils.sleep(5000);
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_SpokeAdmin);
SpokeList list= JsonUtil.parseResponseToBean1(response, SpokeList.class);
time=list.getVo().get(0).getTime();
System.out.println(response.body().asString());
SpokeList list= JsonUtil.parseResponseToBeanTT(response, SpokeList.class);
time=list.getNow();
System.out.println(time);
System.out.println(list);
System.out.println(System.currentTimeMillis() + "," + JSON.toJSONString(list));
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeAdmin, "助播端评论查询失败", response.body().asString()));
}
......@@ -205,7 +208,7 @@ public class Question implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("time", time);
Response response = network.getResponse(params, BasicConfig.MOBILE_SpokeList);
Spolist list= JsonUtil.parseResponseToBean1(response, Spolist.class);
Spolist list= JsonUtil.parseResponseToBeanTT(response, Spolist.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeList, "助播端评论区实时评论查询失败", response.body().asString()));
}
......@@ -218,7 +221,7 @@ public class Question implements AdminAuthorization {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_SpokeHistoryList);
SpokeList list= JsonUtil.parseResponseToBean1(response, SpokeList.class);
SpokeList list= JsonUtil.parseResponseToBeanTT(response, SpokeList.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeHistoryList, "访客端评论区历史评论失败", response.body().asString()));
}
......@@ -245,7 +248,7 @@ public class Question implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("time", time);
Response response = network.getResponse(params, BasicConfig.MOBILE_SpokeList);
Spolist list= JsonUtil.parseResponseToBean1(response, Spolist.class);
Spolist list= JsonUtil.parseResponseToBeanTT(response, Spolist.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeList, "直播间访客查询实时评论失败", response.body().asString()));
}
......@@ -258,7 +261,7 @@ public class Question implements AdminAuthorization {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_SpokeHistoryList);
SpokeList list= JsonUtil.parseResponseToBean1(response, SpokeList.class);
SpokeList list= JsonUtil.parseResponseToBeanTT(response, SpokeList.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeHistoryList, "代理端评论区历史评论失败", response.body().asString()));
}
......@@ -285,7 +288,7 @@ public class Question implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("time", time);
Response response = network.getResponse(params, BasicConfig.MOBILE_SpokeList);
Spolist list= JsonUtil.parseResponseToBean1(response, Spolist.class);
Spolist list= JsonUtil.parseResponseToBeanTT(response, Spolist.class);
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_SpokeList, "直播间访客查询实时评论失败", response.body().asString()));
}
......
......@@ -1089,6 +1089,7 @@ public class Treasure implements AdminAuthorization {
ThreadSleepUtils.sleep(3000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
visitorAuth13();
infoParam.put("openTimes", 2);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
......
......@@ -15,6 +15,12 @@ public class JsonUtil {
private JsonUtil() {
}
public static <T> T parseResponseToBeanTT(Response response, Class<T> tClass) {
Object data = response.jsonPath().getJsonObject("d");
String str = new JsonBuilder(data).toString();
return JSON.parseObject(str, tClass);
}
/**
* 将响应转换成对象
* @param response
......@@ -56,10 +62,4 @@ public class JsonUtil {
return JSON.parseArray(str, tClass);
}
public static <T> T parseResponseToBean1(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("date");
String str = new JsonBuilder(data).toString();
return JSON.parseObject(str, tClass);
}
}
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