Commit 15b684e2 authored by 别湘灵's avatar 别湘灵

代理人首页

parent d454d407
......@@ -20,7 +20,7 @@ public class RedLuckResult {
}
private String hasNext;
......
package com.kjj.bean;
import lombok.Data;
@Data
public class RedOpendate {
private int state;
private String amount;
private String luck;
private String code;
}
......@@ -8,7 +8,6 @@ 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;
......@@ -18,13 +17,7 @@ import java.util.Map;
public class LiveVistorRed implements AdminAuthorization{
public String confId_Red;
@BeforeClass
public void setUp() {
adminAuth();
}
public String red_sharesign;
private AnchorRedList.RedList getRed(List<AnchorRedList.RedList> lists){
for (AnchorRedList.RedList red : lists) {
if (red.getRedStatus()==1){
......@@ -34,68 +27,137 @@ public class LiveVistorRed implements AdminAuthorization{
return null;
}
/*主播端添加红包*/
@Test(description = "主播端添加红包", priority = 1)
public void 主播端添加红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("luck","0");
params.put("general","0");
params.put("totalAmount","200");
params.put("showAmount","200");
params.put("luckAmount","80");
params.put("luckNum","1");
params.put("luckHelpNum","1");
params.put("generalNum","4");
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId","");
Response response = network.postResponse(params, BasicConfig.MOBILE_RedSaveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedSaveOrUpdate, "主播端添加红包失败", response.body().asString()));
}
/*主播端红包轮次查询*/
@Test(description = "主播端红包轮次查询", priority = 1)
@Test(description = "主播端红包轮次查询", priority = 2)
public void 主播端红包轮次查询()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_AnchorRedList);
AnchorRedList Beans=JsonUtil.parseResponseToBean(response, AnchorRedList.class);
AnchorRedList.RedList notPublishRed = getRed(Beans.getRedList());
confId_Red = notPublishRed.getConfId();
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_AnchorRedList, "查询主播端红包轮次失败", response.body().asString()));
}
/*主播端上架普通红包*/
@Test(description = "主播端上架普通红包", priority = 2)
@Test(description = "主播端上架普通红包", priority = 3)
public void 主播端上架手气王红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_Grounding);
boolean data = response.jsonPath().getBoolean("data");
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_Grounding, "上架普通红包失败", response.body().asString()));
}
/*主播端发放普通红包*/
@Test(description = "主播端发放普通红包", priority = 3)
public void 主播端发放普通红包()
/*访客端-获取直播间参数-getShareSign*/
@Test(description = "获取直播间参数", priority = 4)
public void 获取直播间参数()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shareType", 2);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedGetShareSign);
HashMap data = response.jsonPath().getJsonObject("data");
System.out.println(data);
this.red_sharesign = (String)data.get("shareSign");
System.out.println(red_sharesign);
Assert.assertNotNull(red_sharesign, network.message(params, BasicConfig.MOBILE_GETSHARESIGN, "获取直播间参数失败", response.body().asString()));
}
/*访客端助力者-助力查询*/
@Test(description = "助力者助力查询", priority = 5)
public void 助力者助力查询()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedStart);
boolean data = response.jsonPath().getBoolean("data");
params.put("confId", confId_Red);
params.put("shareSign", red_sharesign);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedHelpQuery);
RedHelpQuery data=JsonUtil.parseResponseToBean(response, RedHelpQuery.class);
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedStart, "上架普通红包失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedHelpQuery, "帮好友助力失败", response.body().asString()));
}
/*开红包*/
@Test(description = "开红包", priority = 4)
public void 开红包()
/*访客端助力者-帮好友助力1*/
@Test(description = "帮好友助力", priority = 6)
public void 帮好友助力()
{
visitorAuth2();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shareSign", red_sharesign);
params.put("confRedPacketId", confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedLuckHelp);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedLuckHelp, "帮好友助力失败", response.body().asString()));
}
ThreadSleepUtils.sleep(60000);
/*访客端助力者-帮好友助力2*/
@Test(description = "帮好友助力2", priority = 7)
public void 帮好友助力2()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedOpen);
params.put("shareSign", red_sharesign);
params.put("confRedPacketId", confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedLuckHelp);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedOpen, "开红包失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedLuckHelp, "帮好友助力失败", response.body().asString()));
}
/*主播端发放普通红包*/
@Test(description = "主播端发放普通红包", priority = 8)
public void 主播端发放普通红包()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedStart);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedStart, "上架普通红包失败", response.body().asString()));
}
/*查询红包开始时间,倒计时*/
@Test(description = "查询红包开始时间", priority = 5)
@Test(description = "查询红包开始时间", priority = 9)
public void 查询红包开始时间()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId",confId_Red);
......@@ -105,47 +167,55 @@ public class LiveVistorRed implements AdminAuthorization{
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedGetSimple, "查询主播端发放红包开始时间失败", response.body().asString()));
}
/*主播端获取剩余红包金额*/
@Test(description = "获取剩余红包金额", priority = 6)
public void 获取剩余红包金额()
/*被助力者-红包助力详情信息查询*/
@Test(description = "红包详情助力信息", priority = 10)
public void 红包详情助力信息()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_GetSurplusAmount);
boolean data = response.jsonPath().getBoolean("success");
params.put("confId", confId_Red);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_RedHelpDetail);
RedHepDetail data = JsonUtil.parseResponseToBean(response, RedHepDetail.class);
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_GetSurplusAmount, "查询剩余红包失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedHelpDetail, "查询红包状态失败", response.body().asString()));
}
/*主播端添加红包*/
@Test(description = "主播端添加红包", priority = 7)
public void 主播端添加红包()
/*红包*/
@Test(description = "开红包", priority = 11)
public void 红包()
{
visitorAuth();
ThreadSleepUtils.sleep(60000);
Map<String, Object> params = new HashMap<>();
params.put("luck","0");
params.put("general","0");
params.put("totalAmount","200");
params.put("showAmount","200");
params.put("luckAmount","80");
params.put("luckNum","1");
params.put("luckHelpNum","1");
params.put("generalNum","4");
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId","");
Response response = network.postResponse(params, BasicConfig.MOBILE_RedSaveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
Response response = network.postResponse(params, BasicConfig.MOBILE_RedOpen);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedSaveOrUpdate, "主播端添加红包失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedOpen, "开红包失败", response.body().asString()));
}
/*领红包轮询结果*/
@Test(description = "领红包轮询结果", priority = 12)
public void 领红包轮询结果()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
Response response = network.getResponse(params, BasicConfig.MOBILE_OpenState);
RedOpendate data=JsonUtil.parseResponseToBean(response, RedOpendate.class);
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_OpenState, "领红包轮询结果查询失败", response.body().asString()));
}
/*访客端领取红包*/
/*查询访客端红包状态*/
@Test(description = "红包状态查询", priority = 8)
@Test(description = "红包状态查询", priority = 13)
public void 红包状态查询列表()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_FindRedList);
......@@ -154,9 +224,10 @@ public class LiveVistorRed implements AdminAuthorization{
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_FindRedList, "查询红包状态失败", response.body().asString()));
}
@Test(description = "红包个数", priority = 9)
@Test(description = "红包个数", priority = 14)
public void 红包个数()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
......@@ -167,9 +238,10 @@ public class LiveVistorRed implements AdminAuthorization{
}
/*红包简介详情*/
@Test(description = "红包简介详情", priority = 10)
@Test(description = "红包简介详情", priority = 15)
public void 红包查询列表()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
......@@ -179,23 +251,13 @@ public class LiveVistorRed implements AdminAuthorization{
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedFindSimpleDetail, "查询红包列表失败", response.body().asString()));
}
/*红包详情助力信息*/
@Test(description = "红包详情助力信息", priority = 11)
public void 红包详情助力信息()
{
Map<String, Object> params = new HashMap<>();
params.put("confId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("liveId", confId_Red);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedHelpDetail);
RedHepDetail data = JsonUtil.parseResponseToBean(response, RedHepDetail.class);
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedHelpDetail, "查询红包状态失败", response.body().asString()));
}
/*获取红包小程序分享信息*/
@Test(description = "获取红包小程序分享信息", priority = 12)
@Test(description = "获取红包小程序分享信息", priority = 16)
public void 获取红包小程序分享信息()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_GetRedMpShare);
......@@ -204,93 +266,26 @@ public class LiveVistorRed implements AdminAuthorization{
}
/*查询红包领取列表*/
@Test(description = "查询红包领取列表", priority = 13)
public void 查询红包领取列表()
{
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedResultList);
RedLuckResult Beans = JsonUtil.parseResponseToBean(response, RedLuckResult.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedResultList, "查询红包领取列表失败", response.body().asString()));
}
/*获取直播间参数-getShareSign*/
@Test(description = "获取直播间参数", priority = 14)
public void 获取直播间参数()
{
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shareType", 2);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedGetShareSign);
GetShareSign Beans = JsonUtil.parseResponseToBean(response, GetShareSign.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedGetShareSign, "获取直播间参数失败", response.body().asString()));
}
/*帮好友助力*/
@Test(description = "帮好友助力", priority = 15)
public void 帮好友助力()
/*领红包结果*/
@Test(description = "领红包结果", priority = 17)
public void 领红包结果()
{
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shareSign", "2fk2w3aVT6eyfgwFQZJEAqTFpYerrB8SZ2CuWvbmWTX6W42em1tNHR664Gzo9wU5fhSZyHYtLrFcWYrZURc8CU49UAw");
params.put("confRedPacketId", "Kj21NDE2NTU");
Response response = network.postResponse(params, BasicConfig.MOBILE_RedLuckHelp);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedLuckHelp, "帮好友助力失败", response.body().asString()));
}
/*助力查询*/
@Test(description = "助力查询", priority = 16)
public void 助力查询()
{
Map<String, Object> params = new HashMap<>();
params.put("confId", confId_Red);
params.put("shareSign", "2fk2w3aVT6eyfgwFQZJEAqTFpYerrB8SZ2CuWvbmWTZWET36mtkmgvaiyvG3hx95Zn1aoQ1KTKB5HYDKJVc9mbzmHL7");
Response response = network.postResponse(params, BasicConfig.MOBILE_RedHelpQuery);
RedHelpQuery data=JsonUtil.parseResponseToBean(response, RedHelpQuery.class);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedState);
RedState data=JsonUtil.parseResponseToBean(response, RedState.class);
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedHelpQuery, "帮好友助力失败", response.body().asString()));
}
/* 助力列表*/
@Test(description = "助力列表", priority = 17)
public void 助力列表()
{
Map<String, Object> params = new HashMap<>();
params.put("id", "Kj22NTM5MQ");
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_RedHelpInfo);
RedHelpInfo Beans = JsonUtil.parseResponseToBean(response, RedHelpInfo.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedHelpInfo, "查询助力列表失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedState, "领红包结果查询失败", response.body().asString()));
}
/*手气王公示*/
@Test(description = "手气王公示", priority = 18)
public void 手气王公示()
{
visitorAuth();
ThreadSleepUtils.sleep(15000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
......@@ -300,21 +295,35 @@ public class LiveVistorRed implements AdminAuthorization{
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedLuckResult, "查询手气王公示失败", response.body().asString()));
}
/*领红包结果*/
@Test(description = "领红包结果", priority = 19)
public void 领红包结果()
/*查询红包领取列表*/
@Test(description = "查询红包领取列表", priority = 19)
public void 查询红包领取列表()
{
visitorAuth();
ThreadSleepUtils.sleep(10000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", confId_Red);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedState);
RedState data=JsonUtil.parseResponseToBean(response, RedState.class);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_RedResultList);
RedLuckResult Beans = JsonUtil.parseResponseToBean(response, RedLuckResult.class);
System.out.println(JSON.toJSONString(Beans));
Assert.assertNotNull(Beans, network.message(params, BasicConfig.MOBILE_RedResultList, "查询红包领取列表失败", response.body().asString()));
}
/*主播端获取剩余红包金额*/
@Test(description = "获取剩余红包金额", priority = 20)
public void 获取剩余红包金额()
{
adminAuth();
Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params, BasicConfig.MOBILE_GetSurplusAmount);
boolean data = response.jsonPath().getBoolean("success");
System.out.println(JSON.toJSONString(data));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_RedState, "领红包结果查询失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_GetSurplusAmount, "查询剩余红包失败", response.body().asString()));
}
}
......@@ -3,7 +3,7 @@ package com.kjj.config;
public class BasicConfig {
public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送
public static final boolean isPushReport =true; //true
public static final boolean isPushReport =false; //true
// 代理人微信昵称
public static final String WECHAT_NAME = "嘿保险"; //true
// 代理人的openid(固定)
......@@ -153,6 +153,7 @@ public class BasicConfig {
public static final String MOBILE_RedLuckResult = MOBILE_HOST + "/clue/red/luckResultList";
public static final String MOBILE_RedLuckHelp = MOBILE_HOST + "/kjy/live/user/red/help";
public static final String MOBILE_QuesRewardList = MOBILE_HOST + "/conf/live/ques/reward/list";
public static final String MOBILE_OpenState = MOBILE_HOST + "/clue/red/open/state";
......
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