Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-sportstest
Commits
e7f6cb82
Commit
e7f6cb82
authored
Sep 25, 2024
by
xyy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix幸运抽奖case
parent
2900fa03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
19 deletions
+16
-19
src/main/java/com/xiaomai/cases/polar/luckyDraw/LuckyDrawTools.java
+5
-5
src/main/java/com/xiaomai/cases/polar/luckyDraw/TestGetStudioMemberPrizeByPage.java
+11
-14
No files found.
src/main/java/com/xiaomai/cases/polar/luckyDraw/LuckyDrawTools.java
View file @
e7f6cb82
...
...
@@ -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
();
...
...
src/main/java/com/xiaomai/cases/polar/luckyDraw/TestGetStudioMemberPrizeByPage.java
View file @
e7f6cb82
...
...
@@ -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
"
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment