Commit bede75c3 authored by 张震's avatar 张震

新增boss看板

parent bd89ae1d
package com.kjj.qa.cases;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.IExpectedExceptionsAnnotation;
import org.testng.annotations.Test;
import org.testng.remote.strprotocol.IMessage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Boss {
NetworkUtil network = NetworkUtil.getInstance();
@BeforeClass
public void setUp() {
}
//判断代理人的会员及版本
@Test(description="会员及版本判断",priority = 1)
public void 会员及版本判断() throws IOException{
Response response = network.getResponse("/kjy/mp/version/info");
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版
boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员
Assert.assertEquals(userVersion, 2,"获取版本有误 此版本为非保险版");
Assert.assertTrue(isVip,"会员判断错误 为非会员");
}
//被邀请人点击链接接受邀请
@Test(description="获取代理人身份",priority = 3)
public void 获取代理人身份() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939);
Response response = network.getResponse("/kjy/mp/seller/team/member/identity");
int identity = response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队
Assert.assertEquals(identity, 3, "代理人已有团队或已绑定上级,不能再接受邀请");
}
//邀请结果判断
@Test(description="邀请结果",priority = 4)
public void 邀请结果() throws IOException{
Response response = network.getResponse("/kjy/mp/seller/team/bound");
Boolean data = response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
Assert.assertTrue(data, "接受邀请失败");
}
//代理人有无上下级判断;
@Test(description="当前代理人角色判断",priority = 2)
public void 当前代理人角色判断() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939);
Response response = network.getResponse("/kjy/mp/seller/team/member/role");
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
Assert.assertTrue(hasSubordinate, "暂无下级");
Assert.assertTrue(hasSuperior,"暂无上级");
}
//代理人无下级直接进入个人数据看板页面;获取上级昵称
@Test(description="获取上级昵称",priority = 5)
public void 获取上级昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939);
Response response = network.getResponse("/kjy/mp/seller/team/boss");
String data = response.jsonPath().getString("data");
Assert.assertEquals(data,"喜洋洋保险");
}
//分享链接邀请下级加入
@Test(description="邀请成员加入",priority = 6)
public void 邀请成员加入() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("inviteType",2);
Response response = network.getResponse("/kjy/mp/seller/team/invite/code");
boolean hasSubordinate = response.jsonPath().getBoolean("success");
Assert.assertTrue(true,"分享链接失败");
}
//团队长数据看板
//代理人已存在下级直接进入团队长数据看板;获取上级团队昵称
@Test(description="获取上级团队昵称",priority = 7)
public void 获取上级团队昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939);
Response response = network.getResponse("/kjy/mp/seller/team/boss");
String data = response.jsonPath().getString("data");
Assert.assertEquals(data,"喜洋洋保险");
}
//获取代理人团队人数
@Test(description="获取当前团队人数",priority = 8)
public void 获取当前团队人数() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",1939);
Response response = network.getResponse("/kjy/mp/seller/team/member/role");
boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己
Assert.assertNotNull(teamNumber,"获取团队人数失败");
}
//增加团队成员
//移除团队成员
@Test(description="移除团队成员",priority = 9)
public void 移除团队成员() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sids","Kj21MTYxNDM");
Response response = network.postResponse(params,"/kjy/mp/seller/team/member/remove");
System.out.println(response.getBody().prettyPrint());
boolean data = response.jsonPath().getBoolean("data"); //true:删除成功;false:删除失败
Assert.assertEquals(data,true, "移除失败");
}
}
\ No newline at end of file
......@@ -198,7 +198,6 @@ public class Upload {
Assert.assertEquals(length, 0, network.message(params, UPLOAD_LIST,"获取我的上传-其他列表数量有误"));
}
@AfterClass
public static void tearDown(){
apiCount += 13;
......
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