Commit 584b5c09 authored by 龚小红's avatar 龚小红

增加管理后台销售、公司、权限、总监部分的数据

parent f3a8c6bc
......@@ -39,6 +39,11 @@ public interface Authorization {
network.agentCookies.put(otoSellerCookieKey, otoSellerCookieValue);
}
//oto后台总监
default void otoLeaderAuth() {
network.agentCookies.put(otoLeaderCookieKey, otoLeaderCookieValue);
}
/**
* 集客助手相关授权
......
......@@ -207,7 +207,6 @@ public class MyForward implements Authorization {
List<Object> custLists = response.jsonPath().getList("data.list");
for(int i = 0; i < custLists.size(); i++){
boolean areClued = response.jsonPath().getBoolean("data.list["+i+"].clued");
Assert.assertTrue(areClued, network.message(param, BasicConfig.FORWARD_VISITRECORD, "筛选结果中第"+i+"条记录为未留下线索的访客", response.body().asString()));
}
}
......
......@@ -6,12 +6,10 @@ import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class Manager {
......@@ -22,8 +20,8 @@ public class Manager {
ssoLogin();
}
@Test(description = "查看销售列表",priority = 1)
public void 查看销售列表(){
@Test(description = "分页查看销售列表",priority = 1)
public void 分页查看销售列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", "1");
params.put("pageSize", "10");
......@@ -39,6 +37,8 @@ public class Manager {
Response response = network.getResponse(params, BasicConfig.MANAGER_oto_searchSeller);
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.MANAGER_oto_searchSeller,"查找结果为空",response.body().asString()));
int workStatus = response.jsonPath().getInt("data[0].workStatus");
Assert.assertEquals(workStatus,1,network.message(params,BasicConfig.MANAGER_oto_searchSeller,"查找结果为空",response.body().asString()));
sellerId = response.jsonPath().getInt("data[0].id");
}
......@@ -47,18 +47,25 @@ public class Manager {
public void 修改销售信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", sellerId);
params.put("id", 35);
params.put("sellerName", "勿动-自动化更新销售");
params.put("phoneNumber", "17830855590");
params.put("phoneNumber", "18852895892");
params.put("roleType", 1);
params.put("callPermission", 1);
params.put("sellerStatus", 1);
params.put("callPermission", 0);
params.put("sellerStatus", 0);
params.put("companyId", 1);
params.put("companyName", "勿动-自动化测试公司");
params.put("sellerLevel", 2);
params.put("workStatus", 1);
params.put("parentId", 28);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_updateSeller);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.FORM_submit,"修改客户失败",response.body().asString()));
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateSeller,"修改客户失败",response.body().asString()));
sleep(1000);
HashMap<String,Object> selectParam = new HashMap<>();
selectParam.put("sellerName", "勿动-自动化更新销售");
selectParam.put("phoneNumber", "15136361301");
selectParam.put("phoneNumber", "18852895892");
selectParam.put("pageIndex", "1");
selectParam.put("pageSize", "10");
response = network.getResponse(selectParam, BasicConfig.MANAGER_oto_sellerList);
......@@ -66,16 +73,113 @@ public class Manager {
Assert.assertTrue(size>0,network.message(selectParam,BasicConfig.MANAGER_oto_sellerList,"查找结果为空",response.body().asString()));
//还原
params.put("callPermission", 1);
params.put("sellerStatus", 1);
params.put("companyId", 5);
params.put("sellerLevel", 1);
params.put("parentId", 36);
params.put("sellerName", "勿动-自动化测试销售");
response = network.postResponse(params, BasicConfig.MANAGER_oto_updateSeller);
data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.FORM_submit,"修改客户失败",response.body().asString()));
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateSeller,"修改客户失败",response.body().asString()));
}
@Test(description = "查询渠道列表",priority = 4)
public void 查询渠道列表(){
Response response = network.getResponse(BasicConfig.MANAGER_oto_channelList);
int size = response.jsonPath().getInt("data.size");
Assert.assertTrue(size>0,network.message(BasicConfig.FORM_submit,"渠道列表为空",response.body().asString()));
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_oto_channelList,"渠道列表为空",response.body().asString()));
}
@Test(description = "不可新增同一手机号销售",priority = 5)
public void 不可新增同一手机号销售(){
HashMap<String,Object> params = new HashMap<>();
params.put("sellerName", "勿动-自动化更新销售");
params.put("phoneNumber", "18852895892");
params.put("roleType", 1);
params.put("callPermission", 1);
params.put("sellerStatus", 1);
params.put("companyId", 1);
params.put("sellerLevel", 1);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_saveSeller);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.MANAGER_oto_saveSeller,"新增同一手机号销售成功",response.body().asString()));
}
@Test(description = "不可修改总监为普通",priority = 6)
public void 不可修改总监为普通(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", sellerId);
params.put("sellerName", "勿动-自动化测试销售");
params.put("phoneNumber", "18852895892");
params.put("roleType", 3);
params.put("callPermission", 1);
params.put("sellerStatus", 1);
params.put("companyId", 3);
params.put("sellerLevel", 1);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_updateSeller);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.MANAGER_oto_updateSeller,"修改总监为普通销售成功",response.body().asString()));
}
@Test(description = "不可新增同名公司",priority = 7)
public void 不可新增同名公司(){
HashMap<String,Object> params = new HashMap<>();
params.put("companyName", "勿动-自动化测试公司");
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_saveCompany);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.MANAGER_oto_saveCompany,"新增同名公司成功",response.body().asString()));
}
@Test(description = "修改公司名称",priority = 8)
public void 修改公司名称(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", 5);
params.put("companyName", "勿动-自动化测试公司更新");
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_updateCompany);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateCompany,"修改客户失败",response.body().asString()));
}
@Test(description = "分页查看公司列表",priority = 9)
public void 分页查看公司列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response response = network.getResponse(params, BasicConfig.MANAGER_oto_listCompany);
int size = response.jsonPath().getInt("data.list.findAll{it.companyName == \""+"勿动-自动化测试公司更新"+"\"}.size()");
Assert.assertEquals(size,1,network.message(params,BasicConfig.MANAGER_oto_listCompany,"查询更新的公司名称失败",response.body().asString()));
//还原
params.clear();
params.put("id", 5);
params.put("companyName", "勿动-自动化测试公司");
response = network.postResponse(params, BasicConfig.MANAGER_oto_updateCompany);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateCompany,"修改客户失败",response.body().asString()));
}
@Test(description = "查看所有公司列表",priority = 10)
public void 查看所有公司列表(){
Response response = network.getResponse(BasicConfig.MANAGER_oto_listAllCompany);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_oto_listAllCompany,"查看所有公司列表为空",response.body().asString()));
}
@Test(description = "查看所有总监列表",priority = 11)
public void 查看所有总监列表(){
Response response = network.getResponse(BasicConfig.MANAGER_oto_directorList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_oto_directorList,"查看所有总监列表为空",response.body().asString()));
}
@Test(description = "修改工作状态为请假中",priority = 12)
public void 修改工作状态为请假中(){
HashMap<String,Object> params = new HashMap<>();
params.put("sellerId", 36);
params.put("workStatus", 0);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_switchWorkStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateCompany,"修改工作状态为请假中失败",response.body().asString()));
}
}
......@@ -32,6 +32,7 @@ public class Work implements Authorization {
header = new HashMap<>();
chart = new HashMap<>();
otoSellerLogin();
otoLeaderLogin();
ssoLogin();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
......@@ -133,6 +134,7 @@ public class Work implements Authorization {
@Test(description = "工作台_销售信息",priority = 7)
public void 客户分类_销售信息(){
otosellerAuth();
Response response = network.getResponse(BasicConfig.WORK_userInfo);
String sellerName = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(sellerName,"勿动-自动化测试销售",network.message(BasicConfig.WORK_userInfo,"销售姓名错误",response.body().asString()));
......@@ -738,6 +740,37 @@ public class Work implements Authorization {
Assert.assertNull(followWeight,network.message(params,BasicConfig.WORK_header,"客户权重未清空",response.body().asString()));
}
@Test(description = "总监查看名下销售列表",priority = 55)
public void 总监查看名下销售列表(){
otoLeaderAuth();
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.WORK_attendanceList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertEquals(size,1,network.message(params,BasicConfig.WORK_attendanceList,"总监名下销售列表为空",response.body().asString()));
}
@Test(description = "总监修改名下销售工作状态",priority = 56)
public void 总监修改名下销售工作状态(){
HashMap<String,Object> params = new HashMap<>();
params.put("sellerId", 35);
params.put("workStatus", 0);
Response response = network.postResponse(params, BasicConfig.WORK_switchWorkStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.WORK_logout,"总监修改名下销售工作状态失败",response.body().asString()));
}
@Test(description = "总监修改非名下销售工作状态",priority = 57)
public void 总监修改非名下销售工作状态(){
HashMap<String,Object> params = new HashMap<>();
params.put("sellerId", 1);
params.put("workStatus", 0);
Response response = network.postResponse(params, BasicConfig.WORK_switchWorkStatus);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(BasicConfig.WORK_logout,"总监修改非名下销售工作状态成功",response.body().asString()));
}
@Test(description = "删除客户",priority = 79)
public void 删除客户(){
HashMap<String,Object> params = new HashMap<>();
......@@ -749,6 +782,7 @@ public class Work implements Authorization {
@Test(description = "退出登录",priority = 80)
public void 退出登录(){
otosellerAuth();
Response response = network.postResponse(BasicConfig.WORK_logout);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.WORK_logout,"退出登录失败",response.body().asString()));
......
......@@ -1303,7 +1303,14 @@ public class BasicConfig {
public static final String MANAGER_oto_tagList = MANAGER_HOST + "/kjy/manager/oto/tag/list";
public static final String MANAGER_oto_switchStatus = MANAGER_HOST + "/kjy/manager/oto/tag/switchStatus";
public static final String MANAGER_oto_sellerList = MANAGER_HOST + "/kjy/manager/oto/seller/list";
public static final String MANAGER_oto_saveSeller = MANAGER_HOST + "/kjy/manager/oto/seller/save";
public static final String MANAGER_oto_updateSeller = MANAGER_HOST + "/kjy/manager/oto/seller/update";
public static final String MANAGER_oto_directorList = MANAGER_HOST + "/kjy/manager/oto/seller/directorList";
public static final String MANAGER_oto_updateCompany = MANAGER_HOST + "/kjy/manager/oto/company/update";
public static final String MANAGER_oto_saveCompany = MANAGER_HOST + "/kjy/manager/oto/company/save";
public static final String MANAGER_oto_listCompany = MANAGER_HOST + "/kjy/manager/oto/company/list";
public static final String MANAGER_oto_listAllCompany = MANAGER_HOST + "/kjy/manager/oto/company/listAll";
public static final String MANAGER_oto_switchWorkStatus = MANAGER_HOST + "/kjy/manager/oto/seller/switchWorkStatus";
public static final String MANAGER_oto_customerList = MANAGER_HOST +"/kjy/manager/pub/form/customer/list/v2";
public static final String MANAGER_oto_assignSeller = MANAGER_HOST +"/kjy/manager/pub/form/customer/assignSeller";
public static final String MANAGER_oto_switchSellerStatus = MANAGER_HOST +"/kjy/manager/oto/seller/switchSellerStatus";
......@@ -1346,6 +1353,8 @@ public class BasicConfig {
public static final String WORK_freshList= WORK_HOST + "/kjy/oto/manager/customer/pool/fresh/list";
public static final String WORK_recycleList= WORK_HOST + "/kjy/oto/manager/customer/pool/recycle/list";
public static final String WORK_claim= WORK_HOST + "/kjy/oto/manager/customer/pool/claim";
public static final String WORK_attendanceList= WORK_HOST + "/kjy/oto/manager/attendance/list";
public static final String WORK_switchWorkStatus= WORK_HOST + "/kjy/oto/manager/attendance/switchWorkStatus";
public static final String WORK_verifyCodet = WORK_HOST + "/kjy/oto/auto/test/verifyCode";
public static final String WORK_delCust = WORK_HOST + "/kjy/oto/auto/test/delCust";
......
......@@ -428,9 +428,8 @@ public class BaseUtils {
otoSellerCookieKey = cookieKeyValue[0];
otoSellerCookieValue = cookieKeyValue[1];
// otoSellerCookieKey = "otoToken";
// otoSellerCookieValue = "64e83LYGbaXYX9EkHumCho2Um1Gg9q8bFzwARTRumNzN6Rhk6daEZTsjNPH2GeKiTAnfV1uzt6EdwxQw2bkStkifNAc5B5yPWNzS4kEQBCP";
// otoSellerCookieValue = "64e83LYGbaXYX9EkHumCho2Um1GyikzWhYrmAfaxDJLTKWo3R3ftLtTdVx1ZCaihHqi9qG45dqQ8CdEya9eWEXSiEW9LjCXQoFeJWJvNcVQ";
network.agentCookies.put(otoSellerCookieKey, otoSellerCookieValue); //存入cookies
System.out.println("销售Cookie中key:"+ otoSellerCookieKey +" ,values:"+ otoSellerCookieValue);
......@@ -471,7 +470,10 @@ public class BaseUtils {
otoLeaderCookieKey = cookieKeyValue[0];
otoLeaderCookieValue = cookieKeyValue[1];
// otoLeaderCookieKey = "otoToken";
// otoLeaderCookieValue = "64e83LYGbaXYX9EkHumCho2Um1GyikzWh7fhCVMnZpMvdoMsVm4TxDVoLbzCHGf4BqHzR5nXdrjL6VeJLdpEPHJpVDDg2A3TRyCz7yhttRB";
network.agentCookies.put(otoLeaderCookieKey, otoLeaderCookieValue); //存入cookies
System.out.println("销售Cookie中key:"+ otoLeaderCookieKey +" ,values:"+ otoLeaderCookieValue);
System.out.println("总监Cookie中key:"+ otoLeaderCookieKey +" ,values:"+ otoLeaderCookieValue);
}
}
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