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
6fc34cdb
Commit
6fc34cdb
authored
Dec 16, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/20211215-gxh' into 'master'
将新用户与邀请返现结合 See merge request test-group/kejiji!191
parents
66ea59dd
e18de8fa
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
228 additions
and
243 deletions
+228
-243
Authorization.java
src/test/java/com/kjj/cases/admin/Authorization.java
+14
-13
CashBack.java
src/test/java/com/kjj/cases/assistant/homePage/CashBack.java
+0
-83
HomePage.java
src/test/java/com/kjj/cases/assistant/homePage/HomePage.java
+2
-2
RecommendMaterial.java
...a/com/kjj/cases/assistant/homePage/RecommendMaterial.java
+4
-3
NoviceGuidance.java
...est/java/com/kjj/cases/assistant/menu/NoviceGuidance.java
+28
-44
PersonalCenter.java
...est/java/com/kjj/cases/assistant/menu/PersonalCenter.java
+0
-1
Cashback.java
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
+79
-27
Pay.java
src/test/java/com/kjj/cases/assistant/pay/Pay.java
+10
-33
ForwardAndRead.java
...java/com/kjj/cases/assistant/whoSawMe/ForwardAndRead.java
+35
-12
MyCustomer.java
...est/java/com/kjj/cases/assistant/whoSawMe/MyCustomer.java
+6
-3
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+1
-1
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+10
-2
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+33
-13
NetworkUtils.java
src/test/java/com/kjj/utils/NetworkUtils.java
+1
-1
wechatTestNG.xml
src/test/wechatTestNG.xml
+5
-5
No files found.
src/test/java/com/kjj/cases/admin/Authorization.java
View file @
6fc34cdb
...
@@ -42,14 +42,14 @@ public interface Authorization {
...
@@ -42,14 +42,14 @@ public interface Authorization {
//代理人吉吉 sid:2991
//代理人吉吉 sid:2991
default
void
agentTku
()
{
default
void
agentTku
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
AGENT_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
AGENT_TKU
);
System
.
out
.
println
(
"代理人tku:"
+
AGENT_TKU
);
System
.
out
.
println
(
"代理人
吉吉
tku:"
+
AGENT_TKU
);
}
}
//代理人
//代理人
default
void
agent2Tku
()
{
default
void
agent2Tku
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
AGENT2_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
AGENT2_TKU
);
System
.
out
.
println
(
"代理人tku:"
+
AGENT2_TKU
);
System
.
out
.
println
(
"代理人
梦晨
tku:"
+
AGENT2_TKU
);
}
}
...
@@ -57,30 +57,31 @@ public interface Authorization {
...
@@ -57,30 +57,31 @@ public interface Authorization {
// 获取访客tku:Su Yi
// 获取访客tku:Su Yi
default
void
userTku
()
{
default
void
userTku
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR_UserTku
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR_UserTku
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR_UserTku
);
System
.
out
.
println
(
"访客
一
tku:"
+
VISITOR_UserTku
);
}
}
// 获取访客tku:请勿打扰
// 获取访客tku:请勿打扰
default
void
userTku1
()
{
default
void
userTku1
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR_TKU
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR_TKU
);
System
.
out
.
println
(
"访客
二
tku:"
+
VISITOR_TKU
);
}
}
// 获取访客tku:Ryan
// 获取访客tku:Ryan
default
void
userTku2
()
{
default
void
userTku2
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR1_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR1_TKU
);
System
.
out
.
println
(
"访客tku:"
+
VISITOR1_TKU
);
System
.
out
.
println
(
"访客
三
tku:"
+
VISITOR1_TKU
);
}
}
// 获取访客tku:
向日葵
// 获取访客tku:
小葡萄
default
void
userTku3
()
{
default
void
newUser1
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
VISITOR2_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku1
);
System
.
out
.
println
(
"
访客tku:"
+
VISITOR2_TKU
);
System
.
out
.
println
(
"
新用户小葡萄tku:"
+
tku1
);
}
}
//获取代理人tku,180天打卡返现专用:Jovia
default
void
cashBackTku
(){
// 获取访客tku:小米粥
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
CASHBACK_TKU
);
default
void
newUser2
()
{
System
.
out
.
println
(
"打卡返现tku:"
+
CASHBACK_TKU
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku2
);
System
.
out
.
println
(
"新用户米粥tku:"
+
tku2
);
}
}
/**
/**
...
...
src/test/java/com/kjj/cases/assistant/homePage/CashBack.java
deleted
100644 → 0
View file @
66ea59dd
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
com.kjj.cases.admin.Authorization
;
import
org.testng.Assert
;
import
org.testng.annotations.*
;
import
io.restassured.response.Response
;
import
java.util.*
;
import
java.text.SimpleDateFormat
;
public
class
CashBack
implements
Authorization
{
public
String
sid
;
//加密的销售id
public
String
grassContentId
;
//文章内容id
public
String
scId
;
//获取文章id
public
Integer
clockTimes
;
//获取打卡的总次数
@BeforeClass
public
void
setUp
()
{
//打卡返现专用TKU
cashBackTku
();
}
//种草文章转发
@Test
(
description
=
"种草素材转发"
,
priority
=
1
)
public
void
种草素材转发
()
{
//获取种草素材列表页
Response
listRes
=
network
.
getResponse
(
ARTICLE_GETEXPLOSIONCONTENTLIST
);
grassContentId
=
listRes
.
jsonPath
().
getString
(
"data[0].contentId"
);
//根据种草素材的ContentId获取Scid
Map
<
String
,
Object
>
getScIdParams
=
new
HashMap
<>();
getScIdParams
.
put
(
"contentId"
,
grassContentId
);
Response
getScIdRes
=
network
.
getResponse
(
getScIdParams
,
GETSCID
);
scId
=
getScIdRes
.
jsonPath
().
getString
(
"data"
);
//种草文章转发
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scId"
,
scId
);
params
.
put
(
"forwardType"
,
1
);
Response
response
=
network
.
getResponse
(
params
,
FORWARD
);
Boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
FORWARD
,
"种草文章转发失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"打卡任务进度"
,
priority
=
2
)
public
void
打卡任务进度
(){
Response
response
=
network
.
getResponse
(
HOME_dailyProgress
);
Object
dayStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.dayStatus"
);
String
desc
=
response
.
jsonPath
().
getString
(
"desc"
);
clockTimes
=
response
.
jsonPath
().
getInt
(
"data.clockInTimes"
);
Assert
.
assertEquals
(
dayStatus
,
2
,
network
.
message
(
HOME_dailyProgress
,
"打卡任务查询失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
desc
,
"OK"
,
network
.
message
(
HOME_dailyProgress
,
"打卡任务查询失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"打卡数据统计"
,
priority
=
3
)
public
void
打卡数据统计
(){
Response
response
=
network
.
getResponse
(
HOME_statistic
);
Object
clockInTimes
=
response
.
jsonPath
().
getJsonObject
(
"data.clockInTimes"
);
String
desc
=
response
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
clockInTimes
,
clockTimes
,
network
.
message
(
HOME_dailyProgress
,
"打卡数据统计错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
desc
,
"OK"
,
network
.
message
(
HOME_dailyProgress
,
"打卡数据统计错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"打卡记录"
,
priority
=
4
)
public
void
打卡记录
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"dayStatus"
,
2
);
Response
response
=
network
.
getResponse
(
params
,
HOME_record
);
Object
doneTime
=
response
.
jsonPath
().
getJsonObject
(
"data.list.get(0).doneTime"
);
//获取当天时间
Date
date
=
new
Date
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
today
=
simpleDateFormat
.
format
(
date
.
getTime
());
//获取当天凌晨的时间戳
long
current
=
System
.
currentTimeMillis
();
long
currentDate
=
current
-(
current
+
TimeZone
.
getDefault
().
getRawOffset
())%(
1000
*
3600
*
24
);
Assert
.
assertEquals
(
doneTime
,
currentDate
,
network
.
message
(
params
,
HOME_record
,
"获取当日打卡记录成功"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/assistant/homePage/HomePage.java
View file @
6fc34cdb
...
@@ -2,7 +2,7 @@ package com.kjj.cases.assistant.homePage;
...
@@ -2,7 +2,7 @@ package com.kjj.cases.assistant.homePage;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku
1
;
import
static
com
.
kjj
.
utils
.
IdMakeUtil
.
decodingId
;
import
static
com
.
kjj
.
utils
.
IdMakeUtil
.
decodingId
;
import
static
com
.
kjj
.
utils
.
IdMakeUtil
.
encodingId
;
import
static
com
.
kjj
.
utils
.
IdMakeUtil
.
encodingId
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
...
@@ -1095,7 +1095,7 @@ public class HomePage implements Authorization {
...
@@ -1095,7 +1095,7 @@ public class HomePage implements Authorization {
@Test
(
description
=
"访客_访问文章并参与测评"
,
priority
=
54
)
@Test
(
description
=
"访客_访问文章并参与测评"
,
priority
=
54
)
public
void
访客
_
访问文章并参与测评
()
{
public
void
访客
_
访问文章并参与测评
()
{
//切换为新用户小葡萄,每次都会产生线索
//切换为新用户小葡萄,每次都会产生线索
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
1
);
//获取用户信息
//获取用户信息
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Response
response
=
network
.
getResponse
(
USER_INFO
);
Response
response
=
network
.
getResponse
(
USER_INFO
);
...
...
src/test/java/com/kjj/cases/assistant/homePage/RecommendMaterial.java
View file @
6fc34cdb
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.assistant.whoSawMe.ForwardAndRead
;
import
com.kjj.cases.assistant.whoSawMe.ForwardAndRead
;
...
@@ -116,7 +117,7 @@ public class RecommendMaterial implements Authorization {
...
@@ -116,7 +117,7 @@ public class RecommendMaterial implements Authorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"keywords"
,
keyWord
);
params
.
put
(
"keywords"
,
keyWord
);
Response
response
=
network
.
getResponse
(
params
,
GRASS_searchContent
);
Response
response
=
network
.
getResponse
(
params
,
GRASS_searchContent
);
ThreadSleepUtils
.
sleep
(
1000
);
sleep
(
1000
);
String
gameContentId
=
response
.
jsonPath
().
getString
(
"data[0].contentId"
);
String
gameContentId
=
response
.
jsonPath
().
getString
(
"data[0].contentId"
);
Assert
.
assertNotNull
(
gameContentId
,
network
.
message
(
params
,
GRASS_searchContent
,
"获取动画种草素材列表失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
gameContentId
,
network
.
message
(
params
,
GRASS_searchContent
,
"获取动画种草素材列表失败"
,
response
.
body
().
asString
()));
}
}
...
@@ -269,9 +270,9 @@ public class RecommendMaterial implements Authorization {
...
@@ -269,9 +270,9 @@ public class RecommendMaterial implements Authorization {
//tKu 切换为访客
//tKu 切换为访客
network
.
agentCookies
.
put
(
"tku"
,
VISITOR_TKU
);
network
.
agentCookies
.
put
(
"tku"
,
VISITOR_TKU
);
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"scid"
,
aScid
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"sourceScid"
,
bScid
);
//代理人的用户id
params
.
put
(
"fromUserId"
,
userId
);
//代理人的用户id
params
.
put
(
"fromUserId"
,
userId
);
//代理人的用户id
params
.
put
(
"visitPath"
,
1
);
params
.
put
(
"visitPath"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
CONTENT_visit
);
Response
response
=
network
.
postResponse
(
params
,
CONTENT_visit
);
...
...
src/test/java/com/kjj/cases/assistant/menu/NoviceGuidance.java
View file @
6fc34cdb
...
@@ -12,8 +12,6 @@ import org.testng.Assert;
...
@@ -12,8 +12,6 @@ import org.testng.Assert;
import
org.testng.annotations.*
;
import
org.testng.annotations.*
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -25,7 +23,6 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
...
@@ -25,7 +23,6 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
NoviceGuidance
implements
Authorization
{
public
class
NoviceGuidance
implements
Authorization
{
private
long
userId
;
//小葡萄的用户id
private
long
userId
;
//小葡萄的用户id
private
long
sellerId
;
//小葡萄的销售id
private
String
grasscontentId
=
"Kj21Nzc1NDM"
;
//文章id:9692
private
String
grasscontentId
=
"Kj21Nzc1NDM"
;
//文章id:9692
private
String
scid
;
//转发文章的scid
private
String
scid
;
//转发文章的scid
private
String
visitId
;
//访问id
private
String
visitId
;
//访问id
...
@@ -41,22 +38,8 @@ public class NoviceGuidance implements Authorization {
...
@@ -41,22 +38,8 @@ public class NoviceGuidance implements Authorization {
@BeforeClass
@BeforeClass
public
void
setUp
()
{
public
void
setUp
()
{
ssoLogin
();
ssoLogin
();
}
newUser1
();
userId
=
ForwardAndRead
.
decodeTku
(
tku1
).
get
(
"userId"
);
@Test
(
description
=
"禁用代理人小葡萄"
,
priority
=
1
)
public
void
禁用代理人小葡萄
()
throws
UnsupportedEncodingException
,
SQLException
{
//取关公众号
userId
=
(
long
)
unsubscribe
();
//禁用账号
disableUser
(
userId
);
}
@Test
(
description
=
"小葡萄关注公众号并切换为会员"
,
priority
=
2
)
public
void
小葡萄关注公众号并切换为会员
()
throws
SQLException
{
//关注公众号
subscribe
();
//切换会员
updateTypeOrDate
(
0L
,
true
);
}
}
@Test
(
description
=
"创建资料包"
,
priority
=
3
)
@Test
(
description
=
"创建资料包"
,
priority
=
3
)
...
@@ -85,7 +68,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -85,7 +68,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"查询资料包列表"
,
priority
=
4
)
@Test
(
description
=
"查询资料包列表"
,
priority
=
4
)
public
void
查询资料包列表
()
{
public
void
查询资料包列表
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"pageIndex"
,
1
);
Params
.
put
(
"pageIndex"
,
1
);
Params
.
put
(
"pageSize"
,
20
);
Params
.
put
(
"pageSize"
,
20
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_datagram_list
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_datagram_list
);
...
@@ -97,7 +80,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -97,7 +80,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"查询资料包详情"
,
priority
=
5
)
@Test
(
description
=
"查询资料包详情"
,
priority
=
5
)
public
void
查询资料包详情
()
{
public
void
查询资料包详情
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"id"
,
dataID
);
Params
.
put
(
"id"
,
dataID
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_datagram_detail
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_datagram_detail
);
String
datagramName
=
response
.
jsonPath
().
getString
(
"data.datagramName"
);
String
datagramName
=
response
.
jsonPath
().
getString
(
"data.datagramName"
);
...
@@ -106,7 +89,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -106,7 +89,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"增加文章资料包"
,
priority
=
6
)
@Test
(
description
=
"增加文章资料包"
,
priority
=
6
)
public
void
增加文章资料包
()
{
public
void
增加文章资料包
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"contentId"
,
ARTICLE_ID
);
Params
.
put
(
"contentId"
,
ARTICLE_ID
);
Params
.
put
(
"resourceId"
,
dataContentID
);
Params
.
put
(
"resourceId"
,
dataContentID
);
Params
.
put
(
"resourceIntro"
,
"自动化测试文案"
);
Params
.
put
(
"resourceIntro"
,
"自动化测试文案"
);
...
@@ -121,7 +104,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -121,7 +104,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"查询资源位详情"
,
priority
=
7
)
@Test
(
description
=
"查询资源位详情"
,
priority
=
7
)
public
void
查询资源位详情
()
{
public
void
查询资源位详情
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"id"
,
articleDataID
);
Params
.
put
(
"id"
,
articleDataID
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_resource_findById
);
Response
response
=
network
.
getResponse
(
Params
,
BasicConfig
.
MANAGER_resource_findById
);
String
resourceTitle
=
response
.
jsonPath
().
getString
(
"data.resourceIntro"
);
String
resourceTitle
=
response
.
jsonPath
().
getString
(
"data.resourceIntro"
);
...
@@ -131,7 +114,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -131,7 +114,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"资料包有文章绑定删除失败"
,
priority
=
8
)
@Test
(
description
=
"资料包有文章绑定删除失败"
,
priority
=
8
)
public
void
资料包有文章绑定删除失败
()
{
public
void
资料包有文章绑定删除失败
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"id"
,
dataID
);
Params
.
put
(
"id"
,
dataID
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_delete
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_delete
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
...
@@ -192,7 +175,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -192,7 +175,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"文章有绑定删除互助问答失败"
,
priority
=
12
)
@Test
(
description
=
"文章有绑定删除互助问答失败"
,
priority
=
12
)
public
void
文章有绑定删除互助问答失败
()
{
public
void
文章有绑定删除互助问答失败
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"forceDelete"
,
0
);
Params
.
put
(
"forceDelete"
,
0
);
Params
.
put
(
"id"
,
qaID
);
Params
.
put
(
"id"
,
qaID
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_qa_del
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_qa_del
);
...
@@ -211,8 +194,9 @@ public class NoviceGuidance implements Authorization {
...
@@ -211,8 +194,9 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"小葡萄保存名片基本信息"
,
priority
=
14
)
@Test
(
description
=
"小葡萄保存名片基本信息"
,
priority
=
14
)
public
void
小葡萄保存名片基本信息
()
{
public
void
小葡萄保存名片基本信息
()
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
//修改用户信息
//修改用户信息
params
.
put
(
"companyId"
,
6
);
params
.
put
(
"phoneNumber"
,
"13043214321"
);
params
.
put
(
"phoneNumber"
,
"13043214321"
);
params
.
put
(
"jobPost"
,
"测试"
);
params
.
put
(
"jobPost"
,
"测试"
);
Response
response
=
network
.
postResponse
(
params
,
SELLERCARD_editBaseInfo
);
Response
response
=
network
.
postResponse
(
params
,
SELLERCARD_editBaseInfo
);
...
@@ -232,7 +216,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -232,7 +216,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"完成名片的新手引导"
,
priority
=
16
)
@Test
(
description
=
"完成名片的新手引导"
,
priority
=
16
)
public
void
完成名片的新手引导
()
{
public
void
完成名片的新手引导
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"guideType"
,
21
);
params
.
put
(
"guideType"
,
21
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
...
@@ -269,7 +253,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -269,7 +253,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"点击完成线索的转发引导"
,
priority
=
19
)
@Test
(
description
=
"点击完成线索的转发引导"
,
priority
=
19
)
public
void
点击完成线索的转发引导
()
{
public
void
点击完成线索的转发引导
()
{
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"guideType"
,
35
);
params
.
put
(
"guideType"
,
35
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
...
@@ -326,7 +310,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -326,7 +310,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"代理人点击谁看过我显示备注引导"
,
priority
=
22
)
@Test
(
description
=
"代理人点击谁看过我显示备注引导"
,
priority
=
22
)
public
void
代理人点击谁看过我显示备注引导
()
{
public
void
代理人点击谁看过我显示备注引导
()
{
ne
twork
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
ne
wUser1
(
);
Response
response
=
network
.
getResponse
(
ROOKIECLUEGUIDE
);
Response
response
=
network
.
getResponse
(
ROOKIECLUEGUIDE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
int
guideType
=
response
.
jsonPath
().
getInt
(
"data.guideType"
);
int
guideType
=
response
.
jsonPath
().
getInt
(
"data.guideType"
);
...
@@ -337,7 +321,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -337,7 +321,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"点击完成线索的备注引导"
,
priority
=
23
)
@Test
(
description
=
"点击完成线索的备注引导"
,
priority
=
23
)
public
void
点击完成线索的备注引导
()
{
public
void
点击完成线索的备注引导
()
{
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"guideType"
,
34
);
params
.
put
(
"guideType"
,
34
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
...
@@ -387,10 +371,10 @@ public class NoviceGuidance implements Authorization {
...
@@ -387,10 +371,10 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
// 查看谁看过我首页我的跟进机会列表
@Test
(
description
=
"代理人查看我的跟进机会列表"
,
priority
=
25
)
@Test
(
description
=
"代理人查看我的跟进机会列表"
,
priority
=
25
)
public
void
代理人查看我的跟进机会列表
()
throws
IOException
{
public
void
代理人查看我的跟进机会列表
()
throws
IOException
{
ne
twork
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
ne
wUser1
(
);
sleep
(
2000
);
sleep
(
2000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"lastClueId"
,
0
);
params
.
put
(
"lastClueId"
,
0
);
...
@@ -416,7 +400,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -416,7 +400,7 @@ public class NoviceGuidance implements Authorization {
// 销售线索_跟进建议
// 销售线索_跟进建议
@Test
(
description
=
"查看资料包_跟进建议"
,
priority
=
27
)
@Test
(
description
=
"查看资料包_跟进建议"
,
priority
=
27
)
public
void
查看资料包
_
跟进建议
()
throws
IOException
{
public
void
查看资料包
_
跟进建议
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
=
new
HashMap
<>();
params
=
new
HashMap
<>();
params
.
put
(
"clueId"
,
clueId
);
params
.
put
(
"clueId"
,
clueId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEADVISE
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEADVISE
);
...
@@ -428,7 +412,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -428,7 +412,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"点击完成线索的备注引导"
,
priority
=
28
)
@Test
(
description
=
"点击完成线索的备注引导"
,
priority
=
28
)
public
void
点击完成线索的跟进机会引导
()
{
public
void
点击完成线索的跟进机会引导
()
{
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Response
response
=
network
.
getResponse
(
SELLERCARD_CARDGUIDE
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"guideType"
,
31
);
params
.
put
(
"guideType"
,
31
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
COMPLETEGUIDE
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
...
@@ -506,10 +490,10 @@ public class NoviceGuidance implements Authorization {
...
@@ -506,10 +490,10 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
// 查看谁看过我首页我的跟进机会列表
@Test
(
description
=
"代理人查看更新的跟进机会列表"
,
priority
=
30
)
@Test
(
description
=
"代理人查看更新的跟进机会列表"
,
priority
=
30
)
public
void
代理人查看更新的跟进机会列表
()
throws
IOException
{
public
void
代理人查看更新的跟进机会列表
()
throws
IOException
{
ne
twork
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
ne
wUser1
(
);
sleep
(
2000
);
sleep
(
2000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"lastClueId"
,
0
);
params
.
put
(
"lastClueId"
,
0
);
...
@@ -525,7 +509,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -525,7 +509,7 @@ public class NoviceGuidance implements Authorization {
// 销售线索_线索详情
// 销售线索_线索详情
@Test
(
description
=
"查看_线索详情"
,
priority
=
31
)
@Test
(
description
=
"查看_线索详情"
,
priority
=
31
)
public
void
查看
_
线索详情
()
throws
IOException
{
public
void
查看
_
线索详情
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"clueId"
,
clueId
);
params
.
put
(
"clueId"
,
clueId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEINFO
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEINFO
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(0).subtitle"
),
"直接访问"
,
network
.
message
(
params
,
BasicConfig
.
CLUEINFO
,
"文章标题错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.faqCluePathListInfoVo.faqCluePathDetailInfoVos.get(0).subtitle"
),
"直接访问"
,
network
.
message
(
params
,
BasicConfig
.
CLUEINFO
,
"文章标题错误"
,
response
.
body
().
asString
()));
...
@@ -539,7 +523,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -539,7 +523,7 @@ public class NoviceGuidance implements Authorization {
// 销售线索_跟进建议
// 销售线索_跟进建议
@Test
(
description
=
"查看问答_跟进建议"
,
priority
=
32
)
@Test
(
description
=
"查看问答_跟进建议"
,
priority
=
32
)
public
void
查看问答
_
跟进建议
()
throws
IOException
{
public
void
查看问答
_
跟进建议
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
=
new
HashMap
<>();
params
=
new
HashMap
<>();
params
.
put
(
"clueId"
,
clueId
);
params
.
put
(
"clueId"
,
clueId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEADVISE
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEADVISE
);
...
@@ -572,10 +556,10 @@ public class NoviceGuidance implements Authorization {
...
@@ -572,10 +556,10 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
// 查看谁看过我首页我的跟进机会列表
@Test
(
description
=
"代理人查看最新的跟进机会列表"
,
priority
=
34
)
@Test
(
description
=
"代理人查看最新的跟进机会列表"
,
priority
=
34
)
public
void
代理人查看最新的跟进机会列表
()
throws
IOException
{
public
void
代理人查看最新的跟进机会列表
()
throws
IOException
{
ne
twork
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
ne
wUser1
(
);
sleep
(
2000
);
sleep
(
2000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
List
<
Object
>
customerTagIds
=
Lists
.
newArrayList
();
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"customerTagIds"
,
customerTagIds
);
params
.
put
(
"lastClueId"
,
0
);
params
.
put
(
"lastClueId"
,
0
);
...
@@ -591,7 +575,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -591,7 +575,7 @@ public class NoviceGuidance implements Authorization {
// 销售线索_线索详情
// 销售线索_线索详情
@Test
(
description
=
"查看关联提问_线索详情"
,
priority
=
35
)
@Test
(
description
=
"查看关联提问_线索详情"
,
priority
=
35
)
public
void
查看关联提问
_
线索详情
()
throws
IOException
{
public
void
查看关联提问
_
线索详情
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"clueId"
,
clueId
);
params
.
put
(
"clueId"
,
clueId
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEINFO
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
CLUEINFO
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.questionAnswerVo.extraQuestion"
),
"自动化关联问题"
,
network
.
message
(
params
,
BasicConfig
.
CLUEINFO
,
"文章标题错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.questionAnswerVo.extraQuestion"
),
"自动化关联问题"
,
network
.
message
(
params
,
BasicConfig
.
CLUEINFO
,
"文章标题错误"
,
response
.
body
().
asString
()));
...
@@ -627,7 +611,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -627,7 +611,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"删除互助问答成功"
,
priority
=
37
)
@Test
(
description
=
"删除互助问答成功"
,
priority
=
37
)
public
void
删除互助问答成功
()
{
public
void
删除互助问答成功
()
{
sleep
(
3000
);
sleep
(
3000
);
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"forceDelete"
,
0
);
Params
.
put
(
"forceDelete"
,
0
);
Params
.
put
(
"id"
,
qaID
);
Params
.
put
(
"id"
,
qaID
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_qa_del
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_qa_del
);
...
@@ -638,7 +622,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -638,7 +622,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"删除文章中资料包"
,
priority
=
38
)
@Test
(
description
=
"删除文章中资料包"
,
priority
=
38
)
public
void
删除文章中资料包
()
{
public
void
删除文章中资料包
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"id"
,
articleDataID
);
Params
.
put
(
"id"
,
articleDataID
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_deleteById
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_deleteById
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
@@ -648,7 +632,7 @@ public class NoviceGuidance implements Authorization {
...
@@ -648,7 +632,7 @@ public class NoviceGuidance implements Authorization {
@Test
(
description
=
"删除资料包"
,
priority
=
39
)
@Test
(
description
=
"删除资料包"
,
priority
=
39
)
public
void
删除资料包
()
{
public
void
删除资料包
()
{
sleep
(
3000
);
sleep
(
3000
);
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"id"
,
dataID
);
Params
.
put
(
"id"
,
dataID
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_delete
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource_delete
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
...
...
src/test/java/com/kjj/cases/assistant/menu/PersonalCenter.java
View file @
6fc34cdb
...
@@ -9,7 +9,6 @@ import org.testng.annotations.*;
...
@@ -9,7 +9,6 @@ import org.testng.annotations.*;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku
;
public
class
PersonalCenter
implements
Authorization
{
public
class
PersonalCenter
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
...
...
src/test/java/com/kjj/cases/assistant/pay/Cashback.java
View file @
6fc34cdb
package
com
.
kjj
.
cases
.
assistant
.
pay
;
package
com
.
kjj
.
cases
.
assistant
.
pay
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.assistant.whoSawMe.ForwardAndRead
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.BaseUtils
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -16,20 +19,47 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
...
@@ -16,20 +19,47 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
Cashback
implements
Authorization
{
public
class
Cashback
implements
Authorization
{
private
String
tradeNo
;
private
String
tradeNo
;
private
long
userId
;
private
long
sellerId
;
private
long
userId2
;
private
long
sellerId2
;
@BeforeClass
@BeforeClass
public
void
setUp
()
{
public
void
setUp
()
{
userTku2
();
BaseUtils
.
ssoLogin
();
BaseUtils
.
ssoLogin
();
}
agentAuth
();
try
{
//取关公众号----小葡萄
userId
=
(
long
)
unsubscribe
(
openId1
);
//禁用账号
disableUser
(
userId
);
//关注公众号
tku1
=
subscribe
(
openId1
);
userId
=
ForwardAndRead
.
decodeTku
(
tku1
).
get
(
"userId"
);
sellerId
=
ForwardAndRead
.
decodeTku
(
tku1
).
get
(
"sellerId"
);
insertTestUser
(
userId
);
//取关公众号-----小米粥
userId2
=
(
long
)
unsubscribe
(
openId2
);
//禁用账号
disableUser
(
userId2
);
//关注公众号
tku2
=
subscribe
(
openId2
);
userId2
=
ForwardAndRead
.
decodeTku
(
tku2
).
get
(
"userId"
);
sellerId2
=
ForwardAndRead
.
decodeTku
(
tku2
).
get
(
"sellerId"
);
insertTestUser
(
userId2
);
}
catch
(
SQLException
throwables
)
{
throwables
.
printStackTrace
();
}
}
@Test
(
description
=
"一级用户绑定分享合伙人关系"
,
priority
=
1
)
@Test
(
description
=
"一级用户绑定分享合伙人关系"
,
priority
=
1
)
public
void
一级用户绑定分享合伙人关系
()
{
public
void
一级用户绑定分享合伙人关系
()
{
updateTypeOrDate
(
186
,
false
);
newUser1
(
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"sellerId"
,
186
);
params
.
put
(
"sellerId"
,
sellerId
);
params
.
put
(
"inviterSid"
,
2991
);
params
.
put
(
"inviterSid"
,
2991
);
params
.
put
(
"openId"
,
"osi5w5hV9U4Pix8FBY6X5zcUbIEY"
);
params
.
put
(
"openId"
,
openId1
);
params
.
put
(
"userId"
,
373
);
params
.
put
(
"userId"
,
userId
);
params
.
put
(
"oaId"
,
1
);
params
.
put
(
"oaId"
,
1
);
params
.
put
(
"scene"
,
1
);
params
.
put
(
"scene"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
PAY_bind
);
Response
response
=
network
.
postResponse
(
params
,
PAY_bind
);
...
@@ -62,12 +92,12 @@ public class Cashback implements Authorization {
...
@@ -62,12 +92,12 @@ public class Cashback implements Authorization {
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.list.get(0).nickname"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.list.get(0).nickname"
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
PAY_distributionList
,
"待付款好友列表为null"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
list
,
network
.
message
(
PAY_distributionList
,
"待付款好友列表为null"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickname
,
"
Ryan
"
,
network
.
message
(
PAY_distributionList
,
"待付款微信昵称错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickname
,
"
小葡萄
"
,
network
.
message
(
PAY_distributionList
,
"待付款微信昵称错误"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"返现用户付费_一级用户下单并支付成功"
,
priority
=
4
)
@Test
(
description
=
"返现用户付费_一级用户下单并支付成功"
,
priority
=
4
)
public
void
返现用户付费
_
一级用户下单并支付成功
()
{
public
void
返现用户付费
_
一级用户下单并支付成功
()
{
userTku2
();
newUser1
();
//创建支付
//创建支付
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"entryDiscountType"
,
1
);
params
.
put
(
"entryDiscountType"
,
1
);
...
@@ -106,7 +136,30 @@ public class Cashback implements Authorization {
...
@@ -106,7 +136,30 @@ public class Cashback implements Authorization {
}
}
@Test
(
description
=
"返现用户付费_一级用户续费并支付成功"
,
priority
=
5
)
@Test
(
description
=
"默认付费_续费页"
,
priority
=
5
)
//priority 方法执行优先级
public
void
默认付费
_
续费页
()
{
sleep
(
2000
);
//代理人续费状态
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
payParams
.
put
(
"entryDiscountType"
,
1
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
Response
response
=
network
.
getResponse
(
PAY_info
);
int
discountType
=
response
.
jsonPath
().
getInt
(
"data.discountType"
);
int
validity
=
response
.
jsonPath
().
getInt
(
"data.validity"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
Assert
.
assertEquals
(
discountType
,
2
,
network
.
message
(
PAY_info
,
"非续费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
validity
,
12
,
network
.
message
(
PAY_info
,
"增加会员时长非12个月"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
2
,
network
.
message
(
PAY_info
,
"续费价格非0.02"
,
response
.
body
().
asString
()));
//会员类型版本判断
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"t"
,
System
.
currentTimeMillis
());
response
=
network
.
getResponse
(
params
,
version_info
);
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
()));
}
@Test
(
description
=
"返现用户付费_一级用户续费并支付成功"
,
priority
=
6
)
public
void
返现用户付费
_
一级用户续费并支付成功
()
{
public
void
返现用户付费
_
一级用户续费并支付成功
()
{
//创建支付
//创建支付
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
@@ -141,15 +194,14 @@ public class Cashback implements Authorization {
...
@@ -141,15 +194,14 @@ public class Cashback implements Authorization {
Assert
.
assertEquals
(
data
,
3
,
network
.
message
(
USER_INFO
,
"支付失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
data
,
3
,
network
.
message
(
USER_INFO
,
"支付失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"二级用户绑定分享合伙人关系"
,
priority
=
6
)
@Test
(
description
=
"二级用户绑定分享合伙人关系"
,
priority
=
7
)
public
void
二级用户绑定分享合伙人关系
()
{
public
void
二级用户绑定分享合伙人关系
()
{
userTku3
();
newUser2
();
updateTypeOrDate
(
207
,
false
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"sellerId"
,
207
);
params
.
put
(
"sellerId"
,
sellerId2
);
params
.
put
(
"inviterSid"
,
186
);
params
.
put
(
"inviterSid"
,
sellerId
);
params
.
put
(
"openId"
,
"osi5w5qvNVe8sWzVitVDZVdUkoZ8"
);
params
.
put
(
"openId"
,
openId2
);
params
.
put
(
"userId"
,
359
);
params
.
put
(
"userId"
,
userId2
);
params
.
put
(
"oaId"
,
1
);
params
.
put
(
"oaId"
,
1
);
params
.
put
(
"scene"
,
1
);
params
.
put
(
"scene"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
PAY_bind
);
Response
response
=
network
.
postResponse
(
params
,
PAY_bind
);
...
@@ -157,7 +209,7 @@ public class Cashback implements Authorization {
...
@@ -157,7 +209,7 @@ public class Cashback implements Authorization {
Assert
.
assertTrue
(
bindResult
,
network
.
message
(
PAY_bind
,
"用户绑定失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
bindResult
,
network
.
message
(
PAY_bind
,
"用户绑定失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"默认付费_二级用户邀请付费页"
,
priority
=
7
)
//priority 方法执行优先级
@Test
(
description
=
"默认付费_二级用户邀请付费页"
,
priority
=
8
)
//priority 方法执行优先级
public
void
默认付费
_
二级用户邀请付费页
()
{
public
void
默认付费
_
二级用户邀请付费页
()
{
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
payParams
.
put
(
"entryDiscountType"
,
1
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
payParams
.
put
(
"entryDiscountType"
,
1
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
...
@@ -166,11 +218,11 @@ public class Cashback implements Authorization {
...
@@ -166,11 +218,11 @@ public class Cashback implements Authorization {
String
superiorName
=
response
.
jsonPath
().
getString
(
"data.invitation.superiorName"
);
String
superiorName
=
response
.
jsonPath
().
getString
(
"data.invitation.superiorName"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
Assert
.
assertEquals
(
discountType
,
3
,
network
.
message
(
PAY_info
,
"非邀请付费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
discountType
,
3
,
network
.
message
(
PAY_info
,
"非邀请付费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
superiorName
,
"
Ryan
"
,
network
.
message
(
PAY_info
,
"上级邀请人错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
superiorName
,
"
小葡萄
"
,
network
.
message
(
PAY_info
,
"上级邀请人错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
3
,
network
.
message
(
PAY_info
,
"邀请价格非0.03"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
3
,
network
.
message
(
PAY_info
,
"邀请价格非0.03"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"返现用户付费_二级用户下单并支付成功"
,
priority
=
8
)
@Test
(
description
=
"返现用户付费_二级用户下单并支付成功"
,
priority
=
9
)
public
void
返现用户付费
_
二级用户下单并支付成功
()
{
public
void
返现用户付费
_
二级用户下单并支付成功
()
{
//创建支付
//创建支付
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
@@ -210,7 +262,7 @@ public class Cashback implements Authorization {
...
@@ -210,7 +262,7 @@ public class Cashback implements Authorization {
}
}
@Test
(
description
=
"获取用户版本信息"
,
priority
=
9
)
@Test
(
description
=
"获取用户版本信息"
,
priority
=
10
)
public
void
获取用户版本信息
()
{
public
void
获取用户版本信息
()
{
agentTku
();
agentTku
();
Response
response
=
network
.
getResponse
(
USER_INFO
);
Response
response
=
network
.
getResponse
(
USER_INFO
);
...
@@ -219,7 +271,7 @@ public class Cashback implements Authorization {
...
@@ -219,7 +271,7 @@ public class Cashback implements Authorization {
}
}
@Test
(
description
=
"邀请的已支付好友列表"
,
priority
=
1
0
)
@Test
(
description
=
"邀请的已支付好友列表"
,
priority
=
1
1
)
public
void
邀请的已支付好友列表
()
{
public
void
邀请的已支付好友列表
()
{
sleep
(
2000
);
sleep
(
2000
);
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<
String
,
Object
>();
...
@@ -230,10 +282,10 @@ public class Cashback implements Authorization {
...
@@ -230,10 +282,10 @@ public class Cashback implements Authorization {
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
Object
list
=
response
.
jsonPath
().
getJsonObject
(
"data.list"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.list.get(0).nickname"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.list.get(0).nickname"
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
PAY_distributionList
,
"已付款好友列表为null"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
list
,
network
.
message
(
PAY_distributionList
,
"已付款好友列表为null"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickname
,
"
Ryan
"
,
network
.
message
(
PAY_distributionList
,
"已付款微信昵称错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
nickname
,
"
小葡萄
"
,
network
.
message
(
PAY_distributionList
,
"已付款微信昵称错误"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"代理人账户信息"
,
priority
=
1
1
)
@Test
(
description
=
"代理人账户信息"
,
priority
=
1
2
)
public
void
代理人账户信息
()
{
public
void
代理人账户信息
()
{
Response
response
=
network
.
getResponse
(
PAY_accInfo
);
Response
response
=
network
.
getResponse
(
PAY_accInfo
);
double
balance
=
Double
.
parseDouble
(
response
.
jsonPath
().
getString
(
"data.balance"
));
double
balance
=
Double
.
parseDouble
(
response
.
jsonPath
().
getString
(
"data.balance"
));
...
@@ -250,7 +302,7 @@ public class Cashback implements Authorization {
...
@@ -250,7 +302,7 @@ public class Cashback implements Authorization {
Assert
.
assertTrue
(
maxWithdrawMoney
==
5000
,
network
.
message
(
PAY_accInfo
,
"最大可提现金额不等于5000"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
maxWithdrawMoney
==
5000
,
network
.
message
(
PAY_accInfo
,
"最大可提现金额不等于5000"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"合伙人账户明细"
,
priority
=
1
2
)
@Test
(
description
=
"合伙人账户明细"
,
priority
=
1
3
)
public
void
合伙人账户明细
()
{
public
void
合伙人账户明细
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"type"
,
1
);
Params
.
put
(
"type"
,
1
);
...
@@ -270,7 +322,7 @@ public class Cashback implements Authorization {
...
@@ -270,7 +322,7 @@ public class Cashback implements Authorization {
Assert
.
assertTrue
(
changeMoney2
==
50.0
,
network
.
message
(
PAY_accDetail
,
"一级付费合伙人返现金额不为50"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
changeMoney2
==
50.0
,
network
.
message
(
PAY_accDetail
,
"一级付费合伙人返现金额不为50"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"代理人提现"
,
priority
=
1
3
)
@Test
(
description
=
"代理人提现"
,
priority
=
1
4
)
public
void
代理人提现
()
{
public
void
代理人提现
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"withdrawMoney"
,
1
);
Params
.
put
(
"withdrawMoney"
,
1
);
...
@@ -279,9 +331,9 @@ public class Cashback implements Authorization {
...
@@ -279,9 +331,9 @@ public class Cashback implements Authorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
PAY_withdraw
,
"提现失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
PAY_withdraw
,
"提现失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"普通代理人账户明细"
,
priority
=
1
4
)
@Test
(
description
=
"普通代理人账户明细"
,
priority
=
1
5
)
public
void
普通代理人账户明细
()
{
public
void
普通代理人账户明细
()
{
userTku2
();
newUser1
();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"type"
,
2
);
Params
.
put
(
"type"
,
2
);
Params
.
put
(
"pageNo"
,
1
);
Params
.
put
(
"pageNo"
,
1
);
...
...
src/test/java/com/kjj/cases/assistant/pay/Pay.java
View file @
6fc34cdb
package
com
.
kjj
.
cases
.
assistant
.
pay
;
package
com
.
kjj
.
cases
.
assistant
.
pay
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku
1
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
updateTypeOrDate
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
updateTypeOrDate
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.NetworkUtils
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.apache.commons.lang3.RandomUtils
;
import
org.apache.commons.lang3.RandomUtils
;
import
org.testng.Assert
;
import
org.testng.Assert
;
...
@@ -26,29 +25,23 @@ public class Pay implements Authorization {
...
@@ -26,29 +25,23 @@ public class Pay implements Authorization {
private
String
tradeNo
;
private
String
tradeNo
;
private
String
promotionCode
;
private
String
promotionCode
;
@Test
(
description
=
"默认付费_续费页"
,
priority
=
1
)
//priority 方法执行优先级
@Test
(
description
=
"默认付费_正常付费页"
,
priority
=
2
)
//priority 方法执行优先级
public
void
默认付费
_
续费页
()
{
public
void
默认付费
_
正常付费页
()
{
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
userTku
();
//代理人续费状态
updateTypeOrDate
(
2105
,
false
);
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
payParams
.
put
(
"entryDiscountType"
,
3
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
payParams
.
put
(
"entryDiscountType"
,
1
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
Response
response
=
network
.
getResponse
(
PAY_info
);
Response
response
=
network
.
getResponse
(
PAY_info
);
int
discountType
=
response
.
jsonPath
().
getInt
(
"data.discountType"
);
int
discountType
=
response
.
jsonPath
().
getInt
(
"data.discountType"
);
int
validity
=
response
.
jsonPath
().
getInt
(
"data.validity"
);
int
validity
=
response
.
jsonPath
().
getInt
(
"data.validity"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
Assert
.
assertEquals
(
discountType
,
2
,
network
.
message
(
PAY_info
,
"非续
费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
discountType
,
1
,
network
.
message
(
PAY_info
,
"非正常付
费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
validity
,
12
,
network
.
message
(
PAY_info
,
"增加会员时长非12个月"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
validity
,
12
,
network
.
message
(
PAY_info
,
"增加会员时长非12个月"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
2
,
network
.
message
(
PAY_info
,
"续费价格非0.02"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
4
,
network
.
message
(
PAY_info
,
"正常价格非0.04"
,
response
.
body
().
asString
()));
//会员类型版本判断
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"t"
,
System
.
currentTimeMillis
());
response
=
network
.
getResponse
(
params
,
version_info
);
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
()));
}
}
@Test
(
description
=
"获取开通会员跑马灯"
,
priority
=
2
)
//priority 方法执行优先级
@Test
(
description
=
"获取开通会员跑马灯"
,
priority
=
3
)
//priority 方法执行优先级
public
void
获取开通会员跑马灯
()
{
public
void
获取开通会员跑马灯
()
{
Response
response
=
network
.
getResponse
(
PAY_list
);
Response
response
=
network
.
getResponse
(
PAY_list
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.get(0).nickname"
);
String
nickname
=
response
.
jsonPath
().
getString
(
"data.get(0).nickname"
);
...
@@ -57,22 +50,6 @@ public class Pay implements Authorization {
...
@@ -57,22 +50,6 @@ public class Pay implements Authorization {
Assert
.
assertNotNull
(
avatar
,
network
.
message
(
PAY_list
,
"会员头像为空"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
avatar
,
network
.
message
(
PAY_list
,
"会员头像为空"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"默认付费_正常付费页"
,
priority
=
3
)
//priority 方法执行优先级
public
void
默认付费
_
正常付费页
()
{
userTku
();
updateTypeOrDate
(
2105
,
false
);
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
payParams
.
put
(
"entryDiscountType"
,
1
);
//入口折扣类型,1-普通,3-邀请,4-优惠码
Response
response
=
network
.
getResponse
(
PAY_info
);
int
discountType
=
response
.
jsonPath
().
getInt
(
"data.discountType"
);
int
validity
=
response
.
jsonPath
().
getInt
(
"data.validity"
);
int
preferentialPrice
=
response
.
jsonPath
().
getInt
(
"data.preferentialPrice"
);
Assert
.
assertEquals
(
discountType
,
1
,
network
.
message
(
PAY_info
,
"非正常付费逻辑"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
validity
,
12
,
network
.
message
(
PAY_info
,
"增加会员时长非12个月"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
preferentialPrice
,
4
,
network
.
message
(
PAY_info
,
"正常价格非0.04"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"默认付费_待支付"
,
priority
=
4
)
@Test
(
description
=
"默认付费_待支付"
,
priority
=
4
)
public
void
默认付费
_
待支付
()
{
public
void
默认付费
_
待支付
()
{
//创建支付
//创建支付
...
...
src/test/java/com/kjj/cases/assistant/whoSawMe/ForwardAndRead.java
View file @
6fc34cdb
...
@@ -3,7 +3,6 @@ package com.kjj.cases.assistant.whoSawMe;
...
@@ -3,7 +3,6 @@ package com.kjj.cases.assistant.whoSawMe;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.ThreadSleepUtils
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
...
@@ -12,8 +11,8 @@ import org.testng.annotations.Test;
...
@@ -12,8 +11,8 @@ import org.testng.annotations.Test;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
BOSS_EDITCONFIG
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
TKU_COOKIE_NAME
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
DYNAMIC_addVisit
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
import
static
com
.
kjj
.
utils
.
ThreadSleepUtils
.
sleep
;
...
@@ -28,12 +27,14 @@ public class ForwardAndRead implements Authorization {
...
@@ -28,12 +27,14 @@ public class ForwardAndRead implements Authorization {
private
long
forwardTime
;
private
long
forwardTime
;
private
String
questionId
;
private
String
questionId
;
private
String
traceId
;
//访问链路id
private
String
traceId
;
//访问链路id
private
Long
fromUserId
;
public
static
Map
<
String
,
Integer
>
custClueStatistics
;
public
static
Map
<
String
,
Integer
>
custClueStatistics
;
@BeforeClass
@BeforeClass
public
void
setUp
()
throws
IOException
{
public
void
setUp
()
throws
IOException
{
agent2Tku
();
agent2Tku
();
ssoLogin
();
ssoLogin
();
fromUserId
=
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"userId"
);
}
}
// 获取二度访客起始线索数据
// 获取二度访客起始线索数据
...
@@ -99,6 +100,15 @@ public class ForwardAndRead implements Authorization {
...
@@ -99,6 +100,15 @@ public class ForwardAndRead implements Authorization {
jjvisitId
=
response
.
jsonPath
().
getString
(
"data.userVisitId"
);
jjvisitId
=
response
.
jsonPath
().
getString
(
"data.userVisitId"
);
Assert
.
assertNotNull
(
jjvisitId
,
network
.
message
(
param
,
BasicConfig
.
CONTENT_visit
,
"visitId为空"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
jjvisitId
,
network
.
message
(
param
,
BasicConfig
.
CONTENT_visit
,
"visitId为空"
,
response
.
body
().
asString
()));
traceId
=
response
.
jsonPath
().
getString
(
"data.traceId"
);
traceId
=
response
.
jsonPath
().
getString
(
"data.traceId"
);
param
.
clear
();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"forwardTime"
,
System
.
currentTimeMillis
());
response
=
network
.
postResponse
(
param
,
DYNAMIC_addVisit
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
}
}
...
@@ -118,22 +128,32 @@ public class ForwardAndRead implements Authorization {
...
@@ -118,22 +128,32 @@ public class ForwardAndRead implements Authorization {
@Test
(
description
=
"新用户访问"
,
priority
=
7
)
@Test
(
description
=
"新用户访问"
,
priority
=
7
)
public
void
新用户访问
()
throws
IOException
{
public
void
新用户访问
()
throws
IOException
{
sleep
(
5000
);
sleep
(
5000
);
ne
twork
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
BaseUtils
.
tku
);
ne
wUser1
(
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
response
=
network
.
getResponse
(
BasicConfig
.
USER_INFO
);
System
.
out
.
println
(
response
.
body
().
asString
());
System
.
out
.
println
(
response
.
body
().
asString
());
param
.
clear
();
param
.
clear
();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"fromUserId"
,
sellerId
);
param
.
put
(
"fromUserId"
,
fromUserId
);
param
.
put
(
"traceId"
,
traceId
);
param
.
put
(
"visitPath"
,
0
);
param
.
put
(
"visitPath"
,
0
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CONTENT_visit
);
response
=
network
.
postResponse
(
param
,
BasicConfig
.
CONTENT_visit
);
System
.
out
.
println
(
response
.
body
().
asString
());
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CONTENT_visit
,
"接口调用失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CONTENT_visit
,
"接口调用失败"
,
response
.
body
().
asString
()));
param
.
clear
();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"forwardTime"
,
System
.
currentTimeMillis
());
response
=
network
.
postResponse
(
param
,
DYNAMIC_addVisit
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"二度访客阅读文章"
,
priority
=
9
)
@Test
(
description
=
"二度访客阅读文章"
,
priority
=
9
)
public
void
二度访客阅读文章
()
throws
IOException
{
public
void
二度访客阅读文章
()
throws
IOException
{
sleep
(
5000
);
sleep
(
5000
);
Long
fromUserId
=
decodeTku
(
BasicConfig
.
AGENT_TKU
).
get
(
"userId"
);
userTku2
();
// 切换二度访客
userTku2
();
// 切换二度访客
param
=
new
HashMap
<>();
param
=
new
HashMap
<>();
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"scid"
,
articleScId
);
...
@@ -148,10 +168,13 @@ public class ForwardAndRead implements Authorization {
...
@@ -148,10 +168,13 @@ public class ForwardAndRead implements Authorization {
@Test
(
description
=
"添加访问记录"
,
priority
=
10
)
@Test
(
description
=
"添加访问记录"
,
priority
=
10
)
public
void
添加访问记录
()
throws
IOException
{
public
void
添加访问记录
()
throws
IOException
{
param
.
clear
();
param
.
clear
();
param
.
put
(
"forwardTime"
,
forwardTime
);
// 添加访问记录的时间要小于代理人转发时间
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"scid"
,
articleScId
);
param
.
put
(
"forwardTime"
,
System
.
currentTimeMillis
());
response
=
network
.
postResponse
(
param
,
BasicConfig
.
DYNAMIC_ADDVISIT
);
response
=
network
.
postResponse
(
param
,
DYNAMIC_addVisit
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"data"
),
network
.
message
(
param
,
BasicConfig
.
DYNAMIC_ADDVISIT
,
"添加访问记录失败"
,
response
.
body
().
asString
()));
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
param
,
DYNAMIC_addVisit
,
"接口返回数据为空"
,
response
.
body
().
asString
()));
//转发
//转发
param
.
clear
();
param
.
clear
();
...
@@ -160,8 +183,8 @@ public class ForwardAndRead implements Authorization {
...
@@ -160,8 +183,8 @@ public class ForwardAndRead implements Authorization {
param
.
put
(
"forwardType"
,
1
);
param
.
put
(
"forwardType"
,
1
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
FORWARD
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口调用失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"接口调用失败"
,
response
.
body
().
asString
()));
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"访客转发素材失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
param
,
BasicConfig
.
FORWARD
,
"访客转发素材失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"获取文章FAQs"
,
priority
=
12
)
@Test
(
description
=
"获取文章FAQs"
,
priority
=
12
)
...
...
src/test/java/com/kjj/cases/assistant/whoSawMe/MyCustomer.java
View file @
6fc34cdb
...
@@ -15,6 +15,7 @@ import java.io.IOException;
...
@@ -15,6 +15,7 @@ import java.io.IOException;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
tku1
;
// 我的客户-首页
// 我的客户-首页
public
class
MyCustomer
implements
Authorization
{
public
class
MyCustomer
implements
Authorization
{
...
@@ -25,12 +26,14 @@ public class MyCustomer implements Authorization {
...
@@ -25,12 +26,14 @@ public class MyCustomer implements Authorization {
private
String
sessionId
;
private
String
sessionId
;
private
String
id
;
// 自定义提醒事项id
private
String
id
;
// 自定义提醒事项id
private
long
lastMessageId
;
private
long
lastMessageId
;
private
long
newUserId
;
@BeforeClass
@BeforeClass
public
void
setUp
()
throws
IOException
{
public
void
setUp
()
throws
IOException
{
BaseUtils
.
ssoLogin
();
BaseUtils
.
ssoLogin
();
agent2Tku
();
agent2Tku
();
visitor1UserId
=
ForwardAndRead
.
decodeTku
(
VISITOR1_TKU
).
get
(
"userId"
);
visitor1UserId
=
ForwardAndRead
.
decodeTku
(
VISITOR1_TKU
).
get
(
"userId"
);
newUserId
=
ForwardAndRead
.
decodeTku
(
tku1
).
get
(
"userId"
);
}
}
// 我的客户首页_客户统计
// 我的客户首页_客户统计
...
@@ -189,11 +192,11 @@ public class MyCustomer implements Authorization {
...
@@ -189,11 +192,11 @@ public class MyCustomer implements Authorization {
List
<
Object
>
lists
=
response
.
jsonPath
().
getList
(
"data.list"
);
List
<
Object
>
lists
=
response
.
jsonPath
().
getList
(
"data.list"
);
Assert
.
assertTrue
(
lists
.
size
()
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"直接转发客户数为0"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
lists
.
size
()
>=
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTOMERSEARCH
,
"直接转发客户数为0"
,
response
.
body
().
asString
()));
}
}
//
客户详情页_头部信息栏
//
客户详情页_头部信息栏
@Test
(
description
=
"客户详情页_头部信息栏"
,
priority
=
16
)
@Test
(
description
=
"客户详情页_头部信息栏"
,
priority
=
16
)
public
void
客户详情页
_
头部信息栏
()
throws
IOException
{
public
void
客户详情页
_
头部信息栏
()
throws
IOException
{
param
=
new
HashMap
<>();
param
=
new
HashMap
<>();
param
.
put
(
"custUserId"
,
visitor1
UserId
);
param
.
put
(
"custUserId"
,
new
UserId
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFOHEADER
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
CUSTINFOHEADER
);
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
response
.
jsonPath
().
getBoolean
(
"success"
),
network
.
message
(
param
,
BasicConfig
.
CUSTINFOHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
List
<
Object
>
custOrigins
=
response
.
jsonPath
().
getList
(
"data.custOrigins"
);
List
<
Object
>
custOrigins
=
response
.
jsonPath
().
getList
(
"data.custOrigins"
);
...
@@ -264,7 +267,7 @@ public class MyCustomer implements Authorization {
...
@@ -264,7 +267,7 @@ public class MyCustomer implements Authorization {
Assert
.
assertEquals
(
visitCountHere
,
ForwardAndRead
.
custClueStatistics
.
get
(
"visitCount"
)
+
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTSTATISTIC
,
"用户来访次数有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
visitCountHere
,
ForwardAndRead
.
custClueStatistics
.
get
(
"visitCount"
)
+
1
,
network
.
message
(
param
,
BasicConfig
.
CUSTSTATISTIC
,
"用户来访次数有误"
,
response
.
body
().
asString
()));
}
}
// 客户详情页_阅读偏好
//客户详情页_阅读偏好------访问重构未更新
@Test
(
description
=
"客户详情页_阅读偏好"
,
priority
=
22
)
@Test
(
description
=
"客户详情页_阅读偏好"
,
priority
=
22
)
public
void
客户详情页
_
阅读偏好
()
throws
IOException
{
public
void
客户详情页
_
阅读偏好
()
throws
IOException
{
param
=
new
HashMap
<>();
param
=
new
HashMap
<>();
...
...
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
View file @
6fc34cdb
...
@@ -189,7 +189,7 @@ public class WhoSawMe implements Authorization {
...
@@ -189,7 +189,7 @@ public class WhoSawMe implements Authorization {
break
;
break
;
}
}
}
}
long
xptUserId
=
ForwardAndRead
.
decodeTku
(
BaseUtils
.
tku
).
get
(
"userId"
);
long
xptUserId
=
ForwardAndRead
.
decodeTku
(
BaseUtils
.
tku
1
).
get
(
"userId"
);
param
.
clear
();
param
.
clear
();
param
.
put
(
"userId"
,
ForwardAndRead
.
encodeId
(
xptUserId
));
param
.
put
(
"userId"
,
ForwardAndRead
.
encodeId
(
xptUserId
));
response
=
network
.
getResponse
(
param
,
BasicConfig
.
UPDATENEWTOOLD
);
response
=
network
.
getResponse
(
param
,
BasicConfig
.
UPDATENEWTOOLD
);
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
6fc34cdb
...
@@ -100,8 +100,12 @@ public class BasicConfig {
...
@@ -100,8 +100,12 @@ public class BasicConfig {
public
static
String
VISITOR_UserTku
=
"T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp"
;
public
static
String
VISITOR_UserTku
=
"T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp"
;
// 钉钉机器人 线上-告警群
// 钉钉机器人 线上-告警群
public
static
final
String
dingTalkPath
=
"https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2"
;
public
static
final
String
dingTalkPath
=
"https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2"
;
// 180天打卡专用代理人 TKU (Jovia),sid :3591
//小葡萄的openId
public
static
String
CASHBACK_TKU
=
"T3gM31f18jCeXXZ8mG3oRE5KGiKg8r7x3Kqf81G5TYpPDL2evLbGxhnkJpUxTr1LvrUd1ZGJqxf6jEHoUY"
;
public
static
final
String
openId1
=
"osi5w5kT-smQ42Fc-ByO4G8C-E1M"
;
//小米粥的openId
public
static
final
String
openId2
=
"osi5w5pEY4SxORlLJEE4FkyxQ9E4"
;
// *************** 客集集域名 ***************
// *************** 客集集域名 ***************
public
static
final
String
HOST
=
"https://kjj.m.duibatest.com.cn"
;
public
static
final
String
HOST
=
"https://kjj.m.duibatest.com.cn"
;
public
static
final
String
ACTIVITY_HOST
=
"https://kjj-activity.duibatest.com.cn"
;
public
static
final
String
ACTIVITY_HOST
=
"https://kjj-activity.duibatest.com.cn"
;
...
@@ -1268,4 +1272,8 @@ public class BasicConfig {
...
@@ -1268,4 +1272,8 @@ public class BasicConfig {
public
static
final
String
HOME_customerList
=
HOST
+
"/kjy/corp/employee/customer/list"
;
public
static
final
String
HOME_customerList
=
HOST
+
"/kjy/corp/employee/customer/list"
;
public
static
final
String
HOME_customerStatistic
=
HOST
+
"/kjy/corp/employee/customer/statistic"
;
public
static
final
String
HOME_customerStatistic
=
HOST
+
"/kjy/corp/employee/customer/statistic"
;
public
static
final
String
HOME_customerLiveClue
=
HOST
+
"/kjy/corp/employee/customer/liveClue"
;
public
static
final
String
HOME_customerLiveClue
=
HOST
+
"/kjy/corp/employee/customer/liveClue"
;
//自动化用户
public
static
final
String
TEST_testerSave
=
MOBILE_HOST
+
"/test/user/test/save"
;
public
static
final
String
TEST_testerDelete
=
MOBILE_HOST
+
"/test/user/test/delete"
;
}
}
src/test/java/com/kjj/utils/BaseUtils.java
View file @
6fc34cdb
...
@@ -6,10 +6,8 @@ import com.kjj.sql.KjyUserDB;
...
@@ -6,10 +6,8 @@ import com.kjj.sql.KjyUserDB;
import
com.kjj.sql.UserSqlFactory
;
import
com.kjj.sql.UserSqlFactory
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
...
@@ -18,7 +16,9 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
...
@@ -18,7 +16,9 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
BaseUtils
{
public
class
BaseUtils
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
static
String
tku
;
public
static
String
tku1
;
public
static
String
tku2
;
public
static
String
superCookieKey
;
public
static
String
superCookieKey
;
public
static
String
superCookieValue
;
public
static
String
superCookieValue
;
public
static
String
companyCookieKey
;
public
static
String
companyCookieKey
;
...
@@ -61,16 +61,16 @@ public class BaseUtils {
...
@@ -61,16 +61,16 @@ public class BaseUtils {
/**
/**
* 小葡萄关注客集集微信公众号
* 小葡萄关注客集集微信公众号
*/
*/
public
static
Object
subscribe
(
)
throws
SQLException
{
public
static
String
subscribe
(
String
openId
)
throws
SQLException
{
//关注公众号
//关注公众号
// network.agentHeaders.put("Content-Type","text/plain");
// network.agentHeaders.put("Content-Type","text/plain");
String
str
=
"<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[
osi5w5kT-smQ42Fc-ByO4G8C-E1M
]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>"
;
String
str
=
"<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[
"
+
openId
+
"
]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>"
;
Response
response
=
network
.
postXMLResponse
(
str
,
MANAGER_oamsg
);
Response
response
=
network
.
postXMLResponse
(
str
,
MANAGER_oamsg
);
System
.
out
.
println
(
"关注\n"
+
response
.
body
().
asString
());
System
.
out
.
println
(
"关注\n"
+
response
.
body
().
asString
());
sleep
(
1000
);
sleep
(
1000
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
Map
<
String
,
Object
>
result
=
KjyUserDB
.
getInstance
().
findSimpleResult
(
UserSqlFactory
.
selectUserIdByOpenId
,
"osi5w5kT-smQ42Fc-ByO4G8C-E1M"
);
Map
<
String
,
Object
>
result
=
KjyUserDB
.
getInstance
().
findSimpleResult
(
UserSqlFactory
.
selectUserIdByOpenId
,
openId
);
Object
userId
=
result
.
get
(
"user_id"
);
Object
userId
=
result
.
get
(
"user_id"
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
@@ -79,21 +79,19 @@ public class BaseUtils {
...
@@ -79,21 +79,19 @@ public class BaseUtils {
response
=
network
.
getResponse
(
params
,
MANAGER_encryptTku
);
response
=
network
.
getResponse
(
params
,
MANAGER_encryptTku
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
ROOKIEGUIDE_homeGuide
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
ROOKIEGUIDE_homeGuide
,
"接口返回失败"
,
response
.
body
().
asString
()));
tku
=
response
.
jsonPath
().
getString
(
"data"
);
String
data
=
response
.
jsonPath
().
getString
(
"data"
);
network
.
agentCookies
.
put
(
TKU_COOKIE_NAME
,
tku
);
return
data
;
System
.
out
.
println
(
"小葡萄tku:"
+
tku
);
return
userId
;
}
}
/**
/**
* 小葡萄取关客集集微信公众号
* 小葡萄取关客集集微信公众号
*/
*/
public
static
Object
unsubscribe
()
throws
SQLException
{
public
static
Object
unsubscribe
(
String
openId
)
throws
SQLException
{
//取关公众号
//取关公众号
network
.
agentHeaders
.
put
(
"Content-Type"
,
"text/plain"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"text/plain"
);
String
str
=
"<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[
osi5w5kT-smQ42Fc-ByO4G8C-E1M
]]></FromUserName><CreateTime>1628040963</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[unsubscribe]]></Event></xml>"
;
String
str
=
"<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[
"
+
openId
+
"
]]></FromUserName><CreateTime>1628040963</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[unsubscribe]]></Event></xml>"
;
Response
response
=
network
.
postXMLResponse
(
str
,
MANAGER_oamsg
);
Response
response
=
network
.
postXMLResponse
(
str
,
MANAGER_oamsg
);
Map
<
String
,
Object
>
result
=
KjyUserDB
.
getInstance
().
findSimpleResult
(
UserSqlFactory
.
selectUserIdByOpenId
,
"osi5w5kT-smQ42Fc-ByO4G8C-E1M"
);
Map
<
String
,
Object
>
result
=
KjyUserDB
.
getInstance
().
findSimpleResult
(
UserSqlFactory
.
selectUserIdByOpenId
,
openId
);
System
.
out
.
println
(
"取关\n"
+
response
.
body
().
asString
());
System
.
out
.
println
(
"取关\n"
+
response
.
body
().
asString
());
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
Object
userId
=
result
.
get
(
"user_id"
);
Object
userId
=
result
.
get
(
"user_id"
);
...
@@ -168,6 +166,28 @@ public class BaseUtils {
...
@@ -168,6 +166,28 @@ public class BaseUtils {
}
}
}
}
/*
* 增加测试假用户
* */
public
static
void
insertTestUser
(
long
userId
)
{
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribeParam
.
put
(
"userId"
,
userId
);
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
TEST_testerSave
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
TEST_testerSave
,
"增加测试用户失败"
,
subscribeRes
.
body
().
asString
()));
}
/*
* 删除测试假用户
* */
public
static
void
deleteTestUser
(
long
userId
)
{
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribeParam
.
put
(
"userId"
,
userId
);
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
TEST_testerDelete
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
TEST_testerDelete
,
"删除测试用户失败"
,
subscribeRes
.
body
().
asString
()));
}
/*
/*
* 访客到场
* 访客到场
* */
* */
...
...
src/test/java/com/kjj/utils/NetworkUtils.java
View file @
6fc34cdb
...
@@ -28,7 +28,7 @@ public class NetworkUtils {
...
@@ -28,7 +28,7 @@ public class NetworkUtils {
//cookies中的tku
//cookies中的tku
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//多场景测试标志
//多场景测试标志
agentCookies
.
put
(
"_duibaServiceGroupKey"
,
"miria-2738
"
);
// agentCookies.put("_duibaServiceGroupKey","miria-2679
");
//json类型的headers
//json类型的headers
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
//二进制文件的headers
//二进制文件的headers
...
...
src/test/wechatTestNG.xml
View file @
6fc34cdb
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite
name=
"集客助手"
verbose=
"1"
thread-count=
"3"
>
<suite
name=
"集客助手"
verbose=
"1"
thread-count=
"3"
>
<test
preserve-order=
"true"
name =
"新手引导"
>
<classes>
<class
name=
"com.kjj.cases.assistant.menu.NoviceGuidance"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"支付"
>
<test
preserve-order=
"true"
name=
"支付"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.assistant.pay.Pay"
/>
<class
name=
"com.kjj.cases.assistant.pay.Pay"
/>
...
@@ -16,6 +11,11 @@
...
@@ -16,6 +11,11 @@
<class
name=
"com.kjj.cases.assistant.pay.Cashback"
/>
<class
name=
"com.kjj.cases.assistant.pay.Cashback"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name =
"新手引导"
>
<classes>
<class
name=
"com.kjj.cases.assistant.menu.NoviceGuidance"
/>
</classes>
</test>
<test
preserve-order=
"true"
name =
"首页"
>
<test
preserve-order=
"true"
name =
"首页"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.assistant.homePage.HomePage"
/>
<class
name=
"com.kjj.cases.assistant.homePage.HomePage"
/>
...
...
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