Commit 4ff158ed authored by 龚小红's avatar 龚小红

Merge branch 'Feature/20220415-gxh' into 'master'

Feature/20220415 gxh

See merge request test-group/kejiji!245
parents aaf7f86d 6936e28a
......@@ -34,15 +34,19 @@ public interface Authorization {
network.agentCookies.put(officeCookieKey,officeCookieValue);
}
//oto后台销售
//oto销售工作台-销售
default void otosellerAuth() {
network.agentCookies.put(otoSellerCookieKey, otoSellerCookieValue);
}
//oto后台总监
//oto销售工作台-总监
default void otoLeaderAuth() {
network.agentCookies.put(otoLeaderCookieKey, otoLeaderCookieValue);
}
//oto销售工作台-总监
default void otoSellerTku() {
network.agentCookies.put("tku", OTO_TKU);
}
/**
......
......@@ -8,6 +8,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import static com.kjj.utils.BaseUtils.ssoLogin;
......@@ -16,9 +17,14 @@ import static com.kjj.utils.BaseUtils.ssoLogin;
public class Phone implements Authorization {
private static final NetworkUtils network = NetworkUtils.getInstance();
private String cust_id;
private String custName;
private String introduceCustomer_id;
private String myselfCustomer_id;
private String interviewId;
@BeforeTest
public void setUp(){
//登录销售工作台手机端
otoSellerTku();
}
@Test(description = "查看我的客户",priority = 1)
......@@ -26,28 +32,130 @@ public class Phone implements Authorization {
HashMap<String,Object> params = new HashMap<>();
params.put("pageSize", "20");
Response response = network.getResponse(params, BasicConfig.PHONE_customerList);
int size = response.jsonPath().getInt("data.list.size()");
int size = response.jsonPath().getInt("data.myCustomerVos.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_customerList,"客户列表为空",response.body().asString()));
cust_id = response.jsonPath().getString("data.list[0].id");
cust_id = response.jsonPath().getString("data.myCustomerVos[0].id");
custName = response.jsonPath().getString("data.myCustomerVos[0].custName");
}
@Test(description = "查看我的面访",priority = 1)
@Test(description = "查看我的面访",priority = 2)
public void 查看我的面访(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageSize", "20");
Response response = network.getResponse(params, BasicConfig.PHONE_interviewList);
int size = response.jsonPath().getInt("data.list.size()");
int size = response.jsonPath().getInt("data.customerInterviewVos.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
}
@Test(description = "不可创建重复手机号的客户",priority = 1)
@Test(description = "不可创建重复手机号的客户",priority = 3)
public void 不可创建重复手机号的客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageSize", "20");
Response response = network.postResponse(params, BasicConfig.PHONE_interviewList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
params.put("custName", "重复客户");
params.put("custPhoneNum", "13425256464");
params.put("custSource", 1);
Response response = network.postResponse(params, BasicConfig.PHONE_customerSave);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.PHONE_customerSave,"手机号重复创建客户成功",response.body().asString()));
}
@Test(description = "创建缘故客户",priority = 4)
public void 创建缘故客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化缘故客户");
params.put("custPhoneNum", "13410000001");
params.put("custSource", 1);
Response response = network.postResponse(params, BasicConfig.PHONE_customerSave);
myselfCustomer_id = response.jsonPath().getString("data");
Assert.assertNotNull(myselfCustomer_id,network.message(params,BasicConfig.PHONE_customerSave,"创建缘故客户失败",response.body().asString()));
}
@Test(description = "创建转介绍客户",priority = 5)
public void 创建转介绍客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化转介绍客户");
params.put("custPhoneNum", "13410000002");
params.put("introducerId", myselfCustomer_id);
params.put("custSource", 2);
Response response = network.postResponse(params, BasicConfig.PHONE_customerSave);
introduceCustomer_id = response.jsonPath().getString("data");
Assert.assertNotNull(introduceCustomer_id,network.message(params,BasicConfig.PHONE_customerSave,"创建转介绍客户失败",response.body().asString()));
}
@Test(description = "姓名搜索客户",priority = 6)
public void 姓名搜索客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化");
Response response = network.getResponse(params, BasicConfig.PHONE_fuzzyList);
int size = response.jsonPath().getInt("data.myCustomerVos.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_fuzzyList,"创建缘故客户失败",response.body().asString()));
}
@Test(description = "创建普通面访并关联转介绍和缘故客户",priority = 7)
public void 创建普通面访并关联转介绍和缘故客户(){
HashMap<String,Object> params = new HashMap<>();
ArrayList ids = new ArrayList();
params.put("custIds", cust_id+","+myselfCustomer_id+","+introduceCustomer_id);
params.put("interviewType", 1);
params.put("appointmentTime", System.currentTimeMillis()+3600000);
Response response = network.postResponse(params, BasicConfig.PHONE_interviewSave);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,BasicConfig.PHONE_interviewSave,"创建普通面访失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,BasicConfig.PHONE_interviewSave,"创建普通面访失败",response.body().asString()));
}
@Test(description = "已存在未结束的普通面访后创建普通面访失败",priority = 1)
public void 已存在未结束的普通面访后创建普通面访失败(){
HashMap<String,Object> params = new HashMap<>();
params.put("custIds", cust_id+","+myselfCustomer_id+","+introduceCustomer_id);
params.put("interviewType", 1);
params.put("appointmentTime", System.currentTimeMillis()+3600000);
Response response = network.postResponse(params, BasicConfig.PHONE_interviewSave);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.PHONE_interviewSave,"存在未结束普通面访时创建普通面访成功",response.body().asString()));
int size = response.jsonPath().getJsonObject("data.size()");
Assert.assertEquals(size,3,network.message(params,BasicConfig.PHONE_interviewSave,"返回的失败客户ids错误",response.body().asString()));
}
@Test(description = "创建社区面访并关联转介绍和缘故客户",priority = 1)
public void 创建社区面访并关联转介绍和缘故客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custIds", cust_id+","+myselfCustomer_id+","+introduceCustomer_id);
params.put("interviewType", 2);
params.put("appointmentTime", System.currentTimeMillis()+3600000);
Response response = network.postResponse(params, BasicConfig.PHONE_interviewSave);
boolean success = response.jsonPath().getBoolean("success");
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(success,network.message(params,BasicConfig.PHONE_interviewSave,"创建社区面访失败",response.body().asString()));
Assert.assertEquals(size,3,network.message(params,BasicConfig.PHONE_interviewSave,"创建社区面访失败",response.body().asString()));
interviewId = response.jsonPath().getString("data[0]");
}
@Test(description = "查询面访详情",priority = 1)
public void 查询面访详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("custIds", cust_id);
params.put("interviewType", 2);
Response response = network.getResponse(params, BasicConfig.PHONE_interviewSave);
String customerName = response.jsonPath().getString("data.custName");
String appointmentTime = response.jsonPath().getString("data.appointmentTime");
Assert.assertEquals(customerName,custName,network.message(params,BasicConfig.PHONE_interviewSave,"创建社区面访失败",response.body().asString()));
interviewId = response.jsonPath().getString("data[0]");
}
@Test(description = "修改面访时间",priority = 1)
public void 修改面访时间(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", interviewId);
params.put("appointmentTime", System.currentTimeMillis()+7200000);
Response response = network.getResponse(params, BasicConfig.PHONE_interviewSave);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_interviewSave,"修改社区时间失败",response.body().asString()));
interviewId = response.jsonPath().getString("data[0]");
}
......
......@@ -113,6 +113,9 @@ public class BasicConfig {
public static final String openId2 = "osi5w5pEY4SxORlLJEE4FkyxQ9E4";
/*******OTO销售工作台*********/
public static final String OTO_TKU = "2RA3RVc1LEF7SnuZg7qu8kr9mx4BEQcUy3ZmGw6EcESNTGXj1XP9rtChjMmfcnvfeQzPijhA2sbAWvYHchwK9o9b1GtjMLwvmUpJ1PdC57Y1yGJLynbr3FZ3YLURN35f9CE7sFhm3CrqT5FTo4tjpxD";
// *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn";
public static final String ACTIVITY_HOST = "https://kjj-activity.duibatest.com.cn";
......@@ -123,6 +126,7 @@ public class BasicConfig {
public static final String CORP_HOST = "https://kjj-corp.duibatest.com.cn";
public static final String WORK_HOST = "https://kjj-work.duibatest.com.cn";
public static final String FORM_HOST = "https://kjj-static.duibatest.com.cn";
public static final String PHONE_HOST = "https://kjj-auth.duibatest.com.cn";
// *************** 开启&结束直播 ***************
public static final String ANCHOR_OPEN = MOBILE_HOST + "/conf/live/open";
public static final String ANCHOR_getConfDetail = MOBILE_HOST + "/conf/pre/getConfDetail";
......@@ -1364,27 +1368,28 @@ public class BasicConfig {
public static final String WORK_switchWorkStatus= WORK_HOST + "/kjy/oto/manager/attendance/switchWorkStatus";
public static final String WORK_saveOrModifySchedule= WORK_HOST + "/kjy/oto/manager/sellerNotify/saveOrModifySchedule";
public static final String WORK_cancelSchedule= WORK_HOST + "/kjy/oto/manager/sellerNotify/cancelSchedule";
public static final String PHONE_customerList = MOBILE_HOST + "kjy/oto/customer/list";
public static final String PHONE_customerSave = MOBILE_HOST + "kjy/oto/customer/introduce/save";
public static final String PHONE_appointmentDetail = MOBILE_HOST + "/kjy/oto/interview/appointment/detail";
public static final String PHONE_fuzzyList = MOBILE_HOST + "/kjy/oto/cust/fuzzy/list";
public static final String PHONE_interviewSave = MOBILE_HOST + "/kjy/oto/interview/save";
public static final String PHONE_interviewUpdate = MOBILE_HOST + "/kjy/oto/interview/appointment/update";
public static final String PHONE_interviewList = MOBILE_HOST + "/kjy/oto/interview/list";
public static final String PHONE_interviewCancel = MOBILE_HOST + "/kjy/oto/interview/cancel";
public static final String PHONE_interviewCode = MOBILE_HOST + "/kjy/oto/h5/interview/code";
public static final String PHONE_interviewStatus = MOBILE_HOST + "/kjy/oto/h5/interview/status";
public static final String PHONE_interviewPhone = MOBILE_HOST + "/kjy/oto/h5/interview/phone";
public static final String PHONE_interviewBind = MOBILE_HOST + "/kjy/oto/h5/interview/bind";
public static final String PHONE_bindCancel = MOBILE_HOST + "/kjy/oto/h5/interview/cancel";
public static final String PHONE_feedbackDetail = MOBILE_HOST + "/kjy/oto/interview/feedback/detail";
public static final String PHONE_custExtDetail = MOBILE_HOST + "/kjy/oto/interview/custExtDetail";
public static final String PHONE_interviewFeedback = MOBILE_HOST + "/kjy/oto/interview/feedback";
public static final String PHONE_interviewDetail = MOBILE_HOST + "/kjy/oto/interview/edit/detail";
public static final String PHONE_authPhone = MOBILE_HOST + "/auth/oto/authPhone";
public static final String PHONE_getAuthPhone = MOBILE_HOST + "/auth/oto/getAuthPhone";
public static final String PHONE_submitEvaluate = MOBILE_HOST + "/kjy/oto/interview/submitEvaluate";
public static final String WORK_abandonCust= WORK_HOST + "/kjy/oto/manager/customer/abandonCust";
public static final String PHONE_customerList = PHONE_HOST + "/kjy/oto/manager/customer/list";
public static final String PHONE_customerSave = PHONE_HOST + "/kjy/oto/customer/introduce/save";
public static final String PHONE_appointmentDetail = PHONE_HOST + "/kjy/oto/interview/appointment/detail";
public static final String PHONE_fuzzyList = PHONE_HOST + "/kjy/oto/cust/fuzzy/list";
public static final String PHONE_interviewSave = PHONE_HOST + "/kjy/oto/interview/save";
public static final String PHONE_interviewUpdate = PHONE_HOST + "/kjy/oto/interview/appointment/update";
public static final String PHONE_interviewList = PHONE_HOST + "/kjy/oto/interview/list";
public static final String PHONE_interviewCancel = PHONE_HOST + "/kjy/oto/interview/cancel";
public static final String PHONE_interviewCode = PHONE_HOST + "/kjy/oto/h5/interview/code";
public static final String PHONE_interviewStatus = PHONE_HOST + "/kjy/oto/h5/interview/status";
public static final String PHONE_interviewPhone = PHONE_HOST + "/kjy/oto/h5/interview/phone";
public static final String PHONE_interviewBind = PHONE_HOST + "/kjy/oto/h5/interview/bind";
public static final String PHONE_bindCancel = PHONE_HOST + "/kjy/oto/h5/interview/cancel";
public static final String PHONE_feedbackDetail = PHONE_HOST + "/kjy/oto/interview/feedback/detail";
public static final String PHONE_custExtDetail = PHONE_HOST + "/kjy/oto/interview/custExtDetail";
public static final String PHONE_interviewFeedback = PHONE_HOST + "/kjy/oto/interview/feedback";
public static final String PHONE_interviewDetail = PHONE_HOST + "/kjy/oto/interview/edit/detail";
public static final String PHONE_authPhone = PHONE_HOST + "/auth/oto/authPhone";
public static final String PHONE_getAuthPhone = PHONE_HOST + "/auth/oto/getAuthPhone";
public static final String PHONE_submitEvaluate = PHONE_HOST + "/kjy/oto/interview/submitEvaluate";
public static final String WORK_verifyCode = WORK_HOST + "/kjy/oto/auto/test/verifyCode";
public static final String WORK_delCust = WORK_HOST + "/kjy/oto/auto/test/delCust";
......
......@@ -397,39 +397,39 @@ public class BaseUtils {
* 普通销售员登录销售工作台
*/
public static void otoSellerLogin(){
ThreadSleepUtils.sleep(2000);
// 调用登录接口
Map<String, Object> params = new HashMap<String, Object>();
params.put("phoneNumber","18248405155");
Response response = network.getResponse(params,BasicConfig.WORK_getCaptcha);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_getCaptcha,"获取验证码失败",response.body().asString()));
//专用于自动化获取验证码
params.clear();
params.put("phoneNumber","18248405155");
Response autoTestRes = network.getResponse(params,BasicConfig.WORK_verifyCode);
String captcha = autoTestRes.jsonPath().getString("data");
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phoneNumber","18248405155");
params.put("captcha",captcha);
Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
boolean success = loginRes.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params,BasicConfig.WORK_login,"登录失败",loginRes.body().asString()));
//获取cookie
String header = loginRes.getHeader("Set-Cookie");
String cookieStr = header.split(";")[0];
String[] cookieKeyValue = cookieStr.split("=");
otoSellerCookieKey = cookieKeyValue[0];
otoSellerCookieValue = cookieKeyValue[1];
// otoSellerCookieKey = "otoToken";
// otoSellerCookieValue = "64e83LYGbaXYX9EkHumCho2Um1H6zBcWkw5JtD5N2YjRB7RFmU6uG7ziBmmBWwsRz2uLkFruaQMtPTc4XJVhTmCWQmdZCYvYzyru4GEVxxw";
// ThreadSleepUtils.sleep(2000);
// // 调用登录接口
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("phoneNumber","18248405155");
// Response response = network.getResponse(params,BasicConfig.WORK_getCaptcha);
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(params,BasicConfig.WORK_getCaptcha,"获取验证码失败",response.body().asString()));
//
// //专用于自动化获取验证码
// params.clear();
// params.put("phoneNumber","18248405155");
// Response autoTestRes = network.getResponse(params,BasicConfig.WORK_verifyCode);
// String captcha = autoTestRes.jsonPath().getString("data");
// System.out.println(captcha);
//
// //登录接口
// ThreadSleepUtils.sleep(2000);
// params.clear();
// params.put("phoneNumber","18248405155");
// params.put("captcha",captcha);
// Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
// boolean success = loginRes.jsonPath().getBoolean("success");
// Assert.assertTrue(success, network.message(params,BasicConfig.WORK_login,"登录失败",loginRes.body().asString()));
//
// //获取cookie
// String header = loginRes.getHeader("Set-Cookie");
// String cookieStr = header.split(";")[0];
// String[] cookieKeyValue = cookieStr.split("=");
// otoSellerCookieKey = cookieKeyValue[0];
// otoSellerCookieValue = cookieKeyValue[1];
otoSellerCookieKey = "otoToken";
otoSellerCookieValue = "64e83LYGbaXYX9EkHumCho2UoH8aSt1iNbLHnmfaSV2jr8ETfxRuoJDrf1BZPbbs1Yk6aVV72S79rq975KDpb89MCUYK84cdTpu7j2k2tT9";
network.agentCookies.put(otoSellerCookieKey, otoSellerCookieValue); //存入cookies
System.out.println("销售Cookie中key:"+ otoSellerCookieKey +" ,values:"+ otoSellerCookieValue);
......@@ -439,39 +439,39 @@ public class BaseUtils {
* 总监登录销售工作台
*/
public static void otoLeaderLogin(){
ThreadSleepUtils.sleep(2000);
// 调用登录接口
Map<String, Object> params = new HashMap<String, Object>();
params.put("phoneNumber","13454131091");
Response response = network.getResponse(params,BasicConfig.WORK_getCaptcha);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_getCaptcha,"获取验证码失败",response.body().asString()));
//专用于自动化获取验证码
params.clear();
params.put("phoneNumber","13454131091");
Response autoTestRes = network.getResponse(params,BasicConfig.WORK_verifyCode);
String captcha = autoTestRes.jsonPath().getString("data");
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phoneNumber","13454131091");
params.put("captcha",captcha);
Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
boolean success = loginRes.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params,BasicConfig.WORK_login,"登录失败",loginRes.body().asString()));
//获取cookie
String header = loginRes.getHeader("Set-Cookie");
String cookieStr = header.split(";")[0];
String[] cookieKeyValue = cookieStr.split("=");
otoLeaderCookieKey = cookieKeyValue[0];
otoLeaderCookieValue = cookieKeyValue[1];
// otoLeaderCookieKey = "otoToken";
// otoLeaderCookieValue = "64e83LYGbaXYX9EkHumCho2Um1H6zBcWhBxmWqfu76gC91GAkfnauguistbDFNVTyYSWjjEpQURiMofMzYTYYbBWC2BA95ZJBjKDaspWvRE";
// ThreadSleepUtils.sleep(2000);
// // 调用登录接口
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("phoneNumber","13454131091");
// Response response = network.getResponse(params,BasicConfig.WORK_getCaptcha);
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(params,BasicConfig.WORK_getCaptcha,"获取验证码失败",response.body().asString()));
//
// //专用于自动化获取验证码
// params.clear();
// params.put("phoneNumber","13454131091");
// Response autoTestRes = network.getResponse(params,BasicConfig.WORK_verifyCode);
// String captcha = autoTestRes.jsonPath().getString("data");
// System.out.println(captcha);
//
// //登录接口
// ThreadSleepUtils.sleep(2000);
// params.clear();
// params.put("phoneNumber","13454131091");
// params.put("captcha",captcha);
// Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
// boolean success = loginRes.jsonPath().getBoolean("success");
// Assert.assertTrue(success, network.message(params,BasicConfig.WORK_login,"登录失败",loginRes.body().asString()));
//
// //获取cookie
// String header = loginRes.getHeader("Set-Cookie");
// String cookieStr = header.split(";")[0];
// String[] cookieKeyValue = cookieStr.split("=");
// otoLeaderCookieKey = cookieKeyValue[0];
// otoLeaderCookieValue = cookieKeyValue[1];
otoLeaderCookieKey = "otoToken";
otoLeaderCookieValue = "64e83LYGbaXYX9EkHumCho2UoH8aSt1h9XNrE7BVfevqad7zFZkGt5R98Bi4R5Ri6TjQisprFL8kUvtkrzcokSzMXukDGMSkcfr6UzHxPJU";
network.agentCookies.put(otoLeaderCookieKey, otoLeaderCookieValue); //存入cookies
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