Commit 9ac77614 authored by xiamengchen's avatar xiamengchen

排行榜点赞需求覆盖

parent d592ef14
......@@ -34,6 +34,7 @@ public class Agent implements Authorization {
public String teamName;
public String sellerName;
public static String encodeAgentId;
public static String encodeTeamId;
@BeforeClass
public void setUp() { agentAuth(); }
......@@ -47,6 +48,7 @@ public class Agent implements Authorization {
Assert.assertNotNull(jobNumber, network.message(params, BasicConfig.MOBILE_userInfo1, "用户非代理人", response.body().asString()));
encodeAgentId = response.jsonPath().getString("data.agentId");
encodeTeamId = response.jsonPath().getString("data.teamId");
}
......@@ -88,7 +90,7 @@ public class Agent implements Authorization {
@Test(description = "修改代理人信息", priority = 5)
public void 修改代理人信息() {
Map<String, Object> params = new HashMap<>();
params.put("sellerName", "小智"+ RandomUtils.nextInt(1, 100));
params.put("sellerName", "小智" + RandomUtils.nextInt(1, 100));
params.put("phoneNumber", "152588101691");
params.put("jobNumber", "KJJ0000");
params.put("wechatQrCode", "//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png");
......@@ -301,23 +303,58 @@ public class Agent implements Authorization {
* 排行榜
*/
// 代理人给自己点赞
@Test(description = "个人排行榜点赞", priority = 19)
public void 个人排行榜点赞() {
Map<String, Object> agentLikePar = new HashMap<>();
agentLikePar.put("agentId", encodeAgentId);
agentLikePar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
agentLikePar.put("action", 1);
Response agentLikeRes = network.postResponse(agentLikePar, MOBILE_agentLike);
try {
boolean data = agentLikeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(agentLikePar, MOBILE_agentLike, "点赞失败", agentLikeRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(agentLikePar, MOBILE_agentLike, "获取数据失败", agentLikeRes.body().asString()));
}
}
@Test(description = "团队排行榜点赞", priority = 20)
public void 团队排行榜点赞() {
Map<String, Object> teamLikePar = new HashMap<>();
teamLikePar.put("teamId", encodeTeamId);
teamLikePar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
teamLikePar.put("action", 1);
Response teamLikeRes = network.postResponse(teamLikePar, MOBILE_teamLike);
try {
boolean data = teamLikeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(teamLikePar, MOBILE_teamLike, "点赞失败", teamLikeRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(teamLikePar, MOBILE_teamLike, "获取数据失败", teamLikeRes.body().asString()));
}
}
//个人榜单
public String invitationNum;
@Test(description="获取代理人自己的榜单信息",priority = 18)
@Test(description="获取代理人自己的榜单信息",priority = 21)
public void 获取代理人自己的榜单信息() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_AgentOwnCharts);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
invitationNum = response.jsonPath().getString("data.invitationNum");
int likeNum = response.jsonPath().getInt("data.likeNum");
System.out.println("success="+success+",invitationNum="+invitationNum);
Assert.assertTrue(success, network.message(params, BasicConfig.MOBILE_AgentOwnCharts, "获取代理人自己的榜单信息", response.body().asString()));
Assert.assertNotNull(invitationNum,network.message(MOBILE_AgentOwnCharts,"获取代理人自己榜单内的邀请人数失败",response.body().asString()));
Assert.assertEquals(likeNum, 1, network.message(params, MOBILE_AgentOwnCharts, "代理人获赞数错误", response.body().asString()));
}
@Test(description="所有榜单的奖品列表",priority = 19)
@Test(description="所有榜单的奖品列表",priority = 22)
public void 所有榜单的奖品列表(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -327,20 +364,48 @@ public class Agent implements Authorization {
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_allRewardList, "所有榜单的奖品列表获取失败", response.body().asString()));
}
@Test(description="获取排行榜页面个人榜单",priority = 20)
@Test(description="获取排行榜页面个人榜单",priority = 23)
public void 获取排行榜页面个人榜单(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1);
params.put("pageSize",20);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_AgentPersonalCharts);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_AgentPersonalCharts, "获取个人榜单失败", response.body().asString()));
System.out.println(response.body().asString());
List<Map<String, Object>> agents = null;
boolean hasTarget = false;
try {
agents = response.jsonPath().getList("data.list");
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(params, MOBILE_AgentPersonalCharts, "获取数据失败", response.body().asString()));
}
for (Map<String, Object> agent : agents){
if (agent.get("agentId").equals(encodeAgentId)){
int isLike = (int)agent.get("isLike");
Assert.assertEquals(isLike, 1, network.message(params, MOBILE_AgentPersonalCharts, "点赞状态错误", response.body().asString()));
}
}
}
@Test(description = "获取赞我的人", priority = 24)
public void 获取赞我的人() {
Map<String, Object> likeMeFriendPar = new HashMap<>();
likeMeFriendPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response likeMeFriendRes = network.getResponse(likeMeFriendPar, MOBILE_likeMeFriend);
System.out.println(likeMeFriendRes.body().asString());
try {
List<Map<String, Object>> friends = likeMeFriendRes.jsonPath().getList("data.list");
String friendName = (String) friends.get(0).get("nickName");
Assert.assertEquals(friendName, "小智8", network.message(likeMeFriendPar, MOBILE_likeMeFriend, "最近赞我的朋友昵称错误", likeMeFriendRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(likeMeFriendPar, MOBILE_likeMeFriend, "获取数据失败", likeMeFriendRes.body().asString()));
}
}
@Test(description="代理人直播间公司统计",priority = 21)
@Test(description="代理人直播间公司统计",priority = 25)
public void 代理人直播间公司统计(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -355,7 +420,7 @@ public class Agent implements Authorization {
* 团队榜
*/
@Test(description="自己所在团队的榜单",priority = 22)
@Test(description="自己所在团队的榜单",priority = 26)
public void 自己所在团队的榜单(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -363,33 +428,116 @@ public class Agent implements Authorization {
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_ownTeamCharts, "自己所在团队的榜单获取失败", response.body().asString()));
int likeNum = response.jsonPath().getInt("data.likeNum");
Assert.assertEquals(likeNum, 1, network.message(params, MOBILE_ownTeamCharts, "获赞数量不对", response.body().asString()));
}
@Test(description="获取排行榜页面团队榜单",priority = 23)
@Test(description="获取排行榜页面团队榜单",priority = 27)
public void 获取排行榜页面团队榜单(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1);
params.put("pageSize",20);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(params,BasicConfig.MOBILE_TeamTeamCharts);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
List<String> list = response.jsonPath().getList("data.list.teamName");
System.out.println("-------"+list.size());
for (String name:list){
System.out.println("success="+success+",teamName="+ name);
List<Map<String, Object>> lists = response.jsonPath().getList("data.list");
System.out.println("-------"+lists.size());
for (Map<String, Object> list :lists){
System.out.println("success="+success+",teamName="+ list.get("teamName"));
Assert.assertTrue(success,network.message(params,BasicConfig.MOBILE_TeamTeamCharts,"获取团队榜单失败",response.body().asString()));
Assert.assertNotNull(name,network.message(MOBILE_TeamTeamCharts,"榜单内团队名称获取失败",response.body().asString()));
Assert.assertNotNull(list.get("teamName"),network.message(MOBILE_TeamTeamCharts,"榜单内团队名称获取失败",response.body().asString()));
if (list.get("teamId").equals(encodeTeamId)){
int isLike = (int)list.get("isLike");
Assert.assertEquals(isLike, 1, network.message(params, MOBILE_TeamTeamCharts, "点赞状态错误", response.body().asString()));
}
}
}
@Test(description = "获取赞我团队的朋友列表", priority = 28)
public void 获取赞我团队的朋友列表() {
Map<String, Object> likeMyTeamPar = new HashMap<>();
likeMyTeamPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
likeMyTeamPar.put("teamId", encodeTeamId);
Response likeMyTeamRes = network.getResponse(likeMyTeamPar, MOBILE_likeMyTeamFriends);
try {
List<Map<String, Object>> friends = likeMyTeamRes.jsonPath().getList("data.list");
String name = (String) friends.get(0).get("nickName");
Assert.assertEquals(name, "小智8", network.message(likeMyTeamPar, MOBILE_likeMyTeamFriends, "最近赞我团队的朋友昵称错误", likeMyTeamRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(likeMyTeamPar, MOBILE_likeMyTeamFriends, "获取数据失败", likeMyTeamRes.body().asString()));
}
}
// 取消点赞
@Test(description = "取消对自己的点赞", priority = 29)
public void 取消对自己的点赞() {
Map<String, Object> agentLikePar = new HashMap<>();
agentLikePar.put("agentId", encodeAgentId);
agentLikePar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
agentLikePar.put("action", 0);
Response agentLikeRes = network.postResponse(agentLikePar, MOBILE_agentLike);
try {
boolean data = agentLikeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(agentLikePar, MOBILE_agentLike, "取消点赞失败", agentLikeRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(agentLikePar, MOBILE_agentLike, "获取数据失败", agentLikeRes.body().asString()));
}
// 检查是否取消成功
// 赞我的朋友数量为0
Map<String, Object> likeMeFriendPar = new HashMap<>();
likeMeFriendPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response likeMeFriendRes = network.getResponse(likeMeFriendPar, MOBILE_likeMeFriend);
System.out.println(likeMeFriendRes.body().asString());
try {
List<Map<String, Object>> friends = likeMeFriendRes.jsonPath().getList("data.list");
Assert.assertEquals(friends.size(), 0, network.message(likeMeFriendPar, MOBILE_likeMeFriend, "赞我的朋友数量不为0", likeMeFriendRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(likeMeFriendPar, MOBILE_likeMeFriend, "获取数据失败", likeMeFriendRes.body().asString()));
}
}
@Test(description = "取消对自己团队的点赞", priority = 30)
public void 取消对自己团队的点赞() {
Map<String, Object> teamLikePar = new HashMap<>();
teamLikePar.put("teamId", encodeTeamId);
teamLikePar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
teamLikePar.put("action", 0);
Response teamLikeRes = network.postResponse(teamLikePar, MOBILE_teamLike);
try {
boolean data = teamLikeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(teamLikePar, MOBILE_teamLike, "点赞失败", teamLikeRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(teamLikePar, MOBILE_teamLike, "获取数据失败", teamLikeRes.body().asString()));
}
// 检查是否取消成功
Map<String, Object> likeMyTeamPar = new HashMap<>();
likeMyTeamPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
likeMyTeamPar.put("teamId", encodeTeamId);
Response likeMyTeamRes = network.getResponse(likeMyTeamPar, MOBILE_likeMyTeamFriends);
try {
List<Map<String, Object>> friends = likeMyTeamRes.jsonPath().getList("data.list");
Assert.assertEquals(friends.size(), 0, network.message(likeMyTeamPar, MOBILE_likeMyTeamFriends, "赞我团队的朋友数量不为0", likeMyTeamRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(likeMyTeamPar, MOBILE_likeMyTeamFriends, "获取数据失败", likeMyTeamRes.body().asString()));
}
}
// 获取队内榜;
@Test(description="获取队内榜",priority = 24)
@Test(description="获取队内榜",priority = 31)
public void 获取队内榜(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -400,7 +548,7 @@ public class Agent implements Authorization {
}
@Test(description="获取个人队内榜单",priority = 25)
@Test(description="获取个人队内榜单",priority = 32)
public void 获取个人队内榜单() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1);
......@@ -420,7 +568,7 @@ public class Agent implements Authorization {
/**
* 邀约
*/
@Test(description="获取代理人是否有邀请权限",priority = 26)
@Test(description="获取代理人是否有邀请权限",priority = 33)
public void 获取代理人是否有邀请权限() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -433,7 +581,7 @@ public class Agent implements Authorization {
// 获取代理人直播海报信息;
@Test(description="获取代理人直播海报信息",priority = 27)
@Test(description="获取代理人直播海报信息",priority = 34)
public void 获取代理人直播海报信息() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -444,7 +592,7 @@ public class Agent implements Authorization {
}
@Test(description="获取小程序短链",priority = 28)
@Test(description="获取小程序短链",priority = 35)
public void 获取小程序短链() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
......@@ -521,6 +521,10 @@ public class BasicConfig {
public static final String MOBILE_companyTotalData = MOBILE_HOST + "/kjy/live/team/companyTotalData";
public static final String MOBILE_ownTeamCharts = MOBILE_HOST + "/kjy/live/team/ownTeamCharts";
public static final String MOBILE_ownChartsInTeam = MOBILE_HOST + "/kjy/live/agent/ownChartsInTeam";
public static final String MOBILE_agentLike = MOBILE_HOST + "/kjy/live/agent/agentLike";
public static final String MOBILE_teamLike = MOBILE_HOST + "/kjy/live/team/teamLike";
public static final String MOBILE_likeMeFriend = MOBILE_HOST + "/kjy/live/agent/likeMeFriends";
public static final String MOBILE_likeMyTeamFriends = MOBILE_HOST + "/kjy/live/team/likeMyTeamFriends";
public static final String MANAGER_CompanyVideoList = MANAGER_HOST + "/kjy/manager/live/company/video/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