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

Merge branch 'featrue/20210712-zyl' into 'master'

Featrue/20210712 zyl

See merge request test-group/kejiji!63
parents 32c8ac0c 24fdafb7
package com.kjj.bean.agent;
import lombok.Data;
@Data
public class GrabWelfares {
private Boolean specifyAward;
}
package com.kjj.cases.assistant;
import static com.kjj.config.BasicConfig.*;
//import com.kjj.bean.welfare.Welfare;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class RecommendMaterial implements Authorization {
public String sid; //加密的销售id
......@@ -34,7 +25,7 @@ public class RecommendMaterial implements Authorization {
public void setUp() {
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku",AGENT_TKU);
network.agentCookies.put("tku", AGENT_TKU);
//System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
......@@ -42,199 +33,198 @@ public class RecommendMaterial implements Authorization {
}
//种草文章列表页
@Test(description = "代理人_今日早报_种草素材列表页",priority = 1)
@Test(description = "代理人_今日早报_种草素材列表页", priority = 1)
public void 代理人_今日早报_种草素材列表页() {
Response response = network.getResponse(ARTICLE_GETEXPLOSIONCONTENTLIST);
grasscontentId = response.jsonPath().getString("data[0].contentId");
Assert.assertNotNull(grasscontentId,network.message(ARTICLE_GETEXPLOSIONCONTENTLIST,"获取种草素材文章失败",response.body().asString()));
Assert.assertNotNull(grasscontentId, network.message(ARTICLE_GETEXPLOSIONCONTENTLIST, "获取种草素材文章失败", response.body().asString()));
}
//种草文章内容页
@Test(description = "代理人_今日早报_种草素材内容页",priority = 2)
public void 代理人_今日早报_种草素材内容页(){
@Test(description = "代理人_今日早报_种草素材内容页", priority = 2)
public void 代理人_今日早报_种草素材内容页() {
//根据种草素材的ContentId获取Scid
Map<String,Object> params = new HashMap<String,Object>();
params.put("contentId",grasscontentId);
Response response = network.getResponse(params,GETSCID);
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId", grasscontentId);
Response response = network.getResponse(params, GETSCID);
scid = response.jsonPath().getString("data");
Assert.assertNotNull(scid,network.message(params,GETSCID,"获取文章的scid失败",response.body().asString()));
Assert.assertNotNull(scid, network.message(params, GETSCID, "获取文章的scid失败", response.body().asString()));
Map<String,Object> infoParams = new HashMap<String,Object>();
infoParams.put("scid",scid);
response = network.getResponse(infoParams,ARTICLE_H5INFO);
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid", scid);
response = network.getResponse(infoParams, ARTICLE_H5INFO);
String id = response.jsonPath().getString("data.id");
Assert.assertEquals(grasscontentId,id,network.message(infoParams,ARTICLE_H5INFO,"获取种草文章内容失败",response.body().asString()));
Assert.assertEquals(grasscontentId, id, network.message(infoParams, ARTICLE_H5INFO, "获取种草文章内容失败", response.body().asString()));
}
//种草文章转发
@Test(description = "代理人_今日早报_种草素材转发",priority = 3)
public void 代理人_今日早报_种草素材转发(){
Map<String,Object> params = new HashMap<String,Object>();
params.put("scId",scid);
params.put("forwardType",1);
Response response = network.getResponse(params,FORWARD);
@Test(description = "代理人_今日早报_种草素材转发", priority = 3)
public void 代理人_今日早报_种草素材转发() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId", scid);
params.put("forwardType", 1);
Response response = network.getResponse(params, FORWARD);
Boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params,FORWARD,"种草文章转发失败",response.body().asString()));
Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString()));
}
//种草素材标签列表
@Test(description = "代理人_今日早报_种草素材标签列表",priority = 4)
public void 代理人_今日早报_种草素材标签列表(){
@Test(description = "代理人_今日早报_种草素材标签列表", priority = 4)
public void 代理人_今日早报_种草素材标签列表() {
Response response = network.getResponse(GRASS_getTagList);
String tagId = response.jsonPath().getString("data[0].id");
Assert.assertNotNull(tagId, network.message(GRASS_getTagList,"获取种草素材标签列表失败",response.body().asString()));
Assert.assertNotNull(tagId, network.message(GRASS_getTagList, "获取种草素材标签列表失败", response.body().asString()));
}
//猜你想搜列表
@Test(description = "代理人_种草素材_猜你想搜列表",priority = 5)
public void 代理人_种草素材_猜你想搜列表(){
@Test(description = "代理人_种草素材_猜你想搜列表", priority = 5)
public void 代理人_种草素材_猜你想搜列表() {
Response response = network.getResponse(GRASS_guessYourMind);
keyWord = response.jsonPath().getString("data[1].keyWord");
Assert.assertNotNull(keyWord, network.message(GRASS_guessYourMind,"获取猜你想搜列表失败",response.body().asString()));
Assert.assertNotNull(keyWord, network.message(GRASS_guessYourMind, "获取猜你想搜列表失败", response.body().asString()));
}
//搜索获取种草素材列表
@Test(description = "代理人_种草素材_搜索获取动画种草素材列表",priority = 6)
public void 代理人_种草素材_搜索获取动画种草素材列表(){
@Test(description = "代理人_种草素材_搜索获取动画种草素材列表", priority = 6)
public void 代理人_种草素材_搜索获取动画种草素材列表() {
String type = "game_animation";
Map<String,Object> params = new HashMap<String,Object>();
params.put("contentType",type);
params.put("pageSize",30);
params.put("keywords",keyWord);
Response response = network.getResponse(params,GRASS_searchContent);
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentType", type);
params.put("pageSize", 30);
params.put("keywords", keyWord);
Response response = network.getResponse(params, GRASS_searchContent);
ThreadSleepUtils.sleep(1000);
String gameContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertNotNull(gameContentId, network.message(params,GRASS_searchContent,"获取动画种草素材列表失败",response.body().asString()));
Assert.assertNotNull(gameContentId, network.message(params, GRASS_searchContent, "获取动画种草素材列表失败", response.body().asString()));
}
@Test(description = "代理人_种草素材_搜索获取文章种草素材列表",priority = 7)
public void 代理人_种草素材_搜索获取文章种草素材列表(){
@Test(description = "代理人_种草素材_搜索获取文章种草素材列表", priority = 7)
public void 代理人_种草素材_搜索获取文章种草素材列表() {
String type = "article";
Map<String,Object> params = new HashMap<String,Object>();
params.put("contentType",type);
params.put("pageSize",30);
params.put("keywords",keyWord);
Response response = network.getResponse(params,GRASS_searchContent);
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentType", type);
params.put("pageSize", 30);
params.put("keywords", keyWord);
Response response = network.getResponse(params, GRASS_searchContent);
String gameContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertNotNull(gameContentId, network.message(params,GRASS_searchContent,"获取文章种草素材列表失败",response.body().asString()));
Assert.assertNotNull(gameContentId, network.message(params, GRASS_searchContent, "获取文章种草素材列表失败", response.body().asString()));
}
@Test(description = "代理人_种草素材_搜索获取视频种草素材列表",priority = 8)
public void 代理人_种草素材_搜索获取视频种草素材列表(){
@Test(description = "代理人_种草素材_搜索获取视频种草素材列表", priority = 8)
public void 代理人_种草素材_搜索获取视频种草素材列表() {
String type = "video";
Map<String,Object> params = new HashMap<String,Object>();
params.put("contentType",type);
params.put("pageSize",30);
params.put("keywords",keyWord);
Response response = network.getResponse(params,GRASS_searchContent);
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentType", type);
params.put("pageSize", 30);
params.put("keywords", keyWord);
Response response = network.getResponse(params, GRASS_searchContent);
String gameContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertNotNull(gameContentId, network.message(params,GRASS_searchContent,"获取文章种草素材列表失败",response.body().asString()));
Assert.assertNotNull(gameContentId, network.message(params, GRASS_searchContent, "获取文章种草素材列表失败", response.body().asString()));
}
//获取赠险列表
@Test(description = "代理人_赠险管理_获取赠险列表",priority = 9)
public void 代理人_赠险管理_获取赠险列表(){
@Test(description = "代理人_赠险管理_获取赠险列表", priority = 9)
public void 代理人_赠险管理_获取赠险列表() {
Response response = network.getResponse(GRASS_insuranceListV3t);
Object object = response.jsonPath().getJsonObject("data.insuranceVos");
System.out.println(object);
Assert.assertNotNull(object, network.message(GRASS_insuranceListV3t,"获取赠险列表失败",response.body().asString()));
Assert.assertNotNull(object, network.message(GRASS_insuranceListV3t, "获取赠险列表失败", response.body().asString()));
}
//赠险详情
@Test(description ="代理人_赠险管理_赠险详情",priority = 10)
public void 代理人_赠险管理_赠险详情(){
@Test(description = "代理人_赠险管理_赠险详情", priority = 10)
public void 代理人_赠险管理_赠险详情() {
//根据赠险列表接口获取insuranceType
Response responseParams = network.getResponse(GRASS_insuranceListV3t);
type = responseParams.jsonPath().getJsonObject("data.insuranceVos[0].insuranceType");
Map<String,Object> params = new HashMap<>();
params.put("insuranceType",type);
Response response = network.getResponse(params,GRASS_lastInsurance);
Map<String, Object> params = new HashMap<>();
params.put("insuranceType", type);
Response response = network.getResponse(params, GRASS_lastInsurance);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(params, GRASS_lastInsurance, "获取赠险详情失败",response.body().asString()));
Assert.assertEquals(desc, "OK", network.message(params, GRASS_lastInsurance, "获取赠险详情失败", response.body().asString()));
}
// 编辑赠险
@Test(description = "代理人_赠险管理_新增赠险",priority = 11)
public void 代理人_赠险管理_新增赠险(){
Map<String,Object> params = new HashMap<>();
params.put("insuranceTitle","2222");
params.put("insuranceType",1);
params.put("insureAmount",1000);
Response response = network.postResponse(params,GRASS_editInsurance);
@Test(description = "代理人_赠险管理_新增赠险", priority = 11)
public void 代理人_赠险管理_新增赠险() {
Map<String, Object> params = new HashMap<>();
params.put("insuranceTitle", "2222");
params.put("insuranceType", 1);
params.put("insureAmount", 1000);
Response response = network.postResponse(params, GRASS_editInsurance);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(params, GRASS_editInsurance,"修改赠险信息失败",response.body().asString()));
Assert.assertTrue(success, network.message(params, GRASS_editInsurance, "修改赠险信息失败", response.body().asString()));
//获取赠险信息
Map<String ,Object> responseParams = new HashMap<>();
responseParams.put("insuranceType",1);
Response responseAssert = network.getResponse(responseParams,GRASS_lastInsurance);
String id =responseAssert.jsonPath().getString("data.id");
Map<String, Object> responseParams = new HashMap<>();
responseParams.put("insuranceType", 1);
Response responseAssert = network.getResponse(responseParams, GRASS_lastInsurance);
String id = responseAssert.jsonPath().getString("data.id");
System.out.println(id);
inId=id;
Assert.assertNotNull(id,network.message(responseParams,GRASS_lastInsurance,"修改赠险信息内容失败",responseAssert.body().asString()));
inId = id;
Assert.assertNotNull(id, network.message(responseParams, GRASS_lastInsurance, "修改赠险信息内容失败", responseAssert.body().asString()));
}
//删除赠险
@Test(description = "代理人_赠险管理_删除赠险",priority = 12)
public void 代理人_赠险管理_删除赠险(){
Map<String,Object> params = new HashMap<>();
params.put("id",inId);
Response response = network.getResponse(params,GRASS_delInsurance);
@Test(description = "代理人_赠险管理_删除赠险", priority = 12)
public void 代理人_赠险管理_删除赠险() {
Map<String, Object> params = new HashMap<>();
params.put("id", inId);
Response response = network.getResponse(params, GRASS_delInsurance);
boolean success = response.jsonPath().getBoolean("success");
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(success,network.message(params, GRASS_delInsurance,"删除赠险信息失败",response.body().asString()));
Assert.assertTrue(data,network.message(params, GRASS_delInsurance,"删除赠险信息校验失败",response.body().asString()));
Assert.assertTrue(success, network.message(params, GRASS_delInsurance, "删除赠险信息失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, GRASS_delInsurance, "删除赠险信息校验失败", response.body().asString()));
}
//******************** 访客 **********************8
@Test(description = "访客_记录查看素材",priority = 13)
public void 访客_记录查看素材(){
@Test(description = "访客_记录查看素材", priority = 13)
public void 访客_记录查看素材() {
//tKu 切换为访客
network.agentCookies.put("tKu",VISITOR_TKU);
network.agentCookies.put("tKu", VISITOR_TKU);
Map<String,Object> params = new HashMap<>();
params.put("scid",scid);
params.put("fromUserId",userId); //代理人的用户id
params.put("visitPath",1);
Response response = network.getResponse(params,CONTENT_READ);
Map<String, Object> params = new HashMap<>();
params.put("scid", scid);
params.put("fromUserId", userId); //代理人的用户id
params.put("visitPath", 1);
Response response = network.getResponse(params, CONTENT_READ);
visitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(visitId, network.message(params,CONTENT_READ,"访客记录查看素材失败",response.body().asString()));
Assert.assertNotNull(visitId, network.message(params, CONTENT_READ, "访客记录查看素材失败", response.body().asString()));
}
@Test(description = "访客_文章内容页",priority = 14)
public void 访客_文章内容页(){
Map<String,Object> infoParams = new HashMap<>();
infoParams.put("scid",scid);
Response response = network.getResponse(infoParams,ARTICLE_H5INFO);
@Test(description = "访客_文章内容页", priority = 14)
public void 访客_文章内容页() {
Map<String, Object> infoParams = new HashMap<>();
infoParams.put("scid", scid);
Response response = network.getResponse(infoParams, ARTICLE_H5INFO);
String id = response.jsonPath().getString("data.id");
Assert.assertEquals(grasscontentId,id, network.message(infoParams,ARTICLE_H5INFO,"访客查看文章失败",response.body().asString()));
Assert.assertEquals(grasscontentId, id, network.message(infoParams, ARTICLE_H5INFO, "访客查看文章失败", response.body().asString()));
}
//是否爆款素材
@Test(description = "访客_文章类型判断",priority = 15)
public void 访客_文章类型判断(){
Map<String,Object> params = new HashMap<>();
params.put("id",grasscontentId);
Response response = network.getResponse(params,ARTICLE_GETTAGTYPESBYCONTENTID);
@Test(description = "访客_文章类型判断", priority = 15)
public void 访客_文章类型判断() {
Map<String, Object> params = new HashMap<>();
params.put("id", grasscontentId);
Response response = network.getResponse(params, ARTICLE_GETTAGTYPESBYCONTENTID);
boolean isContains = response.jsonPath().getBoolean("data.contains('grass_content')");
Assert.assertTrue(isContains, network.message(params,ARTICLE_GETTAGTYPESBYCONTENTID,"访客-类型判断错误-类型应该存在种草素材",response.body().asString()));
Assert.assertTrue(isContains, network.message(params, ARTICLE_GETTAGTYPESBYCONTENTID, "访客-类型判断错误-类型应该存在种草素材", response.body().asString()));
//获得爆款素材详情
Map<String,Object> infoParams = new HashMap<>();
infoParams.put("contentId",grasscontentId);
response = network.getResponse(infoParams,ARTICLE_GETEXPINFO);
Map<String, Object> infoParams = new HashMap<>();
infoParams.put("contentId", grasscontentId);
response = network.getResponse(infoParams, ARTICLE_GETEXPINFO);
String tags = response.jsonPath().getString("data.tags");
String recommendReason = response.jsonPath().getString("data.recommendReason");
Assert.assertNotNull(tags, network.message(infoParams,ARTICLE_GETEXPINFO,"访客-获取文章标签有误",response.body().asString()));
Assert.assertNotNull(recommendReason,network.message(infoParams,ARTICLE_GETEXPINFO,"访客-获取文章推荐理由有误",response.body().asString()));
Assert.assertNotNull(tags, network.message(infoParams, ARTICLE_GETEXPINFO, "访客-获取文章标签有误", response.body().asString()));
Assert.assertNotNull(recommendReason, network.message(infoParams, ARTICLE_GETEXPINFO, "访客-获取文章推荐理由有误", response.body().asString()));
}
}
@AfterClass
public void tearDown(){
}
}
package com.kjj.cases.live.agent;
import com.kjj.bean.agent.GrabWelfares;
import com.kjj.bean.agent.LiveUserList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
......@@ -29,11 +30,8 @@ public class LiveLater implements Authorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// params.put("liveId","Kj21MzYyNjM");
Response response = network.getResponse(params,BasicConfig.MOBILE_recycleSuccessCase);
boolean success =response.jsonPath().getBoolean("success");
System.out.println(success);
Assert.assertTrue(success, network.message(params, BasicConfig.MOBILE_recycleSuccessCase, "接口请求失败", response.body().asString()));
System.out.println(response.body().asString());
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_recycleSuccessCase, "未获取到成功案例", response.body().asString()));
}
......@@ -90,7 +88,6 @@ public class LiveLater implements Authorization {
System.out.println(data);
String nickname =response.jsonPath().getString("data.nickname");
Assert.assertEquals(nickname,"张三", network.message(params, BasicConfig.MOBILE_providerInfo, "未获取到发奖人姓名", response.body().asString()));
String phoneNumber =response.jsonPath().getString("data.phoneNumber");
Assert.assertEquals(phoneNumber,"15558005636", network.message(params, BasicConfig.MOBILE_providerInfo, "未获取到发奖人手机号", response.body().asString()));
}
......@@ -228,8 +225,25 @@ public class LiveLater implements Authorization {
Response response = network.getResponse(params,BasicConfig.MOBILE_getClueDetail);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(response.body().asString());
Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_getClueDetail, "查看客户A线索详情失败", response.body().asString()));
int visitorInviteNum=response.jsonPath().getInt("data.visitorInviteNum");
Assert.assertTrue(visitorInviteNum==1, network.message(params, BasicConfig.MOBILE_getClueDetail, "访客邀请数不对", response.body().asString()));
String remarkName=response.jsonPath().getString("data.remarkName");
Assert.assertEquals(remarkName,"访客A", network.message(params, BasicConfig.MOBILE_getClueDetail, "访客备注名不正确", response.body().asString()));
int speakNum=response.jsonPath().getInt("data.speakNum");
Assert.assertTrue(speakNum>0, network.message(params, BasicConfig.MOBILE_getClueDetail, "没有评论数", response.body().asString()));
Object questions=response.jsonPath().getJsonObject("data.questions");
Assert.assertNotNull(questions, network.message(params, BasicConfig.MOBILE_getClueDetail, "用户提问列表为null", response.body().asString()));
Object resources=response.jsonPath().getJsonObject("data.resources");
Assert.assertNotNull(resources, network.message(params, BasicConfig.MOBILE_getClueDetail, "用户领取资料列表为null", response.body().asString()));
Object grabWelfares=response.jsonPath().getJsonObject("data.grabWelfares");
Assert.assertNotNull(grabWelfares, network.message(params, BasicConfig.MOBILE_getClueDetail, "用户中奖列表为null", response.body().asString()));
Object choiceQuestions=response.jsonPath().getJsonObject("data.choiceQuestions");
Assert.assertNotNull(choiceQuestions, network.message(params, BasicConfig.MOBILE_getClueDetail, "投票列表为null", response.body().asString()));
Object testResources=response.jsonPath().getJsonObject("data.testResources");
Assert.assertNotNull(testResources, network.message(params, BasicConfig.MOBILE_getClueDetail, "用户提交测试资源报告为null", response.body().asString()));
List<GrabWelfares>list=JsonUtil.parseResponseToListBean(response,GrabWelfares.class,"grabWelfares");
Boolean specifyAward =list.get(0).getSpecifyAward();
Assert.assertTrue(specifyAward,network.message(params, BasicConfig.MOBILE_getClueDetail, "指定中奖为null", response.body().asString()));
}
......@@ -249,7 +263,8 @@ public class LiveLater implements Authorization {
//需要校验返回结果
@Test(description="访客邀请列表",priority = 14)
public void 访客邀请列表() {
public void
访客邀请列表() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// params.put("liveId","Kj21MzYyNjM");
......@@ -279,7 +294,7 @@ public class LiveLater implements Authorization {
//代理人首页已结束直播,查询待跟进线索数
@Test(description="查询待跟进线索数",priority = 15)
@Test(description="查询待跟进线索数",priority = 16)
public void 查询待跟进线索数() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -296,20 +311,4 @@ public class LiveLater implements Authorization {
}
//不确定业务场景
@Test(description="代理人直播线索页分页查询咨询消息",priority = 16)
public void 代理人直播线索页分页查询咨询消息() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
// params.put("liveId","Kj21MzYyNjM");
Response response = network.getResponse(params,BasicConfig.MOBILE_clueTextList);
boolean success=response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(params, BasicConfig.MOBILE_clueTextList, "接口调用失败", response.body().asString()));
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
// Assert.assertNotNull(data, network.message(params, BasicConfig.MOBILE_clueTextList, "咨询消息为null", response.body().asString()));
}
}
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