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
d9bf3ead
Commit
d9bf3ead
authored
Mar 12, 2021
by
别湘灵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代理人首页
parent
e346f781
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
192 additions
and
33 deletions
+192
-33
AgentBean.java
src/test/java/com/kjj/bean/AgentBean.java
+26
-0
AgentCard.java
src/test/java/com/kjj/bean/AgentCard.java
+31
-0
AgentEndList.java
src/test/java/com/kjj/bean/AgentEndList.java
+22
-0
AdminAuthorization.java
src/test/java/com/kjj/cases/live/AdminAuthorization.java
+11
-0
Procurator.java
src/test/java/com/kjj/cases/live/Procurator.java
+60
-23
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+9
-5
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+5
-3
DingTalkUtils.java
src/test/java/com/kjj/utils/DingTalkUtils.java
+2
-1
JsonUtil.java
src/test/java/com/kjj/utils/JsonUtil.java
+26
-1
No files found.
src/test/java/com/kjj/bean/AgentBean.java
0 → 100644
View file @
d9bf3ead
package
com
.
kjj
.
bean
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
AgentBean
{
private
String
liveId
;
private
int
liveStatus
;
private
Date
noticeTime
;
private
String
picUrl
;
private
String
title
;
private
Date
broadcastTime
;
private
int
ranking
;
private
int
inviteNum
;
private
int
presentNum
;
private
String
companyName
;
private
String
companyId
;
private
String
companyLogo
;
private
Long
appointmentNum
;
private
int
inviteAuthStatus
;
}
src/test/java/com/kjj/bean/AgentCard.java
0 → 100644
View file @
d9bf3ead
package
com
.
kjj
.
bean
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
AgentCard
{
private
String
sellerName
;
private
String
companyName
;
private
int
companyId
;
private
String
phoneNumber
;
private
String
jobNumber
;
private
String
wechatQrCode
;
private
String
avatar
;
private
String
teamId
;
private
String
teamName
;
private
List
<
CompanyList
>
companyList
;
@Data
class
CompanyList
{
private
String
companyId
;
private
String
teamId
;
private
int
companyLevel
;
}
}
src/test/java/com/kjj/bean/AgentEndList.java
0 → 100644
View file @
d9bf3ead
package
com
.
kjj
.
bean
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
AgentEndList
{
private
String
liveId
;
private
String
picUrl
;
private
String
title
;
private
Date
startTime
;
private
String
hasPlayBack
;
private
String
liveEndNeedShowRank
;
private
int
liveStatus
;
private
int
clueCount
;
private
int
notFollowedClueCount
;
private
String
companyName
;
private
String
companyId
;
private
String
companyLogo
;
private
int
inviteAuthStatus
;
}
src/test/java/com/kjj/cases/live/AdminAuthorization.java
View file @
d9bf3ead
...
...
@@ -22,4 +22,15 @@ public interface AdminAuthorization {
System
.
out
.
println
(
"用户AUTH_KEY:"
+
AUTH_KEY
);
}
/**
* 代理人授权
*/
default
void
agentAuth
(){
// 创建用户 并传到network里
BasicConfig
.
AUTH_KEY
=
BaseUtils
.
agentAuthKey
();
network
.
agentCookies
.
put
(
"authKey"
,
AUTH_KEY
);
System
.
out
.
println
(
"用户AUTH_KEY:"
+
AUTH_KEY
);
}
}
src/test/java/com/kjj/cases/live/Procurator.java
View file @
d9bf3ead
package
com
.
kjj
.
cases
.
live
;
import
com.kjj.bean.AnswerBean
;
import
com.kjj.bean.AnswerListBean
;
import
com.kjj.bean.RewardPkBean
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.AgentBean
;
import
com.kjj.bean.AgentCard
;
import
com.kjj.bean.AgentEndList
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.
BaseUtils
;
import
com.kjj.utils.
JsonUtil
;
import
io.restassured.response.Response
;
import
org.apache.commons.lang3.
time.Date
Utils
;
import
org.apache.commons.lang3.
Random
Utils
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.io.IOException
;
import
java.util.*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
ISVIPSUBSCRIBE
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/*代理人端*/
public
class
Procurator
implements
AdminAuthorization
{
@BeforeClass
public
void
setUp
()
{
a
dmin
Auth
();
a
gent
Auth
();
}
public
String
liveID
;
/*代理人端*/
/*代理人首页*/
/*代理人首页直播列表*/
@Test
(
description
=
"代理人首页"
,
priority
=
1
)
public
void
Agent
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
liveID
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_Procurator
);
List
<
AgentBean
>
agentBeans
=
JsonUtil
.
parseResponseToListBean
(
response
,
AgentBean
.
class
);
if
(
agentBeans
.
size
()
>
0
)
{
AgentBean
bean
=
agentBeans
.
get
(
0
);
System
.
out
.
println
(
JSON
.
toJSONString
(
agentBeans
));
Assert
.
assertNotNull
(
bean
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Procurator
,
"查询直播列表失败"
,
response
.
body
().
asString
()));
}
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_Procurator
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data.list.[0].liveid"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_Procurator
,
"查询代理人直播列表"
,
response
.
body
().
asString
()));
}
/*代理人首页已结束的直播列表*/
@Test
(
description
=
"代理人首页已结束的直播列表"
,
priority
=
2
)
public
void
AgentLiveEndList
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
10
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_AgentEndList
);
List
<
AgentEndList
>
agentBeans
=
JsonUtil
.
parseResponseToListBean
(
response
,
AgentEndList
.
class
);
if
(
agentBeans
.
size
()
>
0
)
{
AgentEndList
bean
=
agentBeans
.
get
(
0
);
System
.
out
.
println
(
JSON
.
toJSONString
(
agentBeans
));
Assert
.
assertNotNull
(
bean
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_AgentEndList
,
"查询直播结束列表失败"
,
response
.
body
().
asString
()));
}
}
/*代理人个人信息*/
/*代理人信息*/
@Test
(
description
=
"代理人信息"
,
priority
=
3
)
public
void
AgentCardInfo
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_AgentCardInfo
);
AgentCard
agentBeans
=
JsonUtil
.
parseResponseToBean
(
response
,
AgentCard
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
agentBeans
));
Assert
.
assertNotNull
(
agentBeans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_AgentCardInfo
,
"查询代理人信息失败"
,
response
.
body
().
asString
()));
}
/*代理人信息*/
@Test
(
description
=
"代理人修改信息"
,
priority
=
4
)
public
void
AgentEditCardInfo
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"sellerName"
,
"你好测试"
+
RandomUtils
.
nextInt
(
1
,
100
));
params
.
put
(
"phoneNumber"
,
"15258890691"
);
params
.
put
(
"jobNumber"
,
"TTTTTT"
);
params
.
put
(
"wechatQrCode"
,
"//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png"
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_AgentEditCardInfo
);
Boolean
agentBeans
=
JsonUtil
.
parseResponseToBean
(
response
,
Boolean
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
agentBeans
));
Assert
.
assertNotNull
(
agentBeans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_AgentEditCardInfo
,
"修改代理人信息失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
d9bf3ead
...
...
@@ -4,7 +4,7 @@ public class BasicConfig {
public
static
int
apiCount
;
//接口数量统计
// 是否开启钉钉机器人推送
public
static
final
boolean
isPushReport
=
fals
e
;
//true
public
static
final
boolean
isPushReport
=
tru
e
;
//true
// 代理人微信昵称
public
static
final
String
WECHAT_NAME
=
"客集集-梦晨"
;
//true
...
...
@@ -39,6 +39,9 @@ public class BasicConfig {
public
static
final
String
MANAGER_HOST
=
"https://kjj-mng.duibatest.com.cn"
;
//手机端地址
public
static
final
String
MOBILE_HOST
=
"https://live.duibatest.com.cn"
;
// *************** 直播 ***************
public
static
final
String
MANAGER_SAVEANDUPDATE
=
MANAGER_HOST
+
"/kjy/manager/live/pre/conf/saveAndUpdate"
;
...
...
@@ -76,13 +79,14 @@ public class BasicConfig {
// *************** 代理人 ***************
//用户信息//
public
static
final
String
MANAGER_ISProcurator
=
MANAGER_HOST
+
"/kjy/live/userInfo"
;
public
static
final
String
MANAGER_Procurator
=
MANAGER_HOST
+
"/kjy/live/agent/liveList"
;
//代理人列表//
public
static
final
String
MOBILE_Procurator
=
MOBILE_HOST
+
"/kjy/live/agent/liveList"
;
public
static
final
String
MOBILE_AgentEndList
=
MOBILE_HOST
+
"/kjy/live/agent/liveEndList"
;
public
static
final
String
MOBILE_AgentCardInfo
=
MOBILE_HOST
+
"/kjy/live/agent/card/info"
;
public
static
final
String
MOBILE_AgentEditCardInfo
=
MOBILE_HOST
+
"/kjy/live/agent/card/edit"
;
...
...
src/test/java/com/kjj/utils/BaseUtils.java
View file @
d9bf3ead
...
...
@@ -3,19 +3,21 @@ package com.kjj.utils;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
public
class
BaseUtils
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
static
String
createAuthKey
(){
return
"LEH7epeHVDJWzhZ6DiexTHnsxraeviLJA9bNdknyzwR7cXT557KHZA1Q7zWnN9N2E3vHcFrt8S3xhGApKa3NmE7oaxyXz"
;
}
public
static
String
agentAuthKey
(){
return
"LEH7epeHVDJWzhZ6DiexTHnsxs8JtX5mzCVwq1X5TSe6JEJMzL51umD812fWb8P5rLt5mw9SfPzLp6uwthsFnXAhKCYLq"
;
}
/**
* 登录管理后台
...
...
src/test/java/com/kjj/utils/DingTalkUtils.java
View file @
d9bf3ead
package
com
.
kjj
.
utils
;
import
io.restassured.response.Response
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
static
com
.
kjj
.
config
.
BasicConfig
.
isPushReport
;
public
class
DingTalkUtils
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
...
...
src/test/java/com/kjj/utils/JsonUtil.java
View file @
d9bf3ead
package
com
.
kjj
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.WelfareListBean
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
groovy.json.JsonBuilder
;
import
io.restassured.response.Response
;
import
java.util.List
;
public
class
JsonUtil
{
private
JsonUtil
()
{
}
/**
* 将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public
static
<
T
>
T
parseResponseToBean
(
Response
response
,
Class
<
T
>
tClass
){
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
String
str
=
new
JsonBuilder
(
data
).
toString
();
return
JSON
.
parseObject
(
str
,
tClass
);
}
/**
* 分页接口专用-将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public
static
<
T
>
List
<
T
>
parseResponseToListBean
(
Response
response
,
Class
<
T
>
tClass
){
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
String
str
=
new
JsonBuilder
(
data
).
toString
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
str
);
JSONArray
array
=
jsonObject
.
getJSONArray
(
"list"
);
return
array
.
toJavaList
(
tClass
);
}
}
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