Commit b8d7bf77 authored by 张艳玲's avatar 张艳玲

Merge branch 'featrue/20210702-zhangyl' into 'master'

Featrue/20210702 zhangyl

See merge request test-group/kejiji!57
parents 3647d1da 646c5ee7
package com.kjj.bean.manager;
import lombok.Data;
@Data
public class PassQues {
private String optionDetail;
public Integer optionType;
private Integer id;
}
......@@ -3,6 +3,9 @@ package com.kjj.cases.basics;
import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -13,8 +16,8 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Article implements Authorization {
// private static final NetworkUtils network = NetworkUtils.getInstance();
public class Article {
private static final NetworkUtils network = NetworkUtils.getInstance();
public String sid; // 加密的销售ID
public String articleContentId; // 文章的contentId
public String scid; // getScid后的文章id
......@@ -23,8 +26,15 @@ public class Article implements Authorization {
@BeforeClass
public void setUp() {
agentTku();
userTku();
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku",AGENT_TKU);
System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
System.out.println("访客tku:"+VISITOR_TKU);
}
//文章内容页
......@@ -216,21 +226,12 @@ public class Article implements Authorization {
boolean isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertTrue(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"获取代理人日常精准素材个人专栏开关有误",response.body().asString()));
//关闭 代理人个人专栏开关
//开启 代理人个人专栏开关
Map<String, Object> configParams = new HashMap<String, Object>();
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",false);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
//再获取代理人个人专栏
response = network.getResponse(params,ARTICLE_GETENHANCEDCOLUMNCONFIG);
isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertFalse(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"获取代理人日常精准素材个人专栏开关有误",response.body().asString()));
//再次开启 代理人个人专栏开关
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",true);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
}
// 获取代理人个人专栏
......@@ -350,6 +351,7 @@ public class Article implements Authorization {
Assert.assertTrue(favourResult,network.message(likeParams,HASALREADYLIKE,"访客-头部名片点赞数量显示有误",response.body().asString()));
// 点赞名片
ThreadSleepUtils.sleep(500);
likeParams.put("visitTableId",visitId);
response =network.postResponse(likeParams,INTERACTION_LIKE);
boolean isLike = (response.jsonPath().getInt("data.favourTimes") - favourTimes) > 0;
......
package com.kjj.cases.basics;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -28,8 +29,7 @@ public class CircleFriends {
}
@Test(description="是否首次进入",priority = 1)
public void 是否首次进入() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
public void 是否首次进入() {
Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误",response.body().asString()));
......@@ -37,7 +37,7 @@ public class CircleFriends {
// tab列表 后端根据tku自行判断
@Test(description="获取tab列表",priority = 2)
public void 获取tab列表() throws IOException {
public void 获取tab列表() {
Response response = network.getResponse(FRIENDS_GETMATERIALTAGS);
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab
......@@ -55,7 +55,7 @@ public class CircleFriends {
contentId = response.jsonPath().getString("data[0].contentId"); //素材ID
tagId = response.jsonPath().getString("data[0].materialTag"); //素材频道ID
tagName = response.jsonPath().getString("data[0].tagName"); //素材频道名称
Assert.assertEquals(count,30,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
Assert.assertTrue(count>1,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
}
@Test(description="获取全部列表",priority = 4)
......@@ -80,8 +80,7 @@ public class CircleFriends {
Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误",response.body().asString()));
//延迟2秒,存入ES
Thread.sleep(2000);
ThreadSleepUtils.sleep(5000);
//重新获取未读列表
response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
List<String> contentList = response.jsonPath().getList("data.contentId");
......@@ -115,6 +114,7 @@ public class CircleFriends {
@Test(description="素材频道页",priority = 7)
public void 素材频道页() throws IOException {
//频道页 头部
ThreadSleepUtils.sleep(500);
Map<String, Object> params = new HashMap<String, Object>();
params.put("tagId",tagId);
Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL);
......
......@@ -60,7 +60,7 @@ public class Pay {
}
@Test (description = "默认付费_待支付",priority = 2)
public void 默认付费_待支付() throws IOException {
public void 默认付费_待支付() {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
......
......@@ -1733,8 +1733,140 @@ public class SaveLive implements Authorization {
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_redSwitchStatus, "开启攒现金红包配置失败", response.body().asString()));
}
/**
* 闯关答题
*/
@Test(description = "新增闯关答题配置", priority = 94)
public void 新增闯关答题配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("openTime",10);
List<PassQues> optionLists =new ArrayList<>();
PassQues optionList =new PassQues();
optionList.setOptionDetail("正确选项");
optionList.setOptionType(1);
optionLists.add(optionList);
PassQues optionList1 =new PassQues();
optionList1.setOptionDetail("错误选项");
optionList1.setOptionType(2);
optionLists.add(optionList1);
Params.put("optionList",optionLists);
Params.put("passQuestion","闯关答题配置");
Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateQues);
boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", response.body().asString()));
Map<String, Object> addPassParam = new HashMap<>();
addPassParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addPassParam.put("openTime",10);
List<PassQues> optionLists1 =new ArrayList<>();
PassQues optionList2 =new PassQues();
optionList2.setOptionDetail("正确选项");
optionList2.setOptionType(1);
optionLists1.add(optionList2);
PassQues optionList3 =new PassQues();
optionList3.setOptionDetail("错误选项");
optionList3.setOptionType(2);
optionLists1.add(optionList3);
addPassParam.put("optionList",optionLists1);
addPassParam.put("passQuestion","闯关答题配置");
Response passRes = network.postResponse(addPassParam, BasicConfig.MANAGER_addOrUpdateQues);
boolean data1 =passRes.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(addPassParam, BasicConfig.MANAGER_addOrUpdateQues, "新增闯关答题配置失败", passRes.body().asString()));
}
public List<PassQues> quesId;
@Test(description = "获取问题列表", priority = 95)
public void 获取问题列表() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_quesList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
List<PassQues> list=JsonUtil.parseResponseToListBean(response,PassQues.class);
this.quesId=list;
Assert.assertNotNull(list, network.message(Params, BasicConfig.MANAGER_quesList, "查询问题列表失败", response.body().asString()));
}
@Test(description = "获取问题详情", priority = 96)
public void 获取问题详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("quesId", this.quesId.get(0).getId());
Response response = network.getResponse(Params, BasicConfig.MANAGER_quesInfo);
int id = response.jsonPath().getInt("data.id");
System.out.println(id);
Assert.assertTrue(id==this.quesId.get(0).getId(), network.message(Params, BasicConfig.MANAGER_quesInfo, "获取问题详情失败", response.body().asString()));
}
@Test(description = "删除闯关答题配置", priority = 97)
public void 删除闯关答题配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("quesId", this.quesId.get(1).getId());
Response response = network.postResponse(Params, BasicConfig.MANAGER_deleteQues);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_deleteQues, "删除闯关答题配置失败", response.body().asString()));
}
@Test(description = "获取直播红包配置", priority = 98)
public void 获取直播红包配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_getSurplusAmount);
int data = response.jsonPath().getInt("data");
System.out.println(data);
Assert.assertTrue(data>0, network.message(Params, BasicConfig.MANAGER_getSurplusAmount, "获取直播红包配置失败", response.body().asString()));
}
@Test(description = "新增闯关红包配置", priority = 99)
public void 新增闯关红包配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("amount",1000);
Params.put("carveTime",1);
Params.put("showAmount",1000);
Response response = network.postResponse(Params, BasicConfig.MANAGER_addOrUpdateConf);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_addOrUpdateConf, "新增闯关红包配置失败", response.body().asString()));
}
public int redConfId;
@Test(description = "获取红包配置详情", priority = 100)
public void 获取红包配置详情() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.MANAGER_redConfInfo);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
PassQues confId= JsonUtil.parseResponseToBean(response,PassQues.class);
redConfId = confId.getId();
Assert.assertNotNull(confId, network.message(Params, BasicConfig.MANAGER_redConfInfo, "获取红包配置详情失败", response.body().asString()));
}
@Test(description = "开启闯关红包配置", priority = 101)
public void 开启闯关红包配置() {
Map<String, Object> Params = new HashMap<>();
Params.put("id", redConfId);
Params.put("openStatus",1);
Response response = network.postResponse(Params, BasicConfig.MANAGER_switchOpen);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_switchOpen, "获取红包配置详情失败", response.body().asString()));
}
......
......@@ -61,8 +61,8 @@ public class BasicConfig {
//***********************************************************************
// 基础线代理人 TKU,ID:
public static String AGENT_TKU = "T3gM31f18jCFEcfoYxvVk1LsF5T1YkcBNDbUaryi3TgvwatuP6mroJjZ2k7iCHjC9Srujh7k311i3vFuZm";
// 基础线代理人 TKU,sid:2991
public static String AGENT_TKU = "T3gM31f18jCFEcfTyJdjfJAfSjDmKNMHfH7CvpLDC6UCQd8X84RJEiiPHRHPqbrJYL3KL7tLsZEM5LjN4z";
// 基础线访客 TKU
public static String VISITOR_TKU = "T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfHcRNmyhTEzEbfmwrGFy5doVEinb1k3SVwreYQE";
// 访客的sids
......@@ -90,6 +90,16 @@ public class BasicConfig {
public static final String ANCHOR_getConfDetail = MOBILE_HOST + "/conf/pre/getConfDetail";
public static final String ANCHOR_CLOSE = MOBILE_HOST + "/conf/live/close";
// *************** 闯关答题 ***************
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_quesList = MANAGER_HOST + "/kjy/manager/pass/ques/quesList";
public static final String MANAGER_quesInfo = MANAGER_HOST + "/kjy/manager/pass/ques/quesInfo";
public static final String MANAGER_addOrUpdateConf = MANAGER_HOST + "/kjy/manager/pass/ques/addOrUpdateConf";
public static final String MANAGER_redConfInfo = MANAGER_HOST + "/kjy/manager/pass/ques/redConfInfo";
public static final String MANAGER_switchOpen = MANAGER_HOST + "/kjy/manager/pass/ques/switchOpen";
// *************** 看直播攒现金红包 ***************
public static final String MANAGER_timeRed = MANAGER_HOST + "/kjy/manager/live/time/red/saveOrUpdateFirst";
public static final String MANAGER_timeRedList = MANAGER_HOST + "/kjy/manager/live/time/red/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