Commit 5051cc72 authored by 张艳玲's avatar 张艳玲

新增裂变宝箱配置

parent 6e08856a
package com.kjj.cases.live.agent; package com.kjj.cases.live.LotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization; import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
...@@ -8,13 +8,13 @@ import io.restassured.response.Response; ...@@ -8,13 +8,13 @@ import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class Agent implements AdminAuthorization { public class LotteryCode implements AdminAuthorization {
public String shareSign; public String shareSign;
public String shareSign1;
public String token; public String token;
@Test(description = "代理人A分享直播间", priority = 1) @Test(description = "代理人A分享直播间", priority = 1)
...@@ -31,23 +31,154 @@ public class Agent implements AdminAuthorization { ...@@ -31,23 +31,154 @@ public class Agent implements AdminAuthorization {
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString())); Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
} }
@Test(description = "代理人B分享直播间", priority = 2) @Test(description = "代理人A与访客A邀请关系绑定", priority = 2)
public void 代理人B分享直播间() { public void 代理人A与访客A邀请关系绑定() {
agentAuth1(); visitorAuth();
ThreadSleepUtils.sleep(500); Map<String, Object> bindingParam = new HashMap<>();
Map<String, Object> signParam = new HashMap<>(); bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); bindingParam.put("shareSign",LiveConstants.getValue(LiveConstants.StringKeyEnum.shareSign.getKey()));
signParam.put("shareType", 1); Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN); boolean success = bindingRes.jsonPath().getJsonObject("success");
HashMap data = signRes.jsonPath().getJsonObject("data"); System.out.println(success);
this.shareSign1 = (String)data.get("shareSign"); Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
System.out.println(shareSign1); }
Assert.assertNotNull(shareSign1, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
@Test(description = "访客A获取绑定结果和绑定凭证", priority = 3)
public void 访客A获取绑定结果和绑定凭证() {
visitorAuth();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客A获取根据绑定凭证发放的抽奖码", priority = 4)
public void 访客A获取根据绑定凭证发放的抽奖码() {
visitorAuth();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token",token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "代理人A查询抽奖券列表", priority = 5)
public void 代理人A查询抽奖券列表() {
agentAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "代理人查询抽奖券列表失败", myLotteryCodeRes.body().asString()));
}
@Test(description = "访客A获取直播所有的订阅消息模板", priority = 6)
public void 访客A获取直播所有的订阅消息模板() {
visitorAuth();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("appid","wx4d7276f866bd24c8");
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "访客A预约直播间", priority = 7)
public void 访客A预约直播间() {
visitorAuth();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds1 = new ArrayList<>();
markIds1.add(142L);
markIds1.add(143L);
markIds1.add(140L);
sycParam.put("markIds", markIds1);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客A关注直播间", priority = 8)
public void 访客A关注直播间() {
visitorAuth();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "访客A查询关注状态", priority = 9)
public void 访客A查询关注状态() {
visitorAuth();
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
} }
@Test(description = "访客A保存海报获得抽奖码", priority = 10)
public void 访客A保存海报获得抽奖码() {
visitorAuth();
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_savePoster);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_savePoster, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "访客A抽奖码数量", priority = 11)
public void 访客A抽奖码数量() {
visitorAuth();
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
@Test(description = "访客H关系绑定", priority = 3) @Test(description = "访客A查询抽奖券列表", priority = 12)
public void 访客A查询抽奖券列表() {
visitorAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
}
@Test(description = "访客H关系绑定", priority = 13)
public void 访客H关系绑定() { public void 访客H关系绑定() {
visitorAuth9(); visitorAuth9();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
...@@ -61,7 +192,7 @@ public class Agent implements AdminAuthorization { ...@@ -61,7 +192,7 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "中奖任务邀请H绑定结果和绑定凭证", priority = 4) @Test(description = "中奖任务邀请H绑定结果和绑定凭证", priority = 14)
public void 获取访客H绑定结果和绑定凭证() { public void 获取访客H绑定结果和绑定凭证() {
visitorAuth9(); visitorAuth9();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
...@@ -76,7 +207,7 @@ public class Agent implements AdminAuthorization { ...@@ -76,7 +207,7 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "中奖任务邀请H根据绑定凭证发放抽奖码", priority = 5) @Test(description = "中奖任务邀请H根据绑定凭证发放抽奖码", priority = 15)
public void 中奖任务邀请H根据绑定凭证发放抽奖码() { public void 中奖任务邀请H根据绑定凭证发放抽奖码() {
visitorAuth9(); visitorAuth9();
ThreadSleepUtils.sleep(500); ThreadSleepUtils.sleep(500);
...@@ -89,13 +220,13 @@ public class Agent implements AdminAuthorization { ...@@ -89,13 +220,13 @@ public class Agent implements AdminAuthorization {
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString())); Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
} }
@Test(description = "访客I关系绑定", priority = 6) @Test(description = "访客J关系绑定", priority = 16)
public void 访客I关系绑定() { public void 访客J关系绑定() {
visitorAuth8(); visitorAuth10();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> bindingParam = new HashMap<>(); Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign", shareSign1); bindingParam.put("shareSign", shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding); Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success"); boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success); System.out.println(success);
...@@ -103,9 +234,9 @@ public class Agent implements AdminAuthorization { ...@@ -103,9 +234,9 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "中奖任务邀请I绑定结果和绑定凭证", priority = 7) @Test(description = "中奖任务邀请J绑定结果和绑定凭证", priority = 17)
public void 获取访客I绑定结果和绑定凭证() { public void 获取访客J绑定结果和绑定凭证() {
visitorAuth8(); visitorAuth10();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> tokenParam = new HashMap<>(); Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -118,9 +249,9 @@ public class Agent implements AdminAuthorization { ...@@ -118,9 +249,9 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "邀请I根据绑定凭证发放抽奖码", priority = 8) @Test(description = "邀请J根据绑定凭证发放抽奖码", priority = 18)
public void 邀请I根据绑定凭证发放抽奖码() { public void 邀请J根据绑定凭证发放抽奖码() {
visitorAuth8(); visitorAuth10();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> codeParam = new HashMap<>(); Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -131,9 +262,27 @@ public class Agent implements AdminAuthorization { ...@@ -131,9 +262,27 @@ public class Agent implements AdminAuthorization {
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString())); Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
} }
@Test(description = "访客J关系绑定", priority = 9)
public void 访客J关系绑定() {
visitorAuth10(); //不同团队代理人绑定邀请关系
@Test(description = "代理人B分享直播间", priority = 19)
public void 代理人B分享直播间() {
agentAuth1();
ThreadSleepUtils.sleep(500);
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 1);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
@Test(description = "访客I关系绑定", priority = 20)
public void 访客I关系绑定() {
visitorAuth8();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> bindingParam = new HashMap<>(); Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -145,9 +294,9 @@ public class Agent implements AdminAuthorization { ...@@ -145,9 +294,9 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "中奖任务邀请J绑定结果和绑定凭证", priority = 10) @Test(description = "邀请I绑定结果和绑定凭证", priority = 21)
public void 获取访客J绑定结果和绑定凭证() { public void 访客I绑定结果和绑定凭证() {
visitorAuth10(); visitorAuth8();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> tokenParam = new HashMap<>(); Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -160,9 +309,9 @@ public class Agent implements AdminAuthorization { ...@@ -160,9 +309,9 @@ public class Agent implements AdminAuthorization {
} }
@Test(description = "邀请J根据绑定凭证发放抽奖码", priority = 11) @Test(description = "邀请I根据绑定凭证发放抽奖码", priority = 22)
public void 邀请J根据绑定凭证发放抽奖码() { public void 邀请I根据绑定凭证发放抽奖码() {
visitorAuth10(); visitorAuth8();
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(1000);
Map<String, Object> codeParam = new HashMap<>(); Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
package com.kjj.cases.live.user; package com.kjj.cases.live.LotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization; import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants; import com.kjj.constants.LiveConstants;
......
...@@ -4,7 +4,7 @@ import static com.kjj.config.BasicConfig.*; ...@@ -4,7 +4,7 @@ import static com.kjj.config.BasicConfig.*;
/** /**
* 管理员授权 * 管理员授权
* @author 嘿保险,ID:907 * @author 吉吉,ID:907
*/ */
public interface AdminAuthorization { public interface AdminAuthorization {
...@@ -26,7 +26,7 @@ public interface AdminAuthorization { ...@@ -26,7 +26,7 @@ public interface AdminAuthorization {
} }
/** /**
* 代理人(小疙瘩人寿)授权,ID:815 * 代理人(小疙瘩人寿)授权,ID:995
*/ */
default void agentAuth1(){ default void agentAuth1(){
// 创建用户 并传到network里 // 创建用户 并传到network里
...@@ -51,7 +51,7 @@ public interface AdminAuthorization { ...@@ -51,7 +51,7 @@ public interface AdminAuthorization {
} }
/** /**
* 访客C(刘超)授权,用户,用户ID:811 * 访客C(刘超)授权,地域指定用户ID:811
*/ */
default void visitorAuth3() { default void visitorAuth3() {
network.agentCookies.put("authKey", VISITORKEY3); network.agentCookies.put("authKey", VISITORKEY3);
...@@ -59,7 +59,7 @@ public interface AdminAuthorization { ...@@ -59,7 +59,7 @@ public interface AdminAuthorization {
} }
/** /**
* 访客D(李执)授权,用户ID:89 * 访客D(李执)授权,地域指定用户ID:89
*/ */
default void visitorAuth4() { default void visitorAuth4() {
network.agentCookies.put("authKey", VISITORKEY4); network.agentCookies.put("authKey", VISITORKEY4);
...@@ -74,7 +74,7 @@ public interface AdminAuthorization { ...@@ -74,7 +74,7 @@ public interface AdminAuthorization {
} }
/** /**
* 访客F(新强)授权,区域指定中奖用户,ID:82 * 访客F(新强)授权,用户ID:82
*/ */
default void visitorAuth6() { default void visitorAuth6() {
network.agentCookies.put("authKey", VISITORKEY6); network.agentCookies.put("authKey", VISITORKEY6);
...@@ -97,7 +97,7 @@ public interface AdminAuthorization { ...@@ -97,7 +97,7 @@ public interface AdminAuthorization {
System.out.println("用户AUTH_KEY:" + VISITORKEY8); System.out.println("用户AUTH_KEY:" + VISITORKEY8);
} }
/** /**
* 访客H(嘿保险)授权,ID:907 * 访客H(吉吉)非实名用户授权,ID:907
*/ */
default void visitorAuth9() { default void visitorAuth9() {
network.agentCookies.put("authKey", VISITORKEY9); network.agentCookies.put("authKey", VISITORKEY9);
...@@ -105,13 +105,77 @@ public interface AdminAuthorization { ...@@ -105,13 +105,77 @@ public interface AdminAuthorization {
} }
/** /**
* 访客H(日落)授权,ID:703 * 访客J(日落)授权,ID:703
*/ */
default void visitorAuth10() { default void visitorAuth10() {
network.agentCookies.put("authKey", VISITORKEY10); network.agentCookies.put("authKey", VISITORKEY10);
System.out.println("用户AUTH_KEY:" + VISITORKEY10); System.out.println("用户AUTH_KEY:" + VISITORKEY10);
} }
/**
* 访客K(沈小四)授权,ID:108
*/
default void visitorAuth11() {
network.agentCookies.put("authKey", VISITORKEY11);
System.out.println("用户AUTH_KEY:" + VISITORKEY11);
}
/**
* 访客L(饺子)授权,ID:97
*/
default void visitorAuth12() {
network.agentCookies.put("authKey", VISITORKEY12);
System.out.println("用户AUTH_KEY:" + VISITORKEY12);
}
/**
* 访客M(大妹子保险)非实名用户授权,ID:102
*/
default void visitorAuth13() {
network.agentCookies.put("authKey", VISITORKEY13);
System.out.println("用户AUTH_KEY:" + VISITORKEY13);
}
/**
* 访客N(光头强)非实名用户授权,ID:173
*/
default void visitorAuth14() {
network.agentCookies.put("authKey", VISITORKEY14);
System.out.println("用户AUTH_KEY:" + VISITORKEY14);
}
/**
* 访客O(少侠)授权,ID:79
*/
default void visitorAuth15() {
network.agentCookies.put("authKey", VISITORKEY15);
System.out.println("用户AUTH_KEY:" + VISITORKEY15);
}
/**
* 访客P(抬头有飞碟)授权,ID:99
*/
default void visitorAuth16() {
network.agentCookies.put("authKey", VISITORKEY16);
System.out.println("用户AUTH_KEY:" + VISITORKEY16);
}
/**
* 访客Q(枫城)授权,ID:77
*/
default void visitorAuth17() {
network.agentCookies.put("authKey", VISITORKEY17);
System.out.println("用户AUTH_KEY:" + VISITORKEY17);
}
/**
* 访客R(小老弟来了)非实名用户授权,ID:94
*/
default void visitorAuth18() {
network.agentCookies.put("authKey", VISITORKEY18);
System.out.println("用户AUTH_KEY:" + VISITORKEY18);
}
} }
...@@ -1351,7 +1351,7 @@ public class Lottery implements AdminAuthorization { ...@@ -1351,7 +1351,7 @@ public class Lottery implements AdminAuthorization {
} }
//团队分配定中奖 //团队分配定中奖
@Test(description = "普通抽奖轮次访客是否中奖", priority = 95) @Test(description = "普通抽奖轮次访客是否中奖", priority = 95)
public void 普通抽奖轮次访客是否中奖() { public void 普通抽奖轮次访客是否中奖() {
ThreadSleepUtils.sleep(3000); ThreadSleepUtils.sleep(3000);
......
package com.kjj.cases.live.manager;
import com.kjj.bean.manager.*;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Treasure implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<WelfareList> id;
@Test(description = "查询奖品列表", priority = 1)
public void 查询奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "新增宝箱裂变配置", priority = 2)
public void 新增宝箱裂变配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("openCondition", 1);
saveParam.put("openNum", 1);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setWelfareId(this.id.get(0).getId());
treasureAward.setAwardName("宝箱锦鲤");
treasureAward.setTreasureProbability(2000);
treasureAward.setTreasureType(3);
treasureAward.setRuleType(1);
treasureAward.setTotalNum(10);
treasureAward.setWinLimitCount(-1);
saveParam.put("treasureAward",treasureAward);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(2);
treasureRed.setTotalNum(3);
treasureRed.setTreasureProbability(4000);
treasureRed.setTreasureType(2);
treasureRed.setWinLimitCount(1);
treasureRed.setShowAmount(200);
saveParam.put("treasureRed",treasureRed);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
treasureCode.setTreasureProbability(4000);
treasureCode.setTreasureType(1);
saveParam.put("treasureCode",treasureCode);
saveParam.put("treasurePeriod",3);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveTreasureConf, "新增宝箱裂变配置失败", response.body().asString()));
}
@Test(description = "查询宝箱配置详情", priority = 3)
public void 查询宝箱配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(confDetailParam, BasicConfig.MANAGER_confDetail);
System.out.println(response);
Integer openCondition =response.jsonPath().getInt("data.openCondition");
System.out.println(openCondition);
Assert.assertTrue(openCondition>0, network.message(confDetailParam, BasicConfig.MANAGER_confDetail, "查询宝箱配置详情失败", response.body().asString()));
}
@Test(description = "开启宝箱", priority = 4)
public void 开启宝箱() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
switchStatusParam.put("confStatus", 1);
Response response = network.postResponse(switchStatusParam, BasicConfig.MANAGER_switchStatus);
boolean data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(switchStatusParam, BasicConfig.MANAGER_switchStatus, "开启宝箱失败", response.body().asString()));
}
}
package com.kjj.cases.live.treasure;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.bean.manager.TreasureAward;
import com.kjj.bean.manager.TreasureCode;
import com.kjj.bean.manager.TreasureRed;
import com.kjj.bean.manager.WelfareList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.BooleanUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.xml.crypto.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Treasure implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<WelfareList> id;
public String ConfId;
public String token;
public String shareSign;
public JSONObject treasureConf;
@Test(description = "查询奖品列表", priority = 1)
public void 查询奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getListParam.put("companyId", 101);
getListParam.put("pageIndex", 1);
getListParam.put("pageSize", 20);
getListParam.put("welfareType", 6);
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_getList4Admin);
List<WelfareList>list = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_getList4Admin, "查询奖品列表失败", response.body().asString()));
}
@Test(description = "宝箱实物中奖限制1次", priority = 2)
public void 宝箱实物中奖限制1() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("openCondition", 1);
saveParam.put("openNum",10);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setWelfareId(this.id.get(0).getId());
treasureAward.setAwardName("宝箱锦鲤");
treasureAward.setTreasureProbability(10000);
treasureAward.setTreasureType(3);
treasureAward.setRuleType(1);
treasureAward.setTotalNum(3);
treasureAward.setWinLimitCount(1);
saveParam.put("treasureAward",treasureAward);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(2);
treasureRed.setTotalNum(2);
treasureRed.setTreasureProbability(0);
treasureRed.setTreasureType(2);
treasureRed.setWinLimitCount(1);
treasureRed.setShowAmount(200);
saveParam.put("treasureRed",treasureRed);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
treasureCode.setTreasureProbability(0);
treasureCode.setTreasureType(1);
saveParam.put("treasureCode",treasureCode);
saveParam.put("treasurePeriod",3);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveTreasureConf, "新增宝箱裂变配置失败", response.body().asString()));
}
@Test(description = "查询宝箱配置详情", priority = 3)
public void 查询宝箱配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(confDetailParam, BasicConfig.MANAGER_confDetail);
System.out.println(response);
Integer openCondition =response.jsonPath().getInt("data.openCondition");
System.out.println(openCondition);
Assert.assertTrue(openCondition>0, network.message(confDetailParam, BasicConfig.MANAGER_confDetail, "查询宝箱配置详情失败", response.body().asString()));
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "开启宝箱配置", priority = 4)
public void 开启宝箱配置() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
switchStatusParam.put("confStatus", 1);
Response response = network.postResponse(switchStatusParam, BasicConfig.MANAGER_switchStatus);
boolean data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertTrue(data, network.message(switchStatusParam, BasicConfig.MANAGER_switchStatus, "开启宝箱失败", response.body().asString()));
}
@Test(description = "查询直播前宝箱配置状态", priority = 5)
public void 查询宝箱配置状态() {
visitorAuth9();
Map<String, Object> statusParam = new HashMap<>();
statusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(statusParam, BasicConfig.MANAGER_Status);
boolean confStatus =response.jsonPath().getBoolean("data.confStatus");
System.out.println(confStatus);
Assert.assertTrue(confStatus, network.message(statusParam, BasicConfig.MANAGER_Status, "查询宝箱配置状态失败", response.body().asString()));
}
@Test(description = "查询直播前宝箱配置信息", priority = 6)
public void 查询直播前宝箱配置信息() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail);
HashMap data =response.jsonPath().getJsonObject("data");
System.out.println(data);
this.ConfId=(String) data.get("treasureConfId");
System.out.println(ConfId);
Assert.assertNotNull(ConfId, network.message(detailParam, BasicConfig.MANAGER_detail, "查询宝箱配置状态失败", response.body().asString()));
}
@Test(description = "选择宝箱", priority = 7)
public void 选择宝箱() {
visitorAuth9();
Map<String, Object> chooseAwardParam = new HashMap<>();
chooseAwardParam.put("treasureConfId",ConfId);
chooseAwardParam.put("treasureType",1);
Response response = network.postResponse(chooseAwardParam, BasicConfig.MANAGER_chooseAward);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(chooseAwardParam, BasicConfig.MANAGER_chooseAward, "选择宝箱失败", response.body().asString()));
}
//邀请链路
@Test(description = "访客H分享直播间", priority = 8)
public void 访客H分享直播间() {
visitorAuth9();
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
@Test(description = "访客H与访客B邀请关系绑定", priority = 9)
public void 访客H与访客B邀请关系绑定() {
visitorAuth2();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客B获取绑定结果和绑定凭证", priority = 10)
public void 访客B获取绑定结果和绑定凭证() {
visitorAuth2();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客B根据绑定凭证发放抽奖码", priority = 11)
public void 访客B根据绑定凭证发放抽奖码() {
visitorAuth2();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客B获取直播所有的订阅消息模板", priority = 12)
public void 获取B直播所有的订阅消息模板() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("appid","wx4d7276f866bd24c8");
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "访客B预约直播间", priority = 13)
public void 访客B预约直播间() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds2 = new ArrayList<>();
markIds2.add(142L);
markIds2.add(143L);
markIds2.add(140L);
sycParam.put("markIds", markIds2);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客B关注直播间", priority = 14)
public void 访客B关注直播间() {
visitorAuth2();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "访客B关注状态查询", priority = 15)
public void 访客B关注状态查询() {
visitorAuth2();
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "访客B保存海报获得抽奖码", priority = 16)
public void 访客B保存海报获得抽奖码() {
visitorAuth2();
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_savePoster);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_savePoster, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "查询访客B抽奖码数量", priority = 17)
public void 查询访客B抽奖码数量() {
visitorAuth2();
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
@Test(description = "访客K邀请关系绑定", priority = 18)
public void 访客K邀请关系绑定() {
visitorAuth11();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客K获取绑定结果和绑定凭证", priority = 19)
public void 访客K获取绑定结果和绑定凭证() {
visitorAuth11();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客K根据绑定凭证发放抽奖码", priority = 20)
public void 访客K根据绑定凭证发放抽奖码() {
visitorAuth11();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客L邀请关系绑定", priority = 21)
public void 访客L邀请关系绑定() {
visitorAuth12();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客L获取绑定结果和绑定凭证", priority = 22)
public void 访客L获取绑定结果和绑定凭证() {
visitorAuth12();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客L根据绑定凭证发放抽奖码", priority = 23)
public void 访客L根据绑定凭证发放抽奖码() {
visitorAuth12();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客M邀请关系绑定", priority = 24)
public void 访客M邀请关系绑定() {
visitorAuth13();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客M获取绑定结果和绑定凭证", priority = 25)
public void 访客M获取绑定结果和绑定凭证() {
visitorAuth13();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客M根据绑定凭证发放抽奖码", priority = 26)
public void 访客M根据绑定凭证发放抽奖码() {
visitorAuth13();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客P邀请关系绑定", priority = 27)
public void 访客P邀请关系绑定() {
visitorAuth16();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客P获取绑定结果和绑定凭证", priority = 28)
public void 访客P获取绑定结果和绑定凭证() {
visitorAuth16();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客P根据绑定凭证发放抽奖码", priority = 29)
public void 访客P根据绑定凭证发放抽奖码() {
visitorAuth16();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客Q邀请关系绑定", priority = 30)
public void 访客Q邀请关系绑定() {
visitorAuth17();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客Q获取绑定结果和绑定凭证", priority = 31)
public void 访客Q获取绑定结果和绑定凭证() {
visitorAuth17();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客Q根据绑定凭证发放抽奖码", priority = 32)
public void 访客Q根据绑定凭证发放抽奖码() {
visitorAuth17();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客H查询第1次参与详情的进度显示", priority = 33)
public void 访客H查询第1次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
Integer invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第1轮宝箱获得实物", priority = 34)
public void 访客H开启第1轮宝箱获得实物() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第1轮宝箱失败", response.body().asString()));
}
@Test(description = "访客H第1轮开宝箱参与详情", priority = 35)
public void 访客H1轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType =response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==3, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "宝箱奖品类型非实物", response.body().asString()));
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
@Test(description = "访客H第2次参与详情的进度显示", priority = 36)
public void 访客H2次参与详情的进度显示() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第2次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第2轮宝箱降级抽奖码", priority = 37)
public void 访客H开启第2轮宝箱降级抽奖码() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第2轮宝箱失败", response.body().asString()));
}
@Test(description = "访客H第2轮开宝箱参与详情", priority = 38)
public void 访客H2轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==1, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非抽奖码", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
@Test(description = "宝箱实物中奖无限制", priority = 39)
public void 宝箱实物中奖无限制() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("winLimitCount",-1);//-1无限制,1限制1次
Response response = network.postResponse(treasureConf, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(treasureConf, BasicConfig.MANAGER_saveTreasureConf, "新增宝箱裂变配置失败", response.body().asString()));
}
@Test(description = "访客H第3次参与详情的进度显示", priority = 40)
public void 访客H3次参与详情的进度显示() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第3次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第3轮宝箱获得实物", priority = 41)
public void 访客H开启第3轮宝箱获得实物() {
visitorAuth9();
ThreadSleepUtils.sleep(3000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第2轮宝箱失败", response.body().asString()));
}
@Test(description = "访客H第3轮开宝箱参与详情", priority = 42)
public void 访客H3轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==3, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非实物", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
//B 用户邀请
@Test(description = "访客M分享直播间", priority = 43)
public void 访客M分享直播间() {
visitorAuth13();
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
@Test(description = "访客M与访客N邀请关系绑定", priority = 44)
public void 访客M与访客N邀请关系绑定() {
visitorAuth14();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客N获取绑定结果和绑定凭证", priority = 45)
public void 访客N获取绑定结果和绑定凭证() {
visitorAuth14();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客N根据绑定凭证发放抽奖码", priority = 46)
public void 访客N根据绑定凭证发放抽奖码() {
visitorAuth14();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "访客M与访客R邀请关系绑定", priority = 47)
public void 访客M与访客R邀请关系绑定() {
visitorAuth18();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客R获取绑定结果和绑定凭证", priority = 48)
public void 访客R获取绑定结果和绑定凭证() {
visitorAuth18();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客R根据绑定凭证发放抽奖码", priority = 49)
public void 访客R根据绑定凭证发放抽奖码() {
visitorAuth14();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
//验证实物奖品数量是否会超发
@Test(description = "访客H第4次参与详情的进度显示", priority = 50)
public void 访客H4次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第4次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客M第1次参与详情的进度显示", priority = 51)
public void 访客M1次参与详情的进度显示() {
visitorAuth13();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第4次参与详情进度失败", response.body().asString()));
}
@Test(description = "开启第4轮宝箱实物是否超发", priority = 52)
public void 开启第4轮宝箱实物是否超发() {
ThreadSleepUtils.sleep(3000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
visitorAuth9();
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第4轮宝箱失败", response.body().asString()));
visitorAuth13();
Response response1 = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus1 =response1.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus1);
Assert.assertTrue(receiveStatus1==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第4轮宝箱失败", response.body().asString()));
}
@Test(description = "查询访客H第4轮开宝箱参与详情", priority = 53)
public void 查询访客H4轮开宝箱参与详情() {
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId", ConfId);
visitorAuth9();
ThreadSleepUtils.sleep(3000);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==3, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非实物", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
visitorAuth13();
Response responseB = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType1=responseB.jsonPath().getInt("data.treasureType");
System.out.println(treasureType1);
Assert.assertTrue(treasureType1==1, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非抽奖码", response.body().asString()));
int receiveStatus1=responseB.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus1);
Assert.assertTrue(receiveStatus1==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
@Test(description = "宝箱红包限制1次", priority = 54)
public void 宝箱红包限制1() {
JSONObject treasureRed = treasureConf.getJSONObject("treasureRed");
treasureRed.put("treasureProbability","10000");
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("treasureProbability","0");
Response response = network.postResponse(treasureConf, BasicConfig.MANAGER_saveTreasureConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(treasureConf, BasicConfig.MANAGER_saveTreasureConf, "修改宝箱裂变配置失败", response.body().asString()));
}
//访客A领取红包
@Test(description = "访客H第5次参与详情的进度显示", priority = 55)
public void 访客H5次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第5次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第5次宝箱获得红包", priority = 56)
public void 访客H开启第5次宝箱获得红包() {
visitorAuth9();
ThreadSleepUtils.sleep(15000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第5轮宝箱失败", response.body().asString()));
}
@Test(description = "访客H第5轮开宝箱参与详情", priority = 57)
public void 访客H5轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非红包", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
//访客A降级抽奖码
@Test(description = "访客H第6次参与详情的进度显示", priority = 58)
public void 访客H6次参与详情的进度显示() {
visitorAuth9();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第6次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客H开启第6次宝箱降级抽奖码", priority = 59)
public void 访客H开启第6次宝箱降级抽奖码() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第5轮宝箱失败", response.body().asString()));
}
@Test(description = "访客H第6轮开宝箱参与详情", priority = 60)
public void 访客H6轮开宝箱参与详情() {
visitorAuth9();
ThreadSleepUtils.sleep(2000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==1, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非抽奖码", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
@Test(description = "访客N分享直播间", priority = 61)
public void 访客N分享直播间() {
visitorAuth14();
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
@Test(description = "访客N与访客O邀请关系绑定", priority = 62)
public void 访客N与访客O邀请关系绑定() {
visitorAuth15();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客O获取绑定结果和绑定凭证", priority = 63)
public void 访客O获取绑定结果和绑定凭证() {
visitorAuth15();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客O根据绑定凭证发放抽奖码", priority = 64)
public void 访客O根据绑定凭证发放抽奖码() {
visitorAuth15();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
//访客M和N同时抢红包
@Test(description = "访客M参与详情的进度显示", priority = 65)
public void 访客M参与详情的进度显示() {
visitorAuth13();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第7次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客N参与详情的进度显示", priority = 66)
public void 访客N参与详情的进度显示() {
visitorAuth14();
Map<String, Object> InfoParam = new HashMap<>();
InfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
InfoParam.put("treasureConfId",ConfId);
Response response = network.getResponse(InfoParam, BasicConfig.MANAGER_treasureUserInfo);
int invitationNum =response.jsonPath().getInt("data.invitationNum");
System.out.println(invitationNum);
Assert.assertTrue(invitationNum>0, network.message(InfoParam, BasicConfig.MANAGER_treasureUserInfo, "查询第7次参与详情进度失败", response.body().asString()));
}
@Test(description = "访客M和访客N同时开启宝箱验证红包是否超发", priority = 67)
public void 访客M和访客N同时开启宝箱验证红包是否超发() {
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
openParam.put("treasureConfId",ConfId);
visitorAuth13();
Response response = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第4轮宝箱失败", response.body().asString()));
visitorAuth14();
Response response1 = network.postResponse(openParam, BasicConfig.MANAGER_openTreasure);
int receiveStatus1 =response1.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus1);
Assert.assertTrue(receiveStatus1==0, network.message(openParam, BasicConfig.MANAGER_openTreasure, "开启第4轮宝箱失败", response.body().asString()));
}
@Test(description = "访客M和访客N第7轮开宝箱参与详情", priority = 68)
public void 访客M和访客N7轮开宝箱参与详情() {
ThreadSleepUtils.sleep(3000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("treasureConfId",ConfId);
visitorAuth13();
Response response = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType=response.jsonPath().getInt("data.treasureType");
System.out.println(treasureType);
Assert.assertTrue(treasureType==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非红包", response.body().asString()));
int receiveStatus=response.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus);
Assert.assertTrue(receiveStatus==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
visitorAuth14();
Response response1 = network.getResponse(infoParam, BasicConfig.MANAGER_participateInfo);
int treasureType1=response1.jsonPath().getInt("data.treasureType");
System.out.println(treasureType1);
Assert.assertTrue(treasureType1==1, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "类型非抽奖码", response.body().asString()));
int receiveStatus1=response1.jsonPath().getInt("data.receiveStatus");
System.out.println(receiveStatus1);
Assert.assertTrue(receiveStatus1==2, network.message(infoParam, BasicConfig.MANAGER_participateInfo, "领取失败", response.body().asString()));
}
@Test(description = "访客H宝箱领取记录", priority = 69)
public void 访客H宝箱领取记录() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> openParam = new HashMap<>();
openParam.put("treasureConfId",ConfId);
Response response = network.getResponse(openParam, BasicConfig.MANAGER_participateList);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
ArrayList dataList = (ArrayList)data;
Assert.assertTrue(dataList.size()==6, network.message(openParam, BasicConfig.MANAGER_participateList, "查询领取列表失败", response.body().asString()));
}
}
package com.kjj.cases.live.user;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class User implements AdminAuthorization {
@BeforeClass
public void setUp() { visitorAuth(); }
public String token;
public String shareSign;
//代理人邀请绑定
@Test(description = "代理人邀请关系绑定", priority = 1)
public void 邀请关系绑定() {
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",LiveConstants.getValue(LiveConstants.StringKeyEnum.shareSign.getKey()));
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "获取绑定结果和绑定凭证", priority = 2)
public void 获取绑定结果和绑定凭证() {
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "根据绑定凭证发放抽奖码", priority = 3)
public void 根据绑定凭证发放抽奖码() {
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "查询用户自己的抽奖券列表", priority = 4)
public void 查询用户自己的抽奖券列表() {
try{
agentAuth();
Thread.sleep(500);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
} catch(InterruptedException e){
e.printStackTrace();
}finally {
visitorAuth();
}
}
@Test(description = "预约直播间", priority = 5)
public void 预约直播间() {
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds1 = new ArrayList<>();
markIds1.add(142L);
markIds1.add(143L);
markIds1.add(140L);
sycParam.put("markIds", markIds1);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "关注直播间", priority = 6)
public void 关注直播间() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "查询关注状态", priority = 7)
public void 查询关注状态() {
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "保存海报获得抽奖码", priority = 8)
public void 保存海报获得抽奖码() {
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_savePoster);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_savePoster, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "我的抽奖码数量", priority = 9)
public void 我的抽奖码数量() {
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
@Test(description = "访客分享直播间", priority = 10)
public void 访客分享直播间() {
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 2);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
@Test(description = "访客邀请关系绑定", priority = 11)
public void 访客邀请关系绑定() {
visitorAuth2();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign",shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客获取绑定结果和绑定凭证", priority = 12)
public void 访客获取绑定结果和绑定凭证() {
visitorAuth2();
ThreadSleepUtils.sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
HashMap data = tokenRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.token = (String)data.get("token");
System.out.println(token);
Assert.assertNotNull(this.token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客根据绑定凭证发放抽奖码", priority = 13)
public void 访客根据绑定凭证发放抽奖码() {
visitorAuth2();
ThreadSleepUtils.sleep(2000);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
boolean success = codeRes.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(codeParam, BasicConfig.MOBILE_Code, "发放抽奖码失败", codeRes.body().asString()));
}
@Test(description = "获取直播所有的订阅消息模板", priority = 14)
public void 获取直播所有的订阅消息模板() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("appid","wx4d7276f866bd24c8");
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "访客预约直播间", priority = 15)
public void 访客预约直播间() {
visitorAuth2();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds2 = new ArrayList<>();
markIds2.add(142L);
markIds2.add(143L);
markIds2.add(140L);
sycParam.put("markIds", markIds2);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客关注直播间", priority = 16)
public void 访客关注直播间() {
visitorAuth2();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "访客关注状态查询", priority = 17)
public void 访客关注状态查询() {
visitorAuth2();
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "访客保存海报获得抽奖码", priority = 18)
public void 访客保存海报获得抽奖码() {
visitorAuth2();
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_savePoster);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_savePoster, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "查询访客抽奖码数量", priority = 19)
public void 查询访客抽奖码数量() {
visitorAuth2();
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
@Test(description = "访客查询抽奖券列表", priority = 20)
public void 访客查询抽奖券列表() {
visitorAuth();
try{
Thread.sleep(500);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
myLotteryCodeParam.put("pageIndex",1);
myLotteryCodeParam.put("pageSize",30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
} catch(InterruptedException e){
e.printStackTrace();
}
}
}
...@@ -3,7 +3,7 @@ package com.kjj.config; ...@@ -3,7 +3,7 @@ package com.kjj.config;
public class BasicConfig { public class BasicConfig {
public static int apiCount; //接口数量统计 public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送 // 是否开启钉钉机器人推送
public static final boolean isPushReport =true; //true public static final boolean isPushReport =false; //true
// 代理人微信昵称 // 代理人微信昵称
public static final String WECHAT_NAME = "吉吉"; //true public static final String WECHAT_NAME = "吉吉"; //true
// 代理人的openid(固定) // 代理人的openid(固定)
......
...@@ -19,12 +19,19 @@ ...@@ -19,12 +19,19 @@
</classes> </classes>
</test> </test>
<test preserve-order="true" name="宝箱裂变配置"> <test preserve-order="true" name="获取抽奖码校验">
<classes> <classes>
<class name="com.kjj.cases.live.manager.Treasure"/> <class name="com.kjj.cases.live.LotteryCode.LotteryCode"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="宝箱裂变">
<classes>
<class name="com.kjj.cases.live.treasure.Treasure"/>
</classes>
</test>
<test preserve-order="true" name="宝箱时长"> <test preserve-order="true" name="宝箱时长">
<classes> <classes>
<class name="com.kjj.cases.live.manager.TreasureTime"/> <class name="com.kjj.cases.live.manager.TreasureTime"/>
...@@ -75,17 +82,6 @@ ...@@ -75,17 +82,6 @@
</classes> </classes>
</test> </test>
<test preserve-order="true" name="代理人分享直播间">
<classes>
<class name="com.kjj.cases.live.agent.Agent"/>
</classes>
</test>
<test preserve-order="true" name="访客券码领取">
<classes>
<class name="com.kjj.cases.live.user.User"/>
</classes>
</test>
<test preserve-order="true" name="指定中奖"> <test preserve-order="true" name="指定中奖">
<classes> <classes>
...@@ -108,7 +104,7 @@ ...@@ -108,7 +104,7 @@
<test preserve-order="true" name="访客签到"> <test preserve-order="true" name="访客签到">
<classes> <classes>
<class name="com.kjj.cases.live.user.SignIn"/> <class name="com.kjj.cases.live.LotteryCode.SignIn"/>
</classes> </classes>
</test> </test>
...@@ -168,6 +164,7 @@ ...@@ -168,6 +164,7 @@
<class name="com.kjj.cases.live.question.Question"/> <class name="com.kjj.cases.live.question.Question"/>
</classes> </classes>
</test> </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