Commit 32c5dced authored by 张艳玲's avatar 张艳玲

新增猜数字红包

parent 8145f868
package com.kjj.bean.lottery;
import lombok.Data;
@Data
public class CondDetail {
public class CondDetail {
//宝箱id
private String treasureConfId;
//奖品领取状态
private boolean finishFlag;
public String getTreasureConfId() {
return treasureConfId;
}
public void setTreasureConfId(String treasureConfId) {
this.treasureConfId = treasureConfId;
}
/**
* 获取是否完成标记
* @return 是否完成标记
*/
public boolean isFinishFlag() {
return finishFlag;
}
public void setFinishFlag(boolean finishFlag) {
this.finishFlag = finishFlag;
}
}
......@@ -54,9 +54,9 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("treasureConfId",this.treasureConfId.get(0).getTreasureConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_finish);
Object data=response.jsonPath().getJsonObject("data");
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response.body().asString()));
}
......@@ -67,9 +67,10 @@ public class TreasureTime 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_joinDetail1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第1个宝箱参与情况失败", response.body().asString()));
List<CondDetail> treasureList = JsonUtil.parseResponseToListBean(response, CondDetail.class,"condDetail");
boolean finishFlag=treasureList.get(0).isFinishFlag();
System.out.println(finishFlag);
Assert.assertTrue(finishFlag, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第1个宝箱参与情况失败", response.body().asString()));
}
......@@ -81,9 +82,9 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("treasureConfId",this.treasureConfId.get(0).getTreasureConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data=response.jsonPath().getJsonObject("data");
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H开启第1个宝箱失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H开启第1个宝箱失败", response.body().asString()));
}
......@@ -95,9 +96,13 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("treasureConfId",this.treasureConfId.get(0).getTreasureConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_joinResult);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinResult, "访客H查询第1个宝箱中奖结果失败", response.body().asString()));
Integer treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==1, network.message(params, BasicConfig.MOBILE_joinResult, "中奖结果非抽奖码类型", response.body().asString()));
Integer receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(params, BasicConfig.MOBILE_joinResult, "领取失败", response.body().asString()));
}
......@@ -111,29 +116,27 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(1).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.postResponse(params, BasicConfig.MOBILE_finish);
Object data=response.jsonPath().getJsonObject("data");
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response.body().asString()));
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Response response1 = network.postResponse(params, BasicConfig.MOBILE_finish);
Object data1=response1.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data1, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response1.body().asString()));
boolean data1=response.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response1.body().asString()));
//红包发完降级抽奖码
visitorAuth13();
ThreadSleepUtils.sleep(1000);
Response response2 = network.postResponse(params, BasicConfig.MOBILE_finish);
Object data2=response2.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data2, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response2.body().asString()));
boolean data2=response.jsonPath().getBoolean("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response2.body().asString()));
}
......@@ -144,27 +147,30 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response.body().asString()));
List<CondDetail> treasureList = JsonUtil.parseResponseToListBean(response, CondDetail.class,"condDetail");
boolean finishFlag=treasureList.get(1).isFinishFlag();
System.out.println(finishFlag);
Assert.assertTrue(finishFlag, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第2个宝箱参与情况失败", response.body().asString()));
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Response response1 = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data1=response1.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data1, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response1.body().asString()));
List<CondDetail> treasureList1 = JsonUtil.parseResponseToListBean(response1, CondDetail.class,"condDetail");
boolean finishFlag1=treasureList1.get(1).isFinishFlag();
System.out.println(finishFlag1);
Assert.assertTrue(finishFlag1, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第2个宝箱参与情况失败", response.body().asString()));
//红包发完降级抽奖码
visitorAuth13();
ThreadSleepUtils.sleep(1000);
Response response2 = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data2=response2.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data2, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response2.body().asString()));
List<CondDetail> treasureList2 = JsonUtil.parseResponseToListBean(response2, CondDetail.class,"condDetail");
boolean finishFlag2=treasureList2.get(1).isFinishFlag();
System.out.println(finishFlag2);
Assert.assertTrue(finishFlag2, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第2个宝箱参与情况失败", response.body().asString()));
}
......@@ -176,27 +182,27 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(1).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data=response.jsonPath().getJsonObject("data");
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response.body().asString()));
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Response response1 = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data1=response1.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data1, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response1.body().asString()));
boolean data1=response1.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response1.body().asString()));
//红包发完降级抽奖码
visitorAuth13();
ThreadSleepUtils.sleep(1000);
Response response2 = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data2=response2.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data2, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response2.body().asString()));
boolean data2=response2.jsonPath().getBoolean("data");
System.out.println(data2);
Assert.assertTrue(data2, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response2.body().asString()));
}
......@@ -208,9 +214,10 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(1).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.getResponse(params, BasicConfig.MOBILE_joinResult);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinResult, "访客H获取宝箱参与情况失败", response.body().asString()));
......@@ -242,7 +249,7 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(2).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.postResponse(params, BasicConfig.MOBILE_finish);
Object data=response.jsonPath().getJsonObject("data");
......@@ -256,7 +263,7 @@ public class TreasureTime implements AdminAuthorization {
System.out.println(data);
Assert.assertNotNull(data1, network.message(params, BasicConfig.MOBILE_finish, "访客H获取宝箱参与情况失败", response1.body().asString()));
//红包发完降级抽奖码
//实物发完降级抽奖码
visitorAuth13();
ThreadSleepUtils.sleep(1000);
Response response2 = network.postResponse(params, BasicConfig.MOBILE_finish);
......@@ -275,28 +282,30 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response.body().asString()));
List<CondDetail> treasureList = JsonUtil.parseResponseToListBean(response, CondDetail.class,"condDetail");
boolean finishFlag=treasureList.get(2).isFinishFlag();
System.out.println(finishFlag);
Assert.assertTrue(finishFlag, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第3个宝箱参与情况失败", response.body().asString()));
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Response response1 = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data1=response1.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data1, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response1.body().asString()));
List<CondDetail> treasureList1 = JsonUtil.parseResponseToListBean(response1, CondDetail.class,"condDetail");
boolean finishFlag1=treasureList1.get(2).isFinishFlag();
System.out.println(finishFlag1);
Assert.assertTrue(finishFlag1, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第3个宝箱参与情况失败", response.body().asString()));
//红包发完降级抽奖码
visitorAuth13();
ThreadSleepUtils.sleep(1000);
Response response2 = network.getResponse(params, BasicConfig.MOBILE_joinDetail1);
Object data2=response2.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data2, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response2.body().asString()));
List<CondDetail> treasureList2 = JsonUtil.parseResponseToListBean(response2, CondDetail.class,"condDetail");
boolean finishFlag2=treasureList2.get(2).isFinishFlag();
System.out.println(finishFlag2);
Assert.assertTrue(finishFlag2, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第3个宝箱参与情况失败", response.body().asString()));
}
......@@ -307,7 +316,7 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(2).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data=response.jsonPath().getJsonObject("data");
......@@ -339,7 +348,7 @@ public class TreasureTime implements AdminAuthorization {
params.put("treasureConfId",this.treasureConfId.get(2).getTreasureConfId());
//黑名单用户
visitorAuth13();
visitorAuth7();
ThreadSleepUtils.sleep(1000);
Response response = network.getResponse(params, BasicConfig.MOBILE_joinResult);
Object data=response.jsonPath().getJsonObject("data");
......@@ -389,9 +398,10 @@ public class TreasureTime 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_joinDetail1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取宝箱参与情况失败", response.body().asString()));
List<CondDetail> treasureList = JsonUtil.parseResponseToListBean(response, CondDetail.class,"condDetail");
boolean finishFlag=treasureList.get(2).isFinishFlag();
System.out.println(finishFlag);
Assert.assertTrue(finishFlag, network.message(params, BasicConfig.MOBILE_joinDetail1, "访客H获取第4个宝箱参与情况失败", response.body().asString()));
}
......@@ -403,9 +413,9 @@ public class TreasureTime implements AdminAuthorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("treasureConfId",this.treasureConfId.get(3).getTreasureConfId());
Response response = network.postResponse(params, BasicConfig.MOBILE_treasureOpen);
Object data=response.jsonPath().getJsonObject("data");
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_treasureOpen, "访客H获取宝箱参与情况失败", response.body().asString()));
}
......@@ -416,11 +426,16 @@ public class TreasureTime implements AdminAuthorization {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("treasureConfId",this.treasureConfId.get(3).getTreasureConfId());
Response response = network.getResponse(params, BasicConfig.MOBILE_joinResult);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_joinResult, "访客H获取宝箱参与情况失败", response.body().asString()));
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==1, network.message(params, BasicConfig.MOBILE_joinResult, "宝箱类型非抽奖码", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2,network.message(params, BasicConfig.MOBILE_joinResult, "领取失败", response.body().asString()));
}
......
......@@ -23,9 +23,7 @@ public class SaveAndUpdate implements AdminAuthorization {
public long welfareConfId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public void setUp() { BaseUtils.ssoLogin(); }
@Test(description = "创建直播", priority = 1)
public void 创建直播() {
......
......@@ -43,14 +43,17 @@ public class BaseUtils {
response = network.postResponse(loginParams,SSO_DOLOGIN);
Map<String, String> ssoCookies = response.getCookies();
network.agentCookies.putAll(ssoCookies); //存入cookies
// 2.登录客集集管理后台
String redirectUrl = response.jsonPath().getString("redirect");//获取重定向地址
response = network.getManagerCookies(redirectUrl);
network.agentCookies.putAll(ssoCookies); //存入cookies
// // 2.登录客集集管理后台
// String redirectUrl = response.jsonPath().getString("redirect");//获取重定向地址
// response = network.getManagerCookies(redirectUrl);
ssoCookies = response.getCookies();
network.agentCookies.putAll(ssoCookies);
network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token"));
// 免登
network.agentCookies.put("sso_ticket", "autotest");
}
/**
......
......@@ -57,7 +57,7 @@ public class JsonUtil {
}
public static <T> T parseResponseToBean1(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("d");
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