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
aeb2bf0d
Commit
aeb2bf0d
authored
Aug 13, 2024
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员卡售卖状态,断言
parent
8e7a6d30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
21 deletions
+49
-21
src/main/java/com/xiaomai/cases/polar/memberCard/TestModifyXcxSaleState.java
+49
-21
No files found.
src/main/java/com/xiaomai/cases/polar/memberCard/TestModifyXcxSaleState.java
View file @
aeb2bf0d
...
...
@@ -7,6 +7,7 @@ import com.xiaomai.enums.RequestType;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.XMBaseTest
;
import
com.xiaomai.utils.XMJSONPath
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
...
...
@@ -23,40 +24,67 @@ public class TestModifyXcxSaleState extends XMBaseTest {
super
.
beforeTest
();
}
@Test
(
description
=
"关闭会员卡售卖"
)
public
void
testmodify
Shelf
State
()
{
public
void
testmodify
XcxSale
State
()
{
CardTools
Cardtools
=
new
CardTools
();
Cardtools
.
fetchPageOfMemberCard
(
"MEMBER_CARD"
);
String
memberCardId
=
""
;
String
xcxSaleStatus
;
//先检查次下列表有没有数据,有数据才会执行下面的点代码(如果是个空机构,肯定不会被执行,想从存量数据中获取,需要自己先造个数据)
int
listDatas
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result.records"
).
size
();
if
(
listDatas
>
0
)
{
memberCardId
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].id"
);
//取出第一个数据后,要check下会员卡的售卖状态,想停用,要保证卡的状态目前就是停售状态
xcxSaleStatus
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].xcxSaleStatus"
);
//如果不是启用状态,则开启
if
(
xcxSaleStatus
.
equals
(
"NO"
)){
String
memberCardId
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].id"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"xcxSaleState"
,
"NO"
);
jsonObject
.
put
(
"memberCardId"
,
memberCardId
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
Cardtools
.
modifyXcxSaleState
(
memberCardId
,
"YES"
);
}
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"xcxSaleState"
,
"NO"
);
jsonObject
.
put
(
"memberCardId"
,
memberCardId
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
//check 会员卡详情,查看状态是否是下架状态
Cardtools
.
fetchDetailById
(
memberCardId
);
Assert
.
assertEquals
(
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.xcxSaleStatus"
),
"NO"
,
"操作停用会员卡后,查看卡详情,卡启用状态没变更为NO"
);
}
}
@Test
(
description
=
"
开启会员卡售卖
"
)
@Test
(
description
=
"
启用会员卡
"
)
public
void
testmodifyShelfState1
()
{
CardTools
Cardtools
=
new
CardTools
();
Cardtools
.
fetchPageOfMemberCard
(
"MEMBER_CARD"
);
String
memberCardId
=
""
;
String
xcxSaleStatus
;
int
listDatas
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result.records"
).
size
();
if
(
listDatas
>
0
)
{
memberCardId
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].id"
);
xcxSaleStatus
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].xcxSaleStatus"
);
if
(
xcxSaleStatus
.
equals
(
"YES"
))
{
String
memberCardId
=
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.records[0].id"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"xcxSaleState"
,
"YES"
);
jsonObject
.
put
(
"memberCardId"
,
memberCardId
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
Cardtools
.
modifyXcxSaleState
(
memberCardId
,
"NO"
);
}
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"xcxSaleState"
,
"YES"
);
jsonObject
.
put
(
"memberCardId"
,
memberCardId
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
//check 会员卡详情,查看状态是否是上架状态
Cardtools
.
fetchDetailById
(
memberCardId
);
Assert
.
assertEquals
(
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.xcxSaleStatus"
),
"YES"
,
"操作启用会员卡后,查看卡详情,卡启用状态没变更为YES"
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
}
}
}
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