Commit 21b77680 authored by 张艳玲's avatar 张艳玲

新增猜数字红包

parent aaff3875
package com.kjj.bean.lottery;
import lombok.Data;
@Data
public class ConfIdList {
private String welfareConfId;
private Integer confId;
private Integer specifyStatus;
private Integer afterMin;
private Integer specNum;
private String importExcelUrl;
private Integer teamConfStatus;
private Integer areaConfStatus;
private String name;
private Long broadcastTime;
}
package com.kjj.bean.lottery;
import lombok.Data;
@Data
public class ConfidList {
private String welfareConfId;
}
......@@ -78,9 +78,9 @@ public class Procurator implements AdminAuthorization {
public void 编辑代理人信息() {
Map<String, Object> params = new HashMap<>();
params.put("sellerName", "你好测试"+ RandomUtils.nextInt(1, 100));
params.put("sellerName", "小智"+ RandomUtils.nextInt(1, 100));
params.put("phoneNumber", "152588101691");
params.put("jobNumber", "TTTTTT");
params.put("jobNumber", "技术");
params.put("wechatQrCode", "//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png");
Response response = network.postResponse(params, BasicConfig.MOBILE_AgentEditCardInfo);
Boolean agentBeans = JsonUtil.parseResponseToBean(response, Boolean.class);
......
This diff is collapsed.
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......@@ -21,30 +21,30 @@ public class Share implements AdminAuthorization {
@Test(description = "新增常规小程序分享", priority = 1)
public void 新增常规小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」常规分享文案{{name}}");
saveParam.put("shareType", 1);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」常规分享文案{{name}}");
Params.put("shareType", 1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增常规小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增常规小程序分享失败", 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("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」红包分享文案{{name}}");
saveParam.put("shareType", 2);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」红包分享文案{{name}}");
Params.put("shareType", 2);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增红包小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增红包小程序分享失败", response.body().asString()));
}
......@@ -52,30 +52,30 @@ public class Share implements AdminAuthorization {
@Test(description = "新增直播宝箱小程序分享", priority = 3)
public void 新增直播宝箱小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」宝箱裂变分享文案{{name}}");
saveParam.put("shareType", 4);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」宝箱裂变分享文案{{name}}");
Params.put("shareType", 4);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增直播宝箱小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增直播宝箱小程序分享失败", response.body().asString()));
}
@Test(description = "新增猜数红包小程序分享", priority = 4)
public void 新增猜数红包小程序分享() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
saveParam.put("mpShareTitle", "「{{welfareName}}」猜数字红包分享文案{{name}}");
saveParam.put("shareType", 5);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveOrUpdateMpShare);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("mpShareUrl", "//yun.dui88.com/kjy/image/20210526/1622022856685.jpeg");
Params.put("mpShareTitle", "「{{welfareName}}」猜数字红包分享文案{{name}}");
Params.put("shareType", 5);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdateMpShare);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(saveParam, BasicConfig.MOBILE_info, "新增猜数红包小程序分享失败", response.body().asString()));
Assert.assertTrue(data,network.message(Params, BasicConfig.MOBILE_info, "新增猜数红包小程序分享失败", response.body().asString()));
}
......
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.bean.manager.TeamList;
import com.kjj.cases.live.admin.AdminAuthorization;
......@@ -24,104 +24,104 @@ public class Team implements AdminAuthorization {
@Test(description = "新增团队", priority = 1)
public void 新增团队() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("teamName", "测试团队");
saveOrUpdateParam.put("expectedNum", 100);
saveOrUpdateParam.put("id", "");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("teamName", "测试团队");
Params.put("expectedNum", 100);
Params.put("id", "");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "新增团队失败", response.body().asString()));
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveOrUpdate, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队列表", priority = 2)
public void 查询团队列表() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询新增团队失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询新增团队失败", response.body().asString()));
}
@Test(description = "修改团队", priority = 3)
public void 修改团队() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("id", this.id.get(0).getId());
saveOrUpdateParam.put("teamName", "测试团队");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("id", this.id.get(0).getId());
Params.put("teamName", "测试团队");
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "修改新增团队失败", response.body().asString()));
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_saveOrUpdate, "修改新增团队失败", response.body().asString()));
}
@Test(description = "删除团队", priority = 4)
public void 删除团队() {
Map<String, Object> deleteParam = new HashMap<>();
deleteParam.put("id", this.id.get(0).getId());
Response response = network.postResponse(deleteParam, BasicConfig.MANAGER_del);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Response response = network.postResponse(Params, BasicConfig.MANAGER_del);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(deleteParam, BasicConfig.MANAGER_del, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_del, "查询新增团队失败", response.body().asString()));
}
@Test(description = "设置内勤标识", priority = 5)
public void 设置内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 1);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Params.put("teamFlag", 1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询设置团队内勤标识", priority = 6)
public void 查询设置团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询设置团队内勤标识失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询设置团队内勤标识失败", response.body().asString()));
}
@Test(description = "取消团队内勤标识", priority = 7)
public void 取消内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 0);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
Map<String, Object> Params = new HashMap<>();
Params.put("id", this.id.get(0).getId());
Params.put("teamFlag", 0);
Response response = network.postResponse(Params, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
Assert.assertTrue(deta, network.message(Params, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询取消团队内勤标识", priority = 8)
public void 查询取消团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
Map<String, Object> Params = new HashMap<>();
Params.put("companyId", 101);
Params.put("pageIndex", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询取消内勤标识失败", response.body().asString()));
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_teamList, "查询取消内勤标识失败", response.body().asString()));
}
......
This diff is collapsed.
package com.kjj.cases.live.manager;
package com.kjj.cases.live.liveConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......@@ -22,37 +22,37 @@ public class spec implements AdminAuthorization {
@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);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()) );
Response response = network.getResponse(Params, 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()));
Assert.assertNotNull(id, network.message(Params, 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);
Map<String, Object> Params = new HashMap<>();
Params.put("specifyAwardConfId",id );
Response response = network.getResponse(Params, 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()));
Assert.assertNotNull(data, network.message(Params, 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);
Map<String, Object> Params = new HashMap<>();
Params.put("id", id);
Params.put("payCodeImg", "//yun.dui88.com/kjy/image/20210425/1619328741809.jpeg");
Params.put("supplierName", "yl");
Params.put("supplierPhone", "15558005636");
Response response = network.postResponse(Params, 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()));
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveSpecifyAwardConf, "新增指定中奖付款码失败", response.body().asString()));
}
......
package com.kjj.cases.live.lottery;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfidList;
import com.kjj.bean.lottery.ConfIdList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......@@ -18,18 +18,18 @@ import java.util.Objects;
public class Lottery implements AdminAuthorization {
public List<ConfidList> List_Confid;
public List<ConfIdList> List_Confid;
public String shareSign;
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
agentAuth();
Map<String, Object> listLiveLotterParam = new HashMap<>();
listLiveLotterParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response listLiveLotterRes = network.getResponse(listLiveLotterParam, BasicConfig.USER_listLiveLottery);
Object data = listLiveLotterRes.jsonPath().getJsonObject("data");
Map<String, Object> lotterParam = new HashMap<>();
lotterParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(lotterParam, BasicConfig.USER_listLiveLottery);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(listLiveLotterParam, BasicConfig.USER_listLiveLottery, "抽奖活动弹层福利列表查询失败", listLiveLotterRes.body().asString()));
Assert.assertNotNull(data, network.message(lotterParam, BasicConfig.USER_listLiveLottery, "抽奖活动弹层福利列表查询失败", response.body().asString()));
}
@Test(description = "代理人查询抽奖奖品列表", priority = 2)
......@@ -38,7 +38,7 @@ public class Lottery implements AdminAuthorization {
Map<String, Object> getLiveAwardListParam = new HashMap<>();
getLiveAwardListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response getLiveAwardListRes = network.getResponse(getLiveAwardListParam, BasicConfig.USER_getLiveAwardList);
List<ConfidList> list = JsonUtil.parseResponseToListBean(getLiveAwardListRes, ConfidList.class);
List<ConfIdList> list = JsonUtil.parseResponseToListBean(getLiveAwardListRes, ConfIdList.class);
System.out.println(list);
this.List_Confid = list;
Assert.assertNotNull(list, network.message(getLiveAwardListParam, BasicConfig.USER_getLiveAwardList, "抽奖标记为false", getLiveAwardListRes.body().asString()));
......@@ -259,9 +259,9 @@ public class Lottery implements AdminAuthorization {
submitInfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
submitInfoParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
submitInfoParam.put("winnerName", "中奖姓名XX");
submitInfoParam.put("region", "");
submitInfoParam.put("location", "");
submitInfoParam.put("phoneNum", "");
// submitInfoParam.put("region", "");
// submitInfoParam.put("location", "");
// submitInfoParam.put("phoneNum", "");
Response submitInfoRes = network.postResponse(submitInfoParam, BasicConfig.USER_submitInfo);
Boolean result = submitInfoRes.jsonPath().getBoolean("success");
System.out.println(result);
......
package com.kjj.cases.live.LotteryCode;
package com.kjj.cases.live.lotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
......
package com.kjj.cases.live.LotteryCode;
package com.kjj.cases.live.lotteryCode;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......
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.List;
import java.util.Map;
public class LiveLottery implements AdminAuthorization {
public long confId;
public Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(2);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "上传企业指定中奖名单", priority = 2)
public void 上传企业指定中奖名单() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("confId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210420/51716f59605424332f50a26f0a5d531f.xlsx");
importParam.put("fileName", "指定中奖名单");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 3)
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_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "删除企业指定中奖名单", priority = 4)
public void 删除企业指定中奖名单() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("confId",confId);
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del1);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del1, "删除企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "上传新的企业指定中奖名单", priority = 5)
public void 上传新的企业指定中奖名单() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("confId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210421/14cfc6260713bc97e7cd6a9b27b0e763.xlsx");
importParam.put("fileName", "指定中奖名单");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import);
System.out.println(response);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import, "上传企业指定中奖名单失败", response.body().asString()));
}
@Test(description = "获取新的导入任务结果", priority = 6)
public void 获取新的导入任务结果() {
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_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.kjj.bean.manager.RewardPkBean;
import com.kjj.bean.manager.RuleBean;
import com.kjj.bean.manager.SaveLimitBean;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LotteryRule implements AdminAuthorization {
public long confId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(1);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "未配置区域开启开关", priority = 2)
public void 未配置区域开启开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId );
changeStatusParam.put("status",1 );
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus);
boolean success = response.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertFalse(success, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus, "查询没有区域中奖配置记录失败", response.body().asString()));
}
@Test(description = "获取省市区数据", priority = 3)
public void 获取省市区数据() {
Map<String, Object> areaParam = new HashMap<>();
areaParam.put("areaType",2);
Response response = network.getResponse(areaParam, BasicConfig.MANAGER_area);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(areaParam, BasicConfig.MANAGER_area, "获取省市区数据失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次配置头部信息", priority = 4)
public void 获取抽奖轮次配置头部信息() {
Map<String, Object> headerParam = new HashMap<>();
headerParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
headerParam.put("confId",confId );
Response response = network.getResponse(headerParam, BasicConfig.MANAGER_header);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(headerParam, BasicConfig.MANAGER_header, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "获取抽奖轮次信息配置的中奖地区配置", priority = 5)
public void 获取抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> confListParam = new HashMap<>();
confListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
confListParam.put("confId",confId );
Response response = network.getResponse(confListParam, BasicConfig.MANAGER_confList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(confListParam, BasicConfig.MANAGER_confList, "获取抽奖轮次配置头部信息失败", response.body().asString()));
}
@Test(description = "保存抽奖轮次信息配置的中奖地区配置", priority = 6)
public void 保存抽奖轮次信息配置的中奖地区配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("confId",confId );
List<RuleBean> Rule = new ArrayList<>();
RuleBean save = new RuleBean();
save.setProvinceCode(110000);
save.setCityCode(null);
save.setTotalNum(50);
Rule.add(save);
RuleBean save1 = new RuleBean();
save1.setProvinceCode(420000);
save1.setCityCode(null);
save1.setTotalNum(50);
Rule.add(save1);
RuleBean save2 = new RuleBean();
save2.setProvinceCode(420000);
save2.setCityCode(420900);
save2.setTotalNum(50);
Rule.add(save2);
saveParam.put("list",Rule);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_save);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_save, "保存抽奖轮次信息配置的中奖地区配置失败", response.body().asString()));
}
@Test(description = "已配置区域开启开关", priority = 7)
public void 已配置区域开启开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId );
changeStatusParam.put("status",1 );
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus, "已配置区域开启开关失败", response.body().asString()));
}
@Test(description = "查询中奖限制", priority = 8)
public void 查询中奖限制() {
Map<String, Object> limitParam = new HashMap<>();
limitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(limitParam, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(limitParam, BasicConfig.MANAGER_limit, "查询中奖限制失败", response.body().asString()));
}
@Test(description = "修改中奖规则限制", priority = 9)
public void 修改中奖规则限制() {
Map<String, Object> savelimitParam = new HashMap<>();
savelimitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveLimitBean> savelimit = new ArrayList<>();
SaveLimitBean limitlist = new SaveLimitBean();
limitlist.setConfName(3);
limitlist.setConfValue("1");
savelimit.add(limitlist);
SaveLimitBean limitlist1 = new SaveLimitBean();
limitlist1.setConfName(4);
limitlist1.setConfValue("1");
savelimit.add(limitlist1);
SaveLimitBean limitlist2 = new SaveLimitBean();
limitlist2.setConfName(11);
limitlist2.setConfValue("1");
savelimit.add(limitlist2);
SaveLimitBean limitlist3 = new SaveLimitBean();
limitlist3.setConfName(12);
limitlist3.setConfValue("0");
savelimit.add(limitlist3);
savelimitParam.put("list",savelimit);
Response response = network.postResponse(savelimitParam, BasicConfig.MANAGER_saveLimit);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savelimitParam, BasicConfig.MANAGER_saveLimit, "修改中奖规则限制失败", response.body().asString()));
}
@Test(description = "查询修改中奖限制是否成功", priority = 10)
public void 查询修改中奖限制是否成功() {
Map<String, Object> limitParam = new HashMap<>();
limitParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(limitParam, BasicConfig.MANAGER_limit);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(limitParam, BasicConfig.MANAGER_limit, "未查询到修改后的中奖规则", response.body().asString()));
}
}
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()));
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfidList;
import com.kjj.bean.manager.QuesReward;
import com.kjj.bean.manager.TeamAssignmentList;
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.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TeamAssignment implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<QuesReward> ListConfid;
public List<TeamAssignmentList.team_List> teamID;
@Test(description = "获取有奖答题列表信息", priority = 1)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
List<QuesReward> list = JsonUtil.parseResponseToListBean(response, QuesReward.class);
System.out.println(list);
this.ListConfid = list;
Assert.assertNotNull(list, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "获取答题按团队分配的团队列表", priority = 2)
public void 获取答题按团队分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "添加团队", priority = 3)
public void 添加团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3837,3324,3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加团队失败", response.body().asString()));
}
@Test(description = "获取答题已分配的团队列表", priority = 4)
public void 获取答题已分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
List<TeamAssignmentList.team_List> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")),TeamAssignmentList.team_List.class);
System.out.println(list);
this.teamID = list;
Assert.assertNotNull(list, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "单个团队删除", priority = 5)
public void 单个团队删除() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
TeamParam.put("id",this.teamID.get(0).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_delTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_delTeam, "单个团队删除", response.body().asString()));
}
@Test(description = "一键清空团队", priority = 6)
public void 一键清空团队() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(2).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_deleteAll);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_deleteAll, "一键清空团队失败", response.body().asString()));
}
@Test(description = "添加指定中奖团队", priority = 7)
public void 添加指定中奖团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加指定中奖团队失败", response.body().asString()));
}
@Test(description = "开启团队配置开关", priority = 8)
public void 开启团队配置开关() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(2).getId());
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_updateTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addTeamParam, BasicConfig.MANAGER_updateTeam, "开启团队配置开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
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 Unlimited implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "修改本场答题规则仅一次中奖", priority = 1)
public void 修改本场答题规则仅一次中奖() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 1);
updateParam.put("welfareRuleType", 1);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "答题有奖限制中奖1次", priority = 2)
public void 答题有奖限制中奖1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
@Test(description = "获取有奖答题列表信息", priority = 3)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "本场答题无限制中奖规则", priority = 4)
public void 本场答题无限制中奖规则() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖实物规则无限制", response.body().asString()));
}
}
package com.kjj.cases.live.manager.QuesReward;
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 limited implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "修改本场答题规则仅一次中奖", priority = 1)
public void 修改本场答题规则仅一次中奖() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 2);
updateParam.put("welfareRuleType", 2);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "答题有奖限制中奖1次", priority = 2)
public void 答题有奖限制中奖1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
}
package com.kjj.cases.live.manager;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.TeamList;
import com.kjj.bean.manager.TreasureList;
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.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TeamLottery implements AdminAuthorization {
public long confId;
public long Id;
public Integer taskId;
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "获取抽奖轮次信息", priority = 1)
public void 获取抽奖轮次信息() {
Map<String, Object> listParam = new HashMap<>();
listParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(listParam, BasicConfig.MANAGER_list);
List data = response.jsonPath().getList("data");
Map resultMap = (Map) data.get(3);
System.out.println(resultMap.get("confId"));
confId =Long.parseLong(resultMap.get("confId").toString());
Assert.assertNotNull(confId, network.message(listParam, BasicConfig.MANAGER_list, "获取抽奖轮次信息失败", response.body().asString()));
}
@Test(description = "查询新增时团队列表", priority = 2)
public void 查询新增时团队列表() {
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_search);
Object data=response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(searchParam, BasicConfig.MANAGER_search, "查询新增时团队列表失败", response.body().asString()));
}
@Test(description = "新增团队配置", priority = 3)
public void 新增团队配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
saveParam.put("confId",confId);
saveParam.put("teamId",3817);
saveParam.put("totalNum",1);
Response response = network.postResponse(saveParam, BasicConfig.MANAGER_saveteam);
System.out.println(response.jsonPath());
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveParam, BasicConfig.MANAGER_saveteam, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队份数配置列表", priority = 4)
public void 查询团队份数配置列表() {
ThreadSleepUtils.sleep(500);
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(searchParam, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "修改团队份数", priority = 5)
public void 修改团队份数() {
Map<String, Object> changeNumParam = new HashMap<>();
changeNumParam.put("id",Id);
changeNumParam.put("totalNum",2);
Response response = network.postResponse(changeNumParam, BasicConfig.MANAGER_changeNum);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeNumParam, BasicConfig.MANAGER_changeNum, "修改团队份数失败", response.body().asString()));
}
@Test(description = "删除团队奖品配置", priority = 6)
public void 删除团队奖品配置() {
Map<String, Object> delParam = new HashMap<>();
delParam.put("id",Id);
Response response = network.postResponse(delParam, BasicConfig.MANAGER_del0);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delParam, BasicConfig.MANAGER_del0, "删除团队配置失败", response.body().asString()));
}
@Test(description = "批量导入团队份数配置", priority = 7)
public void 批量导入团队份数配置() {
Map<String, Object> importParam = new HashMap<>();
importParam.put("bizId",confId);
importParam.put("excelUrl", "https://yun.dui88.com/kjy/media/file/20210512/d6cd0ef5b4808d8e5d608433079296a2.xlsx");
importParam.put("fileName", "团队配置份数模板.xlsx");
Response response = network.postResponse(importParam, BasicConfig.MANAGER_import0);
taskId = response.jsonPath().getInt("data");
System.out.println(taskId);
Assert.assertNotNull(taskId, network.message(importParam, BasicConfig.MANAGER_import0, "批量导入团队份数配置失败", response.body().asString()));
}
@Test(description = "获取导入任务结果", priority = 8)
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_result);
boolean hasFinish= response.jsonPath().getBoolean("data.hasFinish");
System.out.println(hasFinish);
if(hasFinish) return;
Thread.sleep(500);
}
Assert.fail(network.message(resultParam, BasicConfig.MANAGER_result, "获取导入任务结果失败", response.body().asString()));
}
@Test(description = "查询新增团队份数配置列表", priority = 9)
public void 查询新增团队份数配置列表() {
Map<String, Object> searchParam = new HashMap<>();
searchParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
searchParam.put("confId",confId);
searchParam.put("pageSize",20);
searchParam.put("pageIndex",1);
Response response = network.getResponse(searchParam, BasicConfig.MANAGER_teamlist);
List data = response.jsonPath().getList("data.list");
Map resultMap = (Map) data.get(0);
System.out.println(resultMap.get("id"));
Id =Long.parseLong(resultMap.get("id").toString());
Assert.assertNotNull(Id, network.message(searchParam, BasicConfig.MANAGER_teamlist, "查询团队份数配置列表失败", response.body().asString()));
}
@Test(description = "开启按团队配置份数开关", priority = 10)
public void 开启按团队配置份数开关() {
Map<String, Object> changeStatusParam = new HashMap<>();
changeStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
changeStatusParam.put("confId",confId);
changeStatusParam.put("status",1);
Response response = network.postResponse(changeStatusParam, BasicConfig.MANAGER_changeStatus1);
boolean data=response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(changeStatusParam, BasicConfig.MANAGER_changeStatus1, "开启按团队配置份数开关失败", response.body().asString()));
}
}
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.HashMap;
import java.util.List;
import java.util.Map;
public class TreasureTime implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<TreasureList> ConfId;
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()));
Response response = network.getResponse(getListParam, BasicConfig.MANAGER_list1);
Object data=response.jsonPath().getJsonObject("data");
System.out.println(data);
List<TreasureList> list = JsonUtil.parseResponseToListBean(response,TreasureList.class);
System.out.println(list);
this.ConfId = list;
Assert.assertNotNull(list, network.message(getListParam, BasicConfig.MANAGER_list1, "获取直播中停留时长宝箱列表失败", response.body().asString()));
}
@Test(description = "停留时长1分钟固定抽奖码", priority = 2)
public void 停留时长1分钟固定抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",1);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(0);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长1分钟固定抽奖码", response.body().asString()));
}
@Test(description = "获取第1轮宝箱配置详情", priority = 3)
public void 获取第1轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(0).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第1轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长2分钟现金红包", priority = 4)
public void 停留时长2分钟现金红包() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
updateParam.put("boxConfType",2);
updateParam.put("openCondition",2);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(3);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
TreasureRed treasureRed =new TreasureRed();
treasureRed.setRedTotalAmount(100);
treasureRed.setRuleType(1);
treasureRed.setTotalNum(1);
treasureRed.setFixedNum(30);
updateParam.put("treasureRed",treasureRed);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "停留时长2分钟现金红包配置失败", response.body().asString()));
}
@Test(description = "获取第2轮宝箱配置详情", priority = 5)
public void 获取第2轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(1).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第2轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "查询奖品列表", priority = 6)
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 = "停留时长3分钟实物奖品", priority = 7)
public void 停留时长3分钟实物奖品() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
updateParam.put("boxConfType",3);
updateParam.put("openCondition",3);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(1);
updateParam.put("treasureCode",treasureCode);
TreasureAward treasureAward =new TreasureAward();
treasureAward.setAwardName("萌娃锦鲤");
treasureAward.setBizConfId(0);
treasureAward.setIsLimit(2);
treasureAward.setTotalNum(1);
treasureAward.setWelfareId(this.id.get(5).getId());
updateParam.put("treasureAward",treasureAward);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第3轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第三轮宝箱配置详情", priority = 8)
public void 获取第三轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(2).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第三轮宝箱配置详情失败", response.body().asString()));
}
@Test(description = "停留时长4分钟随机抽奖码", priority = 9)
public void 停留时长4分钟随机抽奖码() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
updateParam.put("boxConfType",1);
updateParam.put("openCondition",4);
TreasureCode treasureCode =new TreasureCode();
treasureCode.setFixedNum(1);
treasureCode.setMaxNum(6);
treasureCode.setRuleType(2);
updateParam.put("treasureCode",treasureCode);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_update1);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_update1, "第四轮宝箱时长配置失败", response.body().asString()));
}
@Test(description = "获取第四轮宝箱配置详情", priority = 10)
public void 获取第四轮宝箱配置详情() {
Map<String, Object> detailParam = new HashMap<>();
detailParam.put("treasureConfId",this.ConfId.get(3).getTreasureConfId());
Response response = network.getResponse(detailParam, BasicConfig.MANAGER_detail1);
Object data =response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(detailParam, BasicConfig.MANAGER_detail1, "获取第四轮宝箱配置详情失败", response.body().asString()));
}
}
This diff is collapsed.
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
......
package com.kjj.cases.live.manager.signing;
package com.kjj.cases.live.signing;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.SaveRewardConfig;
......@@ -7,7 +7,6 @@ import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.apache.commons.math3.analysis.function.Add;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -29,7 +28,6 @@ public class NuclearAward implements AdminAuthorization {
public void 不开启核奖() {
Map<String, Object> configParam = new HashMap<>();
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,7 +52,6 @@ public class NuclearAward implements AdminAuthorization {
public void 获取不开启核奖配置是否正确() {
Map<String, Object> getConfParam = new HashMap<>();
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.signing;
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.live.admin.AdminAuthorization;
......@@ -26,7 +26,6 @@ public class SignAward implements AdminAuthorization {
public void 扫码签收核奖_不开启红包() {
Map<String, Object> configParam = new HashMap<>();
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);
......@@ -53,7 +52,6 @@ public class SignAward implements AdminAuthorization {
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
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);
......@@ -65,7 +63,6 @@ public class SignAward implements AdminAuthorization {
public void 获取奖品签收小程序码() {
Map<String, Object> CodeParam = new HashMap<>();
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);
......
This diff is collapsed.
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