Commit 727b319d authored by xiamengchen's avatar xiamengchen

直播中测试覆盖

parent e67c0126
......@@ -238,7 +238,7 @@ public class LiveLater implements Authorization {
List<GrabWelfares>list=JsonUtil.parseResponseToListBean(response,GrabWelfares.class,"grabWelfares");
Boolean specifyAward =list.get(0).getSpecifyAward();
Assert.assertTrue(specifyAward,network.message(params, BasicConfig.MOBILE_getClueDetail, "指定中奖为null", response.body().asString()));
List<Map<String, Object>> evaLists = response.jsonPath().getList("evaluationResources");
List<Map<String, Object>> evaLists = response.jsonPath().getList("data.evaluationResources");
System.out.println("evaLists: "+evaLists);
Assert.assertEquals(evaLists.size(), 1, network.message(params, BasicConfig.MOBILE_getClueDetail, "用户参与测试数量错误", response.body().asString()));
String evaTitle = (String) evaLists.get(0).get("resourceTitle");
......
package com.kjj.cases.live.anchor;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.liveConfig.LiveMaterial;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
......@@ -8,6 +9,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
......@@ -33,6 +35,24 @@ public class CloseLive implements Authorization {
}
@Test(description = "删除权益", priority = 2)
public void 删除权益() {
for (int resourceId : Arrays.asList(LiveMaterial.resourceId, LiveMaterial.termResourceId, LiveMaterial.freeResourceId, LiveMaterial.picResourceId)){
System.out.println(resourceId);
Map<String, Object> delResourceParam = new HashMap<>();
delResourceParam.put("id", resourceId);
Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
try {
boolean data = delResourceRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除权益失败", delResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(delResourceParam, BasicConfig.MANAGER_delResource, "获取数据失败", delResourceRes.body().asString()));
}
}
}
......
......@@ -26,9 +26,9 @@ public class LiveVisitors implements Authorization
public String confId_form;
public String confId_link;
public String confId_free;
public String confId_eva;
public String confId_formWithEva;
public String confId_freeWithEva;
public static String confId_eva;
public static String confId_formWithEva;
public static String confId_freeWithEva;
public String encodeEvaluationId;
public String id;
public List<ResourcePushList>PushList;
......@@ -82,24 +82,24 @@ public class LiveVisitors implements Authorization
LiveVisitor one = liveVisitors.get(0);
System.out.println(one.getConfId());
confId_imageText=one.getConfId();
LiveVisitor two = liveVisitors.get(3);
LiveVisitor two = liveVisitors.get(2);
System.out.println(two.getConfId());
confId_free=two.getConfId();
LiveVisitor three = liveVisitors.get(4);
LiveVisitor three = liveVisitors.get(3);
System.out.println(three.getConfId());
confId_form=three.getConfId();
LiveVisitor five = liveVisitors.get(5);
LiveVisitor five = liveVisitors.get(4);
System.out.println(five.getConfId());
confId_link=five.getConfId();
LiveVisitor seven = liveVisitors.get(7);
LiveVisitor seven = liveVisitors.get(6);
String evaId = seven.getEvaluationId();
Assert.assertEquals(evaId, encodeEvaluationId, network.message(params, BasicConfig.MOBILE_Resource, "测试权益关联测试ID错误", response.body().asString()));
confId_eva = seven.getConfId();
LiveVisitor eight = liveVisitors.get(8);
LiveVisitor eight = liveVisitors.get(7);
String evaId2 = eight.getEvaluationId();
Assert.assertEquals(evaId2, encodeEvaluationId, network.message(params, BasicConfig.MOBILE_Resource, "关联测试表单权益关联测试ID错误", response.body().asString()));
confId_formWithEva = eight.getConfId();
LiveVisitor nine = liveVisitors.get(9);
LiveVisitor nine = liveVisitors.get(8);
String evaId3 = nine.getEvaluationId();
Assert.assertEquals(evaId3, encodeEvaluationId, network.message(params, BasicConfig.MOBILE_Resource, "关联测试免费领权益关联测试ID错误", response.body().asString()));
confId_freeWithEva = nine.getConfId();
......@@ -309,9 +309,34 @@ public class LiveVisitors implements Authorization
}
}
@Test(description = "访客端获取关联测试表单权益详情", priority = 16)
@Test(description = "访客领取关联测试表单", priority = 16)
public void 访客领取关联测试表单() {
visitorAuth();
ResourceForm list = 访客端系统表单资料查询();
Map<String, Object> params = new HashMap<>();
params.put("confId", confId_formWithEva);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<ResourceForm.FieldList> fieldList = list.getFieldList();
List<JSONObject> fieldListparam = new ArrayList<>();
JSONObject one = new JSONObject();
one.put("fieldId", fieldList.get(0).getFieldId());
one.put("fieldValue","啦啦啦");
JSONObject two = new JSONObject();
two.put("fieldId", fieldList.get(1).getFieldId());
two.put("fieldValue","152588101691");
fieldListparam.add(one);
fieldListparam.add(two);
params.put("fieldList", fieldListparam);
System.out.println(JSONObject.toJSONString(params));
Response response = network.postResponse(params, BasicConfig.MOBILE_FormSubmit);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.MOBILE_FormSubmit,"提交表单资料失败",response.body().asString()));
}
@Test(description = "访客端获取关联测试表单权益详情", priority = 17)
public void 访客端获取关联测试表单权益详情() {
ThreadSleepUtils.sleep(2000);
visitorAuth();
Map<String, Object> params = new HashMap<>();
params.put("confId",confId_formWithEva);
......@@ -329,7 +354,7 @@ public class LiveVisitors implements Authorization
}
}
@Test(description = "访客端获取关联测试免费领权益详情", priority = 17)
@Test(description = "访客端获取关联测试免费领权益详情", priority = 18)
public void 访客端获取关联测试免费领权益详情() {
visitorAuth();
Map<String, Object> params = new HashMap<>();
......@@ -350,7 +375,7 @@ public class LiveVisitors implements Authorization
}
@Test(description = "领取关联测试免费领", priority = 18)
@Test(description = "领取关联测试免费领", priority = 19)
public void 领取关联测试免费领() {
visitorAuth();
Map<String, Object> params = new HashMap<>();
......@@ -364,7 +389,7 @@ public class LiveVisitors implements Authorization
}
/*访客端链接小程序资料-查询*/
@Test(description = "访客端链接资料查询", priority = 19)
@Test(description = "访客端链接资料查询", priority = 20)
public void 访客端链接小程序资料查询()
{
visitorAuth();
......@@ -378,7 +403,7 @@ public class LiveVisitors implements Authorization
}
/*访客端链接资料资料-领取*/
@Test(description = "访客端链接资料领取", priority = 20)
@Test(description = "访客端链接资料领取", priority = 21)
public void 访客端链接小程序资料领取()
{
visitorAuth();
......@@ -391,7 +416,7 @@ public class LiveVisitors implements Authorization
}
/*代理人端权益列表查询*/
@Test(description = "代理人端权益列表查询", priority = 21)
@Test(description = "代理人端权益列表查询", priority = 22)
public void 代理人端权益列表查询()
{
agentAuth();
......@@ -405,7 +430,7 @@ public class LiveVisitors implements Authorization
}
//代理人端图文资料查询
@Test(description = "代理人端图文资料查询", priority = 22)
@Test(description = "代理人端图文资料查询", priority = 23)
public void 代理人端图文资料查询()
{
agentAuth();
......@@ -419,7 +444,7 @@ public class LiveVisitors implements Authorization
}
//代理人端表单资料查询
@Test(description = "代理人端表单资料查询", priority = 23)
@Test(description = "代理人端表单资料查询", priority = 24)
public ResourceForm 代理人端表单资料查询()
{
agentAuth();
......@@ -433,7 +458,7 @@ public class LiveVisitors implements Authorization
}
/*代理人端免费领资料-查询*/
@Test(description = "代理人端免费领资料查询", priority = 24)
@Test(description = "代理人端免费领资料查询", priority = 25)
public void 代理人端免费领资料查询()
{
agentAuth();
......@@ -447,7 +472,7 @@ public class LiveVisitors implements Authorization
}
//代理人端小程序链接资料查询
@Test(description = "代理人端小程序链接资料查询", priority = 25)
@Test(description = "代理人端小程序链接资料查询", priority = 26)
public void 代理人端小程序链接资料查询()
{
agentAuth();
......@@ -461,7 +486,7 @@ public class LiveVisitors implements Authorization
}
//助播端编辑权益
@Test(description = "助播端编辑权益", priority = 26)
@Test(description = "助播端编辑权益", priority = 27)
public void 助播端编辑权益()
{
adminAuth();
......@@ -474,7 +499,7 @@ public class LiveVisitors implements Authorization
Assert.assertNotNull(list, network.message(params, BasicConfig.MOBILE_ResourceEdit, "编辑主播端权益列表失败", response.body().asString()));
}
@Test(description = "上架贴片", priority = 27)
@Test(description = "上架贴片", priority = 28)
public void 上架贴片()
{
adminAuth();
......@@ -487,7 +512,7 @@ public class LiveVisitors implements Authorization
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_pasterOn, "贴片上架失败", response.body().asString()));
}
@Test(description = "获取推送列表", priority = 28)
@Test(description = "获取推送列表", priority = 29)
public void 获取推送列表()
{
adminAuth();
......@@ -498,13 +523,13 @@ public class LiveVisitors implements Authorization
Response response = network.getResponse(params, BasicConfig.MOBILE_ResourceList);
List<LiveVisitor> liveVisitors = JsonUtil.parseResponseToListBean(response, LiveVisitor.class);
System.out.println(liveVisitors);
LiveVisitor form = liveVisitors.get(5);
LiveVisitor form = liveVisitors.get(4);
boolean isHasConfPaster=form.isHasConfPaster();
System.out.println(response.body().asString());
Assert.assertTrue(isHasConfPaster, network.message(params, BasicConfig.MOBILE_ResourceList, "获取列表失败", response.body().asString()));
}
@Test(description = "访客获取贴片信息", priority = 29)
@Test(description = "访客获取贴片信息", priority = 30)
public void 访客获取贴片信息()
{
ThreadSleepUtils.sleep(1000);
......@@ -516,7 +541,7 @@ public class LiveVisitors implements Authorization
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_pasterInfo, "访客未获取到贴片信息", response.body().asString()));
}
@Test(description = "贴片下架", priority = 30)
@Test(description = "贴片下架", priority = 31)
public void 贴片下架()
{
adminAuth();
......@@ -533,7 +558,7 @@ public class LiveVisitors implements Authorization
* 资料-我要咨询
*/
@Test(description = "资料咨询时客户标记同意", priority =31)
@Test(description = "资料咨询时客户标记同意", priority =32)
public void 资料咨询时客户标记同意() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -548,7 +573,7 @@ public class LiveVisitors implements Authorization
}
@Test(description = "获取访客跟进机会同意状态", priority =32)
@Test(description = "获取访客跟进机会同意状态", priority =33)
public void 获取访客跟进机会同意状态() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -561,7 +586,7 @@ public class LiveVisitors implements Authorization
}
@Test(description = "访客端获取直播间实时数据", priority = 33)
@Test(description = "访客端获取直播间实时数据", priority = 34)
public void 访客端获取直播间实时数据(){
Map<String, Object> clueInfoDataPar = new HashMap<>();
clueInfoDataPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
......@@ -2,6 +2,8 @@ package com.kjj.cases.live.customer;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.agent.Agent;
import com.kjj.cases.live.anchor.LiveVisitors;
import com.kjj.cases.live.liveConfig.LiveMaterial;
import com.kjj.cases.live.lottery.Lottery;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
......@@ -9,9 +11,9 @@ import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
public class AfterLive implements Authorization {
......@@ -61,4 +63,26 @@ public class AfterLive implements Authorization {
Object syntheticAvatar = response.jsonPath().getJsonObject("data.syntheticAvatar");
Assert.assertNotNull(syntheticAvatar, network.message(params, BasicConfig.USER_getAgentQrCode, "轮训代理人二维码失败", response.body().asString()));
}
@Test(description = "直播结束资料列表过滤关联测试资料", priority = 4)
public void 直播结束资料列表过滤关联测试资料() {
Map<String, Object> getResourceListPar = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response getResourceListRes = network.getResponse(params, BasicConfig.MOBILE_resourceList);
try {
List<Map<String, Object>> resourceLists = getResourceListRes.jsonPath().getList("data");
List<String> allResource = new ArrayList<>();
for (Map<String, Object> resource : resourceLists){
allResource.add(String.valueOf(resource.get("confId")));
}
List<String> with_outList = Lists.newArrayList(LiveVisitors.confId_eva, LiveVisitors.confId_formWithEva, LiveVisitors.confId_freeWithEva);
System.out.println("withoutList: "+with_outList);
for (String confId : allResource){
Assert.assertFalse(with_outList.contains(confId), network.message(params, BasicConfig.MOBILE_resourceList, "关联测试的资料未被过滤", getResourceListRes.body().asString()));
}
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(params, BasicConfig.MOBILE_resourceList, "获取数据失败", getResourceListRes.body().asString()));
}
}
}
......@@ -70,21 +70,13 @@ public class PersonalPage implements Authorization {
List<ResourceList> resourceLists = JsonUtil.parseResponseToPageBean(response, ResourceList.class);
ResourceList resourceList = resourceLists.get(0);
sourceRecordId = resourceList.getRecordId();
Assert.assertEquals(sourceRecordId, LiveVisitors.resourceReceiveRecordId, network.message(params, BasicConfig.USER_resourceList, "资料领取记录id不正确", response.body().asString()));
Assert.assertEquals(sourceRecordId, LiveVisitors.freeForEvaReceiveRecordId, network.message(params, BasicConfig.USER_resourceList, "资料领取记录id不正确", response.body().asString()));
String liveId = resourceList.getLiveId();
Assert.assertEquals(liveId, LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_resourceList, "资料领取直播id不正确", response.body().asString()));
try {
for (ResourceList resourceList1 : resourceLists){
if (resourceList1.getLiveId().equals(LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()))){
Assert.assertNotEquals(resourceList1.getRecordId(), LiveVisitors.freeForEvaReceiveRecordId, network.message(params, BasicConfig.USER_resourceList, "关联测试的资料未被过滤", response.body().asString()));
}else {break;}
}
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(params, BasicConfig.USER_resourceList, "获取数据失败", response.body().asString()));
}
companyName = resourceList.getCompanyName(); // 获取领取资料的公司名称
System.out.println(companyName);
}
@Test(description = "获取访客最近观看的公司", priority = 6)
......@@ -93,7 +85,9 @@ public class PersonalPage implements Authorization {
// 管理后台根据公司名称查询公司id
Map<String, Object> searchCompanyPar = new HashMap<>();
searchCompanyPar.put("companyName", companyName);
System.out.println(searchCompanyPar);
Response searchCompanyRes = network.getResponse(searchCompanyPar, BasicConfig.MANAGER_searchCompany);
System.out.println(searchCompanyRes.body().asString());
Assert.assertTrue(searchCompanyRes.jsonPath().getBoolean("success"), network.message(searchCompanyPar, BasicConfig.MANAGER_searchCompany, "接口调用失败", searchCompanyRes.body().asString()));
long companyId = searchCompanyRes.jsonPath().getInt("data[0].id");
// 加密公司id
......
......@@ -32,14 +32,14 @@ public class EvaluationConf implements Authorization {
addEvaResourcePar.put("resourceTitle", "编辑后测试权益标题");
addEvaResourcePar.put("resourceType", 23);
Response addEvaResourceRes = network.postResponse(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource);
System.out.println(addEvaResourceRes.body().asString());
// try {
// boolean data = addEvaResourceRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
// }catch (NullPointerException e){
// e.printStackTrace();
// Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
// }
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
}
// 表单
Map<String, Object> formParam = new HashMap<>();
......@@ -53,7 +53,14 @@ public class EvaluationConf implements Authorization {
formParam.put("formBanner", "https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg");
formParam.put("fieldIds", "1,2");
Response formRes = network.postResponse(formParam, BasicConfig.MANAGER_saveForm);
System.out.println(formRes.body().asString());
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
}
// 免费领
Map<String, Object> freeParam = new HashMap<>();
......@@ -66,7 +73,14 @@ public class EvaluationConf implements Authorization {
freeParam.put("resourceImg", "https://yun.dui88.com/kjy/image/20210306/1615033315608.jpeg");
freeParam.put("resourcePictures", "https://yun.dui88.com/kjy/image/20210306/1615039670425.jpg");
Response FreeRes = network.postResponse(freeParam, BasicConfig.MANAGER_saveFree);
System.out.println(FreeRes.body().asString());
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
}
// 图文
Map<String, Object> Params = new HashMap<>();
......@@ -79,27 +93,16 @@ public class EvaluationConf implements Authorization {
Params.put("resourcePictures", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
Params.put("resourcePicturesArr", "https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg");
Response response = network.postResponse(Params, BasicConfig.MANAGER_resource);
System.out.println(response.body().asString());
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
}
}
// @Test(description = "删除权益", priority = 2)
// public void 删除权益() {
// for (int resourceId : Arrays.asList(LiveMaterial.resourceId, LiveMaterial.termResourceId, LiveMaterial.freeResourceId, LiveMaterial.picResourceId)){
// System.out.println(resourceId);
// Map<String, Object> delResourceParam = new HashMap<>();
// delResourceParam.put("id", resourceId);
// Response delResourceRes = network.postResponse(delResourceParam, BasicConfig.MANAGER_delResource);
// try {
// boolean data = delResourceRes.jsonPath().getBoolean("data");
// System.out.println(data);
// Assert.assertTrue(data, network.message(delResourceParam, BasicConfig.MANAGER_delResource, "删除权益失败", delResourceRes.body().asString()));
// }catch (NullPointerException e){
// e.printStackTrace();
// Assert.fail(network.message(delResourceParam, BasicConfig.MANAGER_delResource, "获取数据失败", delResourceRes.body().asString()));
// }
// }
// }
......
......@@ -6,9 +6,11 @@ import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.poi.ss.formula.functions.Na;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import java.util.*;
......@@ -18,9 +20,9 @@ public class LiveMaterial implements Authorization {
private final long companyId = 101;
public static long evaluationId; // 测试id
public static int resourceId; // 测试权益ID
public static Integer termResourceId = null; // 关联测试表单权益ID
public static Integer freeResourceId = null; // 关联测试免费领权益ID
public static Integer picResourceId = null; // 关联测试图文权益ID
public static int termResourceId; // 关联测试表单权益ID
public static int freeResourceId; // 关联测试免费领权益ID
public static int picResourceId; // 关联测试图文权益ID
@BeforeClass
public void setUp() {
......@@ -336,6 +338,7 @@ public class LiveMaterial implements Authorization {
e.printStackTrace();
Assert.fail(network.message(evaEnablePar, BasicConfig.MANAGER_evaluation_enable, "获取数据失败", evaEnableRes.body().asString()));
}
System.out.println("启用的测试ID" + evaluationId);
}
/**
......@@ -619,6 +622,8 @@ public class LiveMaterial implements Authorization {
e.printStackTrace();
Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
}
System.out.println("测试权益关联测试ID: "+evaluationId);
}
@Test(description = "测试权益详情", priority = 31)
......@@ -849,22 +854,44 @@ public class LiveMaterial implements Authorization {
Response resourceListRes = network.getResponse(resourceListPar, BasicConfig.MANAGER_resourceList);
try {
List<Map<String, Object>> resourceList = resourceListRes.jsonPath().getList("data.list");
List<Map<String, Object>> term = new ArrayList<>();
List<Map<String, Object>> free = new ArrayList<>();
List<Map<String, Object>> pic = new ArrayList<>();
for (Map<String, Object> resource : resourceList){
// 找到表单
if (resource.get("resourceType").equals(12)){
if (resource.get("resourceTitle").equals("表单关联测试")){
termResourceId = (int)resource.get("id");
term.add(resource);
}
}else if (resource.get("resourceType").equals(11)){
if (resource.get("resourceTitle").equals("免费领关联测试")){
freeResourceId = (int) resource.get("id");
free.add(resource);
}
}else if (resource.get("resourceType").equals(1)){
if (resource.get("resourceTitle").equals("图文关联测试")){
picResourceId = (int) resource.get("id");
pic.add(resource);
}
}
}
int max = 0;
for (Map<String, Object> t : term){
int id = (int)t.get("id");
if (id >= max){max = id;}
}
termResourceId = max;
max = 0;
for (Map<String, Object> f : free){
int id = (int) f.get("id");
if (id >= max){max = id;}
}
freeResourceId = max;
max = 0;
for (Map<String, Object> p : pic){
int id = (int) p.get("id");
if (id >= max){max = id;}
}
picResourceId = max;
Assert.assertNotNull(termResourceId, network.message(resourceListPar, BasicConfig.MANAGER_resourceList, "未获取到表单权益ID", resourceListRes.body().asString()));
Assert.assertNotNull(freeResourceId, network.message(resourceListPar, BasicConfig.MANAGER_resourceList, "未获取到表单权益ID", resourceListRes.body().asString()));
}catch (NullPointerException e){
......
......@@ -68,7 +68,6 @@ public class Lottery implements Authorization {
Assert.assertTrue(success, network.message(connectSuccessParam, BasicConfig.USER_connectSuccess, "访客到场请求失败", response.body().asString()));
}
@Test(description = "访客A抽奖查询抽奖活动弹层", priority = 5)
public void 访客A抽奖查询抽奖活动弹层() {
visitorAuth();
......@@ -1475,6 +1474,5 @@ public class Lottery implements Authorization {
}
}
......@@ -173,12 +173,8 @@ public class SecondKill implements Authorization {
goodsOnPar.put("id", ConfSecondKill.skIdSecond);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
try {
boolean success = goodsOnRes.jsonPath().getBoolean("success");
if (success){
Assert.fail(network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "同时上架多轮秒杀成功", goodsOnRes.body().asString()));
}
String code = goodsOnRes.jsonPath().getString("code");
Assert.assertEquals(code, "07230005", network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "失败原因错误", goodsOnRes.body().asString()));
boolean data = goodsOnRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "上架第二轮秒杀失败", goodsOnRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "未获取到数据", goodsOnRes.body().asString()));
......@@ -192,9 +188,10 @@ public class SecondKill implements Authorization {
Map<String, Object> goodsFirstPar = new HashMap<>();
goodsFirstPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response goodsFirstRes = network.getResponse(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst);
System.out.println(goodsFirstRes.body().asString());
try {
String confId = goodsFirstRes.jsonPath().getString("data.confId");
Assert.assertEquals(confId, ConfSecondKill.skIdFirst, network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "当前秒杀商品配置ID错误", goodsFirstRes.body().asString()));
Assert.assertEquals(confId, ConfSecondKill.skIdSecond, network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "当前秒杀商品配置ID错误", goodsFirstRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst, "未获取到数据", goodsFirstRes.body().asString()));
......
......@@ -5,6 +5,7 @@ import com.kjj.bean.manager.RedList;
import com.kjj.bean.red.RedConf;
import com.kjj.bean.resources.ResourceForm;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.liveConfig.LiveMaterial;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
......@@ -544,6 +545,9 @@ public class TimeRed implements Authorization {
ids.add(new Material(359L,0));
ids.add(new Material(960L,0));
ids.add(new Material(3384L,0));
ids.add(new Material(LiveMaterial.resourceId, 0)); // 直播添加测试权益资料
ids.add(new Material(LiveMaterial.termResourceId, 0)); // 直播添加表单关联测试权益
ids.add(new Material(LiveMaterial.freeResourceId, 0)); // 直播添加免费领关联测试权益
Params.put("resourceList", ids);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_8);
System.out.println(Params);
......
......@@ -548,6 +548,7 @@ public class BasicConfig {
public static final String MOBILE_getShortUrl = MOBILE_HOST + "/kjy/live/share/short/getShortUrl";
public static final String MOBILE_evaluationDetail = MOBILE_HOST + "/clue/evaluation/detail";
public static final String MOBILE_evaluationSubmit = MOBILE_HOST + "/clue/evaluation/submit";
public static final String MOBILE_resourceList = MOBILE_HOST + "/kjy/live/resource/list";
//投票
......
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