Commit 920e118e authored by 龚小红's avatar 龚小红

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

parent 6936e28a
......@@ -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);
}
......
......@@ -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