Commit 03ba6026 authored by 张震's avatar 张震

Boss看板优化

parent dfb9b6f4
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,9 +8,9 @@ public class BasicConfig { ...@@ -8,9 +8,9 @@ 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 = "T3gM31f18jAW2tFenMLNQXps9wVNZx8CSHRmW5F2Y3PTwRYafLakcgQ46zZSaxamf3NgDZahQN2QjVc9m2"; public static final String AGENT_TKU = "T3gM31f18jAWudwfTW6o9zs27w5xMjdhLHsKVP3cHo9Aj89LihVhSU86JqCbiZCZKRSbmjmcwJKa6YTo56";
// *************** 钉钉机器人 *************** // *************** 钉钉机器人 ***************
// 线上-告警群 // 线上-告警群
...@@ -23,7 +23,7 @@ public class BasicConfig { ...@@ -23,7 +23,7 @@ public class BasicConfig {
public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn"; public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn";
// *************** TKU *************** // *************** TKU ***************
public static final String VISITOR_TKU = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3kN3PcWwcLdzfxPp2gghfE4x3BFH8JN3f8PUzQ6W"; public static final String VISITOR_TKU = "T3gM31f18jAW31GHJuxJmoCFoANch7fXayUgd4zHHg2hpXAyjSrevfGfzyNfVoHzSvenik8qR9nTEkCSy6";
// *************** 素材ID *************** // *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc"; public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc";
...@@ -191,7 +191,7 @@ public class BasicConfig { ...@@ -191,7 +191,7 @@ public class BasicConfig {
// ************** BOSS看板 *************** // ************** BOSS看板 ***************
public static final String BOSS_INFO = "/kjy/mp/version/info"; public static final String BOSS_VERSIONINFO = "/kjy/mp/version/info";
public static final String BOSS_ROLE = "/kjy/mp/seller/team/member/role"; public static final String BOSS_ROLE = "/kjy/mp/seller/team/member/role";
...@@ -205,6 +205,10 @@ public class BasicConfig { ...@@ -205,6 +205,10 @@ public class BasicConfig {
public static final String BOSS_REMOVE = "/kjy/mp/seller/team/member/remove"; public static final String BOSS_REMOVE = "/kjy/mp/seller/team/member/remove";
public static final String BOSS_USERINFO = "/kjy/mp/user/info";
} }
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