Commit 34c11595 authored by xiamengchen's avatar xiamengchen

feat:直播配置优化接口修改+新增活动分享默认配置

parent b80f3a30
......@@ -53,7 +53,6 @@ public class FlipCard implements Authorization {
public void 开启翻牌配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",6441);
Params.put("confStatus",2);
Response response = network.postResponse(Params, BasicConfig.MANAGER_wordSwitchStatus);
boolean data = response.jsonPath().getBoolean("data");
......@@ -65,7 +64,6 @@ public class FlipCard implements Authorization {
public void 编辑红包等级(){
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",6451);
Params.put("firstInviteStatus",2);
Params.put("freeNum",3);
Params.put("helpNum",2);
......@@ -84,41 +82,26 @@ public class FlipCard implements Authorization {
public void 查看直播翻牌配置详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",6439);
Response response = network.getResponse(Params, BasicConfig.MANAGER_detailV2);
Object data = response.jsonPath().getJsonObject("data");
redConfId = response.jsonPath().getString("data.stepReds.get(2).redConfId");
System.out.println(data);
System.out.println(redConfId);
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_detailV2, "查看直播翻牌配置详情失败", response.body().asString()));
Assert.assertEquals(response.jsonPath().getInt("data.openStatus"), 2, network.message(Params, BasicConfig.MANAGER_detailV2, "翻牌配置开启状态错误", response.body().asString()));
}
@Test(description = "删除红包等级",priority = 5)
public void 删除红包等级(){
Map<String,Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",6439);
Params.put("redConfId",redConfId);
//Params.put("redConfId",28877);
Response response = network.postResponse(Params,BasicConfig.MANAGER_wordDelete);
boolean data = response.jsonPath().getBoolean("data");
String desc = response.jsonPath().getString("desc");
Assert.assertTrue(data, network.message(Params,BasicConfig.MANAGER_wordDelete,"删除红包等级失败",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(Params,BasicConfig.MANAGER_wordDelete,"删除红包等级失败",response.body().asString()));
}
@Test(description = "查看直播配置", priority = 6)
public void 查看直播配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
//Params.put("liveId",6439);
Response response = network.getResponse(Params, BasicConfig.MANAGER_getConfDetail);
boolean flipWordConfBuildStatus = response.jsonPath().getBoolean("data.flipWordConfBuildStatus");
System.out.println(flipWordConfBuildStatus);
Assert.assertTrue(flipWordConfBuildStatus, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未配置翻牌", response.body().asString()));
boolean flipWordConfStatus = response.jsonPath().getBoolean("data.flipWordConfStatus");
System.out.println(flipWordConfStatus);
Assert.assertTrue(flipWordConfStatus, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未开启翻牌", response.body().asString()));
}
@Test(description = "翻牌集字配置详情",priority = 7)
public void 翻牌集字配置详情(){
......
package com.kjj.cases.live.liveConfig;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.bean.answer.AddReward;
import com.kjj.bean.answer.AddWelfareConf;
import com.kjj.bean.answer.RewardList;
......@@ -13,6 +12,7 @@ import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
......@@ -32,6 +32,7 @@ public class SaveLive implements Authorization {
private Integer taskId;
public List<RedList> redId;
public List<WelfareList> id; //奖品列表id
private int confID; // 默认抽奖券配置ID
@BeforeClass
public void setUp() {
......@@ -65,6 +66,7 @@ public class SaveLive implements Authorization {
Params.put("preWindowUrl","https://yun.dui88.com/kjy/image/20210629/1624949098093.png");
Params.put("distributionType", 0);
Params.put("existSeriesPoster", 0);
Params.put("followPushState", 0); // 关注直播间用户是否推送开关,0 = false
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
ProvinceCityCodeList save = new ProvinceCityCodeList();
save.setProvinceCode(110000);
......@@ -1893,7 +1895,7 @@ public class SaveLive implements Authorization {
}
@Test(description = "获取好运红包配置详情", priority = 106)
@Test(description = "获取好运红包配置详情", priority = 107)
public void 获取好运红包配置详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -1903,11 +1905,11 @@ public class SaveLive implements Authorization {
Assert.assertTrue(amount==30, network.message(Params, BasicConfig.MANAGER_redConfDetail, "好运红包配置金额不对", response.body().asString()));
int num=response.jsonPath().getInt("data.num");
Assert.assertTrue(num==1, network.message(Params, BasicConfig.MANAGER_redConfDetail, "好运红包配置总数不对", response.body().asString()));
// 好运红包配置开关状态合并到配置详情接口
Assert.assertEquals(response.jsonPath().getInt("data.confStatus"), 1, network.message(Params, BasicConfig.MANAGER_redConfDetail, "好运红包开关状态错误", response.body().asString()));
}
@Test(description = "开启好运配置开关", priority = 107)
@Test(description = "开启好运配置开关", priority = 106)
public void 开启好运配置开关() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -1919,22 +1921,6 @@ public class SaveLive implements Authorization {
}
@Test(description = "查看直播好运配置状态", priority = 108)
public void 查看直播好运配置状态() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_getConfDetail);
boolean configFortune = response.jsonPath().getBoolean("data.configFortune");
System.out.println(configFortune);
Assert.assertTrue(configFortune, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未配置好运红包", response.body().asString()));
boolean fortuneConfBuildStatus = response.jsonPath().getBoolean("data.fortuneConfBuildStatus");
System.out.println(fortuneConfBuildStatus);
Assert.assertTrue(fortuneConfBuildStatus, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未开启好运红包配置", response.body().asString()));
}
/**
* 直播预告页弹窗
*/
......@@ -2228,7 +2214,25 @@ public class SaveLive implements Authorization {
/**
* 亲友抽奖券配置
*/
@Test(description = "保存亲友抽奖券配置", priority = 124)
/**
* 亲友抽奖券新增默认配置,即有一个默认配置ID
*/
@Test(description = "获取亲友抽奖劵默认配置ID", priority = 124)
public void 获取默认亲友券配置ID(){
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_detailLottery);
Assert.assertNotNull(response.jsonPath().getJsonObject("data"), network.message(Params, BasicConfig.MANAGER_detailLottery, "获取亲友券配置失败", response.body().asString()));
try {
confID = response.jsonPath().getInt("data.id");
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(Params, BasicConfig.MANAGER_detailLottery, "获取默认亲友券配置ID失败", response.body().asString()));
}
}
@Test(description = "保存亲友抽奖券配置", priority = 125)
public void 保存亲友抽奖券配置(){
ssoLogin();
Map<String, Object> Params = new HashMap<>();
......@@ -2240,13 +2244,19 @@ public class SaveLive implements Authorization {
Params.put("lotteryName","亲友抽奖券");
Params.put("lotteryNum",3);
Params.put("lotteryDesc","这是亲友抽奖券的说明");
Params.put("id", confID);
Response response = network.postResponse(Params, BasicConfig.MANAGER_relativeLottery);
System.out.println(response.body().asString());
try {
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_relativeLottery, "保存亲友券配置失败", response.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(Params, BasicConfig.MANAGER_relativeLottery, "获取数据失败", response.body().asString()));
}
}
@Test(description = "查看亲友抽奖券配置详情", priority = 125)
@Test(description = "查看亲友抽奖券配置详情", priority = 127)
public void 查看亲友抽奖券配置详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -2257,7 +2267,7 @@ public class SaveLive implements Authorization {
int lotteryNum = response.jsonPath().getInt("data.lotteryNum");
int openStatus = response.jsonPath().getInt("data.openStatus");
Assert.assertEquals(openStatus,0, network.message(Params, BasicConfig.MANAGER_detailLottery, "亲友抽奖券数开启状态错误", response.body().asString()));
Assert.assertEquals(openStatus,1, network.message(Params, BasicConfig.MANAGER_detailLottery, "亲友抽奖券数开启状态错误", response.body().asString()));
Assert.assertEquals(lotteryNum,3, network.message(Params, BasicConfig.MANAGER_detailLottery, "亲友抽奖券数量错误", response.body().asString()));
}
......@@ -2271,18 +2281,4 @@ public class SaveLive implements Authorization {
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_switchStatusLottery, "开启亲友券配置失败", response.body().asString()));
}
@Test(description = "查询亲友抽奖券配置状态", priority = 127)
public void 查询亲友抽奖券配置状态() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_getConfDetail);
System.out.println(response.body().asString());
boolean fissionLotteryConfBuildStatus = response.jsonPath().getBoolean("data.fissionLotteryConfBuildStatus");
Assert.assertTrue(fissionLotteryConfBuildStatus, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未配置亲友抽奖券", response.body().asString()));
boolean fissionLotteryConfStatus = response.jsonPath().getBoolean("data.fissionLotteryConfStatus");
Assert.assertTrue(fissionLotteryConfStatus, network.message(Params, BasicConfig.MANAGER_getConfDetail, "未配置亲友抽奖券", response.body().asString()));
}
}
......@@ -100,7 +100,9 @@ public class Share implements Authorization {
Params.put("shareType",4);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
// 直播宝箱分享包含一个默认配置,所以新创建的配置索引值为1;
// 其他活动分享同理
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"宝箱裂变分享文案",network.message(Params, BasicConfig.MANAGER_mpShareList, "宝箱裂变分享配置列表为null", response.body().asString()));
}
......@@ -121,7 +123,7 @@ public class Share implements Authorization {
Params.put("shareType",5);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"猜数字红包分享文案",network.message(Params, BasicConfig.MANAGER_mpShareList, "猜数字红包配置列表为null", response.body().asString()));
}
......@@ -142,7 +144,7 @@ public class Share implements Authorization {
Params.put("shareType",6);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"翻牌红包分享文案",network.message(Params, BasicConfig.MANAGER_mpShareList, "翻牌红包配置列表为null", response.body().asString()));
}
......@@ -163,7 +165,7 @@ public class Share implements Authorization {
Params.put("shareType",9);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"好运红包分享",network.message(Params, BasicConfig.MANAGER_mpShareList, "好运红包配置列表为null", response.body().asString()));
}
......@@ -184,7 +186,7 @@ public class Share implements Authorization {
Params.put("shareType",8);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"答题闯关分享文案",network.message(Params, BasicConfig.MANAGER_mpShareList, "答题闯关配置列表为null", response.body().asString()));
}
......@@ -205,7 +207,7 @@ public class Share implements Authorization {
Params.put("shareType",10);
response=network.getResponse(Params, BasicConfig.MANAGER_mpShareList);
System.out.println(response.body().asString());
String mpShareTitle=response.jsonPath().getString("data[0].mpShareTitle");
String mpShareTitle=response.jsonPath().getString("data[1].mpShareTitle");
Assert.assertEquals(mpShareTitle,"亲友抽奖券分享文案",network.message(Params, BasicConfig.MANAGER_mpShareList, "答题闯关配置列表为null", response.body().asString()));
}
......
......@@ -64,6 +64,7 @@ public class SimpleLiveConfig implements Authorization {
Params.put("preWindowUrl","https://yun.dui88.com/kjy/image/20210629/1624949098093.png");
Params.put("distributionType", 1);
Params.put("existSeriesPoster", 0);
Params.put("followPushState", 0);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_0);
liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
......
......@@ -11,10 +11,9 @@ 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;
import java.lang.reflect.Array;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
......@@ -115,8 +114,13 @@ public class RelativeLottery implements Authorization {
params.put("userType","A");
Response response = network.getResponse(params, BasicConfig.MOBILE_helpInfo);
System.out.println(response.body().asString());
Object mpShareTitle = response.jsonPath().getJsonObject("data.mpShareTitle");
Assert.assertEquals(mpShareTitle,"亲友抽奖券分享文案", network.message(params, BasicConfig.MOBILE_helpInfo, "根据分享类型获取分享内容", response.body().asString()));
String mpShareTitle = response.jsonPath().getString("data.mpShareTitle");
// 抽奖劵分享文案有默认配置和个人配置两种
List<String> mpShareTitles = Arrays.asList("亲友抽奖券分享文案", "我在直播间,帮你抢到一张限量抽奖券!快收下~");
if (mpShareTitles.contains(mpShareTitle)){
return;
}
Assert.fail(network.message(params, MOBILE_helpInfo, "根据分享类型获取到的分享内容错误", response.body().asString()));
}
@Test(description = "访客J_获取小程序分享码", priority = 7)
......
......@@ -120,11 +120,12 @@ public class GoldenEgg implements Authorization {
System.out.println(response.body().asString());
Integer openCondition = response.jsonPath().getInt("data.openCondition");
Assert.assertTrue(openCondition > 0, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "查询砸金蛋配置详情失败", response.body().asString()));
Assert.assertEquals(response.jsonPath().getInt("data.confStatus"), 1, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "砸金蛋配置开启状态错误", response.body().asString()));
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "开启砸金蛋配置", priority = 6)
@Test(description = "开启砸金蛋配置", priority = 5)
public void 开启砸金蛋配置() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -136,19 +137,6 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "查询砸金蛋配置状态", priority = 7)
public void 查询宝箱配置状态() {
Map<String, Object> statusParam = new HashMap<>();
statusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(statusParam, BasicConfig.MANAGER_getConfDetail);
System.out.println(response.body().asString());
boolean goldenEggTreasureConfStatus =response.jsonPath().getBoolean("data.goldenEggTreasureConfStatus");
boolean goldenEggTreasureConfBuildStatus =response.jsonPath().getBoolean("data.goldenEggTreasureConfBuildStatus");
Assert.assertTrue(goldenEggTreasureConfStatus, network.message(statusParam, BasicConfig.MANAGER_getConfDetail, "砸金蛋未配置", response.body().asString()));
Assert.assertTrue(goldenEggTreasureConfBuildStatus, network.message(statusParam, BasicConfig.MANAGER_getConfDetail, "砸金蛋未开启", response.body().asString()));
}
@Test(description = "查询砸金蛋配置数据", priority = 8)
public void 查询砸金蛋配置数据() {
visitorAuth1();
......
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