Commit 6c519b7b authored by xiamengchen's avatar xiamengchen

秒杀互动支付成功前流程

parent f8da03ea
......@@ -7,4 +7,5 @@ public class AnchorGetSKList {
private int interactStatus;
private String id;
private int surplusNum;
private String goodsId;
}
......@@ -229,16 +229,6 @@ public class Answer implements Authorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test(description = "代理人关系绑定", priority = 11)
public void 代理人关系绑定() {
agentAuth();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客A查询答题红包配置", priority = 12)
public void 访客A查询答题红包配置()
{
......
......@@ -65,145 +65,145 @@ public class RelativeLottery implements Authorization {
}
@Test(description = "访客H收下抽奖券", priority = 3)
public void 访客H收下抽奖券() {
visitorAuth9();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response bindingRes = network.postResponse(bindingParam, MOBILE_acceptLottery);
boolean success = bindingRes.jsonPath().getJsonObject("success");
Assert.assertTrue(success, network.message(bindingParam, MOBILE_acceptLottery, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客H_分享直播间", priority = 5)
public void 访客H_分享直播间() {
sleep(1000);
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 10);
Response signRes = network.getResponse(signParam, MOBILE_sign);
System.out.println(signRes.body().asString());
String data = signRes.jsonPath().getString("data");
this.shareSign = data;
Assert.assertNotNull(shareSign, network.message(signParam, MOBILE_sign, "分享失败", signRes.body().asString()));
}
@Test(description = "根据分享类型获取分享内容", priority = 6)
public void 根据分享类型获取分享内容() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shareType",14);
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()));
}
@Test(description = "访客H_获取小程序分享码", priority = 7)
public void 访客H_获取小程序分享码() {
sleep(1000);
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(signParam, MOBILE_codeLottery);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertNotNull(data, network.message(signParam, MOBILE_codeLottery, "分享失败", response.body().asString()));
sleep(3000);
response = network.getResponse(signParam, MOBILE_codeDetailLottery);
System.out.println(response.body().asString());
boolean qrCodeUrl = response.jsonPath().getBoolean("data.qrCodeUrl");
Assert.assertNotNull(qrCodeUrl, network.message(signParam, MOBILE_codeDetailLottery, "分享失败", response.body().asString()));
}
@Test(description = "访客H获取直播所有的订阅消息模板", priority = 8)
public void 访客H获取直播所有的订阅消息模板() {
visitorAuth9();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("appid","wx4d7276f866bd24c8");
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
System.out.println(sycRes.body().asString());
Object data = sycRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
}
@Test(description = "邀请Xmz关系绑定", priority = 9)
public void 邀请Xmz关系绑定() {
visitorAuth26();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareSign", shareSign);
Response bindingRes = network.postResponse(bindingParam, MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
Assert.assertTrue(success, network.message(bindingParam, MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "查询访客Xmz绑定结果和绑定凭证", priority = 10)
public void 查询访客Xmz绑定结果和绑定凭证() {
visitorAuth26();
sleep(2000);
Map<String, Object> tokenParam = new HashMap<>();
tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
boolean success = tokenRes.jsonPath().getJsonObject("success");
Integer type = tokenRes.jsonPath().getInt("data.type");
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客A预约直播间", priority = 11)
public void 访客A预约直播间() {
visitorAuth26();
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds1 = new ArrayList<>();
markIds1.add(142L);
markIds1.add(143L);
markIds1.add(140L);
sycParam.put("markIds", markIds1);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "访客Xmz给访客H助力", priority = 12)
public void 访客Xmz给访客H助力() {
visitorAuth26();
sleep(2000);
//获取授权配置助力弹窗
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareType",14);
Response response=network.getResponse(Params,BasicConfig.MOBILE_popupDetail);
System.out.println(response.body().asString());
String helpImg=response.jsonPath().getString("data.currentPopup.helpImg");
Assert.assertNotNull(helpImg,network.message(Params,BasicConfig.MOBILE_popupDetail,"助力弹窗为null",response.body().asString()));
Params.clear();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareSign",shareSign);
Params.put("shareType",14);
Params.put("confId",confId);
response = network.postResponse(Params, BasicConfig.MOBILE_assist);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_assist, "访客Xmz给访客H助力失败", response.body().asString()));
}
@Test(description = "查询亲友券被领取1张", priority = 13)
public void 查询亲友券被领取1() {
visitorAuth9();
Map<String, Object> getLiveAwardListParam = new HashMap<>();
getLiveAwardListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(getLiveAwardListParam, MOBILE_confLottery);
System.out.println(response.body().asString());
int receiverInfoList = response.jsonPath().getInt("data.userDetail.receiverInfoList.size()");
String nickname = response.jsonPath().getString("data.userDetail.receiverInfoList.get(0).nickname");
Assert.assertEquals(receiverInfoList, 1,network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券已接受人数错误", response.body().asString()));
Assert.assertEquals(nickname, "小米粥",network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券领取人错误", response.body().asString()));
}
// @Test(description = "访客H收下抽奖券", priority = 3)
// public void 访客H收下抽奖券() {
// visitorAuth9();
// Map<String, Object> bindingParam = new HashMap<>();
// bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Response bindingRes = network.postResponse(bindingParam, MOBILE_acceptLottery);
// boolean success = bindingRes.jsonPath().getJsonObject("success");
// Assert.assertTrue(success, network.message(bindingParam, MOBILE_acceptLottery, "绑定失败", bindingRes.body().asString()));
// }
//
// @Test(description = "访客H_分享直播间", priority = 5)
// public void 访客H_分享直播间() {
// sleep(1000);
// Map<String, Object> signParam = new HashMap<>();
// signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// signParam.put("shareType", 10);
// Response signRes = network.getResponse(signParam, MOBILE_sign);
// System.out.println(signRes.body().asString());
// String data = signRes.jsonPath().getString("data");
// this.shareSign = data;
// Assert.assertNotNull(shareSign, network.message(signParam, MOBILE_sign, "分享失败", signRes.body().asString()));
//
// }
//
// @Test(description = "根据分享类型获取分享内容", priority = 6)
// public void 根据分享类型获取分享内容() {
// Map<String, Object> params = new HashMap<>();
// params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// params.put("shareType",14);
// 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()));
// }
//
// @Test(description = "访客H_获取小程序分享码", priority = 7)
// public void 访客H_获取小程序分享码() {
// sleep(1000);
// Map<String, Object> signParam = new HashMap<>();
// signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Response response = network.postResponse(signParam, MOBILE_codeLottery);
// System.out.println(response.body().asString());
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertNotNull(data, network.message(signParam, MOBILE_codeLottery, "分享失败", response.body().asString()));
//
// sleep(3000);
// response = network.getResponse(signParam, MOBILE_codeDetailLottery);
// System.out.println(response.body().asString());
// boolean qrCodeUrl = response.jsonPath().getBoolean("data.qrCodeUrl");
// Assert.assertNotNull(qrCodeUrl, network.message(signParam, MOBILE_codeDetailLottery, "分享失败", response.body().asString()));
// }
//
// @Test(description = "访客H获取直播所有的订阅消息模板", priority = 8)
// public void 访客H获取直播所有的订阅消息模板() {
// visitorAuth9();
// Map<String, Object> sycParam = new HashMap<>();
// sycParam.put("appid","wx4d7276f866bd24c8");
// Response sycRes = network.postResponse(sycParam, BasicConfig.USER_wxIdAllList);
// System.out.println(sycRes.body().asString());
// Object data = sycRes.jsonPath().getJsonObject("data");
// Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_wxIdAllList, "获取订阅消息失败", sycRes.body().asString()));
// }
//
// @Test(description = "邀请Xmz关系绑定", priority = 9)
// public void 邀请Xmz关系绑定() {
// visitorAuth26();
// Map<String, Object> bindingParam = new HashMap<>();
// bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// bindingParam.put("shareSign", shareSign);
// Response bindingRes = network.postResponse(bindingParam, MOBILE_binding);
// boolean success = bindingRes.jsonPath().getJsonObject("success");
// Assert.assertTrue(success, network.message(bindingParam, MOBILE_binding, "绑定失败", bindingRes.body().asString()));
// }
//
//
// @Test(description = "查询访客Xmz绑定结果和绑定凭证", priority = 10)
// public void 查询访客Xmz绑定结果和绑定凭证() {
// visitorAuth26();
// sleep(2000);
// Map<String, Object> tokenParam = new HashMap<>();
// tokenParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Response tokenRes = network.getResponse(tokenParam, BasicConfig.MOBILE_Token);
// boolean success = tokenRes.jsonPath().getJsonObject("success");
// Integer type = tokenRes.jsonPath().getInt("data.type");
// Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
// }
//
// @Test(description = "访客A预约直播间", priority = 11)
// public void 访客A预约直播间() {
// visitorAuth26();
// Map<String, Object> sycParam = new HashMap<>();
// sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// sycParam.put("bizType", 1);
// List<Long> markIds1 = new ArrayList<>();
// markIds1.add(142L);
// markIds1.add(143L);
// markIds1.add(140L);
// sycParam.put("markIds", markIds1);
// Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
// Object data = sycRes.jsonPath().getJsonObject("data");
// System.out.println(data);
// Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
// }
//
// @Test(description = "访客Xmz给访客H助力", priority = 12)
// public void 访客Xmz给访客H助力() {
// visitorAuth26();
// sleep(2000);
// //获取授权配置助力弹窗
// Map<String, Object> Params = new HashMap<>();
// Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Params.put("shareType",14);
// Response response=network.getResponse(Params,BasicConfig.MOBILE_popupDetail);
// System.out.println(response.body().asString());
// String helpImg=response.jsonPath().getString("data.currentPopup.helpImg");
// Assert.assertNotNull(helpImg,network.message(Params,BasicConfig.MOBILE_popupDetail,"助力弹窗为null",response.body().asString()));
//
// Params.clear();
// Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Params.put("shareSign",shareSign);
// Params.put("shareType",14);
// Params.put("confId",confId);
// response = network.postResponse(Params, BasicConfig.MOBILE_assist);
// System.out.println(response.body().asString());
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_assist, "访客Xmz给访客H助力失败", response.body().asString()));
// }
//
// @Test(description = "查询亲友券被领取1张", priority = 13)
// public void 查询亲友券被领取1张() {
// visitorAuth9();
// Map<String, Object> getLiveAwardListParam = new HashMap<>();
// getLiveAwardListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// Response response = network.getResponse(getLiveAwardListParam, MOBILE_confLottery);
// System.out.println(response.body().asString());
// int receiverInfoList = response.jsonPath().getInt("data.userDetail.receiverInfoList.size()");
// String nickname = response.jsonPath().getString("data.userDetail.receiverInfoList.get(0).nickname");
// Assert.assertEquals(receiverInfoList, 1,network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券已接受人数错误", response.body().asString()));
// Assert.assertEquals(nickname, "小米粥",network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券领取人错误", response.body().asString()));
// }
}
......@@ -24,7 +24,8 @@ public class ConfSecondKill implements Authorization {
private long newSecKillId; // 会被删除的秒杀id
private static final long secKillGoodsId = 115; // 用来配置轮次的秒杀商品ID
public static final String secKillGoodsIdEncode = IdMakeUtil.managerEncodingId(secKillGoodsId);
private String skId; // 秒杀id
public static String skIdFirst; // 第一轮秒杀id
public static String skIdSecond; // 第二轮秒杀ID
public static int killListSize;
@BeforeClass
......@@ -194,7 +195,25 @@ public class ConfSecondKill implements Authorization {
}
}
@Test(description = "助播端获取秒杀轮次列表", priority = 8)
@Test(description = "新增第二轮秒杀", priority = 8)
public void 新增第二轮秒杀() {
Map<String, Object> secKillAddPar = new HashMap<>();
secKillAddPar.put("goodsId", secKillGoodsIdEncode);
secKillAddPar.put("goodsAmount", 1); // 1 == 0.01
secKillAddPar.put("interactNum", 1);
secKillAddPar.put("ableAgent", 1); // 代理人可参与
secKillAddPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response secKillAddRes = network.postResponse(secKillAddPar, BasicConfig.ANCHOR_secondKillSave);
try {
boolean data = secKillAddRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(secKillAddPar, BasicConfig.ANCHOR_secondKillSave, "新增轮次失败", secKillAddRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(secKillAddPar, BasicConfig.ANCHOR_secondKillSave, "未获取到数据", secKillAddRes.body().asString()));
}
}
@Test(description = "助播端获取秒杀轮次列表", priority = 9)
public void 助播端获取秒杀轮次列表() {
Map<String, Object> liveSecKillPar = new HashMap<>();
liveSecKillPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -203,8 +222,10 @@ public class ConfSecondKill implements Authorization {
try {
secKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, AnchorGetSKList.class);
killListSize = secKillLists.size();
skId = secKillLists.get(killListSize - 1).getId();
System.out.println(skId);
String goodsId = secKillLists.get(0).getGoodsId();
Assert.assertEquals(goodsId, secKillGoodsIdEncode, network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "轮次对应商品ID错误", liveSecKillRes.body().asString()));
skIdFirst = secKillLists.get(0).getId();
skIdSecond = secKillLists.get(1).getId();
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "未获取到数据", liveSecKillRes.body().asString()));
......@@ -212,13 +233,13 @@ public class ConfSecondKill implements Authorization {
}
@Test(description = "助播端编辑秒杀轮次", priority = 9)
@Test(description = "助播端编辑秒杀轮次", priority = 10)
public void 助播端编辑秒杀轮次() {
Map<String, Object> secKillUpdatePar = new HashMap<>();
secKillUpdatePar.put("goodsId", secKillGoodsIdEncode);
secKillUpdatePar.put("goodsAmount", 1);
secKillUpdatePar.put("interactNum", 3);
secKillUpdatePar.put("id", skId);
secKillUpdatePar.put("id", skIdFirst);
secKillUpdatePar.put("ableAgent", 0);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
try {
......
......@@ -2,7 +2,6 @@ package com.kjj.cases.live.secondKill;
import com.kjj.bean.secondKill.AnchorGetSKList;
import com.kjj.bean.secondKill.KillGoods;
import com.kjj.bean.secondKill.SecondKillList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......@@ -15,13 +14,12 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SecondKill implements Authorization {
private String secKillId; // 第一轮秒杀id
private String confId1; // 第一轮秒杀confId
@BeforeClass
public void setUp(){
......@@ -31,23 +29,6 @@ public class SecondKill implements Authorization {
/**
* 直播中编辑秒杀轮次
*/
@Test(description = "获取第一轮秒杀信息", priority = 1)
public void 获取第一轮秒杀信息() {
Map<String, Object> liveSecKillPar = new HashMap<>();
liveSecKillPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response liveSecKillRes = network.getResponse(liveSecKillPar, BasicConfig.MANAGER_secondKillLists);
List<SecondKillList> secondKillLists;
SecondKillList secondKillList = null;
try {
secondKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, SecondKillList.class);
secondKillList = secondKillLists.get(0);
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "未获取到数据", liveSecKillRes.body().asString()));
}
secKillId = IdMakeUtil.managerEncodingId(secondKillList.getId());
System.out.println(secKillId);
}
@Test(description = "修改秒杀商品", priority = 2)
public void 修改秒杀商品() {
......@@ -55,8 +36,8 @@ public class SecondKill implements Authorization {
secKillUpdatePar.put("goodsId", IdMakeUtil.managerEncodingId(111));
secKillUpdatePar.put("goodsAmount", 1);
secKillUpdatePar.put("interactNum", 3);
secKillUpdatePar.put("id", secKillId);
secKillUpdatePar.put("ableAgent", 0);
secKillUpdatePar.put("id", ConfSecondKill.skIdFirst);
secKillUpdatePar.put("ableAgent", 1);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
System.out.println(secKillUpdateRes.body().asString());
}
......@@ -67,8 +48,8 @@ public class SecondKill implements Authorization {
secKillUpdatePar.put("goodsId", ConfSecondKill.secKillGoodsIdEncode);
secKillUpdatePar.put("goodsAmount", 5);
secKillUpdatePar.put("interactNum", 3);
secKillUpdatePar.put("id", secKillId);
secKillUpdatePar.put("ableAgent", 0);
secKillUpdatePar.put("id", ConfSecondKill.skIdFirst);
secKillUpdatePar.put("ableAgent", 1);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
System.out.println(secKillUpdateRes.body().asString());
}
......@@ -79,8 +60,8 @@ public class SecondKill implements Authorization {
secKillUpdatePar.put("goodsId", ConfSecondKill.secKillGoodsIdEncode);
secKillUpdatePar.put("goodsAmount", 1);
secKillUpdatePar.put("interactNum", 1);
secKillUpdatePar.put("id", secKillId);
secKillUpdatePar.put("ableAgent", 0);
secKillUpdatePar.put("id", ConfSecondKill.skIdFirst);
secKillUpdatePar.put("ableAgent", 1);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
System.out.println(secKillUpdateRes.body().asString());
}
......@@ -91,8 +72,8 @@ public class SecondKill implements Authorization {
secKillUpdatePar.put("goodsId", ConfSecondKill.secKillGoodsIdEncode);
secKillUpdatePar.put("goodsAmount", 1);
secKillUpdatePar.put("interactNum", 4);
secKillUpdatePar.put("id", secKillId);
secKillUpdatePar.put("ableAgent", 0);
secKillUpdatePar.put("id", ConfSecondKill.skIdFirst);
secKillUpdatePar.put("ableAgent", 1);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
try {
boolean data = secKillUpdateRes.jsonPath().getBoolean("data");
......@@ -109,8 +90,8 @@ public class SecondKill implements Authorization {
secKillUpdatePar.put("goodsId", ConfSecondKill.secKillGoodsIdEncode);
secKillUpdatePar.put("goodsAmount", 1);
secKillUpdatePar.put("interactNum", 4);
secKillUpdatePar.put("id", secKillId);
secKillUpdatePar.put("ableAgent", 1);
secKillUpdatePar.put("id", ConfSecondKill.skIdFirst);
secKillUpdatePar.put("ableAgent", 0);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.ANCHOR_secondKillUpdate);
try {
boolean data = secKillUpdateRes.jsonPath().getBoolean("data");
......@@ -137,14 +118,14 @@ public class SecondKill implements Authorization {
e.printStackTrace();
Assert.fail(network.message(goodsListPar, BasicConfig.MOBILE_secondKill_getGoodsList, "未获取到数据", goodsListRes.body().asString()));
}
confId1 = goodsListRes.jsonPath().getString("data[0].confId");
ConfSecondKill.skIdFirst = goodsListRes.jsonPath().getString("data[0].confId");
}
@Test(description = "查看秒杀商品详情", priority = 8)
public void 查看秒杀商品详情() {
Map<String, Object> goodsDetailPar = new HashMap<>();
goodsDetailPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
goodsDetailPar.put("confId", confId1);
goodsDetailPar.put("confId", ConfSecondKill.skIdFirst);
Response goodsDetailRes = network.getResponse(goodsDetailPar, BasicConfig.MOBILE_secondKill_getGoodsDetail);
try {
String goodsTitle = goodsDetailRes.jsonPath().getString("data.goodsTitle");
......@@ -162,7 +143,7 @@ public class SecondKill implements Authorization {
public void 助播端上架秒杀() {
adminAuth();
Map<String, Object> goodsOnPar = new HashMap<>();
goodsOnPar.put("id", secKillId);
goodsOnPar.put("id", ConfSecondKill.skIdFirst);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
try {
boolean data = goodsOnRes.jsonPath().getBoolean("data");
......@@ -186,8 +167,26 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "无法同时上架多轮秒杀", priority = 10)
public void 无法同时上架多轮秒杀() {
Map<String, Object> goodsOnPar = new HashMap<>();
goodsOnPar.put("id", ConfSecondKill.skIdSecond);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
try {
boolean success = goodsOnRes.jsonPath().getBoolean("success");
if (success){
Assert.fail(network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "同时上架多轮秒杀成功", goodsOnRes.body().asString()));
}
String code = goodsOnRes.jsonPath().getString("code");
Assert.assertEquals(code, "07230005", network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "失败原因错误", goodsOnRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "未获取到数据", goodsOnRes.body().asString()));
}
}
// 切换访客
@Test(description = "查看当前秒杀商品", priority = 10)
@Test(description = "查看当前秒杀商品", priority = 11)
public void 查看当前秒杀商品() {
visitorAuth();
Map<String, Object> goodsFirstPar = new HashMap<>();
......@@ -195,23 +194,37 @@ public class SecondKill implements Authorization {
Response goodsFirstRes = network.getResponse(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst);
try {
String confId = goodsFirstRes.jsonPath().getString("data.confId");
Assert.assertEquals(confId, confId1, network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "当前秒杀商品配置ID错误", goodsFirstRes.body().asString()));
Assert.assertEquals(confId, ConfSecondKill.skIdFirst, network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "当前秒杀商品配置ID错误", goodsFirstRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "未获取到数据", goodsFirstRes.body().asString()));
}
}
@Test(description = "当前秒杀商品降级接口", priority = 12)
public void 当前秒杀商品降级接口() {
Map<String, Object> downgradeGoodsPar = new HashMap<>();
downgradeGoodsPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response downgradeGoodsRes = network.getResponse(downgradeGoodsPar, BasicConfig.MOBILE_secondKill_downgradeGoodsFirst);
try {
String confId = downgradeGoodsRes.jsonPath().getString("data.confId");
Assert.assertEquals(confId, ConfSecondKill.skIdFirst, network.message(downgradeGoodsPar, BasicConfig.MOBILE_secondKill_goodsFirst, "当前秒杀商品配置ID错误", downgradeGoodsRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(downgradeGoodsPar, BasicConfig.MOBILE_secondKill_goodsFirst, "未获取到数据", downgradeGoodsRes.body().asString()));
}
}
/**
* 下单失败
*/
// 秒杀配置代理人不可参与
@Test(description = "代理人下单", priority = 12)
@Test(description = "代理人下单", priority = 13)
public void 代理人下单() {
agentAuth();
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", confId1);
orderPar.put("confId", ConfSecondKill.skIdFirst);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
......@@ -222,11 +235,11 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "代理人获取下单结果", priority = 13)
public void 代理人获取下单结果() {
@Test(description = "代理人下单失败", priority = 14)
public void 代理人下单失败() {
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", confId1);
orderResultPar.put("confId", ConfSecondKill.skIdFirst);
Response orderResultRes = null;
Object data = null;
int i = 0;
......@@ -259,12 +272,12 @@ public class SecondKill implements Authorization {
}
// 访客被黑名单限制
@Test(description = "黑名单客户下单", priority = 14)
@Test(description = "黑名单客户下单", priority = 15)
public void 黑名单客户下单() {
visitorAuth7();
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", confId1);
orderPar.put("confId", ConfSecondKill.skIdFirst);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
......@@ -275,11 +288,11 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "黑名单客户获取下单结果", priority = 15)
public void 黑名单客户获取下单结果() {
@Test(description = "黑名单客户下单失败", priority = 16)
public void 黑名单客户下单失败() {
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", confId1);
orderResultPar.put("confId", ConfSecondKill.skIdFirst);
Response orderResultRes = null;
Object data = null;
int i = 0;
......@@ -314,12 +327,12 @@ public class SecondKill implements Authorization {
/**
* 下单
*/
@Test(description = "正常用户下单", priority = 16)
@Test(description = "正常用户下单", priority = 19)
public void 正常用户下单() {
visitorAuth();
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", confId1);
orderPar.put("confId", ConfSecondKill.skIdFirst);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
......@@ -330,11 +343,11 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "正常用户获取下单结果", priority = 17)
@Test(description = "正常用户获取下单结果", priority = 20)
public void 正常用户获取下单结果() {
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", confId1);
orderResultPar.put("confId", ConfSecondKill.skIdFirst);
Response orderResultRes = null;
Object data = null;
int i = 0;
......@@ -358,7 +371,7 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "查询待支付状态", priority = 18)
@Test(description = "查询待支付状态", priority = 21)
public void 查询待支付状态() {
Map<String, Object> killGoodsPar = new HashMap<>();
killGoodsPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -367,7 +380,7 @@ public class SecondKill implements Authorization {
List<KillGoods> killGoods = JsonUtil.parseResponseToListBean(killGoodsRes, KillGoods.class);
boolean hasTarget = false;
for (KillGoods killGood : killGoods){
if(killGood.getConfId().equals(confId1)){
if(killGood.getConfId().equals(ConfSecondKill.skIdFirst)){
hasTarget = true;
Assert.assertEquals(killGood.getChargeStatus(), 1, network.message(killGoodsPar, BasicConfig.MOBILE_secondKill_killGoods, "对应轮次支付状态不为待支付", killGoodsRes.body().asString()));
}
......@@ -381,7 +394,7 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "占用库存", priority = 19)
@Test(description = "占用库存", priority = 22)
public void 占用库存() {
// 切换助播端视角获取当前轮次剩余数量
adminAuth();
......@@ -392,7 +405,7 @@ public class SecondKill implements Authorization {
List<AnchorGetSKList> secKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, AnchorGetSKList.class);
boolean hasTarget = false;
for (AnchorGetSKList secKillList : secKillLists){
if (secKillList.getId().equals(confId1)){
if (secKillList.getId().equals(ConfSecondKill.skIdFirst)){
hasTarget = true;
int surplusNum = secKillList.getSurplusNum();
Assert.assertEquals(surplusNum, 3, network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "对应轮次剩余数量有误", liveSecKillRes.body().asString()));
......@@ -407,55 +420,200 @@ public class SecondKill implements Authorization {
}
}
@Test(description = "超时未支付", priority = 20)
@Test(description = "超时未支付", priority = 23)
public void 超时未支付() {
ThreadSleepUtils.sleep(150000); // 两分钟无操作
// 助播端视角查看库存是否释放
Map<String, Object> liveSecKillPar = new HashMap<>();
liveSecKillPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response liveSecKillRes = network.getResponse(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists);
Response liveSecKillRes = null;
try {
long beginTime = new Date().getTime(); // 获取开始时间
long endTime = new Date().getTime(); // 获取结束时间
System.out.println("开始时间:" + beginTime);
boolean hasRelease = false;
while (!hasRelease){
if (endTime - beginTime < 180000){
liveSecKillRes = network.getResponse(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists);
List<AnchorGetSKList> secKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, AnchorGetSKList.class);
boolean hasTarget = false;
for (AnchorGetSKList secKillList : secKillLists){
if (secKillList.getId().equals(confId1)){
if (secKillList.getId().equals(ConfSecondKill.skIdFirst)){
hasTarget = true;
int surplusNum = secKillList.getSurplusNum();
Assert.assertEquals(surplusNum, 4, network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "对应轮次剩余数量有误", liveSecKillRes.body().asString()));
if (surplusNum == 4){
hasRelease = true; // 置释放标记为true
break; // 若查到对应轮次释放,跳出for循环
}else {
endTime = new Date().getTime(); // 若剩余库存还未释放,刷新结束时间,重新获取
System.out.println("当前时间:"+endTime);
}
}
}
if (!hasTarget){
Assert.fail(network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "未获取到对应轮次信息", liveSecKillRes.body().asString()));
Assert.fail(network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "未查询到对应轮次信息", liveSecKillRes.body().asString()));
}
}else {
Assert.fail(network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "订单超时取消3分钟后库存仍未释放出来", liveSecKillRes.body().asString()));
}
}
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(liveSecKillPar, BasicConfig.ANCHOR_secondKillLists, "获取数据失败", liveSecKillRes.body().asString()));
}
}
/**
* 放开代理人秒杀限制
* 助播端需先下架秒杀才能进行编辑
*/
@Test(description = "助播端下架秒杀", priority = 24)
public void 助播端下架秒杀() {
adminAuth();
Map<String, Object> skOffPar = new HashMap<>();
skOffPar.put("id", ConfSecondKill.skIdFirst);
Response skOffRes = network.postResponse(skOffPar, BasicConfig.ANCHOR_secondKillOff);
try {
boolean data = skOffRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(skOffPar, BasicConfig.ANCHOR_secondKillOff, "下架秒杀失败", skOffRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(skOffPar, BasicConfig.ANCHOR_secondKillOff, "获取数据失败", skOffRes.body().asString()));
}
}
@Test(description = "上架第二轮秒杀,代理人可参与", priority = 25)
public void 上架第二轮秒杀() {
Map<String, Object> skOnPar = new HashMap<>();
skOnPar.put("id", ConfSecondKill.skIdSecond);
Response goodsOnRes = network.postResponse(skOnPar, BasicConfig.ANCHOR_secondKillOn);
try {
boolean data = goodsOnRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(skOnPar, BasicConfig.ANCHOR_secondKillOn, "上架秒杀失败", goodsOnRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(skOnPar, BasicConfig.ANCHOR_secondKillOn, "未获取到数据", goodsOnRes.body().asString()));
}
}
@Test(description = "代理人成功下单-占用库存", priority = 26)
public void 代理人成功下单() {
agentAuth();
// 下单
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", ConfSecondKill.skIdSecond);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "下单失败", orderRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "未获取到数据", orderRes.body().asString()));
}
// 获取下单结果
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", ConfSecondKill.skIdSecond);
Response orderResultRes = null;
Object data = null;
int i = 0;
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
if (i == 10){
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训下单结果超过10次", orderResultRes.body().asString()));
}
}
int state = orderResultRes.jsonPath().getInt("data.state");
Assert.assertEquals(state, 3, network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "下单未成功", orderResultRes.body().asString()));
System.out.println(data);
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", orderResultRes.body().asString()));
}
}
// 访客视角查看轮次状态
@Test(description = "用户下单无库存秒杀失败", priority = 27)
public void 用户下单无库存秒杀() {
visitorAuth();
Map<String, Object> goodsDetailPar = new HashMap<>();
goodsDetailPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
goodsDetailPar.put("confId", confId1);
Response goodsDetailRes = network.getResponse(goodsDetailPar, BasicConfig.MOBILE_secondKill_getGoodsDetail);
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", ConfSecondKill.skIdSecond);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
int chargeStatus = goodsDetailRes.jsonPath().getInt("data.chargeStatus");
int interactStatus = goodsDetailRes.jsonPath().getInt("data.interactStatus");
Assert.assertEquals(interactStatus, 2, network.message(goodsDetailPar, BasicConfig.MOBILE_secondKill_getGoodsDetail, "轮次商品状态错误", goodsDetailRes.body().asString()));
Assert.assertEquals(chargeStatus, 5, network.message(goodsDetailPar, BasicConfig.MOBILE_secondKill_getGoodsDetail, "轮次支付状态错误", goodsDetailRes.body().asString()));
boolean data = orderRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "下单失败", orderRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(goodsDetailPar, BasicConfig.MOBILE_secondKill_getGoodsDetail, "获取数据失败", goodsDetailRes.body().asString()));
Assert.fail(network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "未获取到数据", orderRes.body().asString()));
}
// 获取下单结果
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", ConfSecondKill.skIdSecond);
Response orderResultRes = null;
Object data = null;
int i = 0;
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
if (i == 10){
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训下单结果超过10次", orderResultRes.body().asString()));
}
}
int state = orderResultRes.jsonPath().getInt("data.state");
if (state == 2){
int code = orderResultRes.jsonPath().getInt("data.code");
if (code == 4){
System.out.println("失败原因code="+code);
} else {
Assert.assertEquals(code, 2, network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "失败原因不是库存不足", orderResultRes.body().asString()));
}
}else {
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "库存不足时用户下单成功了", orderResultRes.body().asString()));
}
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", orderResultRes.body().asString()));
}
}
@Test(description = "用户成功支付", priority = 21)
@Test(description = "删除已上架过的轮次", priority = 28)
public void 已上架过的轮次无法删除() {
long id = IdMakeUtil.managerDecodeingId(ConfSecondKill.skIdFirst);
Map<String, Object> delSkPar = new HashMap<>();
delSkPar.put("id", id);
Response delSkRes = network.postResponse(delSkPar, BasicConfig.MANAGER_secondKillDel);
try {
boolean success = delSkRes.jsonPath().getBoolean("success");
if (success){
Assert.fail(network.message(delSkPar, BasicConfig.MANAGER_secondKillDel, "已上架轮次删除成功", delSkRes.body().asString()));
}
String code = delSkRes.jsonPath().getString("code");
Assert.assertEquals(code, "95003", network.message(delSkPar, BasicConfig.MANAGER_secondKillDel, "删除失败原因错误", delSkRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(delSkPar, BasicConfig.MANAGER_secondKillDel, "获取数据失败", delSkRes.body().asString()));
}
}
@Test(description = "用户成功支付", priority = 29)
public void 用户成功支付() {
visitorAuth();
// 新建订单
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", confId1);
orderPar.put("confId", ConfSecondKill.skIdFirst);
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
......@@ -467,7 +625,7 @@ public class SecondKill implements Authorization {
Map<String, Object> orderResultPar = new HashMap<>();
orderResultPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", confId1);
orderResultPar.put("confId", ConfSecondKill.skIdFirst);
Response orderResultRes = null;
Object data = null;
int i = 0;
......
......@@ -1055,6 +1055,19 @@ public class Treasure implements Authorization {
}
/**
* 添加代理人绑定关系
*/
@Test(description = "代理人绑定", priority = 70)
public void 代理人绑定() {
agentAuth();
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_binding);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
......
......@@ -146,7 +146,9 @@ public class BasicConfig {
public static final String MOBILE_secondKill_getGoodsList = MOBILE_HOST + "/clue/goods/list";
public static final String MOBILE_secondKill_getGoodsDetail = MOBILE_HOST + "/clue/goods/detail";
public static final String ANCHOR_secondKillOn = MOBILE_HOST + "/conf/live/second/kill/goods/on";
public static final String ANCHOR_secondKillOff = MOBILE_HOST + "/conf/live/second/kill/goods/off";
public static final String MOBILE_secondKill_goodsFirst = MOBILE_HOST + "/clue/goods/first";
public static final String MOBILE_secondKill_downgradeGoodsFirst = MOBILE_HOST + "/clue/downgrade/goods";
public static final String MOBILE_secondKill_goodsOrder = MOBILE_HOST + "/clue/goods/order";
public static final String MOBILE_secondKill_goodsOrderResult = MOBILE_HOST + "/clue/goods/order/result";
public static final String MOBILE_secondKill_killGoods = MOBILE_HOST + "/clue/goods/killGoods";
......
......@@ -62,5 +62,19 @@ public class IdMakeUtil implements Authorization {
return encodeId;
}
public static long managerDecodeingId(String code) {
BaseUtils.ssoLogin();
Map<String, Object> decodePar = new HashMap<>();
decodePar.put("code", code);
Response decodeRes = network.getResponse(decodePar, BasicConfig.MANAGER_ID_DECODE);
long decodeId = 0;
try {
decodeId = decodeRes.jsonPath().getLong("data");
}catch (NullPointerException e){
e.printStackTrace();
}
return decodeId;
}
}
......@@ -77,173 +77,173 @@
<class name="com.kjj.cases.live.lottery.RelativeLottery"/>
</classes>
</test>
<test preserve-order="false" name="翻牌集字红包">
<classes>
<class name="com.kjj.cases.live.flipCard.FlipCard"/>
</classes>
</test>
<test preserve-order="true" name="中奖规则配置">
<classes>
<class name="com.kjj.cases.live.liveConfig.WinningRules"/>
</classes>
</test>
<test preserve-order="true" name="指定中奖">
<classes>
<class name="com.kjj.cases.live.lottery.DesignatedWinner"/>
</classes>
</test>
<test preserve-order="true" name="直播前-我的客户页">
<classes>
<class name="com.kjj.cases.live.agent.LiveBefore"/>
</classes>
</test>
<test preserve-order="true" name="助播-开启直播">
<classes>
<class name="com.kjj.cases.live.anchor.OpenLive"/>
</classes>
</test>
<test preserve-order="true" name="访客签到">
<classes>
<class name="com.kjj.cases.live.lotteryCode.SignIn"/>
</classes>
</test>
<test preserve-order="true" name="宝箱裂变">
<classes>
<class name="com.kjj.cases.live.treasure.Treasure"/>
</classes>
</test>
<test preserve-order="true" name="直播中抽奖">
<classes>
<class name="com.kjj.cases.live.lottery.Lottery"/>
</classes>
</test>
<test preserve-order="true" name="秒杀互动">
<classes>
<class name="com.kjj.cases.live.secondKill.SecondKill"/>
</classes>
</test>
<test preserve-order="true" name="猜数字红包">
<classes>
<class name="com.kjj.cases.live.guess.LiveGuess"/>
</classes>
</test>
<test preserve-order="true" name="看直播攒现金">
<classes>
<class name="com.kjj.cases.live.treasure.TimeRed"/>
</classes>
</test>
<test preserve-order="true" name="免费领福利">
<classes>
<class name="com.kjj.cases.live.FreeReward.FreeReward"/>
</classes>
</test>
<test preserve-order="true" name="我要咨询">
<classes>
<class name="com.kjj.cases.live.agent.Potential"/>
</classes>
</test>
<test preserve-order="true" name="访客领取资料">
<classes>
<class name="com.kjj.cases.live.anchor.LiveVisitors"/>
</classes>
</test>
<test preserve-order="true" name="红包领取">
<classes>
<class name="com.kjj.cases.live.red.LiveVistorRed"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题">
<classes>
<class name="com.kjj.cases.live.answer.Answer"/>
</classes>
</test>
<test preserve-order="true" name="投票">
<classes>
<class name="com.kjj.cases.live.choice.Choice"/>
</classes>
</test>
<test preserve-order="true" name="问题">
<classes>
<class name="com.kjj.cases.live.question.Question"/>
</classes>
</test>
<test preserve-order="true" name="直播中时长宝箱">
<classes>
<class name="com.kjj.cases.live.treasure.TreasureTime"/>
</classes>
</test>
<test preserve-order="true" name="闯关答题">
<classes>
<class name="com.kjj.cases.live.answer.passQues"/>
</classes>
</test>
<test preserve-order="true" name="直播中获取线索统计">
<classes>
<class name="com.kjj.cases.live.agent.LiveAgent"/>
</classes>
</test>
<test preserve-order="true" name="助播-结束直播">
<classes>
<class name="com.kjj.cases.live.anchor.CloseLive"/>
</classes>
</test>
<test preserve-order="true" name="直播结束-我的客户页">
<classes>
<class name="com.kjj.cases.live.agent.LiveLater"/>
</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.liveConfig.spec"/>
</classes>
</test>
<test preserve-order="true" name="客户管理">
<classes>
<class name="com.kjj.cases.live.agent.Customer"/>
</classes>
</test>
<test preserve-order="true" name="访客端直播结束页">
<classes>
<class name="com.kjj.cases.live.customer.AfterLive" />
</classes>
</test>
<test preserve-order="true" name="访客端个人主页">
<classes>
<class name="com.kjj.cases.live.customer.PersonalPage" />
</classes>
</test>
<!-- <test preserve-order="false" name="翻牌集字红包">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.flipCard.FlipCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="中奖规则配置">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.liveConfig.WinningRules"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="指定中奖">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.lottery.DesignatedWinner"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播前-我的客户页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.LiveBefore"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="助播-开启直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.anchor.OpenLive"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="访客签到">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.lotteryCode.SignIn"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="宝箱裂变">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.treasure.Treasure"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播中抽奖">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.lottery.Lottery"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="秒杀互动">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.secondKill.SecondKill"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="猜数字红包">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.guess.LiveGuess"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="看直播攒现金">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.treasure.TimeRed"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="免费领福利">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.FreeReward.FreeReward"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="我要咨询">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.Potential"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="访客领取资料">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.anchor.LiveVisitors"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="红包领取">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.red.LiveVistorRed"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="有奖答题">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.answer.Answer"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="投票">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.choice.Choice"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="问题">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.question.Question"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播中时长宝箱">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.treasure.TreasureTime"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="闯关答题">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.answer.passQues"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播中获取线索统计">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.LiveAgent"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="助播-结束直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.anchor.CloseLive"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播结束-我的客户页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.LiveLater"/>-->
<!-- </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.liveConfig.spec"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="客户管理">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.agent.Customer"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="访客端直播结束页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.customer.AfterLive" />-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="访客端个人主页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.customer.PersonalPage" />-->
<!-- </classes>-->
<!-- </test>-->
</suite>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment