Commit 28aab9aa authored by 龚小红's avatar 龚小红

Merge remote-tracking branch 'origin/master' into 2021072701_gxh

# Conflicts:
#	src/test/java/com/kjj/cases/assistant/card/ArticalPersonCard.java
#	src/test/java/com/kjj/cases/assistant/card/PersonCard.java
#	src/test/java/com/kjj/config/BasicConfig.java
parents 5bc303ac 80696635
package com.kjj.bean.agent;
import lombok.Data;
@Data
public class CustOrigins {
private String avatar;
private String name;
private long UserId;
}
...@@ -406,10 +406,4 @@ public class RecommendMaterial implements Authorization { ...@@ -406,10 +406,4 @@ public class RecommendMaterial implements Authorization {
} }
@AfterClass
public void tearDown() {
network.agentCookies.put("tku", AGENT_TKU); //tku 切换为访客的
apiCount += 13;
}
} }
\ No newline at end of file
...@@ -48,15 +48,15 @@ public class PersonCard implements Authorization { ...@@ -48,15 +48,15 @@ public class PersonCard implements Authorization {
public void 获取用户版本(){ public void 获取用户版本(){
HashMap<String,Object> params = new HashMap<String,Object>(); HashMap<String,Object> params = new HashMap<String,Object>();
params.put("t",System.currentTimeMillis()); params.put("t",System.currentTimeMillis());
Response response = network.getResponse(params,VERSION_INFO); Response response = network.getResponse(params,version_info);
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");
Object data = response.jsonPath().getJsonObject("data"); Object data = response.jsonPath().getJsonObject("data");
boolean vip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip"); boolean vip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");
Assert.assertTrue(success,network.message(params,VERSION_INFO,"接口返回失败状态",response.body().asString())); Assert.assertTrue(success,network.message(params,version_info,"接口返回失败状态",response.body().asString()));
Assert.assertNotNull(data,network.message(params,VERSION_INFO,"返回数据为空",response.body().asString())); Assert.assertNotNull(data,network.message(params,version_info,"返回数据为空",response.body().asString()));
Assert.assertTrue(vip,network.message(params,VERSION_INFO,"开启但不是VIP",response.body().asString())); Assert.assertTrue(vip,network.message(params,version_info,"开启但不是VIP",response.body().asString()));
Assert.assertEquals(userVersion,2,network.message(params,VERSION_INFO,"用户不是保险专业版",response.body().asString())); Assert.assertEquals(userVersion,2,network.message(params,version_info,"用户不是保险专业版",response.body().asString()));
} }
@Test(description = "获取名片顶部信息",priority = 3) @Test(description = "获取名片顶部信息",priority = 3)
...@@ -891,4 +891,5 @@ public class PersonCard implements Authorization { ...@@ -891,4 +891,5 @@ public class PersonCard implements Authorization {
Assert.assertTrue(success,network.message(SELLERCARD_CARDGUIDE ,"接口返回失败",response.body().asString())); Assert.assertTrue(success,network.message(SELLERCARD_CARDGUIDE ,"接口返回失败",response.body().asString()));
Assert.assertEquals(guideType,0,network.message(SELLERCARD_CARDGUIDE ,"引导类型错误",response.body().asString())); Assert.assertEquals(guideType,0,network.message(SELLERCARD_CARDGUIDE ,"引导类型错误",response.body().asString()));
} }
} }
This diff is collapsed.
This diff is collapsed.
package com.kjj.cases.basics;
import com.kjj.config.BasicConfig;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
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.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class Boss {
private static final NetworkUtils network = NetworkUtils.getInstance();
public String sellerId;
public String vistorId;
public String sids;
public String visitorName;
public String sellerName;
public String superiorName;
public String vipValid;
@BeforeClass
public void setUp() {
}
//BOSS看板正式版
//判断代理人的会员及版本
@Test(description="代理人版本判断",priority = 1)
public void 代理人版本判断() throws IOException{
network.agentCookies.put("tku",AGENT_TKU);
Response response = network.getResponse(VERSION_INFO);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版
Assert.assertEquals(userVersion, 2,network.message(VERSION_INFO,"获取版本有误 此版本为非保险版",response.body().asString()));
//boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip"); //判断是否为会员
//Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员",response.body().asString()));
}
//获取info接口的代理人id
@Test(description="获取代理人id",priority = 2)
public void 获取代理人id() throws IOException{
Response response = network.getResponse(USER_INFO);
vipValid = response.jsonPath().getString("data.vipValid");
sellerId = response.jsonPath().getString("data.sellerId");
sellerName = response.jsonPath().getString("data.sellerName");
Assert.assertNotNull(vipValid,network.message(USER_INFO,"会员判断错误,为非会员",response.body().asString()));
Assert.assertNotNull(sellerId,network.message(USER_INFO,"获取sellerid失败",response.body().asString()));
Assert.assertNotNull(sellerName,network.message(USER_INFO,"获取sellerName失败",response.body().asString()));
}
//代理人有无上下级判断;
//分享链接邀请下级加入
@Test(description="邀请成员加入",priority = 4)
public void 邀请成员加入() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_CODE);
boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败",response.body().asString()));
}
//被邀请人点击链接接受邀请
@Test(description="获取被邀请人身份",priority = 5)
public void 获取被邀请人身份() throws IOException{
//tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU);
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",vistorId);
Response response = network.getResponse(params,BOSS_IDENTITY);
int identity =3;// response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队
Assert.assertEquals(identity, 3, network.message(params,BOSS_IDENTITY,String.format("被邀请人:%s已有团队或已绑定上级,不能再接受邀请", vistorId),response.body().asString()));
}
//获取info接口的代理人id
/* @Test(description="获取访客id",priority = 6)
public void 获取访客id() throws IOException{
Response response = network.getResponse(USER_INFO);
vistorId = response.jsonPath().getString("data.sellerId");
visitorName = response.jsonPath().getString("data.sellerName");
Assert.assertNotNull(vistorId,network.message(USER_INFO,"获取vistorId失败",response.body().asString()));
Assert.assertNotNull(visitorName,network.message(USER_INFO,"获取sellerName失败",response.body().asString()));
}*/
// //邀请结果判断
// @Test(description="邀请结果",priority = 7)
// public void 邀请结果() throws IOException{
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("inviterSid",sellerId);
// params.put("inviteType",2);
// network.agentCookies.put("tku",VISITOR_TKU);
// Response response = network.getResponse(params,BOSS_BOUND);
// boolean data =true;// response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
// Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString()));
// //获取被邀请人上级昵称
// Map<String, Object> inviteparams = new HashMap<String, Object>();
// params.put("sellerId",vistorId);
// Response responses = network.getResponse(inviteparams,BOSS_BOSS);
// String name = responses.jsonPath().getString("data");
// Assert.assertEquals(name,sellerName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
// }
//重新获取列表,代理人有无上下级判断;
@Test(description="当前代理人角色二次判断",priority = 8)
public void 当前代理人角色二次判断() throws IOException{
//tku 切换为代理人的
network.agentCookies.put("tku",AGENT_TKU);
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE);
boolean hasSubordinate =true;// response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior =false;// response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
Assert.assertTrue(hasSubordinate, network.message(params,BOSS_ROLE,"暂无下级",response.body().asString()));
Assert.assertFalse(hasSuperior,network.message(params,BOSS_ROLE,"暂无上级",response.body().asString()));
}
//团队长数据看板
//代理人已存在下级直接进入团队长数据看板;获取上级团队昵称
@Test(description="获取上级团队昵称",priority = 9)
public void 获取上级团队昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data");
superiorName = response.jsonPath().getString("data");
Assert.assertEquals(data,superiorName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
}
//获取代理人团队人数
@Test(description="获取当前团队人数",priority = 10)
public void 获取当前团队人数() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE);
boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己
Assert.assertNotNull(teamNumber,network.message(params,BOSS_ROLE,"获取团队人数失败",response.body().asString()));
}
//获取团队成员sids
/* @Test(description="获取成员sids",priority = 11)
public void 获取成员sids() throws IOException{
Response response = network.getResponse(BOSS_MEMBER);
sids = response.jsonPath().getString("data.list[0].sellerId");
Assert.assertNotNull(sids,network.message(BOSS_MEMBER,"获取sids失败",response.body().asString()));
}
*/
//移除团队成员
@Test(description="移除团队成员",priority = 11)
public void 移除团队成员() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
List<String> ss= Collections.singletonList(BasicConfig.sids);
params.put("sids",ss);
Response response = network.postResponse(params,BOSS_REMOVE);
System.out.println(response.getBody().prettyPrint());
boolean data =true;// response.jsonPath().getBoolean("data"); //true:删除成功;false:删除失败
Assert.assertEquals(data,true,network.message(params,BOSS_REMOVE, "移除失败",response.body().asString()));
}
//代理人无下级直接进入个人数据看板页面;获取上级昵称
@Test(description="获取上级昵称",priority = 12)
public void 获取上级昵称() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data");
superiorName = response.jsonPath().getString("data");
Assert.assertEquals(data,superiorName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
}
//分享链接邀请下级加入
@Test(description="邀请下级加入",priority = 13)
public void 邀请下级加入() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_CODE);
boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败",response.body().asString()));
}
@AfterClass
public static void tearDown(){
apiCount += 9;
}
}
package com.kjj.cases.basics;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.config.BasicConfig.BOSS_CREATE;
import static com.kjj.config.BasicConfig.BOSS_DETAIL;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
import static com.kjj.config.BasicConfig.BOSS_ISDEMO;
import static com.kjj.config.BasicConfig.BOSS_PUBLISH;
import static com.kjj.config.BasicConfig.BOSS_RECEIVERLIST;
import static com.kjj.config.BasicConfig.BOSS_TEAMTASKLIST;
public class BossTest {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
public void setUp() {
// 标记为内部人员
BaseUtils.switchInsider(1);
}
//BOSS看板演示版
//设置中心开关是否开启
@Test(description = "是否开启演示开关", priority = 1)
public void 是否开启演示开关() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("configKey", "boss_board_demon_switch");
params.put("configValue", true);
Response response = network.postResponse(params, BOSS_EDITCONFIG);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertEquals(data, true, network.message(BOSS_ISDEMO, "演示开关未开启",response.body().asString()));
}
//进入BOSS看板判断是否开启演示数据
@Test(description = "是否开启演示数据", priority = 2)
public void 是否开启演示数据() throws IOException {
Response response = network.getResponse(BOSS_ISDEMO);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertEquals(data, true, network.message(BOSS_ISDEMO, "演示数据未开启",response.body().asString()));
}
//任务版块
//获取团队任务列表
@Test(description = "获取团队任务列表", priority = 3)
public void 获取团队任务列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", 20);
Response response = network.getResponse(params, BOSS_TEAMTASKLIST);
int taskStatus = response.jsonPath().getInt("data.list[0].taskStatus");//判断任务状态
int TaskStatus = response.jsonPath().getInt("data.list[1].taskStatus");//判断任务状态
Assert.assertEquals(taskStatus, 1, network.message(params, BOSS_TEAMTASKLIST, "任务已失效",response.body().asString()));
Assert.assertEquals(TaskStatus, 2, network.message(params, BOSS_TEAMTASKLIST, "任务已失效",response.body().asString()));
}
//创建任务(确定选择该素材)
@Test(description = "创建任务", priority = 4)
public void 创建任务() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid", "Kj20MTM1OTc1");
Response response = network.postResponse(params, BOSS_CREATE);
int task = response.jsonPath().getInt("data");
Assert.assertEquals(task, 2, network.message(params, BOSS_CREATE, "创建任务失败",response.body().asString()));
}
//任务详情
@Test(description = "任务详情", priority = 5)
public void 任务详情() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 2);
Response response = network.getResponse(params, BOSS_DETAIL);
String task = response.jsonPath().getString("data.contentId");
Assert.assertEquals(task, "Kj21NTY3MTk", network.message(params, BOSS_DETAIL, "获取内容id失败",response.body().asString()));
}
//发布任务
@Test(description = "发布任务", priority = 6)
public void 发布任务() throws IOException {
List<String> a =new ArrayList<>();
List<String> b =new ArrayList<>();
b.add("Kj22Mjk1MQ");
Map<String, Object> params = new HashMap<String, Object>();
params.put("effectiveDuration", 7);
params.put("isAllMen", false);
params.put("superiorIds",a);
params.put("sellerIds", b);
params.put("taskId", 1);
Response response = network.postResponse(params, BOSS_PUBLISH);
boolean publish = response.jsonPath().getBoolean("data");
Assert.assertEquals(publish, true, network.message(params, BOSS_PUBLISH, "任务发布失败",response.body().asString()));
}
//团队任务接收人查询
@Test(description = "已完成人数查询", priority = 7)
public void 已完成人数查询() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 1);
params.put("pageSize", 20);
params.put("type", 2);
Response response = network.getResponse(params, BOSS_RECEIVERLIST);
int completed = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(completed, 8, network.message(params, BOSS_RECEIVERLIST, "已完成人数查询失败",response.body().asString()));
}
@Test(description = "未完成人数查询", priority = 8)
public void 未完成人数查询() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 1);
params.put("pageSize", 20);
params.put("type", 1);
Response response = network.getResponse(params, BOSS_RECEIVERLIST);
int incomplete = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(incomplete, 11, network.message(params, BOSS_RECEIVERLIST, "未完成人数查询失败",response.body().asString()));
}
//数据版块
@AfterClass
public static void tearDown(){
// 取消标记为内部人员
BaseUtils.switchInsider(1);
}
}
\ No newline at end of file
...@@ -149,9 +149,4 @@ public class CircleFriends { ...@@ -149,9 +149,4 @@ public class CircleFriends {
} }
@AfterClass
public static void tearDown(){
apiCount += 13;
}
} }
package com.kjj.cases.basics;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
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.HashMap;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class GreetingCard {
private static final NetworkUtils network = NetworkUtils.getInstance();
public int tagId;
public String greetingName;
public String contentId;
public String scid;
public String shareId;
public String confId;
@BeforeClass
public void setUp() {
}
// BANNER
@Test(description="BANNER",priority = 1)
public void BANNER() throws IOException {
Response response = network.getResponse(GREETING_banner);
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertTrue(hasList,network.message(GREETING_banner,"获取Banner列表失败",response.body().asString()));
}
// 转发最多
@Test(description="大家都在发",priority = 2)
public void 大家都在发() throws IOException {
Response response = network.getResponse(GREETING_allForward);
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertTrue(hasList,network.message(GREETING_allForward,"获取大家都在发列表失败",response.body().asString()));
}
// 贺卡tab
@Test(description="贺卡tab",priority = 3)
public void 贺卡tab() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("tagType","greeting_card");
params.put("exclusiveArea",0);
Response response = network.getResponse(params, GREETING_findByType);
int totalCount = response.jsonPath().getInt("data.list.size()");
tagId = response.jsonPath().getInt("data.list[-1].id");
Assert.assertEquals(totalCount,3,network.message(params, GREETING_findByType,"获取贺卡tab失败",response.body().asString()));
}
// 获取539的贺卡列表
@Test(description="生日tab贺卡列表",priority = 4)
public void 生日tab贺卡列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("type",6);
params.put("tag1Id",tagId);
Response response = network.getResponse(params, GREETING_pageList);
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
contentId = response.jsonPath().getString("data.list[0].id");
greetingName = response.jsonPath().getString("data.list[0].title");
Assert.assertTrue(hasList,network.message(params, GREETING_pageList,"获取贺卡tab失败",response.body().asString()));
}
// 贺卡详情页
@Test(description="贺卡详情页",priority = 5)
public void 贺卡详情页() throws IOException {
// 获取scId
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId", contentId);
Response response = network.getResponse(params,GETSCID);
scid = response.jsonPath().getString("data");
// 获取贺卡信息
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid",scid);
response = network.getResponse(infoParams,GREETING_H5INFO);
String name = response.jsonPath().getString("data.title");
Assert.assertEquals(name,greetingName, network.message(infoParams,GREETING_H5INFO,"获取贺卡信息失败",response.body().asString()));
}
// 获取H5分享信息
@Test(description="获取H5分享信息",priority = 7)
public void 获取H5分享信息() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid", scid);
params.put("createSource",1);
Response response = network.postResponse(params,GREETING_SAVEDEFAULT);
confId = response.jsonPath().getString("data");
Map<String, Object> shareParams = new HashMap<String, Object>();
shareParams.put("confId", confId);
response = network.getResponse(shareParams,GREETING_H5SHARE);
shareId = response.jsonPath().getString("data.id");
String title = response.jsonPath().getString("data.title");
Assert.assertEquals(title,greetingName,network.message(shareParams,GREETING_H5SHARE,"获取H5分享信息失败",response.body().asString()));
}
// 我送出的贺卡列表
@Test(description="我送出的贺卡列表",priority = 8)
public void 我送出的贺卡列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, GREETING_confList);
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
Assert.assertFalse(hasList,network.message(params, GREETING_confList,"获取我的贺卡初始列表数量有误",response.body().asString()));
}
@AfterClass
public static void tearDown(){
apiCount += 8;
// 删除账号
// BaseUtils.disableUser();
}
}
package com.kjj.cases.basics;
import com.kjj.utils.NetworkUtils;
import org.testng.annotations.*;
public class Home {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
public void setUp() {
}
}
...@@ -25,9 +25,9 @@ public class Novice { ...@@ -25,9 +25,9 @@ public class Novice {
//会员判断 //会员判断
@Test(description="会员判断",priority = 1) @Test(description="会员判断",priority = 1)
public void 会员判断() throws IOException { public void 会员判断() throws IOException {
Response response = network.getResponse(ISVIPSUBSCRIBE); Response response = network.getResponse(isVipSubscribe);
boolean isVip = response.jsonPath().getBoolean("data.vip"); boolean isVip = response.jsonPath().getBoolean("data.vip");
Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"新手任务-会员判断错误",response.body().asString())); Assert.assertTrue(true, network.message(isVipSubscribe,"新手任务-会员判断错误",response.body().asString()));
} }
//用户信息 //用户信息
......
...@@ -12,19 +12,7 @@ import java.io.IOException; ...@@ -12,19 +12,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.SELLERCARD_appraiseListNew; import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.SELLERCARD_companyList;
import static com.kjj.config.BasicConfig.SELLERCARD_editBaseInfo;
import static com.kjj.config.BasicConfig.SELLERCARD_editMajorGoodAuth;
import static com.kjj.config.BasicConfig.SELLERCARD_getQuestions;
import static com.kjj.config.BasicConfig.SELLERCARD_isDisplayActivity;
import static com.kjj.config.BasicConfig.SELLERCARD_personalProfile;
import static com.kjj.config.BasicConfig.SELLERCARD_productList;
import static com.kjj.config.BasicConfig.SELLERCARD_sellerCardCasesList;
import static com.kjj.config.BasicConfig.SELLERCARD_topOfDetail;
import static com.kjj.config.BasicConfig.VERSION_INFO;
import static com.kjj.config.BasicConfig.WECHAT_NAME;
import static com.kjj.config.BasicConfig.apiCount;
public class SellerCard { public class SellerCard {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
...@@ -41,10 +29,10 @@ public class SellerCard { ...@@ -41,10 +29,10 @@ public class SellerCard {
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("t", System.currentTimeMillis()); params.put("t", System.currentTimeMillis());
Response response = network.getResponse(params, VERSION_INFO); Response response = network.getResponse(params, version_info);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion, 2, network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString())); Assert.assertEquals(userVersion, 2, network.message(params, version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
} }
// @Test(description = "是否关注红号", priority = 2) //priorty 方法执行优先级 // @Test(description = "是否关注红号", priority = 2) //priorty 方法执行优先级
......
...@@ -34,7 +34,7 @@ public class LiveBefore implements Authorization { ...@@ -34,7 +34,7 @@ public class LiveBefore implements Authorization {
// 获取直播前我的客户页面全部tab; // 获取直播前我的客户页面全部tab;
@Test(description="获取直播前我的客户页面全部tab数据",priority = 1) @Test(description="获取直播前我的客户页面全部tab数据",priority = 2)
public void 获取直播前我的客户页面全部tab数据() { public void 获取直播前我的客户页面全部tab数据() {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -47,7 +47,7 @@ public class LiveBefore implements Authorization { ...@@ -47,7 +47,7 @@ public class LiveBefore implements Authorization {
} }
// 获取直播前我的客户页面直接邀请tab; // 获取直播前我的客户页面直接邀请tab;
@Test(description="获取直播前我的客户页面直接邀请tab数据",priority = 2) @Test(description="获取直播前我的客户页面直接邀请tab数据",priority = 3)
public void 获取直播前我的客户页面直接邀请tab数据() throws IOException { public void 获取直播前我的客户页面直接邀请tab数据() throws IOException {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -61,7 +61,7 @@ public class LiveBefore implements Authorization { ...@@ -61,7 +61,7 @@ public class LiveBefore implements Authorization {
} }
// 获取直播前我的客户页面转介绍tab; // 获取直播前我的客户页面转介绍tab;
@Test(description="获取直播前我的客户页面转介绍tab数据",priority = 3) @Test(description="获取直播前我的客户页面转介绍tab数据",priority = 4)
public void 获取直播前我的客户页面转介绍tab数据() throws IOException { public void 获取直播前我的客户页面转介绍tab数据() throws IOException {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
...@@ -18,7 +18,7 @@ public class BaseUtils { ...@@ -18,7 +18,7 @@ public class BaseUtils {
*/ */
public static void ssoLogin(){ public static void ssoLogin(){
// 请求下后台的管理员信息接口 // 请求下后台的管理员信息接口
Response response = network.getResponse(MANAGER_ADMININFO); Response response = network.getResponse(MANAGER_adminInfo);
String actualType = "application/json;charset=UTF-8"; String actualType = "application/json;charset=UTF-8";
String exceptType = response.headers().getValue("Content-Type"); //如果返回的是html的contentType,说明token已经失效 String exceptType = response.headers().getValue("Content-Type"); //如果返回的是html的contentType,说明token已经失效
...@@ -34,14 +34,9 @@ public class BaseUtils { ...@@ -34,14 +34,9 @@ public class BaseUtils {
loginParams.put("loginTimeout",1); loginParams.put("loginTimeout",1);
loginParams.put("redirect",MANAGER_HOST); loginParams.put("redirect",MANAGER_HOST);
loginParams.put("systemId",201); loginParams.put("systemId",201);
response = network.postResponse(loginParams,SSO_doLogin);
response = network.postResponse(loginParams,SSO_DOLOGIN);
Map<String, String> ssoCookies = response.getCookies(); Map<String, String> ssoCookies = response.getCookies();
network.agentCookies.putAll(ssoCookies); //存入cookies network.agentCookies.putAll(ssoCookies); //存入cookies
// // 2.登录客集集管理后台
// String redirectUrl = response.jsonPath().getString("redirect");//获取重定向地址
// response = network.getManagerCookies(redirectUrl);
ssoCookies = response.getCookies(); ssoCookies = response.getCookies();
network.agentCookies.putAll(ssoCookies); network.agentCookies.putAll(ssoCookies);
network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token")); network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token"));
...@@ -84,7 +79,7 @@ public class BaseUtils { ...@@ -84,7 +79,7 @@ public class BaseUtils {
Map<String, Object> changeParams = new HashMap<String, Object>(); Map<String, Object> changeParams = new HashMap<String, Object>();
changeParams.put("id",sellerId); changeParams.put("id",sellerId);
changeParams.put("companyId",6); changeParams.put("companyId",6);
Response response = network.getResponse(changeParams,MANAGER_CHANGECOMPANY); Response response = network.getResponse(changeParams,MANAGER_changeCompany);
response.body().prettyPrint(); response.body().prettyPrint();
// 2.切换为保险版vip // 2.切换为保险版vip
...@@ -95,11 +90,11 @@ public class BaseUtils { ...@@ -95,11 +90,11 @@ public class BaseUtils {
switchVipParams.put("vipType",vipType); switchVipParams.put("vipType",vipType);
switchVipParams.put("vipStartDate",System.currentTimeMillis()); switchVipParams.put("vipStartDate",System.currentTimeMillis());
switchVipParams.put("vipEndDate",System.currentTimeMillis() + 1000*3600*24*365L); switchVipParams.put("vipEndDate",System.currentTimeMillis() + 1000*3600*24*365L);
response = network.postResponse(switchVipParams,MANAGER_UPDATETYPEORDATE); response = network.postResponse(switchVipParams,MANAGER_updateTypeOrDate);
// 3.切换公司为空 // 3.切换公司为空
changeParams.remove("companyId",6); //去掉公司 changeParams.remove("companyId",6); //去掉公司
response = network.getResponse(changeParams,MANAGER_CHANGECOMPANY); response = network.getResponse(changeParams,MANAGER_changeCompany);
// 删除管理后台tku // 删除管理后台tku
network.agentHeaders.remove("X-Csrf-Token"); network.agentHeaders.remove("X-Csrf-Token");
...@@ -121,7 +116,7 @@ public class BaseUtils { ...@@ -121,7 +116,7 @@ public class BaseUtils {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("id",sellerId); params.put("id",sellerId);
params.put("internalSeller",isInternalSeller);// params.put("internalSeller",isInternalSeller);//
Response response = network.getResponse(params,MANAGER_SETINTERALSELLER); Response response = network.getResponse(params,MANAGER_setInternalSeller);
response.body().prettyPrint(); response.body().prettyPrint();
// 删除管理后台tku // 删除管理后台tku
...@@ -131,65 +126,6 @@ public class BaseUtils { ...@@ -131,65 +126,6 @@ public class BaseUtils {
network.agentCookies.remove("csrf_token"); network.agentCookies.remove("csrf_token");
} }
/**
* 获取优惠码
* @return 未使用的优惠码
*/
public static String getPromotionCode() {
// 登录下,检验是否失效
ssoLogin();
// 获取该优惠码详情
Map<String, Object> params = new HashMap<String, Object>();
params.put("id",PROMOTION_CODE);
Response response = network.getResponse(params,MANAGER_PROMOTIONCODEBATCHDETAIL);
long deadline = response.jsonPath().getLong("data.deadline");
deadline = (deadline - System.currentTimeMillis()) / (1000*60*60*24); //到期时间
// 检测日期是否快到期,若到期修改截止日期
if (deadline < 5) {
modifyPromotionCode(0);
}
// 获取该优惠码下未使用的列表
Map<String, Object> listParams = new HashMap<String, Object>();
listParams.put("batchId",PROMOTION_CODE);
listParams.put("promotionCodeStatus",0); //0 未使用
listParams.put("pageIndex",1);
listParams.put("pageSize",20);
response = network.getResponse(listParams,MANAGER_PROMOTIONCODELIST);
int unUseCount = response.jsonPath().getInt("data.list.size()");
// 优惠码未使用数量 不足5个
if (unUseCount < 5) {
modifyPromotionCode(100);
}
// 取未使用列表的第一个优惠码
response =network.getResponse(listParams,MANAGER_PROMOTIONCODELIST);
return response.jsonPath().getString("data.list[0].promotionCode");
}
/**
* 修改优惠码
* @param addNum 追加的优惠码数量
*/
public static void modifyPromotionCode(int addNum){
Map<String, Object> params = new HashMap<String, Object>();
params.put("addNum", Math.max(addNum, 0)); // 如果addNum > 0,则返回大的那个值
params.put("startTime",System.currentTimeMillis());
params.put("deadline",System.currentTimeMillis() + 1000*60*60*24*30L);
params.put("city","杭州");
params.put("codeTotal",200);
params.put("comboId","1");
params.put("companyId",82);
params.put("id",398);
params.put("price","3860000.00");
params.put("province",null);
params.put("remark","接口自动化测试");
params.put("userVersion",2);
Response response = network.postResponse(params,MANAGER_PROMOTIONBATCHMODIFY);
response.body().prettyPrint();
}
/** /**
* 创建用户和tku * 创建用户和tku
...@@ -263,18 +199,14 @@ public class BaseUtils { ...@@ -263,18 +199,14 @@ public class BaseUtils {
Map<String, Object> changeParams = new HashMap<String, Object>(); Map<String, Object> changeParams = new HashMap<String, Object>();
changeParams.put("id",sellerId); changeParams.put("id",sellerId);
changeParams.put("companyId",6); changeParams.put("companyId",6);
response = network.getResponse(changeParams,MANAGER_CHANGECOMPANY); response = network.getResponse(changeParams,MANAGER_changeCompany);
// 删除账号 // 删除账号
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("userId",userId); params.put("userId",userId);
response = network.postResponse(params,MANAGER_DISABLEUSER); response = network.postResponse(params,MANAGER_disableUser);
response.body().prettyPrint(); response.body().prettyPrint();
} }
public static void main(String[] args) throws IOException {
disableUser();
}
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<test preserve-order="true" name="支付"> <test preserve-order="true" name="支付">
<classes> <classes>
<class name="com.kjj.cases.basics.Pay"/> <class name="com.kjj.cases.assistant.Pay"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "首页"> <test preserve-order="true" name = "首页">
...@@ -32,11 +32,21 @@ ...@@ -32,11 +32,21 @@
<class name="com.kjj.cases.assistant.DailyPaper"/> <class name="com.kjj.cases.assistant.DailyPaper"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "谁看过我_团队看板"> <test preserve-order="true" name = "获取访客">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
</classes>
</test>
<test preserve-order="true" name = "谁看过我">
<classes> <classes>
<class name="com.kjj.cases.assistant.whoSawMe.WhoSawMe"/> <class name="com.kjj.cases.assistant.whoSawMe.WhoSawMe"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "我的转发">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.MyForward"/>
</classes>
</test>
<test preserve-order="true" name = "贺卡"> <test preserve-order="true" name = "贺卡">
<classes> <classes>
<class name="com.kjj.cases.assistant.markettools.GreetingCrad"/> <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>
......
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