Commit e7f6cb82 by xyy

fix幸运抽奖case

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