Commit bfc1d5f3 authored by 龚小红's avatar 龚小红

Merge branch 'feature/20210818-xmc' into 'master'

新增访客/代理人直播结束页部分用例

See merge request test-group/kejiji!101
parents 431db287 7302f1ab
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class LiveList {
private String liveId;
private boolean hasPlayBack;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ResourceList {
private String id;
private int type;
private String recordId;
private String liveId;
private String companyName;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class WelfareList {
private long receiveDate;
private String id;
private int type;
private String recordId;
private String liveId;
}
......@@ -33,6 +33,7 @@ public class Agent implements Authorization {
public String jobNumber;
public String teamName;
public String sellerName;
public static String encodeAgentId;
@BeforeClass
public void setUp() { agentAuth(); }
......@@ -44,6 +45,8 @@ public class Agent implements Authorization {
System.out.println(response.body().asString());
Object jobNumber = response.jsonPath().getJsonObject("data.jobNumber");
Assert.assertNotNull(jobNumber, network.message(params, BasicConfig.MOBILE_userInfo1, "用户非代理人", response.body().asString()));
encodeAgentId = response.jsonPath().getString("data.agentId");
}
......@@ -448,6 +451,7 @@ public class Agent implements Authorization {
params.put("shortType",2);
Response response =null;
for (int i = 0; i < 10; i++) {
ThreadSleepUtils.sleep(1000);
response = network.postResponse(params,MOBILE_getShortUrl);
String data = response.jsonPath().getString("data");
System.out.println(data);
......
......@@ -327,4 +327,28 @@ public class LiveLater implements Authorization {
System.out.println(clueList);
Assert.assertNotNull(clueList,network.message(params,BasicConfig.MOBILE_clueChanceList,"跟进机会获取失败",response.body().asString()));
}
// 直播结束页
@Test(description = "本场直播线索统计", priority = 19)
public void 本场直播线索统计() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = null;
int liveStatus;
try {
for (int i = 0; i < 10; i++){
response = network.getResponse(params, BasicConfig.AGENT_liveEnd);
liveStatus = response.jsonPath().getInt("data.liveStatus");
System.out.println(liveStatus);
if (liveStatus == 5) break;
}
System.out.println(response.body().asString());
int lotteryCount = response.jsonPath().getInt("data.lotteryCount");
int submitFormCount = response.jsonPath().getInt("data.submitFormCount");
Assert.assertTrue(lotteryCount > 0, network.message(params, BasicConfig.AGENT_liveEnd, "直播内中奖用户数错误", response.body().asString()));
Assert.assertTrue(submitFormCount > 0, network.message(params, BasicConfig.AGENT_liveEnd, "直播内提交表单用户数错误", response.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
}
}
}
......@@ -26,6 +26,7 @@ public class LiveVisitors implements Authorization
public String confId_free;
public String id;
public List<ResourcePushList>PushList;
public static String resourceReceiveRecordId;
/*助播端端权益列表*/
@Test(description = "助播端权益列表", priority = 1)
......@@ -168,6 +169,8 @@ public class LiveVisitors implements Authorization
Response response = network.getResponse(params, BasicConfig.MOBILE_Link);
boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BasicConfig.MOBILE_Link,"领取免费领资料失败",response.body().asString()));
resourceReceiveRecordId = response.jsonPath().getString("data");
}
/*访客端链接小程序资料-查询*/
......@@ -366,4 +369,14 @@ public class LiveVisitors implements Authorization
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agreeStatus, "客跟进机会同意状态为false", response.body().asString()));
}
@Test(description = "访客端获取直播间实时数据", priority = 23)
public void 访客端获取直播间实时数据(){
Map<String, Object> clueInfoDataPar = new HashMap<>();
clueInfoDataPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response clueInfoDataRes = network.getResponse(clueInfoDataPar, BasicConfig.USER_clueInfoData);
Assert.assertTrue(clueInfoDataRes.jsonPath().getBoolean("success"), network.message(clueInfoDataPar, BasicConfig.USER_clueInfoData, "接口调用失败", clueInfoDataRes.body().asString()));
Object data = clueInfoDataRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(clueInfoDataPar, BasicConfig.USER_clueInfoData, "获取直播间实时数据失败", clueInfoDataRes.body().asString()));
}
}
package com.kjj.cases.live.customer;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.agent.Agent;
import com.kjj.cases.live.lottery.Lottery;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class AfterLive implements Authorization {
private Map<String, Object> params;
private String encodeLiveId;
@BeforeClass
public void SetUp(){ visitorAuth(); }
// 获取访客直播结束页样式
@Test(description = "获取访客直播结束页样式", priority = 1)
public void 获取访客直播结束页样式(){
encodeLiveId = LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()); // 获取直播ID
params = new HashMap<>();
params.put("liveId", encodeLiveId);
Response response = network.getResponse(params, BasicConfig.USER_liveEnd);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_liveEnd, "接口调用失败", response.body().asString()));
System.out.println(response.body().asString());
String welfareName = response.jsonPath().getString("data.welfareName");
Assert.assertEquals(welfareName, Lottery.welfareName, network.message(params, BasicConfig.USER_liveEnd, "展示奖品名称与实际中奖不符", response.body().asString()));
}
// 查询访客预约状态
@Test(description = "查询访客预约状态", priority = 2)
public void 查询访客预约状态(){
params.clear();
params.put("bizId", encodeLiveId);
params.put("bizType", 3);
Response response = network.getResponse(params, BasicConfig.USER_Appointment);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_Appointment, "接口请求失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params, BasicConfig.USER_Appointment, "返回预约状态失败", response.body().asString()));
}
// 获取代理人二维码信息
@Test(description = "获取代理人二维码信息", priority = 3)
public void 获取代理人二维码信息() {
params.clear();
params.put("agentId", Agent.encodeAgentId);
Response response = network.getResponse(params, BasicConfig.USER_getAgentQrCode);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_getAgentQrCode, "接口请求失败", response.body().asString()));
int pollingResult = response.jsonPath().getInt("data.pollingResult");
while (pollingResult == 2){
response = network.getResponse(params, BasicConfig.USER_getAgentQrCode);
pollingResult = response.jsonPath().getInt("data.pollingResult");
}
Object syntheticAvatar = response.jsonPath().getJsonObject("data.syntheticAvatar");
Assert.assertNotNull(syntheticAvatar, network.message(params, BasicConfig.USER_getAgentQrCode, "轮训代理人二维码失败", response.body().asString()));
}
}
This diff is collapsed.
......@@ -20,6 +20,8 @@ public class Lottery implements Authorization {
public List<ConfIdList> List_ConfId;
public String shareSign;
public static String welfareName;
public static String lotteryConfId;
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
......@@ -103,6 +105,8 @@ public class Lottery implements Authorization {
System.out.println(data);
Assert.assertNotNull(data, network.message(infoParam, BasicConfig.USER_info, "获取正在抽奖的福利失败", infoRes.body().asString()));
welfareName = infoRes.jsonPath().getString("data.welfareName");
lotteryConfId = infoRes.jsonPath().getString("data.confId");
}
......
......@@ -330,6 +330,24 @@ public class BasicConfig {
public static final String USER_savePoster = MOBILE_HOST + "/kjy/live/user/share/savePoster";
public static final String USER_myCount = MOBILE_HOST + "/kjy/live/user/lottery/myCount";
public static final String USER_wxIdAllList = HOST + "/kjy/mp/msg/config/live/user/wxIdAllList";
public static final String USER_Appointment = MOBILE_HOST + "/kjy/live/user/appointment/find";
public static final String USER_clueInfoData = MOBILE_HOST + "/clue/info/data";
public static final String USER_getAgentQrCode = MOBILE_HOST + "/kjy/live/agent/getAgentQrCode";
public static final String USER_findLottryDetail = MOBILE_HOST + "/kjy/live/user/lottery/findDetailByConfId";
// 直播结束
public static final String USER_liveEnd = MOBILE_HOST + "/kjy/live/user/liveEnd";
// *************** 个人主页 ***************
public static final String USER_welfareList = MOBILE_HOST + "/kjy/live/user/welfare/getList";
public static final String USER_resourceList = MOBILE_HOST + "/kjy/live/user/resource/getResourceList";
public static final String USER_lastCompany = MOBILE_HOST + "/kjy/live/user/index/latest";
public static final String USER_getCompanyInfo = MOBILE_HOST + "/kjy/live/company/getLiveInfo";
public static final String USER_getLiveList = MOBILE_HOST + "/kjy/live/company/userLiveList";
public static final String USER_companyShareInfo = MOBILE_HOST + "/kjy/live/company/getHomeShareInfo";
public static final String USER_getLiveOverList = MOBILE_HOST + "/kjy/live/company/userLiveEndList";
public static final String USER_videoAgentCard = MOBILE_HOST + "/kjy/live/card/user/video";
public static final String USER_companyLiving = MOBILE_HOST + "/kjy/live/company/living";
public static final String USER_welfareDetail = MOBILE_HOST + "/kjy/live/user/welfare/findDetailByRecordId";
public static final String USER_sourceDetail = MOBILE_HOST + "/kjy/live/user/resource/findDetailByRecordId";
// *************** 直播管理端 ***************
public static final String MANAGER_saveAndUpdate_0 = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......@@ -436,6 +454,9 @@ public class BasicConfig {
public static final String MOBILE_clueList = MOBILE_HOST + "/kjy/live/agent/clue/list";
public static final String MOBILE_livingClueStatistic = MOBILE_HOST + "/kjy/live/agent/clue/livingClueStatistic";
//直播结束页
public static final String AGENT_liveEnd = MOBILE_HOST + "/kjy/live/agent/liveEnd";
//排行榜
public static final String MOBILE_allRewardList = MOBILE_HOST + "/kjy/live/reward/allRewardList";
public static final String MOBILE_companyTotalData = MOBILE_HOST + "/kjy/live/team/companyTotalData";
......@@ -1031,4 +1052,5 @@ public class BasicConfig {
public static final String MANAGER_activityName = MANAGER_HOST + "/kjy/manager/interact/solution/activityName";
public static final String MANAGER_deleteInteract = MANAGER_HOST + "/kjy/manager/interact/article/delete";
public static final String MANAGER_deleteActivity = MANAGER_HOST + "/kjy/manager/interact/solution/delete";
public static final String MANAGER_searchCompany = MANAGER_HOST + "/kjy/manager/live/company/search";
}
package com.kjj.utils;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.testng.Assert;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
/**
* Created by dugq on 2019-10-23.
......@@ -16,7 +22,7 @@ import java.util.Base64;
* base64加密效率: 加密 1 - 2千万 1s以内完成
*/
public class IdMakeUtil {
public class IdMakeUtil implements Authorization {
private static final Base64.Encoder encoder = Base64.getEncoder();
private static final Base64.Decoder decoder = Base64.getDecoder();
......@@ -46,5 +52,15 @@ public class IdMakeUtil {
}
}
public static String managerEncodingId(long id) {
BaseUtils.ssoLogin();
Map<String, Object> ids = new HashMap<>();
ids.put("code", id);
Response encodeIdRes = network.getResponse(ids, BasicConfig.MANAGER_ID_ENCODE);
String encodeId = encodeIdRes.jsonPath().getString("data");
Assert.assertNotNull(encodeId, network.message(ids, BasicConfig.MANAGER_ID_ENCODE, "加密id失败", encodeIdRes.body().asString()));
return encodeId;
}
}
......@@ -207,5 +207,16 @@
<class name="com.kjj.cases.live.agent.Customer"/>
</classes>
</test>
<test preserve-order="true" name="访客端直播结束页">
<classes>
<class name="com.kjj.cases.live.customer.AfterLive" />
</classes>
</test>
<test preserve-order="true" name="访客端个人主页">
<classes>
<class name="com.kjj.cases.live.customer.PersonalPage" />
</classes>
</test>
</suite>
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