Commit dd60e753 authored by Su-Yi's avatar Su-Yi

Merge remote-tracking branch 'origin/test/20200628-test' into test/20200628-test

# Conflicts:
#	src/test/java/com/kjj/qa/config/BasicConfig.java
parents e27f4f0b b9038e04
package com.kjj.qa.cases; package com.kjj.qa.cases;
import com.google.inject.internal.asm.$TypePath;
import com.kjj.qa.utils.NetworkUtil; import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
...@@ -8,7 +9,6 @@ import org.testng.annotations.BeforeClass; ...@@ -8,7 +9,6 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.IExpectedExceptionsAnnotation; import org.testng.annotations.IExpectedExceptionsAnnotation;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.testng.remote.strprotocol.IMessage; import org.testng.remote.strprotocol.IMessage;
import static com.kjj.qa.config.BasicConfig.*;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
...@@ -16,8 +16,13 @@ import java.util.HashMap; ...@@ -16,8 +16,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.*;
import static com.kjj.qa.config.BasicConfig.BOSS_USERINFO;
public class Boss { public class Boss {
private static final NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
String sellerId = "";
String usellerId ="";
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
...@@ -27,18 +32,26 @@ public class Boss { ...@@ -27,18 +32,26 @@ public class Boss {
//判断代理人的会员及版本 //判断代理人的会员及版本
@Test(description="会员及版本判断",priority = 1) @Test(description="会员及版本判断",priority = 1)
public void 会员及版本判断() throws IOException{ public void 会员及版本判断() throws IOException{
Response response = network.getResponse(BOSS_INFO); Response response = network.getResponse(BOSS_VERSIONINFO);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版 int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版
boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员 boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员
Assert.assertEquals(userVersion, 2,network.message(BOSS_INFO,"获取版本有误 此版本为非保险版")); Assert.assertEquals(userVersion, 2,network.message(BOSS_VERSIONINFO,"获取版本有误 此版本为非保险版"));
Assert.assertTrue(isVip,network.message(BOSS_INFO,"会员判断错误 为非会员")); Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员"));
}
//获取info接口的代理人id
@Test(description="获取代理人id",priority = 2)
public void 获取代理人id() throws IOException{
Response response = network.getResponse(BOSS_USERINFO);
sellerId = response.jsonPath().getString("data.sellerId");
Assert.assertNotNull(sellerId,network.message(BOSS_USERINFO,"获取sellerid失败"));
} }
//代理人有无上下级判断; //代理人有无上下级判断;
@Test(description="当前代理人角色判断",priority = 2) @Test(description="当前代理人角色判断",priority = 3)
public void 当前代理人角色判断() throws IOException{ public void 当前代理人角色判断() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级 boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级 boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
...@@ -48,7 +61,7 @@ public class Boss { ...@@ -48,7 +61,7 @@ public class Boss {
} }
//分享链接邀请下级加入 //分享链接邀请下级加入
@Test(description="邀请成员加入",priority = 3) @Test(description="邀请成员加入",priority = 4)
public void 邀请成员加入() throws IOException{ public void 邀请成员加入() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("inviteType",2); params.put("inviteType",2);
...@@ -58,24 +71,33 @@ public class Boss { ...@@ -58,24 +71,33 @@ public class Boss {
} }
//被邀请人点击链接接受邀请 //被邀请人点击链接接受邀请
@Test(description="获取被邀请人身份",priority = 4) @Test(description="获取被邀请人身份",priority = 5)
public void 获取被邀请人身份() throws IOException{ public void 获取被邀请人身份() throws IOException{
//tku 切换为访客的 //tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU); network.agentCookies.put("tku",VISITOR_TKU);
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",2126); params.put("sellerId",usellerId);
Response response = network.getResponse(params,BOSS_IDENTITY); Response response = network.getResponse(params,BOSS_IDENTITY);
int identity = response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队 int identity = response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队
Assert.assertEquals(identity, 3, network.message(params,BOSS_IDENTITY,"被邀请人已有团队或已绑定上级,不能再接受邀请")); Assert.assertEquals(identity, 3, network.message(params,BOSS_IDENTITY,"被邀请人已有团队或已绑定上级,不能再接受邀请"));
} }
//获取info接口的代理人id
@Test(description="获取访客id",priority = 6)
public void 获取访客id() throws IOException{
Response response = network.getResponse(BOSS_USERINFO);
usellerId = response.jsonPath().getString("data.sellerId");
Assert.assertNotNull(usellerId,network.message(BOSS_USERINFO,"获取usellerid失败"));
}
//邀请结果判断 //邀请结果判断
@Test(description="邀请结果",priority = 5) @Test(description="邀请结果",priority = 7)
public void 邀请结果() throws IOException{ public void 邀请结果() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("inviterSid",1939); params.put("inviterSid",sellerId);
params.put("inviteType",2); params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_BOUND); Response response = network.getResponse(params,BOSS_BOUND);
boolean data = response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败 boolean data = response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
...@@ -84,12 +106,12 @@ public class Boss { ...@@ -84,12 +106,12 @@ public class Boss {
//重新获取列表,代理人有无上下级判断; //重新获取列表,代理人有无上下级判断;
@Test(description="当前代理人角色二次判断",priority = 6) @Test(description="当前代理人角色二次判断",priority = 8)
public void 当前代理人角色二次判断() throws IOException{ public void 当前代理人角色二次判断() throws IOException{
//tku 切换为代理人的 //tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU); network.agentCookies.put("tku",AGENT_TKU);
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级 boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级 boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
...@@ -100,20 +122,20 @@ public class Boss { ...@@ -100,20 +122,20 @@ public class Boss {
//团队长数据看板 //团队长数据看板
//代理人已存在下级直接进入团队长数据看板;获取上级团队昵称 //代理人已存在下级直接进入团队长数据看板;获取上级团队昵称
@Test(description="获取上级团队昵称",priority = 7) @Test(description="获取上级团队昵称",priority = 9)
public void 获取上级团队昵称() throws IOException{ public void 获取上级团队昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_BOSS); Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data"); String data = response.jsonPath().getString("data");
Assert.assertNotNull(data,network.message(params,BOSS_BOSS,"喜洋洋保险")); Assert.assertEquals(data,"喜洋洋保险",network.message(params,BOSS_BOSS,"昵称不匹配"));
} }
//获取代理人团队人数 //获取代理人团队人数
@Test(description="获取当前团队人数",priority = 8) @Test(description="获取当前团队人数",priority = 10)
public void 获取当前团队人数() throws IOException{ public void 获取当前团队人数() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己 boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己
Assert.assertNotNull(teamNumber,network.message(params,BOSS_ROLE,"获取团队人数失败")); Assert.assertNotNull(teamNumber,network.message(params,BOSS_ROLE,"获取团队人数失败"));
...@@ -122,7 +144,7 @@ public class Boss { ...@@ -122,7 +144,7 @@ public class Boss {
//移除团队成员 //移除团队成员
@Test(description="移除团队成员",priority = 9) @Test(description="移除团队成员",priority = 11)
public void 移除团队成员() throws IOException{ public void 移除团队成员() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
List<String> ss= Collections.singletonList("Kj21MTcwMTU"); List<String> ss= Collections.singletonList("Kj21MTcwMTU");
...@@ -135,19 +157,19 @@ public class Boss { ...@@ -135,19 +157,19 @@ public class Boss {
} }
//代理人无下级直接进入个人数据看板页面;获取上级昵称 //代理人无下级直接进入个人数据看板页面;获取上级昵称
@Test(description="获取上级昵称",priority = 10) @Test(description="获取上级昵称",priority = 12)
public void 获取上级昵称() throws IOException{ public void 获取上级昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_BOSS); Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data"); String data = response.jsonPath().getString("data");
Assert.assertNotNull(data,network.message(params,BOSS_BOSS,"喜洋洋保险")); Assert.assertEquals(data,"喜洋洋保险",network.message(params,BOSS_BOSS,"昵称不匹配"));
} }
//分享链接邀请下级加入 //分享链接邀请下级加入
@Test(description="邀请下级加入",priority = 11) @Test(description="邀请下级加入",priority = 13)
public void 邀请下级加入() throws IOException{ public void 邀请下级加入() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("inviteType",2); params.put("inviteType",2);
...@@ -159,7 +181,7 @@ public class Boss { ...@@ -159,7 +181,7 @@ public class Boss {
@AfterClass @AfterClass
public static void tearDown(){ public static void tearDown(){
apiCount += 7; apiCount += 8;
} }
} }
\ No newline at end of file
...@@ -8,15 +8,15 @@ public class BasicConfig { ...@@ -8,15 +8,15 @@ public class BasicConfig {
// 是否推送 // 是否推送
public static final boolean isPushReport = true; //true public static final boolean isPushReport = true; //true
// 用户微信昵称 // 用户微信昵称
public static final String WECHAT_NAME = "小疙瘩人寿"; // public static final String WECHAT_NAME = "亦.心"; //
// 用户tku // 用户tku
public static final String AGENT_TKU = "T3gM31f18jAW2wN5pJRfu58SfszfmF7PhcMdoQLTKAXtfJBT8nmHY7NTWtay3HvGe9MvrdZ6wFqWbpwKvR"; public static final String AGENT_TKU = "T3gM31f18jAWudwfTW6o9zs27w5xMjdhLHsKVP3cHo9Aj89LihVhSU86JqCbiZCZKRSbmjmcwJKa6YTo56";
// *************** 钉钉机器人 *************** // *************** 钉钉机器人 ***************
// 线上-告警群 // 线上-告警群
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";
// 测试 // 测试
// public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd"; public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd";
; ;
// *************** 客集集域名 *************** // *************** 客集集域名 ***************
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment