Commit 25babab1 authored by 龚小红's avatar 龚小红

Merge branch 'gifeature/20211220-gj' into 'master'

秒杀优惠券接口

See merge request test-group/kejiji!200
parents a629bf4e 29ca1b1f
......@@ -171,6 +171,7 @@ public class SaveLive implements Authorization {
ids.add(new Material(359L,0));
ids.add(new Material(960L,0));
ids.add(new Material(3384L,0));
ids.add(new Material(8404L,0));
ids.add(new Material(LiveMaterial.resourceId, 0)); // 直播添加测试权益资料
ids.add(new Material(LiveMaterial.termResourceId, 0)); // 直播添加表单关联测试权益
ids.add(new Material(LiveMaterial.freeResourceId, 0)); // 直播添加免费领关联测试权益
......
package com.kjj.cases.live.secondKill;
import com.kjj.bean.agent.GrabWelfares;
import com.kjj.bean.resources.ResourceForm;
import com.kjj.bean.secondKill.AnchorGetSKList;
import com.kjj.bean.secondKill.KillGoods;
import com.kjj.cases.admin.Authorization;
......@@ -28,6 +29,8 @@ public class SecondKill implements Authorization {
public Object timestamp; //领取秒杀资格的时间戳
public String orderId; //待退款的秒杀订单id
public String recordId; //待退款的秒杀记录id
public String resourceConfId; //资料配置id
public String couponsId;//优惠券id
@BeforeClass
public void setUp(){
BaseUtils.ssoLogin();
......@@ -133,7 +136,6 @@ public class SecondKill implements Authorization {
e.printStackTrace();
Assert.fail(network.message(goodsListPar, BasicConfig.MOBILE_secondKill_getGoodsList, "未获取到数据", goodsListRes.body().asString()));
}
// ConfSecondKill.skIdFirst = goodsListRes.jsonPath().getString("data[0].confId");
}
@Test(description = "查看秒杀商品详情", priority = 8)
......@@ -891,9 +893,9 @@ public class SecondKill implements Authorization {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_secondKill_getGoodsList);
Object infallibleConfig = response.jsonPath().getJsonObject("data.get(0).infallibleConfig");
Object cardConfigOne = response.jsonPath().getJsonObject("data.get(0).cardConfigOne");
Object cardConfigTwo = response.jsonPath().getJsonObject("data.get(0).cardConfigTwo");
Object infallibleConfig = response.jsonPath().getJsonObject("data.get(1).infallibleConfig");
Object cardConfigOne = response.jsonPath().getJsonObject("data.get(1).cardConfigOne");
Object cardConfigTwo = response.jsonPath().getJsonObject("data.get(1).cardConfigTwo");
Assert.assertNotNull(infallibleConfig, network.message(params,BasicConfig.MOBILE_secondKill_getGoodsList,"秒杀资格商品信息获取失败",response.body().asString()));
Assert.assertNotNull(cardConfigOne, network.message(params,BasicConfig.MOBILE_secondKill_getGoodsList,"配图1商品信息获取失败",response.body().asString()));
Assert.assertNotNull(cardConfigTwo, network.message(params,BasicConfig.MOBILE_secondKill_getGoodsList,"配图2商品信息获取失败",response.body().asString()));
......@@ -1057,4 +1059,100 @@ public class SecondKill implements Authorization {
int refundStatus=response.jsonPath().getInt("data.killGoods.get(0).refundStatus");
Assert.assertEquals(refundStatus,5, network.message(params, BasicConfig.MOBILE_getClueDetail, "客户线索详情秒杀退款状态错误", response.body().asString()));
}
@Test(description = "获取优惠券列表",priority = 52)
public void 获取优惠券列表(){
visitorAuth11();
Map<String,Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_couponsList);
resourceConfId = response.jsonPath().getString("data.get(0).resourceConfId");
Assert.assertNotNull(resourceConfId, network.message(params,BasicConfig.MOBILE_couponsList,"获取资源配置id失败",response.body().asString()));
//获取优惠券领取状态,0为未领取,1为已领取,2为已使用
int couponsReceiveStatus = response.jsonPath().getInt("data.get(0).couponsReceiveStatus");
Assert.assertEquals(couponsReceiveStatus,0, network.message(params,BasicConfig.MOBILE_couponsList,"优惠券领取状态记录错误",response.body().asString()));
}
@Test(description = "访客填写表单",priority = 52)
public void 访客填写表单(){
//获取表单题目id
Map<String, Object> params = new HashMap<>();
params.put("confId",resourceConfId);
Response detailRes = network.getResponse(params,BasicConfig.MOBILE_Form);
String fieldId = detailRes.jsonPath().getString("data.fieldList[0].fieldId");
String fieldId2 = detailRes.jsonPath().getString("data.fieldList[1].fieldId");
Assert.assertNotNull(fieldId, network.message(params,BasicConfig.MOBILE_Form,"查询表单详情失败",detailRes.body().asString()));
params.clear();
params.put("confId",resourceConfId);
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<ResourceForm> fieldLists = new ArrayList<>();
ResourceForm fieldList = new ResourceForm();
fieldList.setFieldId(fieldId);
fieldList.setFieldValue("test");
fieldLists.add(fieldList);
ResourceForm fieldList2 = new ResourceForm();
fieldList2.setFieldId(fieldId2);
fieldList2.setFieldValue("15134345555");
fieldLists.add(fieldList2);
params.put("fieldList", fieldLists);
Response response = network.postResponse(params, BasicConfig.MOBILE_FormSubmit);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data,network.message(params,BasicConfig.MOBILE_FormSubmit,"访客K提交表单资料失败",response.body().asString()));
}
@Test(description = "领取秒杀优惠券",priority = 53)
public void 领取秒杀优惠券(){
Map<String,Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("resourceConfId",resourceConfId);
Response response = network.postResponse(params,BasicConfig.MOBILE_couponsReceive);
couponsId = response.jsonPath().getString("data.get(0).id");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.MOBILE_couponsReceive,"领取秒杀优惠券失败",response.body().asString()));
int afterPrice = response.jsonPath().getInt("data.get(0).afterPrice");
Assert.assertEquals(afterPrice,1,network.message(params,BasicConfig.MOBILE_couponsReceive,"券后价记录错误",response.body().asString()));
params.clear();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response statusRes = network.getResponse(params,BasicConfig.MOBILE_couponsList);
//获取优惠券领取状态,0为未领取,1为已领取,2为已使用
int couponsReceiveStatus = statusRes.jsonPath().getInt("data.get(0).couponsReceiveStatus");
Assert.assertEquals(couponsReceiveStatus,1, network.message(params,BasicConfig.MOBILE_couponsList,"优惠券领取状态记录错误",statusRes.body().asString()));
}
@Test(description = "上架秒杀优惠券商品",priority = 54)
public void 上架秒杀优惠券商品(){
adminAuth();
Map<String, Object> goodsOnPar = new HashMap<>();
goodsOnPar.put("id",ConfSecondKill.couponId);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
try {
boolean data = goodsOnRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, 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 = 55)
public void 下单秒杀优惠券商品() {
visitorAuth11();
// 新建订单
Map<String, Object> orderPar = new HashMap<>();
orderPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", resourceConfId);
orderPar.put("couponsId",couponsId);
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()));
}
}
}
......@@ -186,7 +186,10 @@ public class BasicConfig {
public static final String MANAGER_order_refund= MANAGER_HOST + "/kjy/manager/live/second/kill/order/refund";
public static final String MOBILE_secondKill_getList= MOBILE_HOST + "/kjy/live/user/goods/getList";
public static final String MOBILE_secondKill_findDetailByRecordId= MOBILE_HOST + "/kjy/live/user/goods/findDetailByRecordId";
public static final String MANAGER_listResourceByType= MANAGER_HOST + "/kjy/manager/live/second/kill/goods/listResourceByType";
public static final String MANAGER_killGoodsDetail= MANAGER_HOST + "/kjy/manager/live/second/kill/goods/detail";
public static final String MOBILE_couponsList= MOBILE_HOST + "/clue/goods/coupons/list";
public static final String MOBILE_couponsReceive= MOBILE_HOST +"/clue/goods/coupons/receive";
//客户承诺话术配置
public static final String MANAGER_saveDialogue = MANAGER_HOST + "/kjy/manager/live/potential/saveDialogue";
public static final String MANAGER_findDialogue = MANAGER_HOST + "/kjy/manager/live/potential/findDialogue";
......
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