Commit 6d4b8c46 authored by 龚小红's avatar 龚小红

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

增加客户告知书管理的自动化测试接口

See merge request !6
parents 5c4aae80 24693c9a
package com.oto.cases.otoseller; package com.oto.cases.otoseller;
import com.oto.config.BasicConfig; import com.oto.config.BasicConfig;
import com.oto.utils.IdMakeUtil;
import com.oto.utils.NetworkUtils; import com.oto.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import static com.oto.config.BasicConfig.LEADER_ID; import static com.oto.config.BasicConfig.LEADER_ID;
...@@ -18,6 +21,9 @@ public class Manager { ...@@ -18,6 +21,9 @@ public class Manager {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
private int sellerId; //销售ID private int sellerId; //销售ID
private String insureOrderstr; //告知书的保单号
private String pdfUrl; //告知书的模板pdfURL
private String encryptId; //告知书的加密id
@BeforeTest @BeforeTest
public void setUp(){ public void setUp(){
ssoLogin(); ssoLogin();
...@@ -223,10 +229,8 @@ public class Manager { ...@@ -223,10 +229,8 @@ public class Manager {
Response response = network.getResponse(params,BasicConfig.MANAGER_oto_productList); Response response = network.getResponse(params,BasicConfig.MANAGER_oto_productList);
int size = response.jsonPath().getInt("data.list.size()"); int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size>0,network.message(params,BasicConfig.MANAGER_oto_productList,"查询公司产品为空",response.body().asString())); Assert.assertTrue(size>0,network.message(params,BasicConfig.MANAGER_oto_productList,"查询公司产品为空",response.body().asString()));
int id = response.jsonPath().getInt("data.list[0].id"); int costOptionsSize = response.jsonPath().getInt("data.list.find{it.id == 19}.costOptions.size()");
Assert.assertEquals(id,19,network.message(params,BasicConfig.MANAGER_oto_productList,"查询公司产品错误",response.body().asString())); String prodName = response.jsonPath().getString("data.list.find{it.id == 19}.prodName");
int costOptionsSize = response.jsonPath().getInt("data.list[0].costOptions.size()");
String prodName = response.jsonPath().getString("data.list[0].prodName");
Assert.assertEquals(costOptionsSize,3,network.message(params,BasicConfig.MANAGER_oto_productList,"产品的缴费期未更新",response.body().asString())); Assert.assertEquals(costOptionsSize,3,network.message(params,BasicConfig.MANAGER_oto_productList,"产品的缴费期未更新",response.body().asString()));
Assert.assertEquals(prodName,"勿动-自动化专用产品更新",network.message(params,BasicConfig.MANAGER_oto_productList,"产品的名称未更新",response.body().asString())); Assert.assertEquals(prodName,"勿动-自动化专用产品更新",network.message(params,BasicConfig.MANAGER_oto_productList,"产品的名称未更新",response.body().asString()));
} }
...@@ -308,4 +312,180 @@ public class Manager { ...@@ -308,4 +312,180 @@ public class Manager {
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_change,"解绑坐席账号失败",response.body().asString())); Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_oto_change,"解绑坐席账号失败",response.body().asString()));
} }
@Test(description = "不可新增同名供应商",priority = 21)
public void 不可新增同名供应商(){
HashMap<String,Object> params = new HashMap<>();
params.put("supplierName", "勿动-自动化供应商");
Response response = network.postResponse(params, BasicConfig.MANAGER_supplier_save);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.MANAGER_supplier_save,"新增同名供应商成功",response.body().asString()));
}
@Test(description = "修改供应商名称",priority = 22)
public void 修改供应商名称(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", 21);
params.put("supplierName", "勿动-自动化专用供应商");
Response response = network.postResponse(params, BasicConfig.MANAGER_supplier_update);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_supplier_update,"修改供应商名称失败",response.body().asString()));
}
@Test(description = "查看第三方账号列表",priority = 23)
public void 查看供应商列表(){
Response response = network.getResponse(BasicConfig.MANAGER_supplier_list);
int size = response.jsonPath().getInt("data.list.size()");
String supplierName = response.jsonPath().getString("data.list.find{it.id==21}.supplierName");
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_supplier_list,"查询供应商列表为空",response.body().asString()));
Assert.assertEquals(supplierName,"勿动-自动化专用供应商",network.message(BasicConfig.MANAGER_supplier_list,"查询供应商名称未更新",response.body().asString()));
HashMap<String,Object> params = new HashMap<>();
params.put("id", 21);
params.put("supplierName", "勿动-自动化供应商");
response = network.postResponse(params, BasicConfig.MANAGER_supplier_update);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_supplier_update,"修改供应商名称失败",response.body().asString()));
}
@Test(description = "告知书查看产品列表",priority = 24)
public void 告知书查看产品列表(){
Response response = network.getResponse( BasicConfig.MANAGER_product_listByAttachUs);
int size1 = response.jsonPath().getInt("data.findAll{it.id == 60}.size()");
int size2 = response.jsonPath().getInt("data.findAll{it.id == 59}.size()");
int size3 = response.jsonPath().getInt("data.findAll{it.id == 19}.size()");
Assert.assertEquals(size1,0,network.message(BasicConfig.MANAGER_product_listByAttachUs,"告知书产品列表包含久久保自营产品",response.body().asString()));
Assert.assertEquals(size2,1,network.message(BasicConfig.MANAGER_product_listByAttachUs,"告知书产品列表不包含挂靠久久保产品",response.body().asString()));
Assert.assertEquals(size3,0,network.message(BasicConfig.MANAGER_product_listByAttachUs,"告知书产品列表包含其他渠道自营产品",response.body().asString()));
}
@Test(description = "获取告知书的模板",priority = 25)
public void 获取告知书的模板(){
Response response = network.getResponse( BasicConfig.MANAGER_notification_getNotificationTemplate);
pdfUrl = response.jsonPath().getString("data");
Assert.assertNotNull(pdfUrl,network.message(BasicConfig.MANAGER_notification_getNotificationTemplate,"告知书的模板pdfURL为空",response.body().asString()));
}
@Test(description = "新增告知书",priority =26)
public void 新增告知书(){
HashMap<String,Object> params = new HashMap<>();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd");
insureOrderstr = sdf.format(date)+"_0001";
params.put("insureOrder", insureOrderstr);
params.put("custName", "自动化客户");
params.put("sellerName", "自动化销售");
params.put("productId", 59);
params.put("signatureDate", System.currentTimeMillis()-86400);
params.put("notificationUrl", pdfUrl);
Response response = network.postResponse(params, BasicConfig.MANAGER_notification_save);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_notification_save,"增加告知书失败",response.body().asString()));
}
@Test(description = "查询所有供应商列表",priority = 27)
public void 查询所有供应商列表(){
Response response = network.getResponse(BasicConfig.MANAGER_supplier_listAll);
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_supplier_listAll,"查询供应商列表为空",response.body().asString()));
}
@Test(description = "查询告知书列表",priority = 28)
public void 查询告知书列表(){
HashMap<String,Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response response = network.getResponse(params, BasicConfig.MANAGER_notification_list);
int size = response.jsonPath().getInt("data.list.size()");
String insureOrder = response.jsonPath().getString("data.list[0].insureOrder");
int signatureState = response.jsonPath().getInt("data.list[0].signatureState");
Assert.assertTrue(size>0,network.message(BasicConfig.MANAGER_notification_list,"查询告知书列表为空",response.body().asString()));
Assert.assertEquals(insureOrder,insureOrderstr,network.message(BasicConfig.MANAGER_notification_list,"告知书的投保单号错误",response.body().asString()));
Assert.assertEquals(signatureState,0,network.message(BasicConfig.MANAGER_notification_list,"告知书的状态错误:非待签名",response.body().asString()));
encryptId = response.jsonPath().getString("data.list[0].encryptId");
}
@Test(description = "修改告知书",priority = 29)
public void 修改告知书(){
HashMap<String,Object> params = new HashMap<>();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd");
insureOrderstr = sdf.format(date)+"_A0001";
params.put("id", IdMakeUtil.decodingId(encryptId));
params.put("insureOrder", insureOrderstr);
params.put("custName", "自动化告知书客户");
params.put("sellerName", "自动化告知书销售");
params.put("productId", 59);
params.put("signatureDate", System.currentTimeMillis());
params.put("notificationUrl", "//yun.dui88.com/kjy/other/20220607/9b78877fe9f748f78a031c709c66b2c4.pdf");
Response response = network.postResponse(params, BasicConfig.MANAGER_notification_update);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MANAGER_notification_update,"修改告知书失败",response.body().asString()));
}
@Test(description = "H5查询告知书详情",priority = 30)
public void H5查询告知书详情(){
HashMap<String,Object> params = new HashMap<>();
params.put("encryptId", encryptId);
Response response = network.getResponse(params, BasicConfig.PHONE_notification_getDetail);
String supplierName = response.jsonPath().getString("data.supplierName");
String insureOrder = response.jsonPath().getString("data.insureOrder");
String custName = response.jsonPath().getString("data.custName");
String sellerName = response.jsonPath().getString("data.sellerName");
Assert.assertNotNull(supplierName,network.message(BasicConfig.PHONE_notification_getDetail,"告知书的供应商为空",response.body().asString()));
Assert.assertEquals(insureOrder,insureOrderstr,network.message(BasicConfig.PHONE_notification_getDetail,"告知书的投保单号错误",response.body().asString()));
Assert.assertEquals(custName,"自动化告知书客户",network.message(BasicConfig.PHONE_notification_getDetail,"告知书的客户名字错误",response.body().asString()));
Assert.assertEquals(sellerName,"自动化告知书销售",network.message(BasicConfig.PHONE_notification_getDetail,"告知书的销售名字错误",response.body().asString()));
}
@Test(description = "客户签名告知书",priority = 31)
public void 客户签名告知书(){
HashMap<String,Object> params = new HashMap<>();
params.put("encryptId", encryptId);
params.put("notificationUrl", pdfUrl);
params.put("signatureState", 2);
Response response = network.postResponse(params, BasicConfig.PHONE_notification_updateSignatureInfo);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.PHONE_notification_updateSignatureInfo,"签名告知书失败",response.body().asString()));
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, BasicConfig.MANAGER_notification_list);
int signatureState = response.jsonPath().getInt("data.list[0].signatureState");
Assert.assertEquals(signatureState,2,network.message(BasicConfig.MANAGER_notification_list,"告知书的状态错误:非客户已签名",response.body().asString()));
}
@Test(description = "销售签名告知书",priority = 32)
public void 销售签名告知书(){
HashMap<String,Object> params = new HashMap<>();
params.put("encryptId", encryptId);
params.put("notificationUrl", pdfUrl);
params.put("signatureState", 3);
Response response = network.postResponse(params, BasicConfig.PHONE_notification_updateSignatureInfo);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.PHONE_notification_updateSignatureInfo,"签名告知书失败",response.body().asString()));
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, BasicConfig.MANAGER_notification_list);
int signatureState = response.jsonPath().getInt("data.list[0].signatureState");
Assert.assertEquals(signatureState,3,network.message(BasicConfig.MANAGER_notification_list,"告知书的状态错误:非销售客户都签名",response.body().asString()));
}
@Test(description = "标记告知书失效",priority = 33)
public void 标记告知书失效(){
HashMap<String,Object> params = new HashMap<>();
params.put("id", IdMakeUtil.decodingId(encryptId));
Response response = network.postResponse(params, BasicConfig.MANAGER_notification_signInvalid);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(BasicConfig.MANAGER_notification_signInvalid,"签名告知书失败",response.body().asString()));
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, BasicConfig.MANAGER_notification_list);
int signatureState = response.jsonPath().getInt("data.list[0].signatureState");
Assert.assertEquals(signatureState,4,network.message(BasicConfig.MANAGER_notification_list,"告知书的状态错误:非已失效",response.body().asString()));
}
} }
...@@ -520,10 +520,9 @@ public class Phone implements Authorization { ...@@ -520,10 +520,9 @@ public class Phone implements Authorization {
@Test(description = "查看公司产品列表",priority = 38) @Test(description = "查看公司产品列表",priority = 38)
public void 查看公司产品列表() { public void 查看公司产品列表() {
String encodeProductId = IdMakeUtil.encodingId(productId);
Response response = network.getResponse(BasicConfig.PHONE_listBysellComp); Response response = network.getResponse(BasicConfig.PHONE_listBysellComp);
int size = response.jsonPath().getInt("data.findAll{it.id == '"+encodeProductId+"'}.size()"); int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,1,network.message(BasicConfig.PHONE_listBysellComp,"产品列表未包含已上架产品",response.body().asString())); Assert.assertEquals(size,2,network.message(BasicConfig.PHONE_listBysellComp,"产品列表未包含已上架产品",response.body().asString()));
} }
@Test(description = "下架公司产品",priority = 39) @Test(description = "下架公司产品",priority = 39)
...@@ -540,10 +539,9 @@ public class Phone implements Authorization { ...@@ -540,10 +539,9 @@ public class Phone implements Authorization {
public void 产品下架后公司产品列表不显示() { public void 产品下架后公司产品列表不显示() {
otoSellerTku(); otoSellerTku();
String encodeProductId = IdMakeUtil.encodingId(productId);
Response response = network.postResponse(BasicConfig.PHONE_listBysellComp); Response response = network.postResponse(BasicConfig.PHONE_listBysellComp);
int size = response.jsonPath().getJsonObject("data.findAll{it.id == "+encodeProductId+"}.size()"); int size = response.jsonPath().getJsonObject("data.size()");
Assert.assertEquals(size,0,network.message(BasicConfig.PHONE_listBysellComp,"产品列表未包含已上架产品",response.body().asString())); Assert.assertEquals(size,1,network.message(BasicConfig.PHONE_listBysellComp,"产品列表未包含已上架产品",response.body().asString()));
HashMap<String,Object> params = new HashMap<>(); HashMap<String,Object> params = new HashMap<>();
params.put("id", productId); params.put("id", productId);
......
...@@ -57,7 +57,7 @@ public class BasicConfig { ...@@ -57,7 +57,7 @@ public class BasicConfig {
public static final String TEST_testerDelete = MOBILE_HOST + "/test/user/test/delete"; public static final String TEST_testerDelete = MOBILE_HOST + "/test/user/test/delete";
public static final String MANAGER_encryptAuthKey = MANAGER_HOST + "/kjy/manager/testUser/encryptAuthKey"; public static final String MANAGER_encryptAuthKey = MANAGER_HOST + "/kjy/manager/testUser/encryptAuthKey";
//*************** OTO销售工作台 *************** //*************** 公域引流 ***************
public static final String MANAGER_oto_saveTag = MANAGER_HOST + "/kjy/manager/oto/tag/save"; 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_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_deleteTag = MANAGER_HOST +"/kjy/manager/oto/tag/delete";
...@@ -89,7 +89,18 @@ public class BasicConfig { ...@@ -89,7 +89,18 @@ public class BasicConfig {
public static final String MANAGER_oto_accountBind = MANAGER_HOST + "/kjy/manager/oto/seller/account/bind"; public static final String MANAGER_oto_accountBind = MANAGER_HOST + "/kjy/manager/oto/seller/account/bind";
public static final String MANAGER_oto_accountUnbind = MANAGER_HOST + "/kjy/manager/oto/seller/account/unbind"; public static final String MANAGER_oto_accountUnbind = MANAGER_HOST + "/kjy/manager/oto/seller/account/unbind";
public static final String MANAGER_oto_change = MANAGER_HOST + "/kjy/manager/oto/seller/phone/change"; public static final String MANAGER_oto_change = MANAGER_HOST + "/kjy/manager/oto/seller/phone/change";
public static final String MANAGER_supplier_save = MANAGER_HOST + "/kjy/manager/oto/supplier/save";
public static final String MANAGER_supplier_update = MANAGER_HOST + "/kjy/manager/oto/supplier/update";
public static final String MANAGER_supplier_list = MANAGER_HOST + "/kjy/manager/oto/supplier/list";
public static final String MANAGER_notification_list = MANAGER_HOST + "/kjy/manager/oto/notification/list";
public static final String MANAGER_product_listByAttachUs = MANAGER_HOST + "/kjy/manager/oto/product/listByAttachUs";
public static final String MANAGER_notification_save = MANAGER_HOST + "/kjy/manager/oto/notification/save";
public static final String MANAGER_notification_update = MANAGER_HOST + "/kjy/manager/oto/notification/update";
public static final String MANAGER_notification_signInvalid = MANAGER_HOST + "/kjy/manager/oto/notification/signInvalid";
public static final String MANAGER_supplier_listAll = MANAGER_HOST + "/kjy/manager/oto/supplier/listAll";
public static final String MANAGER_notification_getNotificationTemplate = MANAGER_HOST + "/kjy/manager/oto/notification/getNotificationTemplate";
//*************** OTO销售工作台 ***************
public static final String WORK_getCaptcha = WORK_HOST + "/kjy/oto/manager/auth/captcha"; 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_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 WORK_userInfo = WORK_HOST + "/kjy/oto/manager/auth/userInfo";
...@@ -168,6 +179,8 @@ public class BasicConfig { ...@@ -168,6 +179,8 @@ public class BasicConfig {
public static final String PHONE_getReservationList = HOST + "/kjy/pub/form/getReservationList"; public static final String PHONE_getReservationList = HOST + "/kjy/pub/form/getReservationList";
public static final String PHONE_listCustInterConf = PHONE_HOST + "/kjy/oto/interview/listCustInterConf"; public static final String PHONE_listCustInterConf = PHONE_HOST + "/kjy/oto/interview/listCustInterConf";
public static final String PHONE_checkCustPhase = PHONE_HOST + "/kjy/oto/interview/checkCustPhase"; public static final String PHONE_checkCustPhase = PHONE_HOST + "/kjy/oto/interview/checkCustPhase";
public static final String PHONE_notification_getDetail = PHONE_HOST +"/kjy/oto/notification/getDetail";
public static final String PHONE_notification_updateSignatureInfo = PHONE_HOST + "/kjy/oto/notification/updateSignatureInfo";
public static final String WORK_verifyCode = WORK_HOST + "/kjy/oto/auto/test/verifyCode"; public static final String WORK_verifyCode = WORK_HOST + "/kjy/oto/auto/test/verifyCode";
public static final String WORK_delCust = WORK_HOST + "/kjy/oto/auto/test/delCust"; public static final String WORK_delCust = WORK_HOST + "/kjy/oto/auto/test/delCust";
......
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