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

奖品签收

parent 18cb9278
......@@ -68,7 +68,6 @@ public class LiveMaterial implements AdminAuthorization {
}
//添加投票
@Test(description = "添加投票", priority = 3)
public void 添加投票() {
......
package com.kjj.cases.live.manager;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class Provide implements AdminAuthorization {
private Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "上传发奖团队名单", priority = 1)
public void 上传发奖团队名单() {
Map<String, Object> importGroupProviderParam = new HashMap<>();
importGroupProviderParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// importGroupProviderParam.put("liveId", 3107);
importGroupProviderParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210425/45c95c5bf7d8fb8aeb40c2ab307e0681.xlsx");
importGroupProviderParam.put("fileName", "团队发奖人模板");
Response response = network.postResponse(importGroupProviderParam, BasicConfig.MANAGER_importGroupProvider);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importGroupProviderParam, BasicConfig.MANAGER_importGroupProvider, "上传发奖团队名单", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 2)
public void 获取导入任务结果() throws InterruptedException {
Map<String, Object> resultParam = new HashMap<>();
resultParam.put("taskId", taskId);
Response response = null;
for (int i=0; i<10; i++) {
response = network.getResponse(resultParam, BasicConfig.MANAGER_result1);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result1, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "获取奖品配送相关配置详情", priority = 3)
public void 获取奖品配送相关配置详情() {
Map<String, Object> provideDetailParam = new HashMap<>();
provideDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// provideDetailParam.put("liveId", 3107);
Response response = network.getResponse(provideDetailParam, BasicConfig.MANAGER_provideDetail);
boolean data = response.jsonPath().getBoolean("data.groupProviderFlag");
System.out.println(data);
Assert.assertTrue(data, network.message(provideDetailParam, BasicConfig.MANAGER_provideDetail, "获取奖品配送相关配置详情失败", response.body().asString()));
}
}
......@@ -26,8 +26,8 @@ public class AgentOpen implements AdminAuthorization {
@Test(description = "扫码签收核奖_代理人得红包", priority = 1)
public void 扫码签收核奖_代理人得红包() {
Map<String, Object> configParam = new HashMap<>();
// configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
configParam.put("liveId", 3031);
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3031);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -54,8 +54,8 @@ public class AgentOpen implements AdminAuthorization {
@Test(description = "获取中奖名单配置", priority = 2)
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 3031);
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3031);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
......@@ -28,8 +28,8 @@ public class NuclearAward implements AdminAuthorization {
@Test(description = "不开启核奖", priority = 1)
public void 不开启核奖() {
Map<String, Object> configParam = new HashMap<>();
// configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
configParam.put("liveId", 3031);
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3031);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -53,8 +53,8 @@ public class NuclearAward implements AdminAuthorization {
@Test(description = "获取不开启核奖配置是否正确", priority = 2)
public void 获取不开启核奖配置是否正确() {
Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 3031);
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3031);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
......@@ -25,8 +25,8 @@ public class SignAward implements AdminAuthorization {
@Test(description = "扫码签收核奖_不开启红包", priority = 1)
public void 扫码签收核奖_不开启红包() {
Map<String, Object> configParam = new HashMap<>();
// configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
configParam.put("liveId", 3058);
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3058);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -52,8 +52,8 @@ public class SignAward implements AdminAuthorization {
@Test(description = "获取中奖名单配置", priority = 2)
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 3058);
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3058);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......@@ -64,8 +64,8 @@ public class SignAward implements AdminAuthorization {
@Test(description = "获取奖品签收小程序码", priority = 3)
public void 获取奖品签收小程序码() {
Map<String, Object> CodeParam = new HashMap<>();
// CodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
CodeParam.put("liveId", 3058);
CodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// CodeParam.put("liveId", 3058);
Response response = network.getResponse(CodeParam, BasicConfig.MANAGER_rewardSignQrCode);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
......@@ -26,8 +26,8 @@ public class UserOpen implements AdminAuthorization {
@Test(description = "扫码签收核奖_代理人得红包", priority = 1)
public void 扫码签收核奖_代理人得红包() {
Map<String, Object> configParam = new HashMap<>();
// configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
configParam.put("liveId", 3031);
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// configParam.put("liveId", 3031);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
......@@ -54,8 +54,8 @@ public class UserOpen implements AdminAuthorization {
@Test(description = "获取中奖名单配置", priority = 2)
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 3031);
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 3031);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
package com.kjj.cases.live.manager;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class spec implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
private long id;
@Test(description = "根据直播间id查询指定中奖配置", priority = 1)
public void 根据直播间id查询指定中奖配置() {
Map<String, Object> AwardConfParam = new HashMap<>();
AwardConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()) );
Response response = network.getResponse(AwardConfParam, BasicConfig.MANAGER_getSpecifyAwardConf);
id = response.jsonPath().getLong("data.id");
System.out.println(id);
Assert.assertNotNull(id, network.message(AwardConfParam, BasicConfig.MANAGER_getSpecifyAwardConf, "根据直播间id查询指定中奖配置失败", response.body().asString()));
}
@Test(description = "查询指定中奖信息", priority = 2)
public void 查询指定中奖信息() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("specifyAwardConfId",id );
Response response = network.getResponse(saveParam, BasicConfig.MANAGER_findById);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveParam, BasicConfig.MANAGER_findById, "查询指定中奖信息失败", response.body().asString()));
}
@Test(description = "新增指定中奖付款码配置", priority = 3)
public void 新增指定中奖付款码配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("id", id);
saveParam.put("payCodeImg", "//yun.dui88.com/kjy/image/20210425/1619328741809.jpeg");
saveParam.put("supplierName", "yl");
saveParam.put("supplierPhone", "15558005636");
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveSpecifyAwardConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveSpecifyAwardConf, "新增指定中奖付款码失败", 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.MyWebSocketUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.java_websocket.client.WebSocketClient;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.kjj.config.BasicConfig.VISITORKEY;
public class SignIn implements AdminAuthorization {
@BeforeClass
public void setUp() { visitorAuth(); }
@Test(description = "访客签到", priority = 1)
public void 访客签到() {
//连接
WebSocketClient client = MyWebSocketUtil.connect();
//身份认证,识别用户信息
MyWebSocketUtil.auth(client, VISITORKEY);
//进入直播间
MyWebSocketUtil.enter(client, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// MyWebSocketUtil.enter(client,"Kj21MjM2Nzk" );
//循环发送心跳,长时间不发消息,链接会断开
for (int i = 0; i < 5; i++) {
MyWebSocketUtil.hb(client);
ThreadSleepUtils.sleep(5000);
}
//退出直播间
MyWebSocketUtil.out(client, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
//无意义命令
MyWebSocketUtil.gt(client);
//关闭连接
MyWebSocketUtil.close(client);
}
@Test(description = "查询用户是否获得签到码", priority = 4)
public void 查询用户是否获得签到码() {
ThreadSleepUtils.sleep(500);
Map<String, Object> myLotteryCodeParam = new HashMap<>();
myLotteryCodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// myLotteryCodeParam.put("liveId","Kj21MjM2Nzk");
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);
List<Object> values = myLotteryCodeRes.jsonPath().getList("data.list");
boolean result = false;
for (Object value : values) {
if (Objects.equals(((Map) value).get("codeSource"), 2)) {
result = true;
break;
}
}
Assert.assertTrue(result, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询用户自己的抽奖券列表失败", myLotteryCodeRes.body().asString()));
}
}
......@@ -262,6 +262,17 @@ public class BasicConfig {
public static final String MANAGER_del = MANAGER_HOST+ "/kjy/manager/live/company/team/delete";
public static final String MANAGER_teamFlag = MANAGER_HOST+ "/kjy/manager/live/company/team/teamFlag";
//***************指定中奖付款码*****************
public static final String MANAGER_saveSpecifyAwardConf = MANAGER_HOST+ "/kjy/manager/live/spec/saveSpecifyAwardConf";
public static final String MANAGER_findById = MANAGER_HOST+ "/kjy/manager/live/spec/findById";
public static final String MANAGER_getSpecifyAwardConf = MANAGER_HOST+ "/kjy/manager/specifyAward/pre/conf/getSpecifyAwardConf";
// public static final String MANAGER_teamFlag = MANAGER_HOST+ "/kjy/manager/live/company/team/teamFlag";
//***************奖品配送*****************
public static final String MANAGER_provideDetail = MANAGER_HOST+ "/kjy/manager/live/prize/provide/conf/provideDetail";
public static final String MANAGER_result1 = MANAGER_HOST+ "/kjy/manager/live/import/result";
public static final String MANAGER_importGroupProvider= MANAGER_HOST+ "/kjy/manager/live/prize/provide/conf/importGroupProvider";
//***************直播中奖规则配置*****************
public static final String MANAGER_list = MANAGER_HOST+ "/kjy/manager/live/lottery/rule/list";
public static final String MANAGER_limit = MANAGER_HOST+ "/kjy/manager/live/lottery/limit";
......
......@@ -35,8 +35,8 @@ public class BaseUtils {
// 1.先进入SSO登录框 登入管理后台
Map<String, Object> loginParams = new HashMap<String, Object>();
loginParams.put("email","zyl");
loginParams.put("password","zyl123456");
loginParams.put("email","test@duiba.com.cn");
loginParams.put("password","d83HjbsJY76UJH");
loginParams.put("loginTimeout",1);
loginParams.put("redirect",MANAGER_HOST);
loginParams.put("systemId",201);
......
......@@ -12,7 +12,6 @@ import java.net.URI;
* @author lizhi
* @date 2021/4/19 4:00 下午
*/
@Slf4j
public class MyWebSocketUtil {
private static final String URL = "wss://ws.duibatest.com.cn/kws";
......@@ -54,7 +53,6 @@ public class MyWebSocketUtil {
client.connect();
// 判断是否连接成功,未成功后面发送消息时会报错
while (!client.getReadyState().equals(ReadyState.OPEN)) {
log.info("连接中···请稍后");
ThreadSleepUtils.sleep(500);
}
return client;
......@@ -168,22 +166,22 @@ public class MyWebSocketUtil {
@Override
public void onOpen(ServerHandshake serverHandshake) {
log.info("WebSocketClient, onOpen");
System.out.println("WebSocketClient, onOpen");
}
@Override
public void onMessage(String s) {
log.info("WebSocketClient, onMessage, s={}", s);
System.out.println("WebSocketClient, onMessage, s="+ s);
}
@Override
public void onClose(int code, String reason, boolean remote) {
log.info("WebSocketClient, onClose, code={}, reason={}, remote={}", code, reason, remote);
System.out.println("WebSocketClient, onClose, code="+ code+"reason="+reason+", remote="+remote);
}
@Override
public void onError(Exception e) {
log.error("WebSocketClient, onError, e:", e);
System.out.println("WebSocketClient, onError, e:"+ e.getMessage());
}
}
}
\ No newline at end of file
......@@ -73,6 +73,11 @@
</classes>
</test>
<test preserve-order="true" name="访客签到">
<classes>
<class name="com.kjj.cases.live.user.SignIn"/>
</classes>
</test>
<test preserve-order="true" name="直播中抽奖">
<classes>
......@@ -152,6 +157,18 @@
</classes>
</test>
<test preserve-order="true" name="奖品配送">
<classes>
<class name="com.kjj.cases.live.manager.Provide"/>
</classes>
</test>
<test preserve-order="true" name="指定中奖付款码">
<classes>
<class name="com.kjj.cases.live.manager.spec"/>
</classes>
</test>
</suite>
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