Commit 748ae0e3 authored by Su-Yi's avatar Su-Yi

修改boss演示版

parent 7fd23549
package com.kjj.qa.cases;
import com.kjj.qa.utils.BaseUtils;
import com.google.inject.internal.asm.$TypePath;
import com.kjj.qa.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.IExpectedExceptionsAnnotation;
import org.testng.annotations.Test;
import org.testng.remote.strprotocol.IMessage;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;
import static com.kjj.qa.config.BasicConfig.*;
public class BossTest {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
public void setUp() {
// 标记为内部人员
BaseUtils.switchInsider(1);
}
//BOSS看板演示版
//设置中心开关是否开启
@Test(description = "是否开启演示开关", priority = 1)
public void 是否开启演示开关() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("configKey", "boss_board_demon_switch");
params.put("configValue", true);
Response response = network.postResponse(params, BOSS_EDITCONFIG);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertEquals(data, true, network.message(BOSS_ISDEMO, "演示开关未开启",response.body().asString()));
}
//进入BOSS看板判断是否开启演示数据
@Test(description = "是否开启演示数据", priority = 2)
public void 是否开启演示数据() throws IOException {
Response response = network.getResponse(BOSS_ISDEMO);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertEquals(data, true, network.message(BOSS_ISDEMO, "演示数据未开启",response.body().asString()));
}
//任务版块
//获取团队任务列表
@Test(description = "获取团队任务列表", priority = 3)
public void 获取团队任务列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", 20);
Response response = network.getResponse(params, BOSS_TEAMTASKLIST);
int taskStatus = response.jsonPath().getInt("data.list[0].taskStatus");//判断任务状态
int TaskStatus = response.jsonPath().getInt("data.list[1].taskStatus");//判断任务状态
Assert.assertEquals(taskStatus, 1, network.message(params, BOSS_TEAMTASKLIST, "任务已失效",response.body().asString()));
Assert.assertEquals(TaskStatus, 2, network.message(params, BOSS_TEAMTASKLIST, "任务已失效",response.body().asString()));
}
//创建任务(确定选择该素材)
@Test(description = "创建任务", priority = 4)
public void 创建任务() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid", "Kj20MTM1OTc1");
Response response = network.postResponse(params, BOSS_CREATE);
int task = response.jsonPath().getInt("data");
Assert.assertEquals(task, 2, network.message(params, BOSS_CREATE, "创建任务失败",response.body().asString()));
}
//任务详情
@Test(description = "任务详情", priority = 5)
public void 任务详情() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 2);
Response response = network.getResponse(params, BOSS_DETAIL);
String task = response.jsonPath().getString("data.contentId");
Assert.assertEquals(task, "Kj21NTY3MTk", network.message(params, BOSS_DETAIL, "获取内容id失败",response.body().asString()));
}
//发布任务
@Test(description = "发布任务", priority = 6)
public void 发布任务() throws IOException {
List<String> a =new ArrayList<>();
List<String> b =new ArrayList<>();
b.add("Kj22Mjk1MQ");
Map<String, Object> params = new HashMap<String, Object>();
params.put("effectiveDuration", 7);
params.put("isAllMen", false);
params.put("superiorIds",a);
params.put("sellerIds", b);
params.put("taskId", 1);
Response response = network.postResponse(params, BOSS_PUBLISH);
boolean publish = response.jsonPath().getBoolean("data");
Assert.assertEquals(publish, true, network.message(params, BOSS_PUBLISH, "任务发布失败",response.body().asString()));
}
//团队任务接收人查询
@Test(description = "已完成人数查询", priority = 7)
public void 已完成人数查询() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 1);
params.put("pageSize", 20);
params.put("type", 2);
Response response = network.getResponse(params, BOSS_RECEIVERLIST);
int completed = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(completed, 8, network.message(params, BOSS_RECEIVERLIST, "已完成人数查询失败",response.body().asString()));
}
@Test(description = "未完成人数查询", priority = 8)
public void 未完成人数查询() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("taskId", 1);
params.put("pageSize", 20);
params.put("type", 1);
Response response = network.getResponse(params, BOSS_RECEIVERLIST);
int incomplete = response.jsonPath().getInt("data.totalCount");
Assert.assertEquals(incomplete, 11, network.message(params, BOSS_RECEIVERLIST, "未完成人数查询失败",response.body().asString()));
}
//数据版块
@AfterClass
public static void tearDown(){
// 取消标记为内部人员
BaseUtils.switchInsider(1);
}
}
\ No newline at end of file
...@@ -225,6 +225,20 @@ public class BasicConfig { ...@@ -225,6 +225,20 @@ public class BasicConfig {
public static final String BOSS_MEMBER = HOST + "/kjy/mp/seller/team/member"; public static final String BOSS_MEMBER = HOST + "/kjy/mp/seller/team/member";
public static final String BOSS_EDITCONFIG = HOST + "/kjy/mp/sellerConfig/editConfig";
public static final String BOSS_ISDEMO = HOST + "/kjy/mp/seller/team/isDemo";
public static final String BOSS_TEAMTASKLIST = HOST + "/kjy/mp/seller/team/task/teamTaskList";
public static final String BOSS_CREATE = HOST + "/kjy/mp/seller/team/task/create";
public static final String BOSS_DETAIL = HOST + "/kjy/mp/seller/team/task/detail";
public static final String BOSS_PUBLISH = HOST + "/kjy/mp/seller/team/task/publish";
public static final String BOSS_RECEIVERLIST = HOST + "/kjy/mp/seller/team/task/receiverList";
// *************** 贺卡 *************** // *************** 贺卡 ***************
public static final String GREETING_BANNER = HOST + "/kjy/mp/greeting/banner"; public static final String GREETING_BANNER = HOST + "/kjy/mp/greeting/banner";
......
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