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

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

保险OTO项目

See merge request test-group/kejiji!221
parents efff1a87 6cdc58d0
......@@ -10,6 +10,12 @@
</classes>
</test>
<test preserve-order="true" name="配置秒杀轮次及秒杀预告">
<classes>
<class name="com.kjj.cases.live.secondKill.ConfSecondKill"/>
</classes>
</test>
<test preserve-order="true" name="绑定关系绑定">
<classes>
<class name="com.kjj.cases.live.liveConfig.LiveBinding"/>
......@@ -21,23 +27,16 @@
<class name="com.kjj.cases.live.anchor.OpenLive"/>
</classes>
</test>
<test preserve-order="true" name="访客签到">
<!-- 仅用于自测-->
<test preserve-order="true" name="秒杀到场">
<classes>
<class name="com.kjj.cases.live.lotteryCode.SignIn"/>
<class name="com.kjj.cases.live.liveConfig.ConnectLive"/>
</classes>
</test>
<!-- 仅用于自测 -->
<!-- <test preserve-order="true" name="秒杀到场">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.liveConfig.ConnectLive"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="红包领取">
<test preserve-order="true" name="秒杀互动">
<classes>
<class name="com.kjj.cases.live.red.LiveVistorRed"/>
<class name="com.kjj.cases.live.secondKill.SecondKill"/>
</classes>
</test>
......
......@@ -34,6 +34,11 @@ public interface Authorization {
network.agentCookies.put(officeCookieKey,officeCookieValue);
}
//oto后台销售
default void otosellerAuth() {
network.agentCookies.put(otoCookieKey, otoCookieValue);
}
/**
* 集客助手相关授权
......
......@@ -8,528 +8,74 @@ import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.utils.BaseUtils.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
public class Manager {
private static final NetworkUtils network = NetworkUtils.getInstance();
public int tagId; //标签ID
public int custId; //客户ID
public String name; //客户手机号
public String phone; //客户手机号
public int followTimes; //跟进次数
public static Map<String,Integer> header;
public static Map<String,Integer> chart;
private int sellerId;
@BeforeTest
public void setUp(){
ssoLogin();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
name = "自动化用户"+sdf.format(date);
}
@Test(description = "公域引流_创建标签",priority = 1)
public void 公域引流_创建标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("tagName", "勿动-自动化测试标签");
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_saveTag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_saveTag,"创建标签失败",response.body().asString()));
//创建名称相同的标签失败
response = network.postResponse(params,BasicConfig.MANAGER_oto_saveTag);
data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data,network.message(params,BasicConfig.MANAGER_oto_saveTag,"创建同名的标签成功",response.body().asString()));
}
@Test(description = "公域引流_查看标签列表",priority = 2)
public void 公域引流_查看标签列表(){
@Test(description = "查看销售列表",priority = 1)
public void 查看销售列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_tagList);
params.put("pageIndex", "1");
params.put("pageSize", "10");
Response response = network.getResponse(params, BasicConfig.MANAGER_oto_sellerList);
int size = response.jsonPath().getInt("data.list.size()");
String tagName = response.jsonPath().getString("data.list[0].tagName");
int customerCount = response.jsonPath().getInt("data.list[0].customerCount");
int tagStatus = response.jsonPath().getInt("data.list[0].tagStatus");
Assert.assertTrue(size>0 ,network.message(BasicConfig.MANAGER_oto_tagList,"标签列表为空",response.body().asString()));
Assert.assertEquals(tagName ,"勿动-自动化测试标签",network.message(params,BasicConfig.MANAGER_oto_tagList,"标签名称错误",response.body().asString()));
Assert.assertEquals(customerCount ,0,network.message(params,BasicConfig.MANAGER_oto_tagList,"新标签的客户数不为0",response.body().asString()));
Assert.assertEquals(tagStatus ,1,network.message(params,BasicConfig.MANAGER_oto_tagList,"新标签的状态不为打开",response.body().asString()));
tagId = response.jsonPath().getInt("data.list[0].id");
Assert.assertTrue(size>0,network.message(params,BasicConfig.MANAGER_oto_sellerList,"销售列表为空",response.body().asString()));
}
@Test(description = "公域引流_修改标签",priority = 3)
public void 公域引流_修改标签(){
@Test(description = "通过销售名称查找销售",priority = 2)
public void 通过销售名称查找销售(){
HashMap<String,Object> params = new HashMap<>();
params.put("tagName", "勿动-自动化更新标签");
params.put("id", tagId);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_updateTag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateTag,"修改标签失败",response.body().asString()));
}
@Test(description = "公域引流_填写表单",priority = 4)
public void 公域引流_填写表单(){
HashMap<String,Object> params = new HashMap<>();
String str= String.valueOf(System.currentTimeMillis());
phone = "130"+str.substring(str.length()-8,str.length());
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("uuid", "622d83e4-ca21-4ccd-94cb-182c0f2a6b60");
Response response = network.postResponse(params,BasicConfig.FORM_submit);
String recordId = response.jsonPath().getString("data.recordId");
Assert.assertNotNull(recordId,network.message(params,BasicConfig.FORM_submit,"客户创建失败",response.body().asString()));
params.clear();
ArrayList<String> optionIds = new ArrayList<>();
optionIds.add("Kj21NTY1OTE");
params.put("optionIds", optionIds);
params.put("questionId", "Kj21MjQ5Njc");
params.put("recordId", recordId);
response = network.postResponse(params,BasicConfig.FORM_submit);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.FORM_submit,"客户填写表单失败",response.body().asString()));
}
@Test(description = "公域引流_查找客户",priority = 5)
public void 公域引流_查找客户(){
HashMap<String,Object> params = new HashMap<String,Object>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("phoneNum", phone);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_customerList);
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()));
custId = response.jsonPath().getInt("data.list[0].id");
}
@Test(description = "公域引流_分配客户",priority = 6)
public void 公域引流_分配客户(){
HashMap<String,Object> params = new HashMap<>();
String str= String.valueOf(System.currentTimeMillis());
params.put("customerId",custId);
params.put("sellerId", 22);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_assignSeller);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_assignSeller,"分配客户失败",response.body().asString()));
}
@Test(description = "工作台_销售信息",priority = 7)
public void 客户分类_销售信息(){
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()));
}
@Test(description = "工作台_通知栏",priority = 8)
public void 工作台_通知栏(){
Response response = network.getResponse(BasicConfig.WORK_notifyList);
params.put("sellerName", "勿动-自动化测试销售");
Response response = network.getResponse(params, BasicConfig.MANAGER_oto_searchSeller);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,0,network.message(BasicConfig.WORK_notifyList,"通知栏不为空",response.body().asString()));
}
@Test(description = "客户分类_数量总览",priority = 9)
public void 客户分类_数量总览(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(BasicConfig.WORK_staticHeader,"数量总览数据为空",response.body().asString()));
header.put("starNum",response.jsonPath().getInt("data.starNum"));
header.put("totalNum",response.jsonPath().getInt("data.totalNum"));
header.put("unContactNum",response.jsonPath().getInt("data.unContactNum"));
header.put("unMeetNum",response.jsonPath().getInt("data.unMeetNum"));
header.put("unRedialNum",response.jsonPath().getInt("data.unRedialNum"));
}
@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"));
}
@Test(description = "工作台_标签列表",priority = 11)
public void 工作台_标签列表(){
Response response = network.getResponse(BasicConfig.WORK_tagList);
String tagName = response.jsonPath().getString("data.find{it.tagId =="+tagId+"].tagName");
Assert.assertEquals(tagName,"勿动-自动化测试标签",network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
}
@Test(description = "需要联系客户列表",priority = 12)
public void 需要联系客户列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("custClassifyType", 1);
Response response = network.getResponse(params,BasicConfig.WORK_customerList);
int customerId = response.jsonPath().getInt("data.list[0].custId");
Assert.assertEquals(customerId,custId,network.message(params,BasicConfig.WORK_customerList,"需要联系列表中首位客户非新增客户",response.body().asString()));
int custStar = response.jsonPath().getInt("data.list[0].custStar");
int followStatus = response.jsonPath().getInt("data.list[0].followStatus");
followTimes = response.jsonPath().getInt("data.list[0].followTimes");
Object custValue = response.jsonPath().getJsonObject("data.list[0].custValue");
Object lastFollowTime = response.jsonPath().getJsonObject("data.list[0].lastFollowTime");
Assert.assertEquals(custStar,0,network.message(params,BasicConfig.WORK_customerList,"新客户默认为星标客户",response.body().asString()));
Assert.assertEquals(followStatus,1,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进状态非需要联系状态",response.body().asString()));
Assert.assertEquals(followTimes,0,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进次数不为0",response.body().asString()));
Assert.assertNull(custValue,network.message(params,BasicConfig.WORK_customerList,"新客户的默认客户价值不为null",response.body().asString()));
Assert.assertNull(lastFollowTime,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进时间不为null",response.body().asString()));
}
@Test(description = "查询客户手机号",priority = 13)
public void 查询客户手机号(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_phone);
String data = response.jsonPath().getString("data");
Assert.assertEquals(data,phone,network.message(params,BasicConfig.WORK_phone,"手机号错误",response.body().asString()));
}
@Test(description = "查询新客户见面情况",priority = 14)
public void 查询新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.todayMeetFlag");
Assert.assertFalse(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为已见面",response.body().asString()));
Assert.assertFalse(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为已预约",response.body().asString()));
Assert.assertNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间不为空",response.body().asString()));
}
@Test(description = "查询新客户头部信息",priority = 15)
public void 查询新客户头部信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_header);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_header,"头部信息为空",response.body().asString()));
}
@Test(description = "查询新客户详细信息",priority = 16)
public void 查询新客户详细信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_detail);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_detail,"详细信息为空",response.body().asString()));
}
@Test(description = "查询客户电话表单回填状态",priority = 17)
public void 查询客户电话表单回填状态(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_showFeedback);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data,network.message(params,BasicConfig.WORK_showFeedback,"电话表单回填状态错误:为需要回填",response.body().asString()));
}
@Test(description = "查询省市列表",priority = 18)
public void 查询省市列表(){
Response response = network.getResponse(BasicConfig.WORK_regionCity);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(BasicConfig.WORK_regionCity,"省市列表为空",response.body().asString()));
}
@Test(description = "查询历史通话",priority = 19)
public void 查询历史通话(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("logDays", 1);
Response response = network.getResponse(params,BasicConfig.WORK_callLog);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_callLog,"历史通话为空",response.body().asString()));
}
@Test(description = "标记星标用户",priority = 20)
public void 标记星标用户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_star);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_star,"标记星标客户失败",response.body().asString()));
}
Assert.assertTrue(size>0,network.message(params,BasicConfig.MANAGER_oto_searchSeller,"查找结果为空",response.body().asString()));
@Test(description = "查询星标客户更新",priority = 21)
public void 查询星标客户更新(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int starNum = response.jsonPath().getInt("data.starNum");
Assert.assertEquals(unContactNum,header.get("unContactNum")-1,network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未减1",response.body().asString()));
Assert.assertEquals(starNum, header.get("starNum")+1,network.message(BasicConfig.WORK_staticHeader,"星标客户数量未加1",response.body().asString()));
sellerId = response.jsonPath().getInt("data[0].id");
}
@Test(description = "取消星标用户",priority = 22)
public void 取消星标用户(){
@Test(description = "修改销售信息",priority = 3)
public void 修改销售信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_star);
params.put("id", sellerId);
params.put("sellerName", "勿动-自动化更新销售");
params.put("phoneNumber", "17830855590");
params.put("roleType", 1);
params.put("callPermission", 1);
params.put("sellerStatus", 1);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_updateSeller);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data,network.message(params,BasicConfig.WORK_star,"标记星标客户失败",response.body().asString()));
Assert.assertTrue(data,network.message(params,BasicConfig.FORM_submit,"修改客户失败",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int starNum = response.jsonPath().getInt("data.starNum");
Assert.assertEquals(unContactNum, java.util.Optional.ofNullable(header.get("unContactNum")),network.message(BasicConfig.WORK_staticHeader,"星标客户数量未减1",response.body().asString()));
Assert.assertEquals(starNum, java.util.Optional.ofNullable(header.get("starNum")),network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未加1",response.body().asString()));
}
@Test(description = "修改客户价值",priority = 23)
public void 修改客户价值(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("custValue", 200);
Response response = network.postResponse(params,BasicConfig.WORK_assess);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_assess,"修改客户价值失败",response.body().asString()));
}
@Test(description = "修改客户跟进权重",priority = 24)
public void 修改客户跟进权重(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("followWeight", 1);
Response response = network.postResponse(params,BasicConfig.WORK_weight);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_weight,"修改客户跟进权重失败",response.body().asString()));
}
@Test(description = "修改客户标签",priority = 25)
public void 修改客户标签(){
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> tags = new ArrayList<>();
tags.add(tagId);
params.put("custId", custId);
params.put("tagIds", tags);
Response response = network.postResponse(params,BasicConfig.WORK_tag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_tag,"修改客户标签失败",response.body().asString()));
//查询信息更新
params.clear();
params.put("custId", custId);
response = network.postResponse(params,BasicConfig.WORK_detail);
int tagSize = response.jsonPath().getInt("data.custInfo.tagIds.size()");
Assert.assertEquals(tagSize,1,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
int tId = response.jsonPath().getInt("data.custInfo.tagIds[0]");
Assert.assertEquals(tId,tagId,network.message(params,BasicConfig.WORK_detail,"标签Id错误",response.body().asString()));
int custValue = response.jsonPath().getInt("data.custInfo.custValue");
Assert.assertEquals(custValue,200,network.message(params,BasicConfig.WORK_detail,"客户价值错误",response.body().asString()));
}
@Test(description = "修改标签状态为关闭",priority = 26)
public void 修改标签状态为关闭(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", tagId);
params.put("tagStatus", 0);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_switchStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data,network.message(params,BasicConfig.MANAGER_oto_switchStatus,"关闭标签显示失败",response.body().asString()));
}
@Test(description = "查询更新的标签列表和客户标签",priority = 27)
public void 查询更新的标签列表和客户标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_detail);
int tagSize = response.jsonPath().getInt("data.custInfo.tagIds.size()");
Assert.assertEquals(tagSize,0,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_tagList);
int size = response.jsonPath().getInt("data.findAll{it.tagId =="+tagId+"].size()");
Assert.assertEquals(size,0,network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
}
@Test(description = "修改标签状态为开启",priority = 28)
public void 修改标签状态为开启() {
HashMap<String, Object> params = new HashMap<>();
params.put("id", tagId);
params.put("tagStatus", 1);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_switchStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchStatus,"修改客户标签失败",response.body().asString()));
}
@Test(description = "删除客户标签",priority = 29)
public void 删除客户标签() {
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> tags = new ArrayList<>();
params.put("custId", custId);
params.put("tagIds", tags);
Response response = network.postResponse(params,BasicConfig.WORK_tag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_tag,"修改客户标签失败",response.body().asString()));
//校验还原
params.clear();
params.put("custId", custId);
response = network.postResponse(params,BasicConfig.WORK_detail);
int tagSize = response.jsonPath().getInt("data.custInfo.tagIds.size()");
Assert.assertEquals(tagSize,0,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_tagList);
int size = response.jsonPath().getInt("data.findAll{it.tagId =="+tagId+"].size()");
Assert.assertEquals(size,1,network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
}
@Test(description = "完成今日见面",priority = 30)
public void 完成今日见面(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("commitPlanFlag", 0);
params.put("custValue", 102);
params.put("followWeight", 2);
params.put("meetRemark", "今日见面的备注"+new Date());
Response response = network.postResponse(params,BasicConfig.WORK_meet);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_meet,"完成今日见面失败",response.body().asString()));
}
@Test(description = "客户状态见面为待计划",priority = 31)
public void 客户状态见面为待计划(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int unMeetNum = response.jsonPath().getInt("data.unMeetNum");
Assert.assertEquals(unContactNum,header.get("unContactNum")-1,network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未减1",response.body().asString()));
Assert.assertEquals(unMeetNum, java.util.Optional.ofNullable(header.get("unMeetNum")),network.message(BasicConfig.WORK_staticHeader,"需要约见客户数量变化",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_staticChart);
int needContact = response.jsonPath().getInt("data[0].custNum");
int needMeet = response.jsonPath().getInt("data[1].custNum");
int commitPlan = response.jsonPath().getInt("data[2].custNum");
Assert.assertEquals(needContact, chart.get("needContact")-1,network.message(BasicConfig.WORK_staticChart,"需要联系客户未减1",response.body().asString()));
Assert.assertEquals(needMeet, java.util.Optional.ofNullable(chart.get("needMeet")),network.message(BasicConfig.WORK_staticChart,"需要约见客户数量变化",response.body().asString()));
Assert.assertEquals(commitPlan, chart.get("commitPlan")+1,network.message(BasicConfig.WORK_staticChart,"要发计划书客户未加1",response.body().asString()));
}
@Test(description = "预约参观",priority = 32)
public void 预约参观(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("coreMaker", 1);
params.put("ideaAgree", 1);
params.put("insApplicant", 4);
params.put("insByApplicant", 4);
params.put("insMoney", 500);
params.put("insPeriod", 20);
params.put("orderVisitTime", System.currentTimeMillis()-86400000);
Response response = network.postResponse(params,BasicConfig.WORK_order);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_order,"完成今日见面失败",response.body().asString()));
}
@Test(description = "见面并预约后更新客户见面情况",priority = 33)
public void 见面并预约后更新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.todayMeetFlag");
Assert.assertTrue(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为未见面",response.body().asString()));
Assert.assertTrue(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为未预约",response.body().asString()));
Assert.assertNotNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间为空",response.body().asString()));
}
@Test(description = "上传参观详情",priority = 34)
public void 上传参观详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("commitPlanFlag", 1);
params.put("commitCustStatus", 1);
params.put("custValue", 201);
params.put("followWeight", 2);
params.put("visitRemark", "今日参观的备注"+new Date());
Response response = network.postResponse(params,BasicConfig.WORK_feedback);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_feedback,"上传参观详情失败失败",response.body().asString()));
}
@Test(description = "上传参观详情后更新客户见面情况",priority = 35)
public void 上传参观详情后更新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.todayMeetFlag");
Assert.assertTrue(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为未见面",response.body().asString()));
Assert.assertFalse(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为已预约",response.body().asString()));
Assert.assertNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间不为空",response.body().asString()));
}
HashMap<String,Object> selectParam = new HashMap<>();
selectParam.put("sellerName", "勿动-自动化更新销售");
selectParam.put("phoneNumber", "15136361301");
selectParam.put("pageIndex", "1");
selectParam.put("pageSize", "10");
response = network.getResponse(selectParam, BasicConfig.MANAGER_oto_sellerList);
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0,network.message(selectParam,BasicConfig.MANAGER_oto_sellerList,"查找结果为空",response.body().asString()));
@Test(description = "客户状态见面为待促成",priority = 36)
public void 客户状态见面为待促成(){
Response response = network.getResponse(BasicConfig.WORK_staticChart);
int commitPlan = response.jsonPath().getInt("data[2].custNum");
int toFacilitate = response.jsonPath().getInt("data[3].custNum");
Assert.assertEquals(commitPlan, chart.get("commitPlan")-1,network.message(BasicConfig.WORK_staticChart,"要发计划书客户未减1",response.body().asString()));
Assert.assertEquals(toFacilitate, chart.get("toFacilitate")+1,network.message(BasicConfig.WORK_staticChart,"待促成客户未加1",response.body().asString()));
//还原
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()));
}
@Test(description = "修改客户基础信息",priority = 37)
public void 修改客户基础信息(){
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> array = new ArrayList<>();
params.put("custId", custId);
params.put("commitPlanFlag", 1);
params.put("commitCustStatus", 1);
params.put("addWxStatus", 0);
params.put("coreMaker", 1);
params.put("ideaAgree", 1);
params.put("insApplicant", 4);
params.put("insByApplicant", 4);
params.put("insMoney", 500);
params.put("insPeriod", 20);
params.put("custArea", "北京-北京市");
params.put("custDescription", "客户的备注");
params.put("custName", name);
params.put("dealFlag", 1);
params.put("forWho", array);
params.put("retireMoney", 0);
params.put("roomerAge", 0);
params.put("roomerCity", "");
params.put("visitOrg", array);
Response response = network.postResponse(params,BasicConfig.WORK_edit);
@Test(description = "查询渠道列表",priority = 4)
public void 查询渠道列表(){
Response response = network.getResponse(BasicConfig.MANAGER_oto_channelList);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_edit,"修改客户基础信息失败",response.body().asString()));
}
@Test(description = "客户状态见面为已成单",priority = 38)
public void 客户状态见面为已成单(){
Response response = network.getResponse(BasicConfig.WORK_staticChart);
int toFacilitate = response.jsonPath().getInt("data[3].custNum");
int completedOrder = response.jsonPath().getInt("data[4].custNum");
Assert.assertEquals(toFacilitate, chart.get("toFacilitate")-1,network.message(BasicConfig.WORK_staticChart,"待促成客户未减1",response.body().asString()));
Assert.assertEquals(completedOrder, chart.get("completedOrder")+1,network.message(BasicConfig.WORK_staticChart,"已成单客户未加1",response.body().asString()));
Assert.assertTrue(data,network.message(BasicConfig.FORM_submit,"退出登录失败",response.body().asString()));
}
@Test(description = "查看客户动态",priority = 39)
public void 查看客户动态(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("logDays", 1);
Response response = network.getResponse(params,BasicConfig.WORK_operation);
int logSize = response.jsonPath().getInt("data.list[0].dayLog.size()");
Assert.assertEquals(logSize,12,network.message(params,BasicConfig.WORK_operation,"客户动态条数错误",response.body().asString()));
}
}
package com.kjj.cases.otoseller;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.utils.BaseUtils.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class Work implements Authorization {
private static final NetworkUtils network = NetworkUtils.getInstance();
public int tagId; //标签ID
public int custId; //客户ID
public String name; //客户手机号
public String phone; //客户手机号
public int followTimes; //跟进次数
public static Map<String,Integer> header;
public static Map<String,Integer> chart;
@BeforeTest
public void setUp(){
header = new HashMap<>();
chart = new HashMap<>();
otoSellerLogin();
ssoLogin();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
name = "自动化用户"+sdf.format(date);
}
@Test(description = "公域引流_创建标签",priority = 1)
public void 公域引流_创建标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("tagName", "勿动-自动化测试标签");
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_saveTag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_saveTag,"创建标签失败",response.body().asString()));
//创建名称相同的标签失败
response = network.postResponse(params,BasicConfig.MANAGER_oto_saveTag);
data = response.jsonPath().getBoolean("success");
Assert.assertFalse(data,network.message(params,BasicConfig.MANAGER_oto_saveTag,"创建同名的标签成功",response.body().asString()));
}
@Test(description = "公域引流_查看标签列表",priority = 2)
public void 公域引流_查看标签列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_tagList);
int size = response.jsonPath().getInt("data.list.size()");
String tagName = response.jsonPath().getString("data.list[0].tagName");
int customerCount = response.jsonPath().getInt("data.list[0].customerCount");
int tagStatus = response.jsonPath().getInt("data.list[0].tagStatus");
Assert.assertTrue(size>0 ,network.message(BasicConfig.MANAGER_oto_tagList,"标签列表为空",response.body().asString()));
Assert.assertEquals(tagName ,"勿动-自动化测试标签",network.message(params,BasicConfig.MANAGER_oto_tagList,"标签名称错误",response.body().asString()));
Assert.assertEquals(customerCount ,0,network.message(params,BasicConfig.MANAGER_oto_tagList,"新标签的客户数不为0",response.body().asString()));
Assert.assertEquals(tagStatus ,1,network.message(params,BasicConfig.MANAGER_oto_tagList,"新标签的状态不为打开",response.body().asString()));
tagId = response.jsonPath().getInt("data.list[0].id");
}
@Test(description = "公域引流_修改标签",priority = 3)
public void 公域引流_修改标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("tagName", "勿动-自动化更新标签");
params.put("id", tagId);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_updateTag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_updateTag,"修改标签失败",response.body().asString()));
}
@Test(description = "公域引流_填写表单",priority = 4)
public void 公域引流_填写表单(){
HashMap<String,Object> params = new HashMap<>();
phone = "17830855590";
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("uuid", "622d83e4-ca21-4ccd-94cb-182c0f2a6b60");
Response response = network.postResponse(params,BasicConfig.FORM_submit);
String recordId = response.jsonPath().getString("data.recordId");
Assert.assertNotNull(recordId,network.message(params,BasicConfig.FORM_submit,"客户创建失败",response.body().asString()));
params.clear();
ArrayList<String> optionIds = new ArrayList<>();
optionIds.add("Kj21NTY1OTE");
params.put("optionIds", optionIds);
params.put("questionId", "Kj21MjQ5Njc");
params.put("recordId", recordId);
response = network.postResponse(params,BasicConfig.FORM_submitQuestion);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.FORM_submitQuestion,"客户填写表单失败",response.body().asString()));
}
@Test(description = "公域引流_查找客户",priority = 5)
public void 公域引流_查找客户(){
HashMap<String,Object> params = new HashMap<String,Object>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("phoneNum", phone);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_customerList);
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()));
custId = response.jsonPath().getInt("data.list[0].id");
}
@Test(description = "公域引流_分配客户",priority = 6)
public void 公域引流_分配客户(){
HashMap<String,Object> params = new HashMap<>();
String str= String.valueOf(System.currentTimeMillis());
params.put("customerId",custId);
params.put("sellerId", 23);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_assignSeller);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_assignSeller,"分配客户失败",response.body().asString()));
}
@Test(description = "工作台_销售信息",priority = 7)
public void 客户分类_销售信息(){
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()));
}
@Test(description = "工作台_通知栏",priority = 8)
public void 工作台_通知栏(){
Response response = network.getResponse(BasicConfig.WORK_notifyList);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,0,network.message(BasicConfig.WORK_notifyList,"通知栏不为空",response.body().asString()));
}
@Test(description = "客户分类_数量总览",priority = 9)
public void 客户分类_数量总览(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(BasicConfig.WORK_staticHeader,"数量总览数据为空",response.body().asString()));
int starNum = response.jsonPath().getInt("data.starNum");
int totalNum = response.jsonPath().getInt("data.totalNum");
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int unMeetNum = response.jsonPath().getInt("data.unMeetNum");
int unRedialNum = response.jsonPath().getInt("data.unRedialNum");
header.put("starNum",starNum);
header.put("totalNum",totalNum);
header.put("unContactNum",unContactNum);
header.put("unMeetNum",unMeetNum);
header.put("unRedialNum",unRedialNum);
}
@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"));
}
@Test(description = "工作台_标签列表",priority = 11)
public void 工作台_标签列表(){
Response response = network.getResponse(BasicConfig.WORK_tagList);
String tagName = response.jsonPath().getString("data.find{it.tagId =="+tagId+"}.tagName");
Assert.assertEquals(tagName,"勿动-自动化更新标签",network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
}
@Test(description = "需要联系客户列表",priority = 12)
public void 需要联系客户列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("custClassifyType", 1);
Response response = network.getResponse(params,BasicConfig.WORK_customerList);
int customerId = response.jsonPath().getInt("data.list[0].custId");
Assert.assertEquals(customerId,custId,network.message(params,BasicConfig.WORK_customerList,"需要联系列表中首位客户非新增客户",response.body().asString()));
int custStar = response.jsonPath().getInt("data.list[0].custStar");
int followStatus = response.jsonPath().getInt("data.list[0].followStatus");
followTimes = response.jsonPath().getInt("data.list[0].followTimes");
Object custValue = response.jsonPath().getJsonObject("data.list[0].custValue");
Object lastFollowTime = response.jsonPath().getJsonObject("data.list[0].lastFollowTime");
Assert.assertEquals(custStar,0,network.message(params,BasicConfig.WORK_customerList,"新客户默认为星标客户",response.body().asString()));
Assert.assertEquals(followStatus,1,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进状态非需要联系状态",response.body().asString()));
Assert.assertEquals(followTimes,0,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进次数不为0",response.body().asString()));
Assert.assertNull(custValue,network.message(params,BasicConfig.WORK_customerList,"新客户的默认客户价值不为null",response.body().asString()));
Assert.assertNull(lastFollowTime,network.message(params,BasicConfig.WORK_customerList,"新客户的默认跟进时间不为null",response.body().asString()));
}
@Test(description = "查询客户手机号",priority = 13)
public void 查询客户手机号(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_phone);
String data = response.jsonPath().getString("data");
Assert.assertEquals(data,phone,network.message(params,BasicConfig.WORK_phone,"手机号错误",response.body().asString()));
}
@Test(description = "查询新客户见面情况",priority = 14)
public void 查询新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.orderVisitDate");
Assert.assertFalse(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为已见面",response.body().asString()));
Assert.assertFalse(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为已预约",response.body().asString()));
Assert.assertNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间不为空",response.body().asString()));
}
@Test(description = "查询新客户头部信息",priority = 15)
public void 查询新客户头部信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_header);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_header,"头部信息为空",response.body().asString()));
}
@Test(description = "查询新客户详细信息",priority = 16)
public void 查询新客户详细信息(){
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()));
}
@Test(description = "查询客户电话表单回填状态",priority = 17)
public void 查询客户电话表单回填状态(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_showFeedback);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertFalse(data,network.message(params,BasicConfig.WORK_showFeedback,"电话表单回填状态错误:为需要回填",response.body().asString()));
}
@Test(description = "查询省市列表",priority = 18)
public void 查询省市列表(){
Response response = network.getResponse(BasicConfig.WORK_regionCity);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(BasicConfig.WORK_regionCity,"省市列表为空",response.body().asString()));
}
@Test(description = "查询历史通话",priority = 19)
public void 查询历史通话(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("logDays", 1);
Response response = network.getResponse(params,BasicConfig.WORK_callLog);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,BasicConfig.WORK_callLog,"历史通话为空",response.body().asString()));
}
@Test(description = "标记星标用户",priority = 20)
public void 标记星标用户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_star);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_star,"标记星标客户失败",response.body().asString()));
}
@Test(description = "查询星标客户更新",priority = 21)
public void 查询星标客户更新(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int starNum = response.jsonPath().getInt("data.starNum");
Assert.assertEquals(unContactNum,header.get("unContactNum")-1,network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未减1",response.body().asString()));
Assert.assertEquals(starNum, header.get("starNum")+1,network.message(BasicConfig.WORK_staticHeader,"星标客户数量未加1",response.body().asString()));
}
@Test(description = "取消星标用户",priority = 22)
public void 取消星标用户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_star);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_star,"取消客户星标失败",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int starNum = response.jsonPath().getInt("data.starNum");
int num1= header.get("starNum");
int num2= header.get("unContactNum");
Assert.assertEquals(starNum, num1,network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未加1",response.body().asString()));
Assert.assertEquals(unContactNum, num2,network.message(BasicConfig.WORK_staticHeader,"星标客户数量未减1",response.body().asString()));
}
@Test(description = "修改客户价值",priority = 23)
public void 修改客户价值(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("custValue", 200);
Response response = network.postResponse(params,BasicConfig.WORK_assess);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_assess,"修改客户价值失败",response.body().asString()));
}
@Test(description = "修改客户跟进权重",priority = 24)
public void 修改客户跟进权重(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("followWeight", 1);
Response response = network.postResponse(params,BasicConfig.WORK_weight);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_weight,"修改客户跟进权重失败",response.body().asString()));
}
@Test(description = "修改客户标签",priority = 25)
public void 修改客户标签(){
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> tags = new ArrayList<>();
tags.add(tagId);
params.put("custId", custId);
params.put("tagIds", tags);
Response response = network.postResponse(params,BasicConfig.WORK_tag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_tag,"修改客户标签失败",response.body().asString()));
//查询信息更新
params.clear();
params.put("custId", custId);
response = network.getResponse(params,BasicConfig.WORK_detail);
int tagSize = response.jsonPath().getInt("data.custInfo.tagIds.size()");
Assert.assertEquals(tagSize,1,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
int tId = response.jsonPath().getInt("data.custInfo.tagIds[0]");
Assert.assertEquals(tId,tagId,network.message(params,BasicConfig.WORK_detail,"标签Id错误",response.body().asString()));
int custValue = response.jsonPath().getInt("data.custInfo.custValue");
Assert.assertEquals(custValue,200,network.message(params,BasicConfig.WORK_detail,"客户价值错误",response.body().asString()));
}
@Test(description = "修改标签状态为关闭",priority = 26)
public void 修改标签状态为关闭(){
ssoLogin();
HashMap<String,Object> params = new HashMap<>();
params.put("id", tagId);
params.put("tagStatus", 0);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_switchStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchStatus,"关闭标签显示失败",response.body().asString()));
}
@Test(description = "查询更新的标签列表和客户标签",priority = 27)
public void 查询更新的标签列表和客户标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_detail);
Object tagIds = response.jsonPath().getJsonObject("data.custInfo.tagIds");
Assert.assertNull(tagIds,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_tagList);
int size = response.jsonPath().getInt("data.findAll{it.tagId =="+tagId+"}.size()");
Assert.assertEquals(size,0,network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
params.clear();
sleep(1000);
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params,BasicConfig.MANAGER_oto_tagList);
int customerCount = response.jsonPath().getInt("data.list[0].customerCount");
Assert.assertEquals(customerCount ,1,network.message(params,BasicConfig.MANAGER_oto_tagList,"标签的客户数不为1",response.body().asString()));
}
@Test(description = "修改标签状态为开启",priority = 28)
public void 修改标签状态为开启() {
ssoLogin();
HashMap<String, Object> params = new HashMap<>();
params.put("id", tagId);
params.put("tagStatus", 1);
Response response = network.postResponse(params, BasicConfig.MANAGER_oto_switchStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchStatus,"修改客户标签失败",response.body().asString()));
}
@Test(description = "删除客户标签",priority = 29)
public void 删除客户标签() {
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> tags = new ArrayList<>();
params.put("custId", custId);
params.put("tagIds", tags);
Response response = network.postResponse(params,BasicConfig.WORK_tag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_tag,"修改客户标签失败",response.body().asString()));
//校验还原
params.clear();
params.put("custId", custId);
response = network.getResponse(params,BasicConfig.WORK_detail);
Object tagIds = response.jsonPath().getJsonObject("data.custInfo.tagIds");
Assert.assertNull(tagIds,network.message(params,BasicConfig.WORK_detail,"标签数量错误",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_tagList);
int size = response.jsonPath().getInt("data.findAll{it.tagId =="+tagId+"}.size()");
Assert.assertEquals(size,1,network.message(BasicConfig.WORK_tagList,"跟进表格数量为空",response.body().asString()));
}
@Test(description = "完成今日见面",priority = 30)
public void 完成今日见面(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("commitPlanFlag", 0);
params.put("custValue", 102);
params.put("followWeight", 2);
params.put("meetRemark", "今日见面的备注"+new Date());
Response response = network.postResponse(params,BasicConfig.WORK_meet);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_meet,"完成今日见面失败",response.body().asString()));
}
@Test(description = "客户状态见面为待计划",priority = 31)
public void 客户状态见面为待计划(){
Response response = network.getResponse(BasicConfig.WORK_staticHeader);
int unContactNum = response.jsonPath().getInt("data.unContactNum");
int unMeetNum = response.jsonPath().getInt("data.unMeetNum");
int num = header.get("unMeetNum");
Assert.assertEquals(unContactNum,header.get("unContactNum")-1,network.message(BasicConfig.WORK_staticHeader,"需要联系客户数量未减1",response.body().asString()));
Assert.assertEquals(unMeetNum, num,network.message(BasicConfig.WORK_staticHeader,"需要约见客户数量变化",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_staticChart);
int needContact = response.jsonPath().getInt("data[0].custNum");
int needMeet = response.jsonPath().getInt("data[1].custNum");
int commitPlan = response.jsonPath().getInt("data[2].custNum");
num = chart.get("needMeet");
Assert.assertEquals(needContact, chart.get("needContact")-1,network.message(BasicConfig.WORK_staticChart,"需要联系客户未减1",response.body().asString()));
Assert.assertEquals(needMeet,num,network.message(BasicConfig.WORK_staticChart,"需要约见客户数量变化",response.body().asString()));
Assert.assertEquals(commitPlan, chart.get("commitPlan")+1,network.message(BasicConfig.WORK_staticChart,"要发计划书客户未加1",response.body().asString()));
}
@Test(description = "预约参观",priority = 32)
public void 预约参观(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("coreMaker", 1);
params.put("ideaAgree", 1);
params.put("insApplicant", 4);
params.put("insByApplicant", 4);
params.put("insMoney", 500);
params.put("insPeriod", 20);
params.put("orderVisitTime", System.currentTimeMillis()-86400000);
Response response = network.postResponse(params,BasicConfig.WORK_order);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_order,"完成今日见面失败",response.body().asString()));
}
@Test(description = "见面并预约后更新客户见面情况",priority = 33)
public void 见面并预约后更新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.todayMeetFlag");
Assert.assertTrue(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为未见面",response.body().asString()));
Assert.assertTrue(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为未预约",response.body().asString()));
Assert.assertNotNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间为空",response.body().asString()));
response = network.getResponse(BasicConfig.WORK_notifyList);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,1,network.message(BasicConfig.WORK_notifyList,"通知栏不为空",response.body().asString()));
int notifyType = response.jsonPath().getInt("data[0].notifyType");
Assert.assertEquals(size,1,network.message(BasicConfig.WORK_notifyList,"通知栏不为空",response.body().asString()));
}
@Test(description = "上传参观详情",priority = 34)
public void 上传参观详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("commitPlanFlag", 1);
params.put("commitCustStatus", 1);
params.put("custValue", 201);
params.put("followWeight", 2);
params.put("visitRemark", "今日参观的备注"+new Date());
Response response = network.postResponse(params,BasicConfig.WORK_feedback);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_feedback,"上传参观详情失败失败",response.body().asString()));
}
@Test(description = "上传参观详情后更新客户见面情况",priority = 35)
public void 上传参观详情后更新客户见面情况(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.getResponse(params,BasicConfig.WORK_info);
boolean todayMeetFlag = response.jsonPath().getBoolean("data.todayMeetFlag");
boolean orderVisitFlag = response.jsonPath().getBoolean("data.orderVisitFlag");
Object orderVisitDate = response.jsonPath().getJsonObject("data.orderVisitDate");
Assert.assertTrue(todayMeetFlag,network.message(params,BasicConfig.WORK_info,"今日见面状态错误:为未见面",response.body().asString()));
Assert.assertFalse(orderVisitFlag,network.message(params,BasicConfig.WORK_info,"预约参观状态错误:为已预约",response.body().asString()));
Assert.assertNull(orderVisitDate,network.message(params,BasicConfig.WORK_info,"预约时间不为空",response.body().asString()));
}
@Test(description = "客户状态见面为待促成",priority = 36)
public void 客户状态见面为待促成(){
Response response = network.getResponse(BasicConfig.WORK_staticChart);
int commitPlan = response.jsonPath().getInt("data[2].custNum");
int toFacilitate = response.jsonPath().getInt("data[3].custNum");
int num =chart.get("commitPlan");
Assert.assertEquals(commitPlan, num,network.message(BasicConfig.WORK_staticChart,"要发计划书客户未减1",response.body().asString()));
Assert.assertEquals(toFacilitate, chart.get("toFacilitate")+1,network.message(BasicConfig.WORK_staticChart,"待促成客户未加1",response.body().asString()));
}
@Test(description = "修改客户基础信息",priority = 37)
public void 修改客户基础信息(){
HashMap<String,Object> params = new HashMap<>();
ArrayList<Integer> array = new ArrayList<>();
params.put("custId", custId);
params.put("commitPlanFlag", 1);
params.put("commitCustStatus", 1);
params.put("addWxStatus", 0);
params.put("coreMaker", 1);
params.put("ideaAgree", 1);
params.put("insApplicant", 4);
params.put("insByApplicant", 4);
params.put("insMoney", 500);
params.put("insPeriod", 20);
params.put("custArea", "北京-北京市");
params.put("custDescription", "客户的备注");
params.put("custName", name);
params.put("dealFlag", 1);
params.put("forWho", array);
params.put("retireMoney", 0);
params.put("roomerAge", 0);
params.put("roomerCity", "");
params.put("visitOrg", array);
Response response = network.postResponse(params,BasicConfig.WORK_edit);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_edit,"修改客户基础信息失败",response.body().asString()));
}
@Test(description = "客户状态见面为已成单",priority = 38)
public void 客户状态见面为已成单(){
Response response = network.getResponse(BasicConfig.WORK_staticChart);
int toFacilitate = response.jsonPath().getInt("data[3].custNum");
int completedOrder = response.jsonPath().getInt("data[4].custNum");
int num = chart.get("toFacilitate");
Assert.assertEquals(toFacilitate, num,network.message(BasicConfig.WORK_staticChart,"待促成客户未减1",response.body().asString()));
Assert.assertEquals(completedOrder, chart.get("completedOrder")+1,network.message(BasicConfig.WORK_staticChart,"已成单客户未加1",response.body().asString()));
}
@Test(description = "查看客户动态",priority = 39)
public void 查看客户动态(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
params.put("logDays", 1);
Response response = network.getResponse(params,BasicConfig.WORK_operation);
int logSize = response.jsonPath().getInt("data.list[0].dayLog.size()");
Assert.assertEquals(logSize,13,network.message(params,BasicConfig.WORK_operation,"客户动态条数错误",response.body().asString()));
}
@Test(description = "姓名模糊查找客户",priority = 40)
public void 姓名模糊查找客户(){
HashMap<String,Object> params = new HashMap<>();
params.put("custName", "自动化");
Response response = network.getResponse(params,BasicConfig.WORK_fuzzyCustName);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,1,network.message(params,BasicConfig.WORK_fuzzyCustName,"客户动态条数错误",response.body().asString()));
}
@Test(description = "公域引流_删除标签",priority = 41)
public void 公域引流_删除标签(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", tagId);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_deleteTag);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_deleteTag,"删除标签失败",response.body().asString()));
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params,BasicConfig.MANAGER_oto_tagList);
int id = response.jsonPath().getInt("data.list[0].id");
Assert.assertTrue(id!= tagId ,network.message(params,BasicConfig.MANAGER_oto_tagList,"新标签的状态不为打开",response.body().asString()));
}
@Test(description = "公域引流_关闭销售呼叫权限",priority = 42)
public void 公域引流_关闭销售呼叫权限(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", 23);
params.put("callPermission", 0);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_switchCallPermissio);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchCallPermissio,"关闭呼叫权限失败",response.body().asString()));
}
@Test(description = "关闭呼叫权限_呼叫失败",priority = 43)
public void 关闭呼叫权限_呼叫失败(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", custId);
Response response = network.postResponse(params,BasicConfig.WORK_call);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.WORK_call,"关闭呼叫权限后呼叫成功",response.body().asString()));
params.clear();
params.put("id", 23);
params.put("callPermission", 1);
response = network.postResponse(params,BasicConfig.MANAGER_oto_switchCallPermissio);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchCallPermissio,"关闭呼叫权限失败",response.body().asString()));
}
@Test(description = "公域引流_禁用销售账号",priority = 44)
public void 公域引流_禁用销售账号(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", 23);
params.put("sellerStatus", 0);
Response response = network.postResponse(params,BasicConfig.MANAGER_oto_switchSellerStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchSellerStatus,"禁用销售账号失败",response.body().asString()));
}
@Test(description = "关闭销售权限_访问失败",priority = 45)
public void 关闭销售权限_访问失败(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("custClassifyType", 1);
Response response = network.getResponse(params,BasicConfig.WORK_customerList);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.WORK_customerList,"关闭销售权限后访问成功",response.body().asString()));
params.clear();
params.put("id", 23);
params.put("sellerStatus", 1);
response = network.postResponse(params,BasicConfig.MANAGER_oto_switchSellerStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_switchSellerStatus,"启用销售账号失败",response.body().asString()));
}
@Test(description = "公域引流_解密客户手机号",priority = 46)
public void 公域引流_解密客户手机号(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", custId);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_customerPhone);
String data = response.jsonPath().getString("data");
Assert.assertEquals(data,"17830855590",network.message(params,BasicConfig.MANAGER_oto_qaDetail,"解密手机号失败",response.body().asString()));
}
@Test(description = "公域引流_查询问题详情",priority = 47)
public void 公域引流_查询问题详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("customerId", custId);
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_qaDetail);;
int answer = response.jsonPath().getInt("data.list[0].optionTitles.size()");
Assert.assertTrue(answer>0,network.message(params,BasicConfig.MANAGER_oto_customerPhone,"问题详情为空",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 退出登录(){
Response response = network.postResponse(BasicConfig.WORK_logout);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.WORK_logout,"退出登录失败",response.body().asString()));
}
}
......@@ -1288,21 +1288,32 @@ public class BasicConfig {
//OTO销售工作台
public static final String MANAGER_oto_saveTag = MANAGER_HOST + "/kjy/manager/oto/tag/save";
public static final String MANAGER_oto_updateTag = MANAGER_HOST + "/kjy/manager/oto/tag/update";
public static final String MANAGER_oto_deleteTag = MANAGER_HOST +"/kjy/manager/oto/tag/delete";
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_updateSeller = MANAGER_HOST + "/kjy/manager/oto/seller/update";
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";
public static final String MANAGER_oto_switchCallPermissio = MANAGER_HOST +"/kjy/manager/oto/seller/switchCallPermission";
public static final String MANAGER_oto_searchSeller = MANAGER_HOST +"/kjy/manager/pub/form/customer/searchSeller";
public static final String MANAGER_oto_customerPhone = MANAGER_HOST +"/kjy/manager/pub/form/customer/customerPhone";
public static final String MANAGER_oto_qaDetail = MANAGER_HOST +"/kjy/manager/pub/form/customer/qaDetail";
public static final String MANAGER_oto_channelList = MANAGER_HOST +"/kjy/manager/pub/form/channelList";
public static final String WORK_getCaptcha = WORK_HOST + "/kjy/oto/manager/auth/captcha";
public static final String WORK_login = WORK_HOST + "/kjy/oto/manager/auth/login";
public static final String WORK_userInfo = WORK_HOST + "/kjy/oto/manager/auth/userInfo";
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_notifyList = WORK_HOST + "/kjy/oto/manager/customer/notify/list";
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 WORK_tagList = WORK_HOST + "/kjy/oto/manager/tag/list";
public static final String WORK_customerList = WORK_HOST + "/kjy/oto/manager/customer/list";
public static final String WORK_phone = WORK_HOST + "/kjy/oto/manager/customer/phoneNum";
public static final String WORK_info = WORK_HOST + "kjy/oto/manager/customer/visit/info";
public static final String WORK_info = WORK_HOST + "/kjy/oto/manager/customer/visit/info";
public static final String WORK_header = WORK_HOST + "/kjy/oto/manager/customer/header";
public static final String WORK_detail = WORK_HOST + "/kjy/oto/manager/customer/detail";
public static final String WORK_showFeedback = WORK_HOST + "/kjy/oto/manager/customer/call/showFeedback";
......@@ -1317,4 +1328,11 @@ public class BasicConfig {
public static final String WORK_feedback = WORK_HOST + "/kjy/oto/manager/customer/feedback";
public static final String WORK_edit = WORK_HOST + "/kjy/oto/manager/customer/edit";
public static final String WORK_operation = WORK_HOST + "/kjy/oto/manager/customer/log/operation";
public static final String WORK_fuzzyCustName= WORK_HOST + "/kjy/oto/manager/customer/fuzzy/custName";
public static final String WORK_call= WORK_HOST + "/kjy/oto/manager/customer/call";
public static final String WORK_logout= WORK_HOST + "/kjy/oto/manager/auth/logout";
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";
}
......@@ -398,22 +398,22 @@ public class BaseUtils {
ThreadSleepUtils.sleep(2000);
// 调用登录接口
Map<String, Object> params = new HashMap<String, Object>();
params.put("phone","15136361308");
params.put("phoneNumber","15136361301");
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("phone","15136361301");
Response autoTestRes = network.getResponse(params,BasicConfig.CORP_getCaptchaForAutoTest);
params.put("phoneNumber","15136361301");
Response autoTestRes = network.getResponse(params,BasicConfig.WORK_verifyCodet);
String captcha = autoTestRes.jsonPath().getString("data");
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phone","15136361301");
params.put("phoneNumber","15136361301");
params.put("captcha",captcha);
Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
boolean success = loginRes.jsonPath().getBoolean("success");
......@@ -425,6 +425,10 @@ public class BaseUtils {
String[] cookieKeyValue = cookieStr.split("=");
otoCookieKey = cookieKeyValue[0];
otoCookieValue = cookieKeyValue[1];
// otoCookieKey = "otoToken";
// otoCookieValue = "64e83LYGbaXYX9EkHumCho2UkzpJdamKBUy1LxjAMokRCXzXUqz3GhwHVuafuX3XiGBeJtGTACHoTFEV33SyzV8W1RH5HE6pchoYaiHxhbB";
network.agentCookies.put(otoCookieKey,otoCookieValue); //存入cookies
System.out.println("销售Cookie中key:"+otoCookieKey+" ,values:"+otoCookieValue);
}
......
......@@ -7,6 +7,8 @@
<suite-file path="wechatTestNG.xml"></suite-file>
<suite-file path="workTestNG.xml"></suite-file>
</suite-files>
<!-- 监听器-->
<listeners>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="保险OTO" verbose="1" thread-count="3">
<test preserve-order="true" name="销售管理">
<classes>
<class name="com.kjj.cases.otoseller.Manager"/>
</classes>
</test>
<test preserve-order="true" name="销售工作台">
<classes>
<class name="com.kjj.cases.otoseller.Work"/>
</classes>
</test>
</suite>
<!-- Suite -->
<!--
suite定义一个测试套件,可以设置是否使用多线程,可包含多个测试用例或者测试group
parallel = classes  每个测试用例class级别多线程
thread-count =3  线程数为5,可同时执行3个case
preserve-order = true   classes和methods按照配置中的顺序执行,false为乱序执行。(If you want the classes and methods listed in this file to be run in an unpredictible order, set the preserve-order attribute to false)
parameter 标签传递参数
-->
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