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

update

parent a7ddb004
package com.kjj.bean.manager;
import lombok.Data;
@Data
public class TeamList {
public int id;
}
package com.kjj.cases.live.FreeReward;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class FreeReward implements AdminAuthorization {
public String configId;
@Test(description = "查询免费领福利", priority = 1)
public void 查询免费领福利() {
visitorAuth2();
Map<String, Object> FreeRewardParam = new HashMap<>();
FreeRewardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response FreeRewardRes = network.getResponse(FreeRewardParam, BasicConfig.ANCHOR_listLiveFreeReward);
HashMap data = FreeRewardRes.jsonPath().getJsonObject("data");
System.out.println(data);
this.configId = (String) data.get("configId");
System.out.println(configId);
Assert.assertNotNull(configId, network.message(FreeRewardParam, BasicConfig.ANCHOR_listLiveFreeReward, "查询免费领福利失败", FreeRewardRes.body().asString()));
}
@Test(description = "领取免费福利", priority = 2)
public void 领取免费福利() {
visitorAuth2();
Map<String, Object> receiveParam = new HashMap<>();
receiveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
receiveParam.put("liveInteractConfId",configId );
Response receiveRes = network.getResponse(receiveParam, BasicConfig.ANCHOR_receive);
Object data = receiveRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(receiveParam, BasicConfig.ANCHOR_receive, "领取免费福利失败", receiveRes.body().asString()));
}
@Test(description = "提交免费福利姓名", priority = 3)
public void 提交免费福利姓名() {
visitorAuth2();
Map<String, Object> submitInfoParam = new HashMap<>();
submitInfoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
submitInfoParam.put("confId",configId );
submitInfoParam.put("winnerName", "中奖姓名YY");
Response submitInfoRes = network.postResponse(submitInfoParam, BasicConfig.USER_submitInfo);
Boolean result = submitInfoRes.jsonPath().getBoolean("success");
System.out.println(result);
Assert.assertTrue(result, network.message(submitInfoParam, BasicConfig.USER_submitInfo, "提交姓名失败", submitInfoRes.body().asString()));
}
}
......@@ -13,13 +13,13 @@ import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class Lottery implements AdminAuthorization {
public List<ConfidList> List_Confid;
public String shareSign;
public String token;
public String drawDownNum;
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
......@@ -135,6 +135,7 @@ public class Lottery implements AdminAuthorization {
@Test(description = "结束第一轮抽奖", priority = 10)
public void 结束第一轮抽奖() {
adminAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> endParam = new HashMap<>();
endParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
endParam.put("confId", this.List_Confid.get(0).getWelfareConfId());
......@@ -277,10 +278,9 @@ public class Lottery implements AdminAuthorization {
Boolean result = submitInfoRes.jsonPath().getBoolean("success");
System.out.println(result);
Assert.assertTrue(result, network.message(submitInfoParam, BasicConfig.USER_submitInfo, "提交姓名失败", submitInfoRes.body().asString()));
ThreadSleepUtils.sleep(3000);
}
@Test(description = "访客A中奖任务", priority = 20)
public void 访客A中奖任务() {
visitorAuth();
......@@ -420,8 +420,15 @@ public class Lottery implements AdminAuthorization {
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询邀请人抽奖券列表失败", myLotteryCodeRes.body().asString()));
List<Object> values = myLotteryCodeRes.jsonPath().getList("data.list");
boolean result = false;
for (Object value : values){
if (Objects.equals(((Map)value).get("codeSource"),5)){
result = true;
break;
}
}
Assert.assertNotNull(result, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询访客A抽奖券列表失败", myLotteryCodeRes.body().asString()));
}
@Test(description = "访客A抽奖码数量", priority = 31)
......@@ -450,7 +457,7 @@ public class Lottery implements AdminAuthorization {
}
//完成幸运任务逻辑
@Test(description = "访客B直播中分享直播间", priority = 33)
public void 访客B直播中分享直播间() {
visitorAuth2();
......@@ -577,6 +584,7 @@ public class Lottery implements AdminAuthorization {
public void 幸运任务邀请F根据绑定凭证发放抽奖码() {
visitorAuth6();
Map<String, Object> codeParam = new HashMap<>();
ThreadSleepUtils.sleep(500);
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
Response codeRes = network.getResponse(codeParam, BasicConfig.MOBILE_Code);
......@@ -607,9 +615,16 @@ public class Lottery implements AdminAuthorization {
myLotteryCodeParam.put("pageIndex", 1);
myLotteryCodeParam.put("pageSize", 30);
Response myLotteryCodeRes = network.getResponse(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode);
Object data = myLotteryCodeRes.jsonPath().getJsonObject("data");
System.out.println(JSON.toJSON(data));
Assert.assertNotNull(data, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "查询邀请人抽奖券列表失败", myLotteryCodeRes.body().asString()));
List<Object> values = myLotteryCodeRes.jsonPath().getList("data.list");
boolean result = false;
for (Object value : values){
if (Objects.equals(((Map)value).get("codeSource"),8)){
result = true;
break;
}
}
Assert.assertTrue(result, network.message(myLotteryCodeParam, BasicConfig.MOBILE_MyLotteryCode, "获取抽奖码列表失败", myLotteryCodeRes.body().asString()));
}
@Test(description = "访客B的抽奖码数量", priority = 45)
......@@ -692,7 +707,6 @@ public class Lottery implements AdminAuthorization {
}
@Test(description = "获取第二轮喜报", priority = 51)
public void 获取第二轮喜报() {
visitorAuth();
......
......@@ -13,9 +13,7 @@ import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.*;
public class SaveAndUpdate implements AdminAuthorization {
public String liveID;
public String EncodeLiveID;
......@@ -60,7 +58,6 @@ public class SaveAndUpdate implements AdminAuthorization {
public void 查询直播配置() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", liveID);
Response response = network.getResponse(params, BasicConfig.MANAGER_GETCONFDETAIL);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
......
package com.kjj.cases.live.manager;
import com.kjj.bean.manager.TeamList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Team implements AdminAuthorization {
public List<TeamList> id;
@Test(description = "新增团队", priority = 1)
public void 新增团队() {
BaseUtils.ssoLogin();
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("teamName", "测试团队");
saveOrUpdateParam.put("expectedNum", 100);
saveOrUpdateParam.put("id", "");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "新增团队失败", response.body().asString()));
}
@Test(description = "查询团队列表", priority = 2)
public void 查询团队列表() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询新增团队失败", response.body().asString()));
}
@Test(description = "修改团队", priority = 3)
public void 修改团队() {
Map<String, Object> saveOrUpdateParam = new HashMap<>();
saveOrUpdateParam.put("companyId", 101);
saveOrUpdateParam.put("id", this.id.get(0).getId());
saveOrUpdateParam.put("teamName", "测试团队");
Response response = network.postResponse(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(saveOrUpdateParam, BasicConfig.MANAGER_saveOrUpdate, "修改新增团队失败", response.body().asString()));
}
@Test(description = "删除团队", priority = 4)
public void 删除团队() {
Map<String, Object> deleteParam = new HashMap<>();
deleteParam.put("id", this.id.get(0).getId());
Response response = network.postResponse(deleteParam, BasicConfig.MANAGER_del);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(deleteParam, BasicConfig.MANAGER_del, "查询新增团队失败", response.body().asString()));
}
@Test(description = "设置内勤标识", priority = 5)
public void 设置内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 1);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询设置团队内勤标识", priority = 6)
public void 查询设置团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询设置团队内勤标识失败", response.body().asString()));
}
@Test(description = "取消团队内勤标识", priority = 7)
public void 取消内勤标识() {
Map<String, Object> teamFlagParam = new HashMap<>();
teamFlagParam.put("id", this.id.get(0).getId());
teamFlagParam.put("teamFlag", 0);
Response response = network.postResponse(teamFlagParam, BasicConfig.MANAGER_teamFlag);
boolean deta =response.jsonPath().getBoolean("data");
System.out.println(deta);
Assert.assertTrue(deta, network.message(teamFlagParam, BasicConfig.MANAGER_teamFlag, "查询新增团队失败", response.body().asString()));
}
@Test(description = "查询取消团队内勤标识", priority = 8)
public void 查询取消团队内勤标识() {
Map<String, Object> teamListParam = new HashMap<>();
teamListParam.put("companyId", 101);
teamListParam.put("pageIndex", 1);
teamListParam.put("pageSize", 20);
Response response = network.getResponse(teamListParam, BasicConfig.MANAGER_teamList);
List<TeamList> list = JsonUtil.parseResponseToPageBean(response, TeamList.class);
System.out.println(list);
this.id = list;
Assert.assertNotNull(list, network.message(teamListParam, BasicConfig.MANAGER_teamList, "查询取消内勤标识失败", response.body().asString()));
}
}
......@@ -2,6 +2,7 @@ package com.kjj.cases.live.user;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
......@@ -46,6 +47,7 @@ public class User implements AdminAuthorization {
@Test(description = "根据绑定凭证发放抽奖码", priority = 3)
public void 根据绑定凭证发放抽奖码() {
ThreadSleepUtils.sleep(500);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
......@@ -138,8 +140,6 @@ public class User implements AdminAuthorization {
}
//访客分享直播间
@Test(description = "访客分享直播间", priority = 10)
public void 访客分享直播间() {
Map<String, Object> signParam = new HashMap<>();
......@@ -153,8 +153,6 @@ public class User implements AdminAuthorization {
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
//访客邀请绑定
@Test(description = "访客邀请关系绑定", priority = 11)
public void 访客邀请关系绑定() {
visitorAuth2();
......@@ -167,8 +165,6 @@ public class User implements AdminAuthorization {
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_binding, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "访客获取绑定结果和绑定凭证", priority = 12)
public void 访客获取绑定结果和绑定凭证() {
visitorAuth2();
......@@ -183,10 +179,10 @@ public class User implements AdminAuthorization {
Assert.assertNotNull(token, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
@Test(description = "访客根据绑定凭证发放抽奖码", priority = 13)
public void 访客根据绑定凭证发放抽奖码() {
visitorAuth2();
ThreadSleepUtils.sleep(500);
Map<String, Object> codeParam = new HashMap<>();
codeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
codeParam.put("token", token);
......
......@@ -52,7 +52,9 @@ public class BasicConfig {
public static final String ANCHOR_OPEN = MOBILE_HOST + "/conf/live/open";
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 ANCHOR_listLiveFreeReward = MOBILE_HOST + "/kjy/live/lottery/listLiveFreeReward";
public static final String ANCHOR_receive = MOBILE_HOST + "/kjy/live/user/lottery/receive";
// *************** 代理人指定中奖 ***************
public static final String MOBILE_getSpecifyAwardConf = MOBILE_HOST + "/conf/pre/specifyAward/getSpecifyAwardConf";
public static final String MOBILE_getAgentParticipateCond = MOBILE_HOST + "/conf/pre/specifyAward/getAgentParticipateCond";
......@@ -222,7 +224,11 @@ public class BasicConfig {
public static final String MANAGER_FREE= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateFree";
public static final String MANAGER_TEST= MANAGER_HOST+ "/kjy/manager/live/resource/saveOrUpdateTest";
//***************直播团队管理*****************
public static final String MANAGER_teamList = MANAGER_HOST+ "/kjy/manager/live/company/team/teamList";
public static final String MANAGER_saveOrUpdate = MANAGER_HOST+ "/kjy/manager/live/company/team/saveOrUpdate";
public static final String MANAGER_del = MANAGER_HOST+ "/kjy/manager/live/company/team/delete";
public static final String MANAGER_teamFlag = MANAGER_HOST+ "/kjy/manager/live/company/team/teamFlag";
// *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc";
......
......@@ -7,6 +7,11 @@
<class name="com.kjj.cases.live.manager.LiveMaterial"/>
</classes>
</test>
<test preserve-order="true" name="团队管理">
<classes>
<class name="com.kjj.cases.live.manager.Team"/>
</classes>
</test>
<test preserve-order="true" name="创建直播">
<classes>
......@@ -52,6 +57,12 @@
<class name="com.kjj.cases.live.lottery.Lottery"/>
</classes>
</test>
<test preserve-order="true" name="免费领福利">
<classes>
<class name="com.kjj.cases.live.FreeReward.FreeReward"/>
</classes>
</test>
<test preserve-order="true" name="访客领取资料">
<classes>
<class name="com.kjj.cases.live.anchor.LiveVisitors"/>
......
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