Commit 3fe24467 authored by 张艳玲's avatar 张艳玲

Merge branch 'feature/20210312-bxl' into 'master'

Feature/20210312 bxl

See merge request test-group/kejiji!30
parents ce01862a d9bf3ead
package com.kjj.bean;
import lombok.Data;
import java.util.Date;
@Data
public class AgentBean {
private String liveId;
private int liveStatus;
private Date noticeTime;
private String picUrl;
private String title;
private Date broadcastTime;
private int ranking;
private int inviteNum;
private int presentNum;
private String companyName;
private String companyId;
private String companyLogo;
private Long appointmentNum;
private int inviteAuthStatus;
}
package com.kjj.bean;
import lombok.Data;
import java.util.List;
@Data
public class AgentCard {
private String sellerName;
private String companyName;
private int companyId;
private String phoneNumber;
private String jobNumber;
private String wechatQrCode;
private String avatar;
private String teamId;
private String teamName;
private List<CompanyList> companyList;
@Data
class CompanyList{
private String companyId;
private String teamId;
private int companyLevel;
}
}
package com.kjj.bean;
import lombok.Data;
import java.util.Date;
@Data
public class AgentEndList {
private String liveId;
private String picUrl;
private String title;
private Date startTime;
private String hasPlayBack;
private String liveEndNeedShowRank;
private int liveStatus;
private int clueCount;
private int notFollowedClueCount;
private String companyName;
private String companyId;
private String companyLogo;
private int inviteAuthStatus;
}
......@@ -22,4 +22,15 @@ public interface AdminAuthorization {
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
/**
* 代理人授权
*/
default void agentAuth(){
// 创建用户 并传到network里
BasicConfig.AUTH_KEY = BaseUtils.agentAuthKey();
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
}
package com.kjj.cases.live;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.AgentBean;
import com.kjj.bean.AgentCard;
import com.kjj.bean.AgentEndList;
import com.kjj.config.BasicConfig;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/*代理人端*/
public class Procurator implements AdminAuthorization{
@BeforeClass
public void setUp() {
agentAuth();
}
/*代理人首页直播列表*/
@Test(description = "代理人首页", priority = 1)
public void Agent() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_Procurator);
List<AgentBean> agentBeans = JsonUtil.parseResponseToListBean(response, AgentBean.class);
if (agentBeans.size() > 0) {
AgentBean bean = agentBeans.get(0);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(bean, network.message(params, BasicConfig.MOBILE_Procurator, "查询直播列表失败", response.body().asString()));
}
}
/*代理人首页已结束的直播列表*/
@Test(description = "代理人首页已结束的直播列表", priority = 2)
public void AgentLiveEndList() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_AgentEndList);
List<AgentEndList> agentBeans = JsonUtil.parseResponseToListBean(response, AgentEndList.class);
if (agentBeans.size() > 0) {
AgentEndList bean = agentBeans.get(0);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(bean, network.message(params, BasicConfig.MOBILE_AgentEndList, "查询直播结束列表失败", response.body().asString()));
}
}
/*代理人信息*/
@Test(description = "代理人信息", priority = 3)
public void AgentCardInfo() {
Map<String, Object> params = new HashMap<>();
Response response = network.getResponse(params, BasicConfig.MOBILE_AgentCardInfo);
AgentCard agentBeans = JsonUtil.parseResponseToBean(response, AgentCard.class);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(agentBeans, network.message(params, BasicConfig.MOBILE_AgentCardInfo, "查询代理人信息失败", response.body().asString()));
}
/*代理人信息*/
@Test(description = "代理人修改信息", priority = 4)
public void AgentEditCardInfo() {
Map<String, Object> params = new HashMap<>();
params.put("sellerName", "你好测试"+ RandomUtils.nextInt(1, 100));
params.put("phoneNumber", "15258890691");
params.put("jobNumber", "TTTTTT");
params.put("wechatQrCode", "//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png");
Response response = network.postResponse(params, BasicConfig.MOBILE_AgentEditCardInfo);
Boolean agentBeans = JsonUtil.parseResponseToBean(response, Boolean.class);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(agentBeans, network.message(params, BasicConfig.MOBILE_AgentEditCardInfo, "修改代理人信息失败", response.body().asString()));
}
}
......@@ -39,6 +39,9 @@ public class BasicConfig {
public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn";
//手机端地址
public static final String MOBILE_HOST = "https://live.duibatest.com.cn";
// *************** 直播 ***************
public static final String MANAGER_SAVEANDUPDATE = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......@@ -74,6 +77,20 @@ public class BasicConfig {
public static final String MANAGER_SAVEORUPDATE7 = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/saveOrUpdate";
// *************** 代理人 ***************
//代理人列表//
public static final String MOBILE_Procurator = MOBILE_HOST + "/kjy/live/agent/liveList";
public static final String MOBILE_AgentEndList = MOBILE_HOST + "/kjy/live/agent/liveEndList";
public static final String MOBILE_AgentCardInfo = MOBILE_HOST + "/kjy/live/agent/card/info";
public static final String MOBILE_AgentEditCardInfo = MOBILE_HOST + "/kjy/live/agent/card/edit";
//***************直播素材*****************
public static final String MANAGER_SAVEORUPDATE6 = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/saveOrUpdate";
......
......@@ -3,19 +3,21 @@ package com.kjj.utils;
import io.restassured.response.Response;
import org.testng.Assert;
import static com.kjj.config.BasicConfig.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class BaseUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
public static String createAuthKey(){
return "LEH7epeHVDJWzhZ6DiexTHnsxraeviLJA9bNdknyzwR7cXT557KHZA1Q7zWnN9N2E3vHcFrt8S3xhGApKa3NmE7oaxyXz";
}
public static String agentAuthKey(){
return "LEH7epeHVDJWzhZ6DiexTHnsxs8JtX5mzCVwq1X5TSe6JEJMzL51umD812fWb8P5rLt5mw9SfPzLp6uwthsFnXAhKCYLq";
}
/**
* 登录管理后台
......
package com.kjj.utils;
import io.restassured.response.Response;
import static com.kjj.config.BasicConfig.*;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.kjj.config.BasicConfig.isPushReport;
public class DingTalkUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.utils;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.WelfareListBean;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import groovy.json.JsonBuilder;
import io.restassured.response.Response;
import java.util.List;
public class JsonUtil {
private JsonUtil() {
}
/**
* 将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public static <T> T parseResponseToBean(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("data");
String str = new JsonBuilder(data).toString();
return JSON.parseObject(str, tClass);
}
/**
* 分页接口专用-将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public static <T> List<T> parseResponseToListBean(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("data");
String str = new JsonBuilder(data).toString();
JSONObject jsonObject = JSON.parseObject(str);
JSONArray array = jsonObject.getJSONArray("list");
return array.toJavaList(tClass);
}
}
......@@ -6,6 +6,11 @@
<class name="com.kjj.cases.live.SaveAndUpdate"/>
</classes>
</test>
<test preserve-order="true" name="代理人首页">
<classes>
<class name="com.kjj.cases.live.Procurator"/>
</classes>
</test>
<test preserve-order="true" name="直播素材">
<classes>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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