Commit 8cad5c6d authored by 龚小红's avatar 龚小红

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

增加销售工作台手机端的测试用例

See merge request test-group/kejiji!246
parents 4ff158ed 920e118e
......@@ -43,7 +43,7 @@ public interface Authorization {
default void otoLeaderAuth() {
network.agentCookies.put(otoLeaderCookieKey, otoLeaderCookieValue);
}
//oto销售工作台-总监
//oto销售工作台手机端-销售
default void otoSellerTku() {
network.agentCookies.put("tku", OTO_TKU);
}
......
package com.kjj.cases.otoseller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.sql.KjyLiveNormalDB;
import com.kjj.sql.KjyUserDB;
import com.kjj.sql.UserSqlFactory;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.ThreadSleepUtils.sleep;
//手机端
public class Phone implements Authorization {
private static final NetworkUtils network = NetworkUtils.getInstance();
private String cust_id;
private String cust_id;//加密的客户ID
private String custName;
private String introduceCustomer_id;
private String myselfCustomer_id;
private String interviewId;
private ArrayList ids;
private ArrayList<String> interviewIds;
@BeforeTest
public void setUp(){
//登录销售工作台手机端
otoSellerTku();
ids = new ArrayList<>();
interviewIds = new ArrayList<>();
}
@Test(description = "查看我的客户",priority = 1)
......@@ -34,21 +46,9 @@ public class Phone implements Authorization {
Response response = network.getResponse(params, BasicConfig.PHONE_customerList);
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.myCustomerVos[0].id");
custName = response.jsonPath().getString("data.myCustomerVos[0].custName");
}
@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.customerInterviewVos.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
}
@Test(description = "不可创建重复手机号的客户",priority = 3)
@Test(description = "不可创建重复手机号的客户",priority = 2)
public void 不可创建重复手机号的客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "重复客户");
......@@ -59,7 +59,7 @@ public class Phone implements Authorization {
Assert.assertFalse(success,network.message(params,BasicConfig.PHONE_customerSave,"手机号重复创建客户成功",response.body().asString()));
}
@Test(description = "创建缘故客户",priority = 4)
@Test(description = "创建缘故客户",priority = 3)
public void 创建缘故客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化缘故客户");
......@@ -70,7 +70,7 @@ public class Phone implements Authorization {
Assert.assertNotNull(myselfCustomer_id,network.message(params,BasicConfig.PHONE_customerSave,"创建缘故客户失败",response.body().asString()));
}
@Test(description = "创建转介绍客户",priority = 5)
@Test(description = "创建转介绍客户",priority = 4)
public void 创建转介绍客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化转介绍客户");
......@@ -82,8 +82,21 @@ public class Phone implements Authorization {
Assert.assertNotNull(introduceCustomer_id,network.message(params,BasicConfig.PHONE_customerSave,"创建转介绍客户失败",response.body().asString()));
}
@Test(description = "姓名搜索客户",priority = 6)
@Test(description = "姓名搜索客户",priority = 5)
public void 姓名搜索客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化测试用户");
params.put("pageSize", "20");
Response response = network.getResponse(params, BasicConfig.PHONE_customerList);
int size = response.jsonPath().getInt("data.myCustomerVos.size()");
Assert.assertEquals(size,1,network.message(params,BasicConfig.PHONE_customerList,"查找不到该客户",response.body().asString()));
cust_id = response.jsonPath().getString("data.myCustomerVos[0].id");
custName = response.jsonPath().getString("data.myCustomerVos[0].custName");
}
@Test(description = "姓名模糊关联客户",priority = 6)
public void 姓名模糊查找客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化");
Response response = network.getResponse(params, BasicConfig.PHONE_fuzzyList);
......@@ -91,73 +104,238 @@ public class Phone implements Authorization {
Assert.assertTrue(size>0,network.message(params,BasicConfig.PHONE_fuzzyList,"创建缘故客户失败",response.body().asString()));
}
@Test(description = "创建普通面访并关联转介绍和缘故客户",priority = 7)
public void 创建普通面访并关联转介绍和缘故客户(){
@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);
ids = new ArrayList();
ids.add(cust_id);
ids.add(myselfCustomer_id);
ids.add(introduceCustomer_id);
params.put("custIds", ids);
params.put("interviewType", 2);
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()));
int size = response.jsonPath().getJsonObject("data.size()");
Assert.assertEquals(size,3,network.message(params,BasicConfig.PHONE_interviewSave,"创建普通面访失败",response.body().asString()));
interviewIds.add(response.jsonPath().getString("data[0]"));
interviewIds.add(response.jsonPath().getString("data[1]"));
interviewIds.add(response.jsonPath().getString("data[2]"));
}
@Test(description = "已存在未结束的普通面访后创建普通面访失败",priority = 1)
public void 已存在未结束的普通面访后创建普通面访失败(){
@Test(description = "查询面访二维码",priority = 8)
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()));
params.put("ids", interviewIds.get(0)+","+interviewIds.get(1)+","+interviewIds.get(2));
Response response = network.getResponse(params, BasicConfig.PHONE_interviewCode);
int size = response.jsonPath().getInt("data.size()");
int statusCount = response.jsonPath().getInt("data.findAll{it.interviewStatus == 1}.size()");
Assert.assertEquals(size,3,network.message(params,BasicConfig.PHONE_interviewCode,"面访码数量错误",response.body().asString()));
Assert.assertEquals(statusCount,3,network.message(params,BasicConfig.PHONE_interviewCode,"面访码数量错误",response.body().asString()));
}
@Test(description = "创建社区面访并关联转介绍和缘故客户",priority = 1)
public void 创建社区面访并关联转介绍和缘故客户(){
@Test(description = "已存在未结束的普通面访后创建普通面访失败",priority = 9)
public void 已存在未结束的社区面访后创建社区面访失败(){
HashMap<String,Object> params = new HashMap<>();
params.put("custIds", cust_id+","+myselfCustomer_id+","+introduceCustomer_id);
params.put("custIds", ids);
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]");
Assert.assertFalse(success,network.message(params,BasicConfig.PHONE_interviewSave,"存在未结束普通面访时创建普通面访成功",response.body().asString()));
}
@Test(description = "查询面访详情",priority = 1)
@Test(description = "查询面访详情",priority = 10)
public void 查询面访详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("custIds", cust_id);
params.put("custId", cust_id);
params.put("interviewType", 2);
Response response = network.getResponse(params, BasicConfig.PHONE_interviewSave);
Response response = network.getResponse(params, BasicConfig.PHONE_appointmentDetail);
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]");
String id = response.jsonPath().getString("data.id");
Assert.assertEquals(customerName,custName,network.message(params,BasicConfig.PHONE_appointmentDetail,"查询面访详情的客户姓名错误",response.body().asString()));
Assert.assertEquals(id, interviewIds.get(0),network.message(params,BasicConfig.PHONE_appointmentDetail,"查询面访详情的id错误",response.body().asString()));
}
@Test(description = "修改面访时间",priority = 1)
@Test(description = "修改面访时间",priority = 11)
public void 修改面访时间(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", interviewId);
params.put("id", interviewIds.get(0));
params.put("appointmentTime", System.currentTimeMillis()+7200000);
Response response = network.getResponse(params, BasicConfig.PHONE_interviewSave);
Response response = network.postResponse(params, BasicConfig.PHONE_interviewUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_interviewSave,"修改社区时间失败",response.body().asString()));
interviewId = response.jsonPath().getString("data[0]");
Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_interviewUpdate,"修改社区时间失败",response.body().asString()));
}
// @Test(description = "客户扫码进行评价",priority = 12)
// public void 客户扫码进行评价() throws SQLException {
// userTku();
// Map<String, Object> result = KjyLiveNormalDB.getInstance().findSimpleResult(UserSqlFactory.selectCodeIdByCustomerId, IdMakeUtil.decodingId(cust_id));
// Object scanCodeId = result.get("scan_code_id");
//
// HashMap<String,Object> params = new HashMap<>();
// params.put("scanCodeId", scanCodeId);
// params.put("scanCodeType", 1047);
// params.put("evaluateDetail", "[2]");
// Response response = network.getResponse(params, BasicConfig.PHONE_submitEvaluate);
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_submitEvaluate,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售查询面访状态",priority = 13)
// public void 销售查询面访状态() {
// sleep(2000);
// otoSellerTku();
//
// HashMap<String,Object> params = new HashMap<>();
// params.put("latitude", 30.287816);
// params.put("longitude", 120.111991);
// params.put("id", IdMakeUtil.decodingId(interviewIds.get(0)));
// Response response = network.postResponse(params, BasicConfig.PHONE_interviewStatus);
// int interviewStatus = response.jsonPath().getInt("data.interviewStatus");
// boolean isMatching = response.jsonPath().getBoolean("data.isMatching");
// Assert.assertEquals(interviewStatus,2,network.message(params,BasicConfig.PHONE_interviewStatus,"扫码评价失败",response.body().asString()));
// Assert.assertFalse(isMatching,network.message(params,BasicConfig.PHONE_interviewStatus,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售查询客户授权手机号",priority = 14)
// public void 销售查询客户授权手机号() {
// HashMap<String,Object> params = new HashMap<>();
// params.put("id", interviewIds.get(0));
// Response response = network.getResponse(params, BasicConfig.PHONE_interviewPhone);
// String authPhone = response.jsonPath().getString("data.authPhone");
// boolean isMatching = response.jsonPath().getBoolean("data.isMatching");
// Assert.assertNotNull(authPhone,network.message(params,BasicConfig.PHONE_interviewPhone,"扫码评价失败",response.body().asString()));
// Assert.assertFalse(isMatching,network.message(params,BasicConfig.PHONE_interviewPhone,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售取消关联手机号",priority = 15)
// public void 销售取消关联手机号() {
// HashMap<String,Object> params = new HashMap<>();
// params.put("id", IdMakeUtil.decodingId(interviewIds.get(0)));
// Response response = network.postResponse(params, BasicConfig.PHONE_interviewCancel);
// String authPhone = response.jsonPath().getString("data.authPhone");
// boolean isMatching = response.jsonPath().getBoolean("data.isMatching");
// Assert.assertNotNull(authPhone,network.message(params,BasicConfig.PHONE_interviewCancel,"扫码评价失败",response.body().asString()));
// Assert.assertFalse(isMatching,network.message(params,BasicConfig.PHONE_interviewCancel,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售再次查询面访状态",priority = 16)
// public void 销售再次查询面访状态() {
// sleep(2000);
// otoSellerTku();
//
// HashMap<String,Object> params = new HashMap<>();
// params.put("latitude", 30.287816);
// params.put("longitude", 120.111991);
// params.put("id", IdMakeUtil.decodingId(interviewIds.get(0)));
// Response response = network.postResponse(params, BasicConfig.PHONE_interviewStatus);
// int interviewStatus = response.jsonPath().getInt("data.interviewStatus");
// Assert.assertEquals(interviewStatus,1,network.message(params,BasicConfig.PHONE_interviewStatus,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "客户重新扫码进行评价",priority = 17)
// public void 客户重新扫码进行评价() throws SQLException {
// userTku();
// Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectCodeIdByCustomerId, IdMakeUtil.decodingId(cust_id));
// Object scanCodeId = result.get("scan_code_id");
//
// HashMap<String,Object> params = new HashMap<>();
// params.put("scanCodeId", scanCodeId);
// params.put("scanCodeType", 1047);
// params.put("evaluateDetail", "[2]");
// Response response = network.postResponse(params, BasicConfig.PHONE_submitEvaluate);
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_submitEvaluate,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售查询更新面访状态",priority = 18)
// public void 销售查询更新面访状态() {
// sleep(2000);
// otoSellerTku();
//
// HashMap<String,Object> params = new HashMap<>();
// params.put("latitude", 30.287816);
// params.put("longitude", 120.111991);
// params.put("id", IdMakeUtil.decodingId(interviewIds.get(0)));
// Response response = network.postResponse(params, BasicConfig.PHONE_interviewStatus);
// int interviewStatus = response.jsonPath().getInt("data.interviewStatus");
// Assert.assertEquals(interviewStatus,2,network.message(params,BasicConfig.PHONE_interviewStatus,"扫码评价失败",response.body().asString()));
// }
//
// @Test(description = "销售确定关联手机号",priority = 19)
// public void 销售确定关联手机号() {
// HashMap<String,Object> params = new HashMap<>();
// params.put("id", interviewIds.get(0));
// Response response = network.postResponse(params, BasicConfig.PHONE_interviewBind);
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(params,BasicConfig.PHONE_interviewBind,"确定关联失败",response.body().asString()));
// }
//
// @Test(description = "查看我的面访",priority = 20)
// public void 查看我的面访(){
// HashMap<String,Object> params = new HashMap<>();
// params.put("pageSize", "自动化测试用户");
// params.put("pageSize", "20");
// Response response = network.getResponse(params, BasicConfig.PHONE_interviewList);
// int size = response.jsonPath().getInt("data.customerInterviewVos.size()");
// int interviewStatus = response.jsonPath().getInt("data.customerInterviewVos[0].interviewStatus");
// Assert.assertEquals(size,1,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
// Assert.assertEquals(interviewStatus,3,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
// }
//
// @Test(description = "查询面访回填信息",priority = 21)
// public void 查询面访回填信息(){
// HashMap<String,Object> params = new HashMap<>();
// params.put("id", interviewIds.get(0));
// Response response = network.getResponse(params, BasicConfig.PHONE_custExtDetail);
// String interviewAddress = response.jsonPath().getString("data.interviewAddress");
// int commitPlanFlag = response.jsonPath().getInt("data.commitPlanFlag");
// Assert.assertNotNull(interviewAddress,network.message(params,BasicConfig.PHONE_custExtDetail,"面访列表为空",response.body().asString()));
// Assert.assertEquals(commitPlanFlag,0,network.message(params,BasicConfig.PHONE_custExtDetail,"面访列表为空",response.body().asString()));
// }
//
// @Test(description = "上传面访详情",priority = 22)
// public void 上传面访详情(){
// HashMap<String,Object> params = new HashMap<>();
// params.put("id", interviewIds.get(0));
// params.put("interviewRemark", "第一次社区参观");
// params.put("coreMaker", 2);
// params.put("followWeight", 1);
// params.put("commitPlanFlag", 0);
// Response response = network.getResponse(params, BasicConfig.PHONE_interviewList);
// int size = response.jsonPath().getInt("data.customerInterviewVos.size()");
// int interviewStatus = response.jsonPath().getInt("data.customerInterviewVos[0].interviewStatus");
// Assert.assertEquals(size,1,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
// Assert.assertEquals(interviewStatus,3,network.message(params,BasicConfig.PHONE_interviewList,"面访列表为空",response.body().asString()));
// }
//
//
//
@Test(description = "删除客户",priority = 79)
public void 删除客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", IdMakeUtil.decodingId(cust_id));
Response response = network.postResponse(params,BasicConfig.WORK_delCust);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_delCust,"删除客户失败",response.body().asString()));
params.put("custId", IdMakeUtil.decodingId(introduceCustomer_id));
response = network.postResponse(params,BasicConfig.WORK_delCust);
data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_delCust,"删除客户失败",response.body().asString()));
params.put("custId", IdMakeUtil.decodingId(myselfCustomer_id));
response = network.postResponse(params,BasicConfig.WORK_delCust);
data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_delCust,"删除客户失败",response.body().asString()));
}
@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()));
}
}
......@@ -24,7 +24,6 @@ public class Work implements Authorization {
public int tagId; //标签ID
public int custId; //客户ID
public int collectCustId = 2801; //客户ID
public String name; //客户手机号
public String phone; //客户手机号
public int followTimes; //跟进次数
public static Map<String,Integer> header;
......@@ -36,9 +35,6 @@ public class Work implements Authorization {
otoSellerLogin();
otoLeaderLogin();
ssoLogin();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
name = "自动化用户"+sdf.format(date);
}
@Test(description = "公域引流_创建标签",priority = 1)
......@@ -90,7 +86,7 @@ public class Work implements Authorization {
params.put("formId", "Kj20ODA3");
params.put("phoneNum", phone);
params.put("urlLink", "https://kjj-static.duibatest.com.cn/cpic-home/202111261430?formId=Kj20ODA3&channel=bd&agent=x");
params.put("username", name);
params.put("username", "自动化测试用户");
params.put("uuid", "622d83e4-ca21-4ccd-94cb-182c0f2a6b60");
Response response = network.postResponse(params,BasicConfig.FORM_submit);
String recordId = response.jsonPath().getString("data.recordId");
......@@ -118,7 +114,7 @@ public class Work implements Authorization {
int totalCount = response.jsonPath().getInt("data.totalCount");
Assert.assertTrue(totalCount == 1,network.message(params,BasicConfig.MANAGER_oto_customerList,"未查找到该客户",response.body().asString()));
String custName = response.jsonPath().getString("data.list[0].custName");
Assert.assertEquals(custName,name,network.message(params,BasicConfig.MANAGER_oto_customerList,"未查找到该客户",response.body().asString()));
Assert.assertEquals(custName,"自动化测试用户",network.message(params,BasicConfig.MANAGER_oto_customerList,"未查找到该客户",response.body().asString()));
custId = response.jsonPath().getInt("data.list[0].id");
}
......@@ -163,23 +159,25 @@ public class Work implements Authorization {
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int unMeetNum = response.jsonPath().getInt("data.unMeetNum");
int unRedialNum = response.jsonPath().getInt("data.unRedialNum");
int willRecycleCustNum = response.jsonPath().getInt("data.willRecycleCustNum");
header.put("starNum",starNum);
header.put("totalNum",totalNum);
header.put("unContactNum",unContactNum);
header.put("unMeetNum",unMeetNum);
header.put("unRedialNum",unRedialNum);
header.put("willRecycleCustNum",willRecycleCustNum);
}
@Test(description = "客户跟进分类_表格总览",priority = 10)
public void 客户跟进分类_表格总览(){
@Test(description = "客户流程组_表格总览",priority = 10)
public void 客户流程组_表格总览(){
Response response = network.getResponse(BasicConfig.WORK_staticChart);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(BasicConfig.WORK_staticChart,"跟进表格数量为空",response.body().asString()));
chart.put("needContact",response.jsonPath().getInt("data[0].custNum"));
chart.put("needMeet",response.jsonPath().getInt("data[1].custNum"));
chart.put("commitPlan",response.jsonPath().getInt("data[2].custNum"));
chart.put("toFacilitate",response.jsonPath().getInt("data[3].custNum"));
chart.put("completedOrder",response.jsonPath().getInt("data[4].custNum"));
Assert.assertNotNull(data,network.message(BasicConfig.WORK_staticChart,"流程组表格数量为空",response.body().asString()));
chart.put("ondStep",response.jsonPath().getInt("data[0].custNum"));
chart.put("twoStep",response.jsonPath().getInt("data[1].custNum"));
chart.put("threeStep",response.jsonPath().getInt("data[2].custNum"));
chart.put("fourStep",response.jsonPath().getInt("data[3].custNum"));
chart.put("fiveStep",response.jsonPath().getInt("data[4].custNum"));
}
@Test(description = "工作台_标签列表",priority = 11)
......@@ -247,8 +245,14 @@ public class Work implements Authorization {
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_detail);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_detail,"详细信息为空",response.body().asString()));
int custFlow = response.jsonPath().getInt("data.custInfo.custFlow");
int commitInsure = response.jsonPath().getInt("data.custInfo.commitInsure");
int commitPlanFlag = response.jsonPath().getInt("data.custInfo.commitPlanFlag");
Assert.assertEquals(custFlow,0,network.message(params,BasicConfig.WORK_detail,"新客户流程组状态错误非0",response.body().asString()));
Assert.assertEquals(commitInsure,0,network.message(params,BasicConfig.WORK_detail,"新客户提交计划书状态错误非0",response.body().asString()));
Assert.assertEquals(commitPlanFlag,0,network.message(params,BasicConfig.WORK_detail,"新客户投保要素确认状态错误非0",response.body().asString()));
}
@Test(description = "查询客户电话表单回填状态",priority = 17)
......@@ -398,7 +402,7 @@ public class Work implements Authorization {
params.put("insPeriod", 20);
params.put("custArea", "北京-北京市");
params.put("custDescription", "客户的备注");
params.put("custName", name);
params.put("custName", "自动化测试用户");
params.put("dealFlag", 1);
params.put("forWho", array);
params.put("retireMoney", 0);
......@@ -637,6 +641,12 @@ public class Work implements Authorization {
Response logRes = network.getResponse(params,BasicConfig.WORK_operation);
int logSize = logRes.jsonPath().getInt("data.list.size()");
Assert.assertTrue(logSize>0,network.message(BasicConfig.WORK_operation,"客户动态隔离失败",logRes.body().asString()));
//还原
params.clear();
params.put("customerId",custId);
params.put("sellerId",SELLER_ID);
response = network.postResponse(params,BasicConfig.MANAGER_oto_assignSeller);
}
@Test(description = "关闭总监的新客户认领权限和回收客户认领权限",priority = 59)
......@@ -716,20 +726,4 @@ public class Work implements Authorization {
Assert.assertTrue(data,network.message(BasicConfig.WORK_cancelSchedule,"取消日程失败",response.body().asString()));
}
@Test(description = "删除客户",priority = 79)
public void 删除客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_delCust);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_delCust,"删除客户失败",response.body().asString()));
}
@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()));
}
}
......@@ -1337,7 +1337,7 @@ public class BasicConfig {
public static final String FORM_submit = FORM_HOST + "/kjy/live/pub/form/user/submit";
public static final String FORM_submitQuestion = FORM_HOST + "/kjy/live/pub/form/question/submit";
public static final String WORK_staticHeader = WORK_HOST + "/kjy/oto/manager/customer/statistic/header";
public static final String WORK_staticChart = WORK_HOST + "/kjy/oto/manager/customer/statistic/chart";
public static final String WORK_staticChart = WORK_HOST + "/kjy/oto/manager/customer/statistic/custFlowChart";
public static final String WORK_notifyList = WORK_HOST + "/kjy/oto/manager/customer/notify/list";
public static final String WORK_tagList = WORK_HOST + "/kjy/oto/manager/tag/list";
public static final String WORK_customerList = WORK_HOST + "/kjy/oto/manager/customer/list";
......@@ -1371,7 +1371,7 @@ public class BasicConfig {
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_customerSave = PHONE_HOST + "/kjy/oto/manager/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";
......
package com.kjj.sql;
import java.sql.*;
import java.util.*;
public class KjyLiveNormalDB {
private static KjyLiveNormalDB user_Utils;
//数据库用户名
private String USERNAME = "auto_test";
//数据库密码
private String PASSWORD = "881QYHoGGgc09Ngv"; //= "yanzi";
//驱动信息
private String DRIVER="com.mysql.cj.jdbc.Driver";
//数据库地址
private String USER_URL="jdbc:mysql://rm-bp11mkg584kvjr485.mysql.rds.aliyuncs.com:3306/kjy_live_normal";
private Connection connection;
private PreparedStatement pstmt;
private ResultSet resultSet;
public static synchronized KjyLiveNormalDB getInstance(){
if (Objects.nonNull(user_Utils)){
return user_Utils;
}
user_Utils = new KjyLiveNormalDB();
user_Utils.initConnection();
return user_Utils;
}
/**
* 获得数据库的连接
* @return
*/
private Connection initConnection(){
try {
try {
Class.forName(DRIVER);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
String url = USER_URL+"?autoReconnect=true&testOnBorrow=true&testWhileIdle=true";
connection = DriverManager.getConnection(url,USERNAME,PASSWORD);
System.out.println("数据库连接成功!");
} catch (SQLException e) {
e.printStackTrace();
}
return connection;
}
/**
* 查询结果只有一行数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return map
* @throws SQLException
*/
public Map<String, Object> findSimpleResult(String sql, Object ...params) throws SQLException{
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
initConnection();
}
Map<String, Object> map = new HashMap<String, Object>();
int index = 1;
pstmt = connection.prepareStatement(sql);
if(params != null && !(params.length==0)){
for(int i=0; i<params.length; i++){
pstmt.setObject(index++, params[i]);
}
}
System.out.println("sql:"+pstmt.toString());
resultSet = pstmt.executeQuery();//返回查询结果
ResultSetMetaData metaData = resultSet.getMetaData();
int col_len = metaData.getColumnCount();
while(resultSet.next()){
for(int i=0; i<col_len; i++ ){
String cols_name = metaData.getColumnName(i+1);
Object cols_value = resultSet.getObject(cols_name);
if(cols_value == null){
cols_value = "";
}
map.put(cols_name, cols_value);
}
}
return map;
}
/**
* 返回多条数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return list
* @throws SQLException
*/
public List<Map<String, Object>> findModeResult(String sql, Object ...params) throws SQLException{
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
initConnection();
}
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
int index = 1;
pstmt = connection.prepareStatement(sql);
if(params != null && !(params.length==0)){
for(int i=0; i<params.length; i++){
pstmt.setObject(index++, params[i]);
}
}
resultSet = pstmt.executeQuery();
ResultSetMetaData metaData = resultSet.getMetaData();
int cols_len = metaData.getColumnCount();
while(resultSet.next()){
Map<String, Object> map = new HashMap<String, Object>();
for(int i=0; i<cols_len; i++){
String cols_name = metaData.getColumnName(i+1);
Object cols_value = resultSet.getObject(cols_name);
if(cols_value == null){
cols_value = "";
}
map.put(cols_name, cols_value);
}
list.add(map);
}
return list;
}
/**
* 执行更新语句
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return void
* @throws SQLException
*/
public void updataSql(String sql, Object ...params) throws SQLException{
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
initConnection();
}
Map<String, Object> map = new HashMap<String, Object>();
int index = 1;
pstmt = connection.prepareStatement(sql);
if(params != null && !(params.length==0)){
for(int i=0; i<params.length; i++){
pstmt.setObject(index++, params[i]);
}
}
System.out.println("sql:"+pstmt.toString());
pstmt.executeUpdate();//返回更新结果
}
/**
* 释放数据库连接
*/
public void releaseConn(){
if(resultSet != null){
try{
resultSet.close();
}catch(SQLException e){
e.printStackTrace();
}
}
}
}
......@@ -9,4 +9,5 @@ public class UserSqlFactory {
public static final String selectUserIdForJmeter = "SELECT a.`id` FROM `tb_live_user` a, `tb_users` b ,`tb_users_wx_ext` c WHERE a.`biz_user_id` = b.`id` and b.`id` = c.`user_id` and b.`union_id` NOT LIKE \"-d%\" AND c.`open_id` IS NOT NULL and c.`oa_id` = 14";
public static final String selectCodeIdByCustomerId = "SELECT `scan_code_id` FROM `tb_cust_interview_record` WHERE `customer_id` = ?";
}
......@@ -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 = "64e83LYGbaXYX9EkHumCho2UoH8aSt1iNbLHnmfaSV2jr8ETfxRuoJDrf1BZPbbs1Yk6aVV72S79rq975KDpb89MCUYK84cdTpu7j2k2tT9";
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 = "64e83LYGbaXYX9EkHumCho2UoH8aSt1h9XNrE7BVfevqad7zFZkGt5R98Bi4R5Ri6TjQisprFL8kUvtkrzcokSzMXukDGMSkcfr6UzHxPJU";
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);
......
......@@ -32,9 +32,9 @@ public class JmeterAccountFile {
public static void otoCookieMaker() {
OtoTokenCookie otoTokenCookie = new OtoTokenCookie();
otoTokenCookie.setExpiredTime(System.currentTimeMillis() + 86400*1000*150L);
otoTokenCookie.setPhoneNumber("13454131091");
otoTokenCookie.setPhoneNumber("15869195130");
otoTokenCookie.setLoginId(IdMakeUtil.encodingId(43L, IdConvertBase64Enum.DEF));
otoTokenCookie.setLoginId(IdMakeUtil.encodingId(46L, IdConvertBase64Enum.DEF));
String json = JSON.toJSONString(otoTokenCookie);
String otoToken = BlowfishUtils.encryptBlowfish(json,"02a16fs1b6a3");
......
......@@ -6,12 +6,18 @@
<class name="com.kjj.cases.otoseller.Manager"/>
</classes>
</test>
<test preserve-order="true" name="销售工作台">
<test preserve-order="true" name="销售工作台PC端">
<classes>
<class name="com.kjj.cases.otoseller.Work"/>
</classes>
</test>
<test preserve-order="true" name="销售工作台手机端">
<classes>
<class name="com.kjj.cases.otoseller.Phone"/>
</classes>
</test>
</suite>
<!-- Suite -->
......
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