Commit 1deb00be authored by 龚小红's avatar 龚小红

1.增加客户资料配置的测试用例

parent bf2b1013
package com.oto.bean;
import lombok.Data;
@Data
public class Answer {
public String code;
public String text;
public Answer(String code, String text) {
this.code = code;
this.text = text;
}
}
package com.oto.bean;
import lombok.Data;
import java.util.ArrayList;
@Data
public class FormQuestion {
public int groupId;
public int id;
public String code;
public String type;
public String title;
public Object date;
public Object multi;
public ArrayList<Option> options;
public ArrayList<Answer> answers;
public FormQuestion(int groupId, int id, String code, String type, String title, Object date, Object multi, ArrayList<Option> options, ArrayList<Answer> answers) {
this.groupId = groupId;
this.id = id;
this.code = code;
this.type = type;
this.title = title;
this.date = date;
this.multi = multi;
this.options = options;
this.answers = answers;
}
}
package com.oto.bean;
import lombok.Data;
import java.util.ArrayList;
@Data
public class GroupData {
public int id;
public String title;
public ArrayList<FormQuestion> formQuestions;
}
package com.oto.bean;
import lombok.Data;
@Data
public class Option {
public int questionId;
public String code;
public String type;
public String title;
public Option(int questionId, String code, String type, String title) {
this.questionId = questionId;
this.code = code;
this.type = type;
this.title = title;
}
}
package com.oto.bean;
import lombok.Data;
import java.util.ArrayList;
@Data
public class QuestionParam {
public int id;
public ArrayList answers;
public QuestionParam(int id, ArrayList answers) {
this.id = id;
this.answers = answers;
}
}
package com.oto.cases.otoseller;
import com.alibaba.fastjson.JSONObject;
import com.oto.bean.*;
import com.oto.cases.admin.Authorization;
import com.oto.config.BasicConfig;
import com.oto.utils.BaseUtils;
import com.oto.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import static com.oto.cases.otoseller.Manager.cust_id;
import static com.oto.utils.ThreadSleepUtils.sleep;
public class FormSubmit implements Authorization {
public int formId; //资料组ID
public GroupData groupData;
@Test(description = "查看资料组列表",priority = 1)
public void 查看资料组列表(){
otoManagerAuth();
Response response = network.getResponse(BasicConfig.WORK_formList);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,8,network.message(BasicConfig.WORK_formList,"资料组数量错误",response.body().asString()));
formId =response.jsonPath().getInt("data[7].id");
}
@Test(description = "创建同名资料组名称失败",priority = 2)
public void 创建同名资料组名称失败(){
HashMap<String,Object> params = new HashMap<>();
params.put("title", "勿动-自动化资料组");
Response response = network.postResponse(params, BasicConfig.WORK_formSave);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(params,BasicConfig.WORK_formSave,"创建同名资料组名称成功",response.body().asString()));
}
@Test(description = "删除资料组所有题目不可开启资料组",priority = 3)
public void 删除资料组所有题目不可开启资料组(){
HashMap<String,Object> paramsFrom = new HashMap<>();
paramsFrom.put("id", formId);
paramsFrom.put("formQuestions", new ArrayList<>());
paramsFrom.put("title", "勿动-自动化资料组");
Response response = network.postResponse(paramsFrom, BasicConfig.WORK_saveFormDetail);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success,network.message(paramsFrom,BasicConfig.WORK_saveFormDetail,"修改资料组状态失败",response.body().asString()));
}
@Test(description = "获取资料组的配置详情",priority = 4)
public void 获取资料组的配置详情(){
formDetail(4,"勿动-自动化资料组");
}
@Test(description = "开启资料组",priority = 5)
public void 开启资料组(){
formStatus(1,true);
//客户详情仅显示开启的资料组
custDetail(8,false,false);
}
@Test(description = "新增资料组题目",priority = 6)
public void 新增资料组题目(){
ArrayList options = new ArrayList();
options.add(new Option(0,"q-0-"+ BaseUtils.randomCode(),"normal","选项1"));
options.add(new Option(0,"q-1-"+ BaseUtils.randomCode(),"normal","选项2"));
options.add(new Option(0,"q-2-"+ BaseUtils.randomCode(),"normal","选项3"));
options.add(new Option(0,"q-3-"+ BaseUtils.randomCode(),"other","其他"));
FormQuestion select = new FormQuestion(0,0,"q-5-"+ BaseUtils.randomCode(),"select","自动化新增多选题",null,true,options,null);
groupData.formQuestions.add(select);
FormQuestion input = new FormQuestion(0,0,"q-6-"+ BaseUtils.randomCode(),"input","自动化新增填空题",false,null,new ArrayList<>(),null);
groupData.formQuestions.add(input);
groupData.setTitle("勿动-自动化更新资料组");
saveFormDetail();
formDetail(6,"勿动-自动化更新资料组");
custDetail(8,false,false);
}
@Test(description = "客户保存新增资料组选项",priority = 7)
public void 客户保存新增资料组选项(){
otoInviterAuth();
ArrayList answers1 = new ArrayList(); //多选题答案
ArrayList answers2 = new ArrayList(); //填空题答案
answers1.add(new Answer(groupData.formQuestions.get(4).options.get(0).code,""));
answers1.add(new Answer(groupData.formQuestions.get(4).options.get(1).code,""));
answers1.add(new Answer(groupData.formQuestions.get(4).options.get(3).code,"其他选项"));
answers2.add(new Answer("","输入框"));
ArrayList questionParams = new ArrayList();
for (int i = 0; i < 4;i++) {
questionParams.add(new QuestionParam(groupData.formQuestions.get(i).id,new ArrayList()));
}
questionParams.add(new QuestionParam(groupData.formQuestions.get(4).id,answers1));//单选题-选择选项1、选项2、其他选项
questionParams.add(new QuestionParam(groupData.formQuestions.get(5).id,answers2));//填空题输入内容
HashMap<String,Object> paramsFrom = new HashMap<>();
paramsFrom.put("groupId", formId);
paramsFrom.put("custId", cust_id);
paramsFrom.put("questionParams", questionParams);
Response response = network.postResponse(paramsFrom, BasicConfig.WORK_formSubmit);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(paramsFrom,BasicConfig.WORK_formSubmit,"修改资料组状态失败",response.body().asString()));
sleep(3000);
custDetail(8,true,false);
}
@Test(description = "删除和修改选项",priority = 8)
public void 删除和修改选项(){
groupData.formQuestions.get(4).options.get(0).setTitle("选项1的文案更新"); //修改多选题-选项1的答案
groupData.formQuestions.get(4).options.remove(3); //删除多选题-其他选项
groupData.setTitle("勿动-自动化资料组");
saveFormDetail();
}
@Test(description = "删除和修改选项客户回显更新",priority = 9)
public void 删除和修改选项客户回显更新(){
sleep(3000);
formDetail(6,"勿动-自动化资料组");
custDetail(8,true,true);
}
@Test(description = "删除资料组题目",priority = 10)
public void 删除资料组题目(){
groupData.formQuestions.remove(5); //删除多选题
groupData.formQuestions.remove(4); //删除填空题
saveFormDetail();
}
@Test(description = "删除资料组题目客户不显示该题目",priority = 11)
public void 删除资料组题目客户不显示该题目(){
formDetail(4,"勿动-自动化资料组");
custDetail(8,false,true);
}
@Test(description = "关闭资料组",priority = 20)
public void 关闭资料组(){
formStatus(0,true);
//客户详情仅显示开启的资料组
custDetail(7,false,true);
}
@Test(description = "查询客户的历史字段信息",priority = 11)
public void 查询客户的历史字段信息(){
HashMap<String,Object> params = new HashMap<>();
params.put("custId", cust_id);
params.put("type", 1);
Response response = network.getResponse(params,BasicConfig.WORK_detail_v2);
int checkInCommunity = response.jsonPath().getInt("data.otoCustInfo4Insurance.checkInCommunity");
String familyStructure = response.jsonPath().getString("data.otoCustInfo4Insurance.familyStructure");
int commitPlanFlag = response.jsonPath().getInt("data.otoCustInfo4Manage.commitPlanFlag");
int meetTimeSize = response.jsonPath().getInt("data.otoCustInfo4Manage.meetTimeSize");
String drawType = response.jsonPath().getString("data.otoCustInfo4Plan.drawType");
Assert.assertNull(familyStructure,network.message(params,BasicConfig.WORK_detail_v2,"新客户家庭结构非空",response.body().asString()));
Assert.assertNull(drawType,network.message(params,BasicConfig.WORK_detail_v2,"新客户支取方案非空",response.body().asString()));
Assert.assertEquals(checkInCommunity,0,network.message(params,BasicConfig.WORK_detail_v2,"新客户的是否需入住社区非否",response.body().asString()));
Assert.assertEquals(commitPlanFlag,0,network.message(params,BasicConfig.WORK_detail_v2,"新客户的是否提交计划书非否",response.body().asString()));
Assert.assertEquals(meetTimeSize,0,network.message(params,BasicConfig.WORK_detail_v2,"新客户的见面次数非0",response.body().asString()));
}
public void formStatus(int status,boolean result){
otoManagerAuth();
HashMap<String,Object> paramsFrom = new HashMap<>();
paramsFrom.put("id", formId);
paramsFrom.put("status", status);
Response response = network.postResponse(paramsFrom, BasicConfig.WORK_formStatus);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertEquals(data,result,network.message(paramsFrom,BasicConfig.WORK_formStatus,"修改资料组状态失败",response.body().asString()));
}
public void saveFormDetail(){
otoManagerAuth();
HashMap<String,Object> paramsFrom = new HashMap<>();
paramsFrom.put("id", formId);
paramsFrom.put("formQuestions", groupData.formQuestions);
paramsFrom.put("title", groupData.title);
Response response = network.postResponse(paramsFrom, BasicConfig.WORK_saveFormDetail);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(paramsFrom,BasicConfig.WORK_saveFormDetail,"新增资料组题目失败",response.body().asString()));
}
public void custDetail(int formCount,boolean submit,boolean deleteFlag){
otoInviterAuth();
HashMap<String,Object> params = new HashMap<>();
params.put("custId", cust_id);
params.put("type", 1);
Response response = network.getResponse(params, BasicConfig.WORK_custDetail);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size,formCount,network.message(params,BasicConfig.WORK_custDetail,"资料组数量错误",response.body().asString()));
if(formCount == 8){
int qCount = response.jsonPath().getInt("data[7].formQuestions.size()");
String title = response.jsonPath().getString("data[7].title");
Assert.assertEquals(qCount,groupData.formQuestions.size(),network.message(params,BasicConfig.WORK_custDetail,"资料组数量错误",response.body().asString()));
Assert.assertEquals(title,groupData.title,network.message(params,BasicConfig.WORK_custDetail,"资料组名称错误",response.body().asString()));
if (submit){
int answers1 = response.jsonPath().getInt("data[7].formQuestions[4].answers.size()");
String answers2 = response.jsonPath().getString("data[7].formQuestions[5].answers[0].text");
if(deleteFlag){
String option1 = response.jsonPath().getString("data[7].formQuestions[4].answers[0].text");
String option2 = response.jsonPath().getString("data[7].formQuestions[4].answers[1].text");
Assert.assertEquals(answers1,2,network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
Assert.assertEquals(option1,"",network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
Assert.assertEquals(option2,"",network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
Assert.assertEquals(answers2,"输入框",network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
}else{
Assert.assertEquals(answers1,3,network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
String other = response.jsonPath().getString("data[7].formQuestions[4].answers[2].text");
Assert.assertEquals(other,"其他选项",network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
Assert.assertEquals(answers2,"输入框",network.message(params,BasicConfig.WORK_custDetail,"答案回显错误",response.body().asString()));
}
}
}
}
public void formDetail(int questionCount,String groupName){
HashMap<String,Object> paramsFrom = new HashMap<>();
paramsFrom.put("id", formId);
Response response = network.getResponse(paramsFrom, BasicConfig.WORK_formDetail);
int size = response.jsonPath().getInt("data.formQuestions.size()");
String title = response.jsonPath().getString("data.title");
Assert.assertEquals(size,questionCount,network.message(paramsFrom,BasicConfig.WORK_formDetail,"资料组的配置详情的题目数量错误",response.body().asString()));
Assert.assertEquals(title,groupName,network.message(paramsFrom,BasicConfig.WORK_formDetail,"资料组的名称数量错误",response.body().asString()));
groupData = JsonUtil.parseResponseToBean(response,GroupData.class);
}
}
...@@ -266,13 +266,11 @@ public class Phone implements Authorization { ...@@ -266,13 +266,11 @@ public class Phone implements Authorization {
public void 上传第一次社区参观面访详情(){ public void 上传第一次社区参观面访详情(){
HashMap<String,Object> params = new HashMap<>(); HashMap<String,Object> params = new HashMap<>();
int[] unusualTypes = {1,2}; int[] unusualTypes = {1,2};
int[] coreMakers={2,3};
ArrayList unusualProofs = new ArrayList(); ArrayList unusualProofs = new ArrayList();
unusualProofs.add("https://yun.dui88.com/kjy/image/20220506/ecf1d585e2e040ad97ec7996ce5bf2a3.jpg"); unusualProofs.add("https://yun.dui88.com/kjy/image/20220506/ecf1d585e2e040ad97ec7996ce5bf2a3.jpg");
unusualProofs.add("https://yun.dui88.com/kjy/image/20220505/62cc0df86ed7430ea67d5015ee3fcc2b.jpg"); unusualProofs.add("https://yun.dui88.com/kjy/image/20220505/62cc0df86ed7430ea67d5015ee3fcc2b.jpg");
params.put("id", interviewIds.get(0)); params.put("id", interviewIds.get(0));
params.put("interviewRemark", "第一次社区参观"); params.put("interviewRemark", "第一次社区参观");
params.put("coreMakers", coreMakers);
params.put("birthdayTime", "1960-01-03"); params.put("birthdayTime", "1960-01-03");
params.put("custAddress", "杭州市文新地铁站"); params.put("custAddress", "杭州市文新地铁站");
params.put("followWeight", 3); params.put("followWeight", 3);
...@@ -416,13 +414,11 @@ public class Phone implements Authorization { ...@@ -416,13 +414,11 @@ public class Phone implements Authorization {
otoTakerTku(); otoTakerTku();
HashMap<String,Object> params = new HashMap<>(); HashMap<String,Object> params = new HashMap<>();
int[] unusualTypes = {2}; int[] unusualTypes = {2};
int[] coreMakers = {2,4};
ArrayList unusualProofs = new ArrayList(); ArrayList unusualProofs = new ArrayList();
unusualProofs.add("https://yun.dui88.com/kjy/image/20220506/ecf1d585e2e040ad97ec7996ce5bf2a3.jpg"); unusualProofs.add("https://yun.dui88.com/kjy/image/20220506/ecf1d585e2e040ad97ec7996ce5bf2a3.jpg");
params.put("id", interviewIds.get(1)); params.put("id", interviewIds.get(1));
params.put("custPhase", 1); params.put("custPhase", 1);
params.put("interviewRemark", "第二次的社区参观"); params.put("interviewRemark", "第二次的社区参观");
params.put("coreMakers", coreMakers);
params.put("birthdayTime", "1960-01-03"); params.put("birthdayTime", "1960-01-03");
params.put("custAddress", "杭州市文新地铁站"); params.put("custAddress", "杭州市文新地铁站");
params.put("followWeight", 2); params.put("followWeight", 2);
...@@ -562,10 +558,8 @@ public class Phone implements Authorization { ...@@ -562,10 +558,8 @@ public class Phone implements Authorization {
@Test(description = "上传送计划书面访",priority = 41) @Test(description = "上传送计划书面访",priority = 41)
public void 上传送计划书面访() { public void 上传送计划书面访() {
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
int[] coreMakers = {2,4};
params.put("id", interviewIds.get(2)); params.put("id", interviewIds.get(2));
params.put("interviewRemark", "送客户最终版计划书"); params.put("interviewRemark", "送客户最终版计划书");
params.put("coreMakers", coreMakers);
params.put("birthdayTime", "1960-01-03"); params.put("birthdayTime", "1960-01-03");
params.put("custAddress", "杭州市文新地铁站"); params.put("custAddress", "杭州市文新地铁站");
params.put("followWeight", 1); params.put("followWeight", 1);
......
...@@ -259,6 +259,16 @@ public class BasicConfig { ...@@ -259,6 +259,16 @@ public class BasicConfig {
public static final String WORK_deptDel= WORK_HOST + "/kjy/oto/manager/dept/delete"; public static final String WORK_deptDel= WORK_HOST + "/kjy/oto/manager/dept/delete";
public static final String WORK_batchAddSeller= WORK_HOST + "/kjy/oto/manager/dept/batchAddSeller"; public static final String WORK_batchAddSeller= WORK_HOST + "/kjy/oto/manager/dept/batchAddSeller";
//**************************资料配置***************************
public static final String WORK_formList= WORK_HOST + "/kjy/oto/customer/form/list";
public static final String WORK_formSave= WORK_HOST + "/kjy/oto/customer/form/saveForm";
public static final String WORK_formStatus= WORK_HOST + "/kjy/oto/customer/form/formStatus";
public static final String WORK_saveFormDetail= WORK_HOST + "/kjy/oto/customer/form/saveFormDetail";
public static final String WORK_formSubmit = WORK_HOST + "/kjy/oto/customer/form/submit";
public static final String WORK_formDetail= WORK_HOST + "/kjy/oto/customer/form/detail";
public static final String WORK_custDetail= WORK_HOST + "/kjy/oto/customer/form/custDetail";
public static final String WORK_formOrder= WORK_HOST + "/kjy/oto/customer/form/order";
//**************************客户管理*************************** //**************************客户管理***************************
public static final String WORK_MNG_custSourceList = WORK_HOST + "/kjy/oto/mng/common/custFromSourceList"; public static final String WORK_MNG_custSourceList = WORK_HOST + "/kjy/oto/mng/common/custFromSourceList";
public static final String WORK_MNG_customerList = WORK_HOST + "/kjy/oto/mng/pub/form/customer/list/v2"; public static final String WORK_MNG_customerList = WORK_HOST + "/kjy/oto/mng/pub/form/customer/list/v2";
......
...@@ -214,4 +214,14 @@ public class BaseUtils { ...@@ -214,4 +214,14 @@ public class BaseUtils {
System.out.println("久久保cookie中的key:"+JJBManagerCookieKey +",values:"+JJBManagerCookieValue); System.out.println("久久保cookie中的key:"+JJBManagerCookieKey +",values:"+JJBManagerCookieValue);
} }
public static String randomCode() {
StringBuilder sb = new StringBuilder();
for (int i = 0;i < 4;i++){
sb.append((char) (Math.random()*26+97));
}
String code = sb.toString();
System.out.println("随机码 :"+code);
return code;
}
} }
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
</classes> </classes>
</test> </test>
<test preserve-order="true" name="PC_客户资料配置">
<classes>
<class name="com.oto.cases.otoseller.FormSubmit"/>
</classes>
</test>
<test preserve-order="true" name="PC_邀约承诺"> <test preserve-order="true" name="PC_邀约承诺">
<classes> <classes>
<class name="com.oto.cases.otoseller.Invite"/> <class name="com.oto.cases.otoseller.Invite"/>
...@@ -37,11 +43,11 @@ ...@@ -37,11 +43,11 @@
</classes> </classes>
</test> </test>
<!-- <test preserve-order="true" name="久久保人管系统">--> <test preserve-order="true" name="久久保人管系统">
<!-- <classes>--> <classes>
<!-- <class name="com.oto.cases.otoseller.JiuJiuBao"/>--> <class name="com.oto.cases.otoseller.JiuJiuBao"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
</suite> </suite>
<!-- 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