Commit e7f6cb82 by xyy

fix幸运抽奖case

parent 2900fa03
......@@ -413,7 +413,7 @@ public class LuckyDrawTools extends BaseTestImpl {
public int getDrawNum(String activityId,String memberId,DataUserInfo...userInfos) {
dataApi.setApiModule(ApiModule.Lunar_LuckyDraw)
.setApiName("API_getDrawNum")
.setTerminal(Terminal.C);
.setTerminal(Terminal.minApp);
super.beforeDataRequest(userInfos);
JSONObject body = new JSONObject();
......@@ -432,7 +432,7 @@ public class LuckyDrawTools extends BaseTestImpl {
public JSONObject getMyActPrizeByPage(String activityId,String memberId,DataUserInfo...userInfos) {
dataApi.setApiModule(ApiModule.Lunar_LuckyDraw)
.setApiName("API_getMyActPrizeByPage")
.setTerminal(Terminal.C);
.setTerminal(Terminal.minApp);
super.beforeDataRequest(userInfos);
JSONObject body = new JSONObject();
......@@ -454,7 +454,7 @@ public class LuckyDrawTools extends BaseTestImpl {
public JSONObject getMyActivityByPage(String memberId,DataUserInfo...userInfos) {
dataApi.setApiModule(ApiModule.Lunar_LuckyDraw)
.setApiName("API_getMyActivityByPage")
.setTerminal(Terminal.C);
.setTerminal(Terminal.minApp);
super.beforeDataRequest(userInfos);
JSONObject body = new JSONObject();
......@@ -475,7 +475,7 @@ public class LuckyDrawTools extends BaseTestImpl {
public int countMemberReceivedCoupon(String memberId,DataUserInfo...userInfos) {
dataApi.setApiModule(ApiModule.Lunar_Coupon)
.setApiName("API_countMemberReceivedCoupon")
.setTerminal(Terminal.C);
.setTerminal(Terminal.minApp);
super.beforeDataRequest(userInfos);
JSONObject body = new JSONObject();
......@@ -496,7 +496,7 @@ public class LuckyDrawTools extends BaseTestImpl {
public JSONObject luckyDrawLottery(String activityId,String memberId,DataUserInfo...userInfos) {
dataApi.setApiModule(ApiModule.Lunar_LuckyDraw)
.setApiName("API_luckyDrawLottery")
.setTerminal(Terminal.C);
.setTerminal(Terminal.minApp);
super.beforeDataRequest(userInfos);
JSONObject body = new JSONObject();
......
......@@ -2,7 +2,6 @@ package com.xiaomai.cases.polar.luckyDraw;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.cases.polar.training.TrainingTools;
import com.xiaomai.client.DataUserInfo;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
......@@ -20,7 +19,6 @@ public class TestGetStudioMemberPrizeByPage extends XMBaseTest {
LuckyDrawTools luckyDrawTools;
@Resource(name = "trainingTools")
TrainingTools trainingTools;
DataUserInfo info = new DataUserInfo();
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_LuckyDraw)
......@@ -47,23 +45,22 @@ public class TestGetStudioMemberPrizeByPage extends XMBaseTest {
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON, params, body.toJSONString(), headers).assetsSuccess(true);
Assert.assertEquals(XMJSONPath.readPath(xmAppApi.getBodyInJSON(),"$.message"),"操作成功!");
JSONObject jsBody = xmAppApi.getBodyInJSON();
//若该会员名下有抽奖记录,则进入手动兑奖流程:
int total = Integer.parseInt(XMJSONPath.readPath(xmAppApi.getBodyInJSON(),"$.result.total"));
int total = Integer.parseInt(XMJSONPath.readPath(jsBody,"$.result.total"));
Assert.assertEquals(XMJSONPath.readPath(jsBody,"$.message"),"操作成功!");
if (total>0){
for (int i = 0; i < total-1; i++) {
String sendState = XMJSONPath.readPath(xmAppApi.getBodyInJSON(),"$.result.records["+i+"].sendState");
String sendRecordId = XMJSONPath.readPath(xmAppApi.getBodyInJSON(),"$.result.records["+i+"].id");
String activityId = XMJSONPath.readPath(xmAppApi.getBodyInJSON(),"$.result.records["+i+"].activityId");
String sendState = XMJSONPath.readPath(jsBody,"$.result.records["+i+"].sendState");
String sendRecordId = XMJSONPath.readPath(jsBody,"$.result.records["+i+"].id");
//获取到的兑奖记录,暂未兑奖,可进行兑奖:
if(sendState=="NOT_SENT"){
Assert.assertEquals(luckyDrawTools.exchangePrize(sendRecordId),"$.message","操作成功!");
//兑奖状态=已兑换
Assert.assertEquals(XMJSONPath.readPath(luckyDrawTools.getLuckyAttendByPage(activityId),"$.result.records[0].sendState"),"SENT");//已兑奖状态
if(sendState.equals("NOT_SENT")){
//进行兑换
luckyDrawTools.exchangePrize(sendRecordId);
break;
}else{
//该兑奖记录若已兑奖,则提示兑奖码已兑换!
Assert.assertEquals(XMJSONPath.readPath(luckyDrawTools.exchangePrize(sendRecordId),"$.message"),"该奖品码已兑换");
}else {
Assert.assertEquals(XMJSONPath.readPath(jsBody,"$.result.records["+i+"].sendState"),"SENT");
Assert.assertEquals(XMJSONPath.readPath(jsBody,"$.result.records["+i+"].redemptionState"),"REDEEMED");
}
}
}
......
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