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

update

parent 35d683b8
package com.kjj.cases.live.agent;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
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 Reward implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
/**奖品发放配置*/
@Test(description = "获取中奖名单配置信息", priority = 1)
public void 获取中奖名单配置信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
boolean success=response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(getConfParam, BasicConfig.MANAGER_getConf, "接口调用失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getConf, "未获取到中奖名单配置信息", response.body().asString()));
}
@Test(description = "获取奖品签收小程序码", priority = 2)
public void 获取奖品签收小程序码() {
Map<String, Object> CodeParam = new HashMap<>();
CodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(CodeParam, BasicConfig.MANAGER_rewardSignQrCode);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(CodeParam, BasicConfig.MANAGER_rewardSignQrCode, "获取小程序码失败", response.body().asString()));
}
/**不开启核奖*/
@Test(description = "不开启核奖", priority = 3)
public void 不开启核奖() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(1);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(1);
configs.add(saveReward1);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "接口调用失败"+ JSON.toJSONString(response.jsonPath().get()), response.body().asString()));
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启核奖设置失败", response.body().asString()));
}
@Test(description="未开启核奖_获取代理人中奖信息",priority = 4)
public void 未开启核奖_获取代理人中奖信息() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_head);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer allCount =response.jsonPath().getInt("data.allCount");
Assert.assertTrue(allCount>5, network.message(params, BasicConfig.MOBILE_head, "中奖总数", response.body().asString()));
Integer signCount=response.jsonPath().getInt("data.signCount");
Assert.assertTrue(signCount==0, network.message(params, BasicConfig.MOBILE_head, "签收数量", response.body().asString()));
Integer unSignCount =response.jsonPath().getInt("data.unSignCount");
Assert.assertTrue(unSignCount>5, network.message(params, BasicConfig.MOBILE_head, "未签收数量", response.body().asString()));
Integer amount=response.jsonPath().getInt("data.amount");
Assert.assertTrue(amount==0, network.message(params, BasicConfig.MOBILE_head, "金额", response.body().asString()));
Integer checkOpen =response.jsonPath().getInt("data.checkOpen");//0关闭,1开启
Assert.assertTrue(checkOpen==0, network.message(params, BasicConfig.MOBILE_head, "确认信息开关开启", response.body().asString()));
Integer checkRedOpen=response.jsonPath().getInt("data.checkRedOpen");//0关闭,1开启
Assert.assertTrue(checkRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户确认信息红包开关开启", response.body().asString()));
Integer signEntranceOpen =response.jsonPath().getInt("data.signEntranceOpen");//0关闭,1开启
Assert.assertTrue(signEntranceOpen==0, network.message(params, BasicConfig.MOBILE_head, "奖品前后入口开关开启", response.body().asString()));
Integer signEntranceRedOpen=response.jsonPath().getInt("data.signEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(signEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收红包开关开启", response.body().asString()));
Integer agentSignEntranceRedOpen =response.jsonPath().getInt("data.agentSignEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(agentSignEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收代理人得红包开关开启", response.body().asString()));
Integer agentCheckRedOpen=response.jsonPath().getInt("data.agentCheckRedOpen");//0关闭,1开启
Assert.assertTrue(agentCheckRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "代理人核奖红包开启", response.body().asString()));
}
@Test(description="获取代理人中奖名单",priority = 5)
public void 获取代理人中奖名单() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
Response response = network.getResponse(params,BasicConfig.MOBILE_RewardAgentList);
Object list = response.jsonPath().getJsonObject("data.list");
System.out.println(list);
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_RewardAgentList, "未获取到代理人中奖名单", response.body().asString()));
}
//扫码签收核奖_不开启红包
@Test(description = "扫码签收核奖_不开启红包", priority = 6)
public void 扫码签收核奖_不开启红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(1);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启红包设置失败", response.body().asString()));
}
//访客查询绑定关系
@Test(description="通过绑定关系查询名片我的福利资料签收等",priority = 7)
public void 通过绑定关系查询名片福利资料签收等() {
visitorAuth10();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_small);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
String agentId =response.jsonPath().getString("data.agentId");
Assert.assertEquals(agentId,"Kj22MjMxMQ", network.message(params, BasicConfig.MOBILE_small, "未获取到代理人信息", response.body().asString()));
}
@Test(description="获取奖品签收信息",priority = 8)
public void 获取奖品签收信息() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
//已中奖用户
visitorAuth10();
Response response = network.getResponse(params,BasicConfig.MOBILE_visitorSignInfo);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer rewardPacketSignOpen =response.jsonPath().getInt("data.rewardPacketSignOpen");
Assert.assertTrue(rewardPacketSignOpen==0, network.message(params, BasicConfig.MOBILE_visitorSignInfo, "签收有红包", response.body().asString()));
Object welfareVos =response.jsonPath().getJsonObject("data.welfareVos");
Assert.assertNotNull(welfareVos,network.message(params, BasicConfig.MOBILE_visitorSignInfo, "奖品列表为空", response.body().asString()));
//非中奖用户
visitorAuth6();
Response signInfoRes = network.getResponse(params,BasicConfig.MOBILE_visitorSignInfo);
Object data1 = signInfoRes.jsonPath().getJsonObject("data");
System.out.println(signInfoRes.body().asString());
Integer rewardPacketSignOpen1 =signInfoRes.jsonPath().getInt("data.rewardPacketSignOpen");
Assert.assertTrue(rewardPacketSignOpen1==0, network.message(params, BasicConfig.MOBILE_visitorSignInfo, "签收有红包", signInfoRes.body().asString()));
Object welfareVos1 =signInfoRes.jsonPath().getJsonObject("data.welfareVos");
Assert.assertNull(welfareVos1,network.message(params, BasicConfig.MOBILE_visitorSignInfo, "奖品列表为空", signInfoRes.body().asString()));
}
@Test(description="签收奖品",priority = 9)
public void 签收奖品() {
visitorAuth10();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params,BasicConfig.MOBILE_doSign);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_doSign, "签收失败", response.body().asString()));
}
@Test(description="扫码签收核奖不开启红包_获取代理人中奖头部信息",priority = 10)
public void 扫码签收核奖不开启红包_获取代理人中奖头部信息() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_head);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer allCount =response.jsonPath().getInt("data.allCount");
Assert.assertTrue(allCount>5, network.message(params, BasicConfig.MOBILE_head, "中奖总数", response.body().asString()));
Integer signCount=response.jsonPath().getInt("data.signCount");
Assert.assertTrue(signCount==1, network.message(params, BasicConfig.MOBILE_head, "签收数量", response.body().asString()));
Integer unSignCount =response.jsonPath().getInt("data.unSignCount");
Assert.assertTrue(unSignCount>5, network.message(params, BasicConfig.MOBILE_head, "未签收数量", response.body().asString()));
Integer amount=response.jsonPath().getInt("data.amount");
Assert.assertTrue(amount==0, network.message(params, BasicConfig.MOBILE_head, "金额", response.body().asString()));
Integer checkOpen =response.jsonPath().getInt("data.checkOpen");//0关闭,1开启
Assert.assertTrue(checkOpen==0, network.message(params, BasicConfig.MOBILE_head, "确认信息开关开启", response.body().asString()));
Integer checkRedOpen=response.jsonPath().getInt("data.checkRedOpen");//0关闭,1开启
Assert.assertTrue(checkRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户确认信息红包开关开启", response.body().asString()));
Integer signEntranceOpen =response.jsonPath().getInt("data.signEntranceOpen");//0关闭,1开启
Assert.assertTrue(signEntranceOpen==0, network.message(params, BasicConfig.MOBILE_head, "奖品签收入口开关开启", response.body().asString()));
Integer signEntranceRedOpen=response.jsonPath().getInt("data.signEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(signEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收红包开关开启", response.body().asString()));
Integer agentSignEntranceRedOpen =response.jsonPath().getInt("data.agentSignEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(agentSignEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收代理人得红包开关开启", response.body().asString()));
Integer agentCheckRedOpen=response.jsonPath().getInt("data.agentCheckRedOpen");//0关闭,1开启
Assert.assertTrue(agentCheckRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "代理人核奖红包开启", response.body().asString()));
}
@Test(description = "扫码签收核奖_代理人得红包", priority = 11)
public void 扫码签收核奖_代理人得红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(2);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启核奖设置失败", response.body().asString()));
}
@Test(description="扫码签收核奖代理人得红包_获取代理人中奖头部信息",priority = 12)
public void 扫码签收核奖代理人得红包_获取代理人中奖头部信息() {
agentAuth();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_head);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer allCount =response.jsonPath().getInt("data.allCount");
Assert.assertTrue(allCount>5, network.message(params, BasicConfig.MOBILE_head, "中奖总数", response.body().asString()));
Integer signCount=response.jsonPath().getInt("data.signCount");
Assert.assertTrue(signCount==1, network.message(params, BasicConfig.MOBILE_head, "签收数量", response.body().asString()));
Integer unSignCount =response.jsonPath().getInt("data.unSignCount");
Assert.assertTrue(unSignCount>5, network.message(params, BasicConfig.MOBILE_head, "未签收数量", response.body().asString()));
Integer amount=response.jsonPath().getInt("data.amount");
Assert.assertTrue(amount==0, network.message(params, BasicConfig.MOBILE_head, "金额", response.body().asString()));
Integer checkOpen =response.jsonPath().getInt("data.checkOpen");//0关闭,1开启
Assert.assertTrue(checkOpen==0, network.message(params, BasicConfig.MOBILE_head, "确认信息开关开启", response.body().asString()));
Integer checkRedOpen=response.jsonPath().getInt("data.checkRedOpen");//0关闭,1开启
Assert.assertTrue(checkRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户确认信息红包开关开启", response.body().asString()));
Integer signEntranceOpen =response.jsonPath().getInt("data.signEntranceOpen");//0关闭,1开启
Assert.assertTrue(signEntranceOpen==1, network.message(params, BasicConfig.MOBILE_head, "奖品签收入口开关开启", response.body().asString()));
Integer signEntranceRedOpen=response.jsonPath().getInt("data.signEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(signEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收红包开关开启", response.body().asString()));
Integer agentSignEntranceRedOpen =response.jsonPath().getInt("data.agentSignEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(agentSignEntranceRedOpen==1, network.message(params, BasicConfig.MOBILE_head, "客户签收代理人得红包开关开启", response.body().asString()));
Integer agentCheckRedOpen=response.jsonPath().getInt("data.agentCheckRedOpen");//0关闭,1开启
Assert.assertTrue(agentCheckRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "代理人核奖红包开启", response.body().asString()));
}
@Test(description = "扫码签收核奖_客户得红包", priority = 13)
public void 扫码签收核奖_客户得红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(3);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "扫码签收代理人得红包配置失败", response.body().asString()));
}
//访客查询绑定关系
@Test(description="访客查询与代理人绑定关系",priority = 14)
public void 访客查询与代理人绑定关系() {
visitorAuth9();
ThreadSleepUtils.sleep(100000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_small);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
String agentId =response.jsonPath().getString("data.agentId");
Assert.assertEquals(agentId,"Kj22MjMxMQ", network.message(params, BasicConfig.MOBILE_small, "未获取到代理人信息", response.body().asString()));
}
@Test(description="访客获取奖品签收信息",priority = 15)
public void 访客获取奖品签收信息() {
visitorAuth9();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_visitorSignInfo);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer rewardPacketSignOpen =response.jsonPath().getInt("data.rewardPacketSignOpen");
Assert.assertTrue(rewardPacketSignOpen==1, network.message(params, BasicConfig.MOBILE_visitorSignInfo, "签收无红包", response.body().asString()));
Object welfareVos =response.jsonPath().getJsonObject("data.welfareVos");
Assert.assertNotNull(welfareVos,network.message(params, BasicConfig.MOBILE_visitorSignInfo, "奖品列表为空", response.body().asString()));
}
@Test(description="访客签收奖品",priority = 16)
public void 访客签收奖品() {
visitorAuth9();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params,BasicConfig.MOBILE_doSign);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_doSign, "签收失败", response.body().asString()));
}
@Test(description="签收奖品之后开红包",priority = 17)
public void 签收奖品之后开红包() {
visitorAuth9();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(params,BasicConfig.MOBILE_signOpen);
System.out.println(response.body().asString());
int receiveAmount = response.jsonPath().getInt("data.receiveAmount");
Assert.assertTrue(receiveAmount==30, network.message(params, BasicConfig.MOBILE_signOpen, "签收失败", response.body().asString()));
}
@Test(description="访客获取奖品签收后信息",priority = 18)
public void 访客获取奖品签收后信息() {
visitorAuth9();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_visitorSignInfo);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer rewardPacketSignOpen =response.jsonPath().getInt("data.rewardPacketSignOpen");
Assert.assertTrue(rewardPacketSignOpen==1, network.message(params, BasicConfig.MOBILE_visitorSignInfo, "签收无红包", response.body().asString()));
Integer receiveAmount =response.jsonPath().getInt("data.receiveAmount");
Assert.assertTrue(receiveAmount==30,network.message(params, BasicConfig.MOBILE_visitorSignInfo, "红包金额为空", response.body().asString()));
}
//代理人
@Test(description="扫码签收核奖客户得红包_获取代理人头部信息",priority = 19)
public void 扫码签收核奖客户得红包_获取代理人头部信息() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_head);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Integer allCount =response.jsonPath().getInt("data.allCount");
Assert.assertTrue(allCount>5, network.message(params, BasicConfig.MOBILE_head, "中奖总数", response.body().asString()));
Integer signCount=response.jsonPath().getInt("data.signCount");
Assert.assertTrue(signCount==2, network.message(params, BasicConfig.MOBILE_head, "签收数量", response.body().asString()));
Integer unSignCount =response.jsonPath().getInt("data.unSignCount");
Assert.assertTrue(unSignCount>4, network.message(params, BasicConfig.MOBILE_head, "未签收数量", response.body().asString()));
Integer amount=response.jsonPath().getInt("data.amount");
Assert.assertTrue(amount==30, network.message(params, BasicConfig.MOBILE_head, "金额", response.body().asString()));
Integer signEntranceOpen =response.jsonPath().getInt("data.signEntranceOpen");//0关闭,1开启
Assert.assertTrue(signEntranceOpen==1, network.message(params, BasicConfig.MOBILE_head, "奖品签收入口开关开启", response.body().asString()));
Integer signEntranceRedOpen=response.jsonPath().getInt("data.signEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(signEntranceRedOpen==1, network.message(params, BasicConfig.MOBILE_head, "客户签收红包开关开启", response.body().asString()));
Integer agentSignEntranceRedOpen =response.jsonPath().getInt("data.agentSignEntranceRedOpen");//0关闭,1开启
Assert.assertTrue(agentSignEntranceRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "客户签收代理人得红包开关开启", response.body().asString()));
Integer agentCheckRedOpen=response.jsonPath().getInt("data.agentCheckRedOpen");//0关闭,1开启
Assert.assertTrue(agentCheckRedOpen==0, network.message(params, BasicConfig.MOBILE_head, "代理人核奖红包开启", response.body().asString()));
}
@Test(description="获取奖品签收码信息",priority = 20)
public void 获取奖品签收码信息() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_signInfo);
boolean success=response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(params, BasicConfig.MOBILE_signInfo, "接口调用失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
String qrCode=response.jsonPath().getString("data.qrCode");
Assert.assertNotNull(qrCode, network.message(params, BasicConfig.MOBILE_signInfo, "未获取到签收二维吗", response.body().asString()));
String sponsor=response.jsonPath().getString("data.sponsor");
Assert.assertNotNull(sponsor, network.message(params, BasicConfig.MOBILE_signInfo, "未获取到主办方信息", response.body().asString()));
String title=response.jsonPath().getString("data.title");
Assert.assertNotNull(title, network.message(params, BasicConfig.MOBILE_signInfo, "未获取到直播标题", response.body().asString()));
}
@Test(description="获取直播奖品寄送方式",priority = 21)
public void 获取直播奖品寄送方式() {
agentAuth();
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_getDeliveryWay);
boolean success=response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(params, BasicConfig.MOBILE_getDeliveryWay, "接口调用失败", response.body().asString()));
Integer data = response.jsonPath().getInt("data");
System.out.println(data);
Assert.assertTrue(data==0, network.message(params, BasicConfig.MOBILE_getDeliveryWay, "未获取到签收二维吗", response.body().asString()));
}
}
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.admin.Authorization;
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 AgentOpen implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@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);
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(2);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启核奖设置失败", response.body().asString()));
}
@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);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getConf, "获取中奖名单配置失败", response.body().asString()));
}
}
package com.kjj.cases.live.signing;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.admin.Authorization;
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 NuclearAward implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "不开启核奖", priority = 1)
public void 不开启核奖() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(1);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(1);
configs.add(saveReward1);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "接口调用失败"+ JSON.toJSONString(response.jsonPath().get()), response.body().asString()));
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启核奖设置失败", response.body().asString()));
}
@Test(description = "获取不开启核奖配置是否正确", priority = 2)
public void 获取不开启核奖配置是否正确() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getConf, "不开启核奖配置未配置成功", response.body().asString()));
}
}
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.admin.Authorization;
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 SignAward implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "扫码签收核奖_不开启红包", priority = 1)
public void 扫码签收核奖_不开启红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(1);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "不开启红包设置失败", response.body().asString()));
}
@Test(description = "获取中奖名单配置", priority = 2)
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getConf, "获取中奖名单配置失败", response.body().asString()));
}
@Test(description = "获取奖品签收小程序码", priority = 3)
public void 获取奖品签收小程序码() {
Map<String, Object> CodeParam = new HashMap<>();
CodeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(CodeParam, BasicConfig.MANAGER_rewardSignQrCode);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(CodeParam, BasicConfig.MANAGER_rewardSignQrCode, "获取小程序码失败", response.body().asString()));
}
}
package com.kjj.cases.live.signing;
import com.kjj.bean.manager.SaveRewardConfig;
import com.kjj.cases.admin.Authorization;
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 UserOpen implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "扫码签收核奖_代理人得红包", priority = 1)
public void 扫码签收核奖_代理人得红包() {
Map<String, Object> configParam = new HashMap<>();
configParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
List<SaveRewardConfig> configs = new ArrayList<>();
SaveRewardConfig saveReward = new SaveRewardConfig();
saveReward.setConfName(24);
saveReward.setConfValue(3);
configs.add(saveReward);
SaveRewardConfig saveReward1 = new SaveRewardConfig();
saveReward1.setConfName(23);
saveReward1.setConfValue(2);
configs.add(saveReward1);
SaveRewardConfig saveReward2 = new SaveRewardConfig();
saveReward2.setConfName(25);
saveReward2.setConfValue(1);
configs.add(saveReward2);
configParam.put("list",configs);
Response response = network.postResponse(configParam, BasicConfig.MANAGER_saveRewardConfig);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(configParam, BasicConfig.MANAGER_saveRewardConfig, "扫码签收代理人得红包配置失败", response.body().asString()));
}
@Test(description = "获取中奖名单配置", priority = 2)
public void 获取中奖名单配置() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getConf);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getConf, "获取代理人得红包配置失败", response.body().asString()));
}
}
......@@ -530,11 +530,10 @@ public class BasicConfig {
public static final String MANAGER_getConf = MANAGER_HOST+ "/kjy/manager/live/awardGrant/getConf";
public static final String MANAGER_rewardSignQrCode = MANAGER_HOST+ "/kjy/manager/live/awardGrant/rewardSignQrCode";
public static final String MANAGER_saveRewardConfig = MANAGER_HOST+ "/kjy/manager/live/awardGrant/saveRewardConfig";
public static final String MOBILE_small = MOBILE_HOST + "/kjy/live/card/user/small";
public static final String MOBILE_visitorSignInfo = MOBILE_HOST + "/kjy/live/reward/visitor/signInfo";
public static final String MOBILE_doSign = MOBILE_HOST + "/kjy/live/reward/visitor/doSign";
public static final String MOBILE_signOpen = MOBILE_HOST + "/kjy/live/visitor/reward/winner/signOpen";
......
......@@ -186,35 +186,12 @@
</classes>
</test>
<!-- <test preserve-order="true" name="奖品发放配置-不开启核奖">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.Reward"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="奖品发放配置-不开启核奖">
<classes>
<class name="com.kjj.cases.live.signing.NuclearAward"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_不开启红包">
<classes>
<class name="com.kjj.cases.live.signing.SignAward"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_代理人得红包">
<test preserve-order="true" name="奖品发放配置">
<classes>
<class name="com.kjj.cases.live.signing.AgentOpen"/>
<class name="com.kjj.cases.live.agent.Reward"/>
</classes>
</test>
<test preserve-order="true" name="扫码签收核奖_客户得红包">
<classes>
<class name="com.kjj.cases.live.signing.UserOpen"/>
</classes>
</test>
<test preserve-order="true" name="指定中奖付款码">
<classes>
......
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