Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
龚小红
oto
Commits
f35171ef
Commit
f35171ef
authored
Nov 01, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/202111101-gxh' into 'master'
下架签到领红包,并修改抽奖转盘为固定的模板id See merge request test-group/kejiji!157
parents
c85ff764
2d6ca234
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
151 deletions
+10
-151
SignRed.java
src/test/java/com/kjj/cases/assistant/homePage/SignRed.java
+0
-106
GameLottery.java
...java/com/kjj/cases/assistant/markettools/GameLottery.java
+10
-28
Cashback.java
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
+0
-4
Pay.java
src/test/java/com/kjj/cases/assistant/pay/Pay.java
+0
-8
wechatTestNG.xml
src/test/wechatTestNG.xml
+0
-5
No files found.
src/test/java/com/kjj/cases/assistant/homePage/SignRed.java
deleted
100644 → 0
View file @
c85ff764
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
import
com.kjj.cases.admin.Authorization
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
public
class
SignRed
implements
Authorization
{
private
double
attendAmount
;
private
double
totalPromotionEarnings
;
private
boolean
todayAttendFlag
;
@BeforeClass
public
void
setUp
()
{
agentTku
();
}
@Test
(
description
=
"指定用户展示入口"
,
priority
=
1
)
public
void
指定用户展示入口
()
{
Response
response
=
network
.
getResponse
(
ATTEND_entrance
);
System
.
out
.
println
(
response
.
body
().
asString
());
Boolean
showFlag
=
response
.
jsonPath
().
getBoolean
(
"data.showFlag"
);
Boolean
vipExpireFlag
=
response
.
jsonPath
().
getBoolean
(
"data.vipExpireFlag"
);
Assert
.
assertTrue
(
showFlag
,
network
.
message
(
ATTEND_entrance
,
"指定用户不展示入口"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
vipExpireFlag
,
network
.
message
(
ATTEND_entrance
,
"指定用户会员已到期"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"非指定用户不展示入口"
,
priority
=
2
)
public
void
非指定用户不展示入口
()
{
userTku2
();
Response
response
=
network
.
getResponse
(
ATTEND_entrance
);
System
.
out
.
println
(
response
.
body
().
asString
());
Boolean
showFlag
=
response
.
jsonPath
().
getBoolean
(
"data.showFlag"
);
Boolean
vipExpireFlag
=
response
.
jsonPath
().
getBoolean
(
"data.vipExpireFlag"
);
Assert
.
assertFalse
(
showFlag
,
network
.
message
(
ATTEND_entrance
,
"非指定用户展示入口"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
vipExpireFlag
,
network
.
message
(
ATTEND_entrance
,
"指定用户会员已到期"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"签到详情"
,
priority
=
3
)
public
void
签到详情
()
{
agentTku
();
Response
response
=
network
.
getResponse
(
ATTEND_detail
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
roundNum
=
response
.
jsonPath
().
getInt
(
"data.roundNum"
);
todayAttendFlag
=
response
.
jsonPath
().
getBoolean
(
"data.todayAttendFlag"
);
Assert
.
assertEquals
(
roundNum
,
7
,
network
.
message
(
ATTEND_detail
,
"签到周期错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取累计收益"
,
priority
=
4
)
public
void
获取累计收益
()
{
Response
response
=
network
.
getResponse
(
ATTEND_income
);
System
.
out
.
println
(
response
.
body
().
asString
());
totalPromotionEarnings
=
response
.
jsonPath
().
getDouble
(
"data.totalPromotionEarnings"
);
double
balance
=
response
.
jsonPath
().
getDouble
(
"data.balance"
);
Assert
.
assertTrue
(
totalPromotionEarnings
>
0
,
network
.
message
(
ATTEND_income
,
"签到周期错误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
balance
>
0
,
network
.
message
(
ATTEND_income
,
"签到周期错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"签到"
,
priority
=
5
)
public
void
签到
()
{
Response
response
=
network
.
postResponse
(
ATTEND_open
);
System
.
out
.
println
(
response
.
body
().
asString
());
if
(!
todayAttendFlag
)
{
attendAmount
=
response
.
jsonPath
().
getDouble
(
"data.attendAmount"
);
Assert
.
assertTrue
(
attendAmount
>
0
,
network
.
message
(
ATTEND_open
,
"签到失败"
,
response
.
body
().
asString
()));
}
else
{
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
ATTEND_open
,
"重复签到"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"签到金额验证"
,
priority
=
6
)
public
void
签到金额验证
()
{
Response
response
=
network
.
getResponse
(
ATTEND_income
);
System
.
out
.
println
(
response
.
body
().
asString
());
double
total
=
response
.
jsonPath
().
getDouble
(
"data.totalPromotionEarnings"
);
Assert
.
assertEquals
(
total
,
attendAmount
+
totalPromotionEarnings
,
network
.
message
(
ATTEND_income
,
"签到周期错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人账户明细"
,
priority
=
7
)
public
void
代理人账户明细
()
{
agentTku
();
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Params
.
put
(
"type"
,
2
);
Params
.
put
(
"pageNo"
,
1
);
Params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
Params
,
PAY_accDetail
);
if
(!
todayAttendFlag
)
{
int
changeType
=
response
.
jsonPath
().
getInt
(
"data[0].changeType"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data[0].nickname"
);
int
bizType
=
response
.
jsonPath
().
getInt
(
"data[0].bizType"
);
double
changeMoney
=
response
.
jsonPath
().
getDouble
(
"data[0].changeMoney"
);
Assert
.
assertEquals
(
changeType
,
2
,
network
.
message
(
PAY_accDetail
,
"收益明细类型错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickname
,
"吉吉"
,
network
.
message
(
PAY_accDetail
,
"签到用户名称错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
bizType
,
16
,
network
.
message
(
PAY_accDetail
,
"收益明细类型错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
changeMoney
,
attendAmount
/
100
,
network
.
message
(
PAY_accDetail
,
"收益金额错误"
,
response
.
body
().
asString
()));
}
}
}
src/test/java/com/kjj/cases/assistant/markettools/GameLottery.java
View file @
f35171ef
...
...
@@ -20,7 +20,6 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
GameLottery
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
String
lotteryId
;
//抽奖模板id
public
String
scid
;
//指定中奖-抽奖scid
public
String
id
;
//抽奖重定向地址id
public
Visitor
visitor
;
//指定中奖的客户
...
...
@@ -33,6 +32,11 @@ public class GameLottery implements Authorization {
public
String
visitTableId
;
//订单id
public
int
remainingTimes
;
//剩余抽奖次数
public
String
winningRecodeId
;
//中奖记录id
private
static
final
Long
ACTIVITY_ID
=
8196L
;
private
static
final
String
ACTIVITY_ID_ENCODE
=
"Kj21NjU1NzU"
;
@BeforeClass
public
void
setUp
(){
BaseUtils
.
ssoLogin
();
...
...
@@ -40,30 +44,9 @@ public class GameLottery implements Authorization {
@Test
(
description
=
"代理人_获取抽奖活动重定向地址id"
,
priority
=
1
)
public
void
代理人
_
获取抽奖活动重定向地址
id
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentType"
,
"game_template"
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
MANAGER_searchTemplateList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_searchTemplateList
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
MANAGER_searchTemplateList
,
"返回数据为空"
,
response
.
body
().
asString
()));
int
lId
=
0
;
List
<
LotteryTable
>
templateList
=
JsonUtil
.
parseResponsePathToListBean
(
response
,
"data.list"
,
LotteryTable
.
class
);
for
(
LotteryTable
template:
templateList
)
{
if
(
template
.
getStatus
()==
2
&&
template
.
getPublicly
()
==
1
){
lId
=
template
.
getId
();
break
;
}
}
if
(
lId
==
0
){
System
.
out
.
println
(
"抽奖转盘列表没有已上架的公有的抽奖模板"
);
return
;
}
params
.
clear
();
params
.
put
(
"id"
,
lId
);
response
=
network
.
getResponse
(
params
,
MANAGER_getTemplateDetail
);
params
.
put
(
"id"
,
ACTIVITY_ID
);
Response
response
=
network
.
getResponse
(
params
,
MANAGER_getTemplateDetail
);
String
activityUrl
=
response
.
jsonPath
().
getString
(
"data.activityUrl"
);
id
=
activityUrl
.
substring
(
activityUrl
.
indexOf
(
"id"
)+
3
);
System
.
out
.
println
(
id
);
...
...
@@ -83,7 +66,6 @@ public class GameLottery implements Authorization {
int
size
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
);
Assert
.
assertTrue
(
size
>
0
,
network
.
message
(
params
,
LOTTERRY_templatePageList
,
"抽奖模板列表为空"
,
response
.
body
().
asString
()));
lotteryId
=
response
.
jsonPath
().
getString
(
"data.list.get(0).id"
);
}
@Test
(
description
=
"代理人_根据page获取当前页面的Tips"
,
priority
=
3
)
...
...
@@ -110,7 +92,7 @@ public class GameLottery implements Authorization {
public
void
代理人
_
获取抽奖详情页
()
{
//根据ContentId获取Scid
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentId"
,
lotteryId
);
params
.
put
(
"contentId"
,
ACTIVITY_ID_ENCODE
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
scid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
scid
,
network
.
message
(
params
,
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
...
...
@@ -119,7 +101,7 @@ public class GameLottery implements Authorization {
params
.
put
(
"scid"
,
scid
);
response
=
network
.
getResponse
(
params
,
GREETING_H5INFO
);
String
id
=
response
.
jsonPath
().
getString
(
"data.id"
);
Assert
.
assertEquals
(
lotteryId
,
id
,
network
.
message
(
params
,
GREETING_H5INFO
,
"获取贺卡页面失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
ACTIVITY_ID_ENCODE
,
id
,
network
.
message
(
params
,
GREETING_H5INFO
,
"获取贺卡页面失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"代理人_获取次数及奖品信息"
,
priority
=
6
)
...
...
@@ -462,7 +444,7 @@ public class GameLottery implements Authorization {
//根据ContentId获取Scid
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"contentId"
,
lotteryId
);
params
.
put
(
"contentId"
,
ACTIVITY_ID_ENCODE
);
Response
response
=
network
.
getResponse
(
params
,
GETSCID
);
rateScid
=
response
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
rateScid
,
network
.
message
(
params
,
GETSCID
,
"获取scid失败"
,
response
.
body
().
asString
()));
...
...
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
View file @
f35171ef
...
...
@@ -86,8 +86,6 @@ public class Cashback implements Authorization {
}
@Test
(
description
=
"邀请的好友列表"
,
priority
=
5
)
public
void
邀请的好友列表
()
{
agentTku
();
...
...
@@ -96,13 +94,11 @@ public class Cashback implements Authorization {
Params
.
put
(
"pageIndex"
,
1
);
Params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
Params
,
PAY_distributionList
);
System
.
out
.
println
(
response
.
body
().
asString
());
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
PAY_distributionList
,
"待付款好友列表为null"
,
response
.
body
().
asString
()));
Params
.
put
(
"distributionListType"
,
2
);
response
=
network
.
getResponse
(
Params
,
PAY_distributionList
);
System
.
out
.
println
(
response
.
body
().
asString
());
Object
list1
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Assert
.
assertNotNull
(
list1
,
network
.
message
(
PAY_distributionList
,
"已付款好友列表为null"
,
response
.
body
().
asString
()));
...
...
src/test/java/com/kjj/cases/assistant/pay/Pay.java
View file @
f35171ef
...
...
@@ -34,21 +34,18 @@ public class Pay implements Authorization {
//付款中间页判断
Response
response
=
network
.
getResponse
(
PAY_getMiddleDetail
);
int
skipType
=
response
.
jsonPath
().
getInt
(
"data.skipType"
);
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertEquals
(
skipType
,
2
,
network
.
message
(
PAY_getMiddleDetail
,
"付款中间页:不是2020新版"
,
response
.
body
().
asString
()));
//会员类型版本判断
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"t"
,
System
.
currentTimeMillis
());
response
=
network
.
getResponse
(
params
,
version_info
);
System
.
out
.
println
(
response
.
body
().
asString
());
int
userVersion
=
response
.
jsonPath
().
getInt
(
"data.find {it.openType == 1}.userVersion"
);
// 找出开启状态的版本类型 1为通用版 2为保险版
Assert
.
assertEquals
(
userVersion
,
2
,
network
.
message
(
params
,
version_info
,
"会员类型版本判断:判断错误,此版本为通用版"
,
response
.
body
().
asString
()));
//获取当前用户可用优惠码
response
=
network
.
getResponse
(
params
,
PAY_getPromoCode
);
String
promoCode
=
response
.
jsonPath
().
getString
(
"data"
);
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertNull
(
promoCode
,
network
.
message
(
params
,
PAY_getPromoCode
,
"是否优惠判断:判断错误,当前有优惠"
,
response
.
body
().
asString
()));
//获取付费价格
...
...
@@ -141,7 +138,6 @@ public class Pay implements Authorization {
System
.
out
.
println
(
response
.
body
().
asString
());
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
PAY_isRenewCondition
,
"用户不满足续费条件"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"创建优惠码"
,
priority
=
6
)
...
...
@@ -186,7 +182,6 @@ public class Pay implements Authorization {
payParams
.
put
(
"comboId"
,
comboId
);
payParams
.
put
(
"promotionCode"
,
promotionCode
);
Response
response
=
network
.
postResponse
(
payParams
,
PAY_create
);
System
.
out
.
println
(
response
.
body
().
asString
());
String
tradeNo
=
response
.
jsonPath
().
getString
(
"data.tradeNo"
);
// mock微信回调成功
...
...
@@ -255,9 +250,6 @@ public class Pay implements Authorization {
response
=
network
.
postResponse
(
payParams
,
PAY_create
);
tradeNo
=
response
.
jsonPath
().
getString
(
"data.tradeNo"
);
System
.
out
.
println
(
tradeNo
);
}
}
src/test/wechatTestNG.xml
View file @
f35171ef
...
...
@@ -11,11 +11,6 @@
<class
name=
"com.kjj.cases.assistant.pay.Pay"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"签到领红包"
>
<classes>
<class
name=
"com.kjj.cases.assistant.homePage.SignRed"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"邀请返现"
>
<classes>
<class
name=
"com.kjj.cases.assistant.pay.Cashback"
/>
...
...
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