Commit 6a78fa28 authored by 龚小红's avatar 龚小红

Merge branch 'gifeature/20211209-gj' into 'master'

Gifeature/20211209 gj

See merge request test-group/kejiji!189
parents d4f81d9b dc0f0f59
......@@ -4,6 +4,7 @@ import com.kjj.utils.NetworkUtils;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.visitorAuth17;
import static com.kjj.utils.BaseUtils.*;
/**
......@@ -20,6 +21,21 @@ public interface Authorization {
System.out.println("用户AUTH_KEY:"+ADMIN_KEY);
}
//企业后台超级管理员
default void superAuth(){
network.agentCookies.put(superCookieKey,superCookieValue);
}
//企业后台企业管理员
default void companyAuth(){
network.agentCookies.put(companyCookieKey,companyCookieValue);
}
//企业后台营业部管理员
default void officeAuth(){
network.agentCookies.put(officeCookieKey,officeCookieValue);
}
/**
* 集客助手相关授权
*/
......
......@@ -21,6 +21,8 @@ public class Enterprise implements Authorization {
public void setUp() {
ssoLogin();
superUserLogin();
companyUserLogin();
officeUserLogin();
}
public long companyPageID; //管理后台公司管理员数据驾驶页面ID
public long officePageID; //管理后台营业部管理员数据驾驶页面ID
......@@ -34,6 +36,7 @@ public class Enterprise implements Authorization {
@Test(description = "企业后台_获取当前用户公司列表",priority = 1)
public void 企业后台_获取当前用户公司列表(){
superAuth();
Response comListRes = network.getResponse(BasicConfig.CORP_listSimple);
Object dataRes = comListRes.jsonPath().getJsonObject("data.size()");
Object data = comListRes.jsonPath().getJsonObject("data");
......@@ -159,7 +162,7 @@ public class Enterprise implements Authorization {
@Test(description = "企业后台_公司管理员数据驾驶舱页面隐藏",priority = 10)
public void 企业后台_公司管理员数据驾驶舱页面隐藏(){
companyUserLogin();
companyAuth();
ThreadSleepUtils.sleep(3000);
Response response = network.getResponse(BasicConfig.CORP_pageList);
Object data = response.jsonPath().getJsonObject("data.size()");
......@@ -168,7 +171,7 @@ public class Enterprise implements Authorization {
@Test(description = "企业后台_营业部管理员数据驾驶舱页面隐藏",priority = 11)
public void 企业后台_营业部管理员数据驾驶舱页面隐藏(){
officeUserLogin();
officeAuth();
ThreadSleepUtils.sleep(3000);
Response response = network.getResponse(BasicConfig.CORP_pageList);
Object data = response.jsonPath().getJsonObject("data.size()");
......@@ -248,7 +251,7 @@ public class Enterprise implements Authorization {
}
@Test(description = "企业后台_营业部管理员数据驾驶舱为空",priority = 17)
public void 企业后台_营业部管理员数据驾驶舱为空(){
officeUserLogin();
officeAuth();
ThreadSleepUtils.sleep(2000);
Response response = network.getResponse(BasicConfig.CORP_pageList);
Object data = response.jsonPath().getJsonObject("data.size()");
......@@ -260,7 +263,7 @@ public class Enterprise implements Authorization {
**/
@Test(description = "导入架构名单",priority = 18)
public void 导入架构名单(){
superUserLogin();
superAuth();
Map<String,Object> params = new HashMap<>();
//导入的架构名单内容为工号KJJ002一条数据,营业部为余杭区营业部
params.put("excelUrl","https://yun.dui88.com/kjy/corp/media/file/20211116/82d1352f96526be537e1635c42a37231.xlsx");
......@@ -475,7 +478,7 @@ public class Enterprise implements Authorization {
@Test(description = "企业后台_新增公司管理员",priority = 33)
public void 企业后台_新增公司管理员(){
superUserLogin();
superAuth();
Map<String,Object> params = new HashMap<>();
params.put("staffName","自动化公司管理员2");
params.put("staffPhone","13456467582");
......@@ -500,7 +503,7 @@ public class Enterprise implements Authorization {
@Test(description = "企业后台_新增营业部管理员",priority = 34)
public void 企业后台_新增营业部管理员(){
superUserLogin();
superAuth();
ThreadSleepUtils.sleep(2000);
Map<String,Object> params = new HashMap<>();
params.put("deptId",departmentId2);
......
......@@ -33,6 +33,7 @@ public class EnterpriseAgent implements Authorization {
@Test(description = "企业后台_新增账号", priority = 1)
public void 企业后台_新增账号() {
superAuth();
//利用当前时间戳作为工号
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
jobNumber= new Date().getTime();
......@@ -78,7 +79,7 @@ public class EnterpriseAgent implements Authorization {
@Test(description = "企业后台_已激活数量", priority = 4)
public void 企业后台_已激活数量() {
superUserLogin();
superAuth();
Response response = network.getResponse(BasicConfig.CORP_employeeStat);
int activateCount = response.jsonPath().getInt("data.activateCount");
Assert.assertEquals(activateCount, 1, network.message(BasicConfig.CORP_employeeStat, "已激活数量统计错误", response.body().asString()));
......@@ -294,7 +295,7 @@ public class EnterpriseAgent implements Authorization {
@Test(description = "企业后台_新增备用账号", priority = 20)
public void 企业后台_新增备用账号() {
superUserLogin();
superAuth();
Map<String, Object> params = new HashMap<>();
params.put("deptId", deptId);
params.put("employeeName", "账号2");
......
......@@ -19,6 +19,13 @@ public class BaseUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
public static String tku;
public static String superCookieKey;
public static String superCookieValue;
public static String companyCookieKey;
public static String companyCookieValue;
public static String officeCookieKey;
public static String officeCookieValue;
/**
* 登录管理后台
......@@ -218,7 +225,7 @@ public class BaseUtils {
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(5000);
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phone","15136361308");
params.put("captcha",captcha);
......@@ -241,6 +248,8 @@ public class BaseUtils {
header = switchRes.getHeader("Set-Cookie");
cookieStr = header.split(";")[0];
cookieKeyValue= cookieStr.split("=");
superCookieKey = cookieKeyValue[0];
superCookieValue = cookieKeyValue[1];
network.agentCookies.put(cookieKeyValue[0],cookieKeyValue[1]); //存入cookies
network.agentCookies.put("companyId","Kj20MjE1");
......@@ -264,7 +273,7 @@ public class BaseUtils {
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(5000);
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phone","15136361307");
params.put("captcha",captcha);
......@@ -287,6 +296,8 @@ public class BaseUtils {
header = switchRes.getHeader("Set-Cookie");
cookieStr = header.split(";")[0];
cookieKeyValue= cookieStr.split("=");
companyCookieKey = cookieKeyValue[0];
companyCookieValue = cookieKeyValue[1];
network.agentCookies.put(cookieKeyValue[0],cookieKeyValue[1]); //存入cookies
//put company Id
network.agentCookies.put("companyId","Kj20MjE1");
......@@ -334,7 +345,9 @@ public class BaseUtils {
header = switchRes.getHeader("Set-Cookie");
cookieStr = header.split(";")[0];
cookieKeyValue= cookieStr.split("=");
network.agentCookies.put(cookieKeyValue[0],cookieKeyValue[1]); //存入cookies
officeCookieKey = cookieKeyValue[0];
officeCookieValue = cookieKeyValue[1];
network.agentCookies.put(officeCookieKey,officeCookieValue); //存入cookies
//put company Id
network.agentCookies.put("companyId","Kj20MjE1");
}
......
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