Commit e4f9ceae authored by 龚小红's avatar 龚小红

Merge branch 'feature/20210823-xmc' into 'master'

Feature/20210823 xmc-fix客户线索校验

See merge request test-group/kejiji!106
parents d70f90d8 31ab6db0
package com.kjj.bean.secondKill;
import lombok.Data;
@Data
public class KillGoodsList {
private String goodsTitle;
private long id;
}
package com.kjj.bean.secondKill;
import lombok.Data;
@Data
public class SecondKillList {
private long goodsId;
private int goodsAmount;
private String goodsTitle;
private int interactNum;
private int surplusNum;
private long id;
private int ableAgent;
}
...@@ -21,7 +21,6 @@ public class MyCustomer implements Authorization { ...@@ -21,7 +21,6 @@ public class MyCustomer implements Authorization {
private String createTagId; private String createTagId;
private long visitor1UserId; private long visitor1UserId;
private String sessionId; private String sessionId;
private int visitCount; // 二度访客来访次数
private String id; // 自定义提醒事项id private String id; // 自定义提醒事项id
private long lastMessageId; private long lastMessageId;
...@@ -138,8 +137,6 @@ public class MyCustomer implements Authorization { ...@@ -138,8 +137,6 @@ public class MyCustomer implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
long userId = response.jsonPath().getLong("data.list[0].userId"); long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString())); Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString()));
visitCount = response.jsonPath().getInt("data.list[0].visitCount");
} }
// 我的客户首页_获取全部客户列表_按照访问次数排列 // 我的客户首页_获取全部客户列表_按照访问次数排列
...@@ -377,7 +374,7 @@ public class MyCustomer implements Authorization { ...@@ -377,7 +374,7 @@ public class MyCustomer implements Authorization {
response = network.getResponse(param, BasicConfig.CUSTSTATISTIC); response = network.getResponse(param, BasicConfig.CUSTSTATISTIC);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTSTATISTIC, "接口请求失败", response.body().asString()));
int visitCountHere = response.jsonPath().getInt("data.visitCount"); int visitCountHere = response.jsonPath().getInt("data.visitCount");
Assert.assertEquals(visitCountHere, visitCount, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString())); Assert.assertEquals(visitCountHere, ForwardAndRead.custClueStatistics.get("visitCount") + 1, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString()));
} }
// 客户详情页_阅读偏好 // 客户详情页_阅读偏好
...@@ -446,10 +443,17 @@ public class MyCustomer implements Authorization { ...@@ -446,10 +443,17 @@ public class MyCustomer implements Authorization {
param = new HashMap<>(); param = new HashMap<>();
param.put("custUserId", visitor1UserId); param.put("custUserId", visitor1UserId);
param.put("pageIndex", 1); param.put("pageIndex", 1);
param.put("paheSize", 30); param.put("pageSize", 30);
response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD); response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD);
int totalCount = response.jsonPath().getInt("data.custVisitList.totalCount"); String contentId;
Assert.assertEquals(totalCount, visitCount, network.message(param, BasicConfig.CONTENTVISITRECORD, "访问记录总数与来访次数不符", response.body().asString())); try {
contentId = response.jsonPath().getString("data.custVisitList.list[0].contentId");
}catch (NullPointerException e){
System.out.println(response.body().asString());
e.printStackTrace();
return;
}
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param, BasicConfig.CONTENTVISITRECORD, "最新访问记录素材ID错误", response.body().asString()));
} }
// 客户详情页_关键线索_提交资料 // 客户详情页_关键线索_提交资料
......
...@@ -4,6 +4,7 @@ import com.kjj.bean.manager.VoteBean; ...@@ -4,6 +4,7 @@ import com.kjj.bean.manager.VoteBean;
import com.kjj.bean.manager.VoteListBean; import com.kjj.bean.manager.VoteListBean;
import com.kjj.bean.manager.WelfareBean; import com.kjj.bean.manager.WelfareBean;
import com.kjj.bean.manager.WelfareListBean; import com.kjj.bean.manager.WelfareListBean;
import com.kjj.bean.secondKill.KillGoodsList;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
...@@ -16,6 +17,16 @@ import org.testng.annotations.Test; ...@@ -16,6 +17,16 @@ import org.testng.annotations.Test;
import java.util.*; import java.util.*;
public class LiveMaterial implements Authorization { public class LiveMaterial implements Authorization {
private final String killGoodsImg = "https://yun.dui88.com/kjy/image/20210818/1629269441692.jpeg";
private final String killGoodsHeadImg = "https://yun.dui88.com/kjy/image/20210818/1629269453038.jpeg";
private final String killGoodsPicture = "https://yun.dui88.com/kjy/image/20210818/1629269488947.jpeg";
private final long companyId = 101; // 直播公司ID
private final String newGoodsTitle = "秒杀商品1";
private long skGoodsId; // 秒杀商品id
private int pageNum; // 秒杀商品分页数
private int goodsCount; // 当前页面商品数量
public static String skGoodsTitle = "编辑秒杀商品"; //秒杀商品名称
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
...@@ -352,5 +363,114 @@ public class LiveMaterial implements Authorization { ...@@ -352,5 +363,114 @@ public class LiveMaterial implements Authorization {
} }
// 配置公司秒杀商品
@Test(description = "添加秒杀商品", priority = 15)
public void 添加秒杀商品() {
List<String> killGoodsHeadImgs = new ArrayList<>();
List<String> killGoodsPictures = new ArrayList<>();
killGoodsHeadImgs.add(killGoodsHeadImg);
killGoodsPictures.add(killGoodsPicture);
Map<String, Object> killGoodsPar = new HashMap<>();
killGoodsPar.put("goodsImg", killGoodsImg);
killGoodsPar.put("goodsHeadImg", killGoodsHeadImgs);
killGoodsPar.put("goodsPictures", killGoodsPictures);
killGoodsPar.put("companyId", companyId);
killGoodsPar.put("goodsTitle", newGoodsTitle);
killGoodsPar.put("goodsExplain", "文字说明");
Response killGoodsRes = network.postResponse(killGoodsPar, BasicConfig.MANAGER_skGoodsSaveOrUpdate);
Assert.assertTrue(killGoodsRes.jsonPath().getBoolean("success"));
boolean data = killGoodsRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(killGoodsPar, BasicConfig.MANAGER_skGoodsSaveOrUpdate, "添加秒杀商品失败", killGoodsRes.body().asString()));
}
@Test(description = "获取秒杀商品列表", priority = 16)
public void 获取秒杀商品列表() {
Map<String, Object> skGoodsListsPar = new HashMap<>();
skGoodsListsPar.put("companyId", companyId); // 默认pageSize=20,pageNo=1
try {
Response skGoodsListsRes = network.getResponse(skGoodsListsPar, BasicConfig.MANAGER_skGoodsLists);
long totalCount = skGoodsListsRes.jsonPath().getLong("data.totalCount");
if (totalCount > 20){
pageNum = (int) totalCount / 20 + 1;
skGoodsListsPar.put("pageSize", 20);
skGoodsListsPar.put("pageNo", pageNum);
System.out.println();
skGoodsListsRes = network.getResponse(skGoodsListsPar, BasicConfig.MANAGER_skGoodsLists);
}
List<KillGoodsList> killGoodsLists = JsonUtil.parseResponseToPageBean(skGoodsListsRes, KillGoodsList.class);
goodsCount = killGoodsLists.size();
KillGoodsList killGoodsList = killGoodsLists.get(0);
String goodsTitle = killGoodsList.getGoodsTitle();
Assert.assertEquals(goodsTitle, newGoodsTitle, network.message(skGoodsListsPar, BasicConfig.MANAGER_skGoodsLists, "新增商品错误", skGoodsListsRes.body().asString()));
skGoodsId = killGoodsList.getId();
}catch (Exception e){
e.printStackTrace();
}
}
@Test(description = "获取商品详情", priority = 17)
public void 获取商品详情() {
Map<String, Object> skGoodsDetailPar = new HashMap<>();
skGoodsDetailPar.put("id", skGoodsId);
Response skGoodsDetailRes = network.getResponse(skGoodsDetailPar, BasicConfig.MANAGER_skGoodsDetail);
long id = skGoodsDetailRes.jsonPath().getLong("data.companyId");
String goodsTitle = skGoodsDetailRes.jsonPath().getString("data.goodsTitle");
Assert.assertEquals(goodsTitle, newGoodsTitle, network.message(skGoodsDetailPar, BasicConfig.MANAGER_skGoodsDetail, "获取商品标题错误", skGoodsDetailRes.body().asString()));
Assert.assertEquals(id, companyId, network.message(skGoodsDetailPar, BasicConfig.MANAGER_skGoodsDetail, "获取商品所属公司id错误", skGoodsDetailRes.body().asString()));
}
@Test(description = "编辑秒杀商品", priority = 18)
public void 编辑秒杀商品() {
List<String> killGoodsHeadImgs = new ArrayList<>();
List<String> killGoodsPictures = new ArrayList<>();
killGoodsHeadImgs.add(killGoodsHeadImg);
killGoodsPictures.add(killGoodsPicture);
Map<String, Object> killGoodsPar = new HashMap<>();
killGoodsPar.put("id", skGoodsId);
killGoodsPar.put("goodsImg", killGoodsImg);
killGoodsPar.put("goodsHeadImg", killGoodsHeadImgs);
killGoodsPar.put("goodsPictures", killGoodsPictures);
killGoodsPar.put("companyId", companyId);
killGoodsPar.put("goodsTitle", skGoodsTitle);
killGoodsPar.put("goodsExplain", "文字说明");
Response killGoodsRes = network.postResponse(killGoodsPar, BasicConfig.MANAGER_skGoodsSaveOrUpdate);
try {
boolean data = killGoodsRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(killGoodsPar, BasicConfig.MANAGER_skGoodsSaveOrUpdate, "编辑秒杀商品失败", killGoodsRes.body().asString()));
Map<String, Object> skGoodsDetailPar = new HashMap<>();
skGoodsDetailPar.put("id", skGoodsId);
Response skGoodsDetailRes = network.getResponse(skGoodsDetailPar, BasicConfig.MANAGER_skGoodsDetail);
String goodsTitle = skGoodsDetailRes.jsonPath().getString("data.goodsTitle");
Assert.assertEquals(goodsTitle, skGoodsTitle, network.message(skGoodsDetailPar, BasicConfig.MANAGER_skGoodsDetail, "商品名称未更新", skGoodsDetailRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
@Test(description = "删除秒杀商品", priority = 19)
public void 删除秒杀商品() {
Map<String, Object> skGoodsDelPar = new HashMap<>();
skGoodsDelPar.put("id", skGoodsId);
Response skGoodsDelRes = network.postResponse(skGoodsDelPar, BasicConfig.MANAGER_skGoodsDelete);
boolean data = skGoodsDelRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(skGoodsDelPar, BasicConfig.MANAGER_skGoodsDelete, "删除商品失败", skGoodsDelRes.body().asString()));
if(goodsCount == 1){
pageNum = pageNum - 1;
}
Map<String, Object> skGoodsListsPar = new HashMap<>();
skGoodsListsPar.put("companyId", companyId);
skGoodsListsPar.put("pageSize", 20);
skGoodsListsPar.put("pageNo", pageNum);
Response skGoodsListsRes = network.getResponse(skGoodsListsPar, BasicConfig.MANAGER_skGoodsLists);
List<KillGoodsList> killGoodsLists = JsonUtil.parseResponseToPageBean(skGoodsListsRes, KillGoodsList.class);
for (KillGoodsList killGoodsList : killGoodsLists){
long id = killGoodsList.getId();
Assert.assertNotEquals(id, skGoodsId, network.message(skGoodsListsPar, BasicConfig.MANAGER_skGoodsLists, "被删除商品id仍存在于列表", skGoodsListsRes.body().asString()));
}
}
} }
...@@ -6,6 +6,7 @@ import com.kjj.bean.answer.AddWelfareConf; ...@@ -6,6 +6,7 @@ import com.kjj.bean.answer.AddWelfareConf;
import com.kjj.bean.answer.RewardList; import com.kjj.bean.answer.RewardList;
import com.kjj.bean.lottery.ConfIdList; import com.kjj.bean.lottery.ConfIdList;
import com.kjj.bean.manager.*; import com.kjj.bean.manager.*;
import com.kjj.bean.secondKill.SecondKillList;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants; import com.kjj.constants.LiveConstants;
...@@ -16,6 +17,7 @@ import com.kjj.utils.ThreadSleepUtils; ...@@ -16,6 +17,7 @@ import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.bson.json.JsonParseException;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -26,6 +28,8 @@ public class SaveLive implements Authorization { ...@@ -26,6 +28,8 @@ public class SaveLive implements Authorization {
public long welfareConfId; public long welfareConfId;
private Integer taskId; private Integer taskId;
public List<RedList> redId; public List<RedList> redId;
private long newSecKillId; // 新增秒杀id
private final long secKillGoodsId = 115; // 用来配置轮次的秒杀商品ID
@BeforeClass @BeforeClass
public void setUp() {BaseUtils.ssoLogin(); } public void setUp() {BaseUtils.ssoLogin(); }
...@@ -2340,6 +2344,96 @@ public class SaveLive implements Authorization { ...@@ -2340,6 +2344,96 @@ public class SaveLive implements Authorization {
Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_otherDetail, "查询第6轮时长红包详情失败", response.body().asString())); Assert.assertNotNull(data, network.message(Params, BasicConfig.MANAGER_otherDetail, "查询第6轮时长红包详情失败", response.body().asString()));
} }
/**
* 配置秒杀互动
*/
@Test(description = "添加秒杀互动", priority = 125)
public void 添加秒杀互动() {
Map<String, Object> secKillAddPar = new HashMap<>();
secKillAddPar.put("goodsId", secKillGoodsId);
secKillAddPar.put("goodsAmount", 1); // 1 == 0.01
secKillAddPar.put("interactNum", 3);
secKillAddPar.put("ableAgent", 0); // 代理人不可参与
secKillAddPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response secKillAddRes = network.postResponse(secKillAddPar, BasicConfig.MANAGER_secondKillSave);
try{
boolean data = secKillAddRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(secKillAddPar, BasicConfig.MANAGER_secondKillSave, "添加秒杀互动失败", secKillAddRes.body().asString()));
}catch (NullPointerException e){
System.out.println(secKillAddRes.body().asString());
e.printStackTrace();
Assert.fail(network.message(secKillAddPar, BasicConfig.MANAGER_secondKillSave, "获取数据失败", secKillAddRes.body().asString()));
}
}
@Test(description = "获取秒杀轮次列表", priority = 126)
public void 获取秒杀轮次列表() {
Map<String, Object> liveSecKillPar = new HashMap<>();
liveSecKillPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response liveSecKillRes = network.getResponse(liveSecKillPar, BasicConfig.MANAGER_secondKillLists);
List<SecondKillList> secondKillLists;
try {
secondKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, SecondKillList.class);
}catch (Exception e){
System.out.println(liveSecKillRes.body().asString());
e.printStackTrace();
return;
}
SecondKillList secondKillList = secondKillLists.get(0);
long goodsId = secondKillList.getGoodsId();
Assert.assertEquals(goodsId, secKillGoodsId, network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "商品id与实际添加的不符", liveSecKillRes.body().asString()));
int goodsAmount = secondKillList.getGoodsAmount();
Assert.assertEquals(goodsAmount, 1, network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "商品价格与实际添加的不符", liveSecKillRes.body().asString()));
String goodsTitle = secondKillList.getGoodsTitle();
Assert.assertEquals(goodsTitle, "自动化专用商品", network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "商品名称与实际添加的不符", liveSecKillRes.body().asString()));
int interactNum = secondKillList.getInteractNum();
Assert.assertEquals(interactNum, 3, network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "商品数量与实际添加的不符", liveSecKillRes.body().asString()));
int surplusNum = secondKillList.getSurplusNum();
Assert.assertEquals(surplusNum, 3, network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "商品剩余数量与实际不符", liveSecKillRes.body().asString()));
int ableAgent = secondKillList.getAbleAgent();
Assert.assertEquals(ableAgent, 0, network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "代理人参与限制与实际添加的不符", liveSecKillRes.body().asString()));
newSecKillId = secondKillList.getId();
}
@Test(description = "编辑秒杀轮次", priority = 127)
public void 编辑秒杀轮次() {
Map<String, Object> secKillUpdatePar = new HashMap<>();
secKillUpdatePar.put("goodsId", secKillGoodsId);
secKillUpdatePar.put("goodsAmount", 0.01);
secKillUpdatePar.put("interactNum", 1);
secKillUpdatePar.put("id", newSecKillId);
secKillUpdatePar.put("ableAgent", 0);
Response secKillUpdateRes = network.postResponse(secKillUpdatePar, BasicConfig.MANAGER_secondKillUpdate);
try{
boolean data = secKillUpdateRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(secKillUpdatePar, BasicConfig.MANAGER_secondKillUpdate, "编辑秒杀轮次失败", secKillUpdateRes.body().asString()));
}catch (NullPointerException e){
System.out.println(secKillUpdateRes.body().asString());
e.printStackTrace();
}
}
@Test(description = "删除秒杀轮次", priority = 128)
public void 删除秒杀轮次() {
Map<String, Object> secKillDelPar = new HashMap<>();
secKillDelPar.put("id", newSecKillId);
Response secKillDelRes = network.postResponse(secKillDelPar, BasicConfig.MANAGER_secondKillDel);
boolean data = secKillDelRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(secKillDelPar, BasicConfig.MANAGER_secondKillDel, "删除轮次失败", secKillDelRes.body().asString()));
Map<String, Object> liveSecKillPar = new HashMap<>();
liveSecKillPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response liveSecKillRes = network.getResponse(liveSecKillPar, BasicConfig.MANAGER_secondKillLists);
List<SecondKillList> secondKillLists = null;
try{
secondKillLists = JsonUtil.parseResponseToListBean(liveSecKillRes, SecondKillList.class);
}catch (NullPointerException e){
e.printStackTrace();
}
for (SecondKillList secondKillList : secondKillLists){
Assert.assertNotEquals(newSecKillId, secondKillList.getId(), network.message(liveSecKillPar, BasicConfig.MANAGER_secondKillLists, "被删除的轮次id还存在", liveSecKillRes.body().asString()));
}
}
} }
...@@ -127,6 +127,16 @@ public class BasicConfig { ...@@ -127,6 +127,16 @@ public class BasicConfig {
public static final String MOBILE_receiverOpen= MOBILE_HOST + "/kjy/live/fortune/receiver/open"; public static final String MOBILE_receiverOpen= MOBILE_HOST + "/kjy/live/fortune/receiver/open";
public static final String MOBILE_joinRecord= MOBILE_HOST + "/kjy/live/fortune/receiver/joinRecord"; public static final String MOBILE_joinRecord= MOBILE_HOST + "/kjy/live/fortune/receiver/joinRecord";
// *************** 秒杀互动 ***************
public static final String MANAGER_skGoodsSaveOrUpdate = MANAGER_HOST + "/kjy/manager/live/goods/saveOrUpdate";
public static final String MANAGER_skGoodsLists = MANAGER_HOST + "/kjy/manager/live/goods/list";
public static final String MANAGER_skGoodsDelete = MANAGER_HOST + "/kjy/manager/live/goods/delete";
public static final String MANAGER_skGoodsDetail = MANAGER_HOST + "/kjy/manager/live/goods/detail";
public static final String MANAGER_secondKillSave = MANAGER_HOST + "/kjy/manager/live/second/kill/goods/save";
public static final String MANAGER_secondKillLists = MANAGER_HOST + "/kjy/manager/live/second/kill/goods/list";
public static final String MANAGER_secondKillDel = MANAGER_HOST + "/kjy/manager/live/second/kill/goods/delete";
public static final String MANAGER_secondKillUpdate = MANAGER_HOST + "/kjy/manager/live/second/kill/goods/update";
// *************** 闯关答题 *************** // *************** 闯关答题 ***************
public static final String MANAGER_addOrUpdateQues = MANAGER_HOST + "/kjy/manager/pass/ques/addOrUpdateQues"; public static final String MANAGER_addOrUpdateQues = MANAGER_HOST + "/kjy/manager/pass/ques/addOrUpdateQues";
public static final String MANAGER_deleteQues = MANAGER_HOST + "/kjy/manager/pass/ques/deleteQues"; public static final String MANAGER_deleteQues = MANAGER_HOST + "/kjy/manager/pass/ques/deleteQues";
......
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