Commit 2227a860 authored by 龚小红's avatar 龚小红

Merge branch '2021081201_gxh' into 'master'

2021081201 gxh

See merge request test-group/kejiji!95
parents a948910d 4ddb4993
package com.kjj.bean.marketTools;
import lombok.Data;
@Data
public class Activity {
private String title;
private long id;
private int status;
}
...@@ -25,7 +25,7 @@ public class ArticalPersonCard implements Authorization { ...@@ -25,7 +25,7 @@ public class ArticalPersonCard implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
agentAuth(); agentTku();
} }
//文章内容页 //文章内容页
......
package com.kjj.cases.assistant.homePage; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.BaseUtils.tku;
import static com.kjj.utils.IdMakeUtil.decodingId;
import static com.kjj.utils.IdMakeUtil.encodingId;
import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.bean.marketTools.Activity;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils; import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
import java.io.IOException; import java.util.*;
import java.util.HashMap;
import java.util.Map;
public class HomePage implements Authorization { public class HomePage implements Authorization {
public int firstTagId; //获取种草素材标签ID public int firstTagId; //获取种草素材标签ID
...@@ -20,13 +26,23 @@ public class HomePage implements Authorization { ...@@ -20,13 +26,23 @@ public class HomePage implements Authorization {
public int hotTagId; //获取热榜标签ID public int hotTagId; //获取热榜标签ID
public int posterTagId; //获取海报标签ID public int posterTagId; //获取海报标签ID
public String posterContentId; //获取海报的的contentId public String posterContentId; //获取海报的的contentId
public String grasscontentId; //获取种草文章id
public int caseId; //获取成功案例id public int caseId; //获取成功案例id
public long answer1 = 4700; //胃部测评的id
public long answer2 = 8784; //摆摊测试的id
public long activity1; //胃部测评的互动id
public long activity2; //摆摊测试的互动id
public String scid; //获取文章对应的scid
public int sid; //代理人的sid
public int userId; //用户的userId
public String visitId; //用户的visitId
public String activityScid; //测评对应的scid
public long articleId; //解密后的的文章id
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
agentTku(); agentTku();
userTku();
} }
//获取种草素材列表页 //获取种草素材列表页
...@@ -40,6 +56,15 @@ public class HomePage implements Authorization { ...@@ -40,6 +56,15 @@ public class HomePage implements Authorization {
Response response = network.getResponse(params,HOME_getContentList); Response response = network.getResponse(params,HOME_getContentList);
Object obj = response.jsonPath().getJsonObject("data.list"); Object obj = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页种草素材列表失败",response.body().asString())); Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页种草素材列表失败",response.body().asString()));
grasscontentId = response.jsonPath().getString("data.list.get(0).contentId");
articleId = decodingId(grasscontentId);
//获取素材对应的scid
params.clear();
params.put("contentId", grasscontentId);
response = network.getResponse(params, GETSCID);
scid = response.jsonPath().getString("data");
Assert.assertNotNull(scid, network.message(params, GETSCID, "获取文章的scid失败", response.body().asString()));
} }
//获取发圈素材列表 //获取发圈素材列表
...@@ -343,4 +368,395 @@ public class HomePage implements Authorization { ...@@ -343,4 +368,395 @@ public class HomePage implements Authorization {
Assert.assertEquals(feedbackContent,"自动化测试",network.message(MANAGER_feedBackList,"个人中心反馈失败",manageRes.body().asString())); Assert.assertEquals(feedbackContent,"自动化测试",network.message(MANAGER_feedBackList,"个人中心反馈失败",manageRes.body().asString()));
} }
//***********************文章配置素材*******************************
@Test(description = "代理人_访问文章未配置互动素材", priority = 26)
public void 代理人_访问文章未配置互动素材() {
agentTku();
Map<String, Object> params = new HashMap<String, Object>();
params.put("cid", grasscontentId);
Response response = network.getResponse(params, ARTICLE_interact);
boolean success = response.jsonPath().getBoolean("success");
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(success, network.message(params, ARTICLE_interact, "接口返回失败", response.body().asString()));
Assert.assertEquals(size,0, network.message(params, ARTICLE_interact, "返回数据为空", response.body().asString()));
//获取文章对应的scid
params.clear();
params.put("contentId", grasscontentId);
response = network.getResponse(params, GETSCID);
scid = response.jsonPath().getString("data");
Assert.assertNotNull(scid, network.message(params, GETSCID, "获取文章的scid失败", response.body().asString()));
}
@Test(description = "管理后台_新增互动方案", priority = 27)
public void 管理后台_新增互动方案() {
ssoLogin();
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response response = network.getResponse(params, MANAGER_searchAnswerList);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_searchAnswerList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
List<Activity> list = JsonUtil.parseResponsePathToListBean(response,"data.list", Activity.class);
for (Activity item:list) {
if(item.getTitle().equals("肝脏测评")){
answer1 = item.getId();
}
if(item.getTitle().equals("摆摊测试")){
answer2 = item.getId();
}
}
params.clear();
params.put("activityId", answer1);
params.put("activityName", "肝脏测试");
params.put("coverImgUrl", "https://yun.dui88.com/kjy/image/20210804/1628075514881.jpeg");
params.put("activityRemark", "");
response = network.postResponse(params, MANAGER_saveActivity);
success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_saveActivity, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_saveActivity, "返回数据为空", response.body().asString()));
params.clear();
params.put("activityId", answer2);
params.put("activityName", "摆摊测试");
params.put("coverImgUrl", "https://yun.dui88.com/kjy/image/20210804/1628075514881.jpeg");
params.put("activityRemark", "");
response = network.postResponse(params, MANAGER_saveActivity);
success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_saveActivity, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_saveActivity, "返回数据为空", response.body().asString()));
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_solutionPageList);
success = response.jsonPath().getBoolean("success");
data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_solutionPageList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, MANAGER_solutionPageList, "返回数据为空", response.body().asString()));
System.out.println(response.body().asString());
activity1 = response.jsonPath().getLong("data.list.get(1).id");
activity2 = response.jsonPath().getLong("data.list.get(0).id");
Assert.assertNotNull(activity1, network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
Assert.assertNotNull(activity2, network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_修改互动方案", priority = 28)
public void 管理后台_修改互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
params.put("activityName", "快来摆摊测试吧");
params.put("coverImgUrl", "https://yun.dui88.com/kjy/image/20210804/1628075514881.jpeg");
params.put("activityRemark", "备注呀");
Response response = network.postResponse(params, MANAGER_updateActivity);
boolean success = response.jsonPath().getBoolean("success");
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(success, network.message(params, MANAGER_updateActivity, "接口返回失败", response.body().asString()));
Assert.assertTrue(data, network.message(params, MANAGER_updateActivity, "修改失败", response.body().asString()));
params.clear();
params.put("activityId", answer2);
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_solutionPageList);
System.out.println(response.body().asString());
success = response.jsonPath().getBoolean("success");
Object result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_solutionPageList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(result, network.message(params, MANAGER_solutionPageList, "接口返回失败", response.body().asString()));
String activityName = response.jsonPath().getString("data.list.get(0).activityName");
Assert.assertEquals(activityName, "快来摆摊测试吧",network.message(params, MANAGER_searchAnswerList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_通过方案id查找方案是否存在", priority = 29)
public void 管理后台_通过方案id查找方案是否存在() {
Map<String, Object> params = new HashMap<String, Object>();
//存在
params.put("interactId", activity2);
Response response = network.getResponse(params, MANAGER_activityName);
boolean success = response.jsonPath().getBoolean("success");
String data = response.jsonPath().getString("data");
Assert.assertTrue(success, network.message(params, MANAGER_activityName, "接口返回失败", response.body().asString()));
Assert.assertEquals(data,"快来摆摊测试吧", network.message(params, MANAGER_activityName, "方案名称错误", response.body().asString()));
//不存在
params.put("interactId", 2);
response = network.getResponse(params, MANAGER_activityName);
success = response.jsonPath().getBoolean("success");
data = response.jsonPath().getString("data");
Assert.assertTrue(success, network.message(params, MANAGER_activityName, "接口返回失败", response.body().asString()));
Assert.assertEquals(data,null, network.message(params, MANAGER_activityName, "此方案存在", response.body().asString()));
}
@Test(description = "管理后台_新增文章关联互动方案", priority = 30)
public void 管理后台_新增文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
interactIds.add((int)activity2);
params.put("articleId", articleId);
params.put("interactIds",interactIds);
params.put("refRemark", "");
Response response = network.postResponse(params, MANAGER_saveInteract);
System.out.println(params);
System.out.println(response.body().asString());
System.out.println(new Date());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_saveInteract, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_saveInteract, "接口返回失败", response.body().asString()));
params.clear();
params.put("articleId", articleId);
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_articlePageList);
System.out.println(params);
System.out.println(response.body().asString());
success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_articlePageList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, MANAGER_articlePageList, "接口返回失败", response.body().asString()));
int aolutionId = response.jsonPath().getInt("data.list.get(0).interactSolution.get(0).interactId");
Assert.assertEquals(aolutionId, activity2,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "管理后台_互动方案使用中会删除失败", priority = 31)
public void 管理后台_互动方案使用中会删除失败() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity2);
Response response = network.postResponse(params, MANAGER_deleteActivity);
System.out.println(params);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(params, MANAGER_deleteActivity, "有文章使用互动方案删除成功", response.body().asString()));
params.clear();
params.put("activityId", activity2);
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_solutionPageList);
success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_solutionPageList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, MANAGER_solutionPageList, "有文章使用互动方案删除成功", response.body().asString()));
}
@Test(description = "代理人_访问文章新增配置互动素材", priority = 32)
public void 代理人_访问文章新增配置互动素材() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("cid", grasscontentId);
Response response = network.getResponse(params, ARTICLE_interact);
System.out.println(new Date());
System.out.println(params);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
String data = response.jsonPath().getString("data");
Assert.assertTrue(success, network.message(params, ARTICLE_interact, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, ARTICLE_interact, "返回数据为空", response.body().asString()));
String activityIdStr = response.jsonPath().getString("data.get(0).activityId");
long activityId = decodingId(activityIdStr);
Assert.assertEquals(activityId,answer2, network.message(params, ARTICLE_interact, "访问文章配置素材ID与实际配置不一致", response.body().asString()));
}
@Test(description = "管理后台_修改文章关联互动方案", priority = 33)
public void 管理后台_修改文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<Integer> interactIds = new ArrayList<Integer>();
interactIds.add((int)activity1);
params.put("articleId", articleId);
params.put("interactIds",interactIds);
params.put("refRemark", "更新了方案");
Response response = network.postResponse(params, MANAGER_updateInteract);
System.out.println(new Date());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_updateInteract, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_updateInteract, "接口返回失败", response.body().asString()));
params.clear();
params.put("articleId", articleId);
params.put("activityName", "");
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_articlePageList);
success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_articlePageList, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, MANAGER_articlePageList, "接口返回失败", response.body().asString()));
int aolutionId = response.jsonPath().getInt("data.list.get(0).interactSolution.get(0).interactId");
Assert.assertEquals(aolutionId, activity1,network.message(params, MANAGER_articlePageList, "返回数据为空", response.body().asString()));
}
@Test(description = "代理人_访问文章修改配置互动素材并转发", priority = 34)
public void 代理人_访问文章修改配置互动素材并转发() {
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("cid", grasscontentId);
Response response = network.getResponse(params, ARTICLE_interact);
System.out.println(new Date());
boolean success = response.jsonPath().getBoolean("success");
String data = response.jsonPath().getString("data");
Assert.assertTrue(success, network.message(params, ARTICLE_interact, "接口返回失败", response.body().asString()));
Assert.assertNotNull(data, network.message(params, ARTICLE_interact, "返回数据为空", response.body().asString()));
String activityIdStr = response.jsonPath().getString("data.get(0).activityId");
long activityId = decodingId(activityIdStr);
Assert.assertEquals(activityId,answer1, network.message(params, ARTICLE_interact, "访问文章配置素材ID与实际配置不一致", response.body().asString()));
//转发文章
params.clear();
params.put("scId", scid);
params.put("forwardType", 1);
response = network.getResponse(params, FORWARD);
success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString()));
params.clear();
response = network.getResponse(USER_INFO);
sid = response.jsonPath().getInt("data.sellerId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
}
@Test(description = "访客_访问文章并参与测评", priority = 34)
public void 访客_访问文章并参与测评() {
//切换为新用户小葡萄,每次都会产生线索
network.agentCookies.put("tku", tku);
//获取用户信息
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO);
userId = response.jsonPath().getInt("data.userId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
//阅读文章
params.clear();
params.put("scid", scid);
params.put("fromUserId", userId); //代理人的用户id
params.put("visitPath", 1);
response = network.getResponse(params, CONTENT_READ);
visitId = response.jsonPath().getString("data.visitId");
System.out.println("visitId:"+visitId);
Assert.assertNotNull(visitId, network.message(params, CONTENT_READ, "访客记录查看素材失败", response.body().asString()));
//打开测评
params.clear();
params.put("contentId",encodingId(answer1));
params.put("sid",encodingId((long)sid));
response = network.getResponse(params, GETSCID);
activityScid = response.jsonPath().getString("data");
System.out.println(activityScid);
Assert.assertNotNull(scid,network.message(params, GETSCID,"获取scid失败",response.body().asString()));
params.clear();
params.put("scid", activityScid);
params.put("fromUserId", userId); //代理人的用户id
params.put("sourceScId", scid); //代理人的用户id
params.put("visitPath", 1);
response = network.getResponse(params, CONTENT_READ);
visitId = response.jsonPath().getString("data.visitId");
System.out.println("visitId:"+visitId);
Assert.assertNotNull(visitId, network.message(params, CONTENT_READ, "访客记录查看素材失败", response.body().asString()));
//发送测试结果-多次提交接口返回失败
params.clear();
params.put("scid", activityScid);
params.put("completed",1);
params.put("sourceScId",scid);
params.put("visitExtra", "{\"食物\":\"爱吃垃圾食品\",\"喝酒\":\"爱喝酒\",\"睡觉\":\"习惯早睡\",\"早餐\":\"按时吃早饭\",\"心情\":\"心情烦闷\"}");
response = network. postResponse(params,GAME_sendInfo);
System.out.println(response.body().asString());
//申请领取报告
params.clear();
params.put("scid", activityScid);
params.put("completed",1);
params.put("sourceScId",scid);
params.put("originScId",scid);
params.put("riskTestOperateType",2);
params.put("sourceType","1");
params.put("visitId",visitId);
response = network. postResponse(params,GAME_sendInfoForRisk);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, GAME_sendInfoForRisk, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, GAME_sendInfoForRisk, "申请领取食谱失败", response.body().asString()));
}
@Test(description = "管理后台_删除文章关联互动方案", priority = 35)
public void 管理后台_删除文章关联互动方案() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("articleId", articleId);
Response response = network.postHeaderResponse(params, MANAGER_deleteInteract);
System.out.println(params);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_deleteInteract, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_deleteInteract, "删除失败", response.body().asString()));
params.clear();
params.put("articleId", articleId);
params.put("activityName", "");
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_articlePageList);
success = response.jsonPath().getBoolean("success");
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(success, network.message(params, MANAGER_articlePageList, "接口返回失败", response.body().asString()));
Assert.assertEquals(size, 0, network.message(params, MANAGER_articlePageList, "删除失败", response.body().asString()));
}
@Test(description = "代理人_访问文章删除配置互动素材", priority = 36)
public void 代理人_访问文章删除配置互动素材() {
agentTku();
sleep(10000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("cid", grasscontentId);
Response response = network.getResponse(params, ARTICLE_interact);
boolean success = response.jsonPath().getBoolean("success");
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(success, network.message(params, ARTICLE_interact, "接口返回失败", response.body().asString()));
Assert.assertEquals(size, 0, network.message(params, ARTICLE_interact, "返回数据不为空", response.body().asString()));
}
@Test(description = "管理后台_删除互动方案成功", priority = 37)
public void 管理后台_删除互动方案成功() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", activity1);
Response response = network.postHeaderResponse(params, MANAGER_deleteActivity);
System.out.println(params);
System.out.println(response.body().asString());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_deleteActivity, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_deleteActivity, "删除失败", response.body().asString()));
params.put("id", activity2);
response = network.postHeaderResponse(params, MANAGER_deleteActivity);
success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success, network.message(params, MANAGER_deleteActivity, "接口返回失败", response.body().asString()));
Assert.assertTrue(result, network.message(params, MANAGER_deleteActivity, "删除失败", response.body().asString()));
params.clear();
params.put("activityId", answer1);
params.put("activityName", "");
params.put("pageIndex", 1);
params.put("pageSize", 20);
response = network.getResponse(params, MANAGER_solutionPageList);
success = response.jsonPath().getBoolean("success");
int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(success, network.message(params, MANAGER_solutionPageList, "接口返回失败", response.body().asString()));
Assert.assertEquals(size,0, network.message(params, MANAGER_solutionPageList, "删除失败", response.body().asString()));
}
} }
package com.kjj.cases.assistant.homePage; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.IdMakeUtil.decodingId;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils; import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -31,7 +33,6 @@ public class RecommendMaterial implements Authorization { ...@@ -31,7 +33,6 @@ public class RecommendMaterial implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
userTku();
agentTku(); agentTku();
} }
...@@ -406,6 +407,4 @@ public class RecommendMaterial implements Authorization { ...@@ -406,6 +407,4 @@ public class RecommendMaterial implements Authorization {
String desc = response.jsonPath().getString("desc"); String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc, "OK", network.message(params, CHECKUNREAD, "访客-获取私信有误", response.body().asString())); Assert.assertEquals(desc, "OK", network.message(params, CHECKUNREAD, "访客-获取私信有误", response.body().asString()));
} }
} }
\ No newline at end of file
...@@ -9,6 +9,8 @@ import org.testng.annotations.*; ...@@ -9,6 +9,8 @@ import org.testng.annotations.*;
import java.util.*; import java.util.*;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku;
public class PersonalCenter implements Authorization{ public class PersonalCenter implements Authorization{
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
public String faqId; // 问答的contentId public String faqId; // 问答的contentId
......
...@@ -20,6 +20,8 @@ import java.util.HashMap; ...@@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class WhoSawMe implements Authorization { public class WhoSawMe implements Authorization {
private Response response; private Response response;
...@@ -30,6 +32,8 @@ public class WhoSawMe implements Authorization { ...@@ -30,6 +32,8 @@ public class WhoSawMe implements Authorization {
private Long xxrUserId; private Long xxrUserId;
private Long jjSellerId; private Long jjSellerId;
private String tagId0; private String tagId0;
private String reportId;
private String reportScid;
private String weeklyPublicationId; private String weeklyPublicationId;
private String scid; // 代理人周报scid private String scid; // 代理人周报scid
private String taskArticleContentId; // 任务素材contentId private String taskArticleContentId; // 任务素材contentId
...@@ -869,4 +873,74 @@ public class WhoSawMe implements Authorization { ...@@ -869,4 +873,74 @@ public class WhoSawMe implements Authorization {
Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString())); Assert.assertEquals(remarkName, "备注", network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户备注错误", response.body().asString()));
Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString())); Assert.assertTrue(tagIsMark, network.message(param, BasicConfig.GETCUSTAGANDMEMO, "用户标签错误", response.body().asString()));
} }
// 销售线索_测评报告领取线索
@Test(description = "销售线索_测评报告领取线索", priority = 58)
public void 销售线索_测评报告领取线索() throws IOException{
agentTku();
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
String clueSummary = response.jsonPath().getString("data.list.find{it.nickName == '小葡萄'}.clueSummary");
Assert.assertEquals(clueSummary, "TA想要领取风险测评报告", network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
clueId = response.jsonPath().getLong("data.list.find{it.nickName == '小葡萄'}.clueId");
System.out.println(response.body().asString());
}
// 销售线索_查看测评报告的领取详情
@Test(description = "销售线索_查看测评报告的领取详情", priority = 59)
public void 销售线索_查看测评报告的领取详情() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
response = network.getResponse(param, BasicConfig.CLUEINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUEINFO, "接口请求失败", response.body().asString()));
int visitClueType = response.jsonPath().getInt("data.visitClueType");
reportId = response.jsonPath().getString("data.contentId");
String clueSummary = response.jsonPath().getString("data.clueSummary");
Assert.assertEquals(visitClueType, 32, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(clueSummary, "领评测报告", network.message(param, BasicConfig.CLUEINFO, "线索来源类型错误", response.body().asString()));
System.out.println(response.body().asString());
}
// 代理人_转发评测报告
@Test(description = "代理人_转发评测报告", priority = 60)
public void 代理人_转发评测报告() throws IOException{
param = new HashMap<>();
param.put("contentId",reportId);
response = network.getResponse(param,GETSCID);
reportScid = response.jsonPath().getString("data");
Assert.assertNotNull(reportScid, network.message(param,GETSCID,"获取sCid失败",response.body().asString()));
//查看线索客户信息
param.put("clueId",clueId);
Response response = network.getResponse(param,WHOSAWME_clientInfo);
String custName = response.jsonPath().getString("data.custName");
Assert.assertEquals(custName,"小葡萄", network.message(param,WHOSAWME_clientInfo,"线索客户信息错误",response.body().asString()));
}
// 访客_咨询问题
@Test(description = "访客_咨询问题", priority = 61)
public void 访客_咨询问题() throws IOException{
userTku();
//获取问题按钮列表
param.put("scene",1);
Response response = network.getResponse(param,GAME_button);
int size = response.jsonPath().getInt("data.size()");
Assert.assertEquals(size, 4, network.message(param,GAME_button,"问题个数错误",response.body().asString()));
//点击问题
param.clear();
param.put("order",3);
param.put("scene",2);
param.put("scid",reportScid);
response = network.postResponse(param,GAME_consult);
String sCid = response.jsonPath().getString("data");
Assert.assertNotNull(reportScid, network.message(param,GAME_consult,"获取sCid失败",response.body().asString()));
}
} }
...@@ -242,7 +242,7 @@ public class Answer implements Authorization { ...@@ -242,7 +242,7 @@ public class Answer implements Authorization {
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString())); Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString()));
Integer amount = response.jsonPath().getJsonObject("data.amount"); Integer amount = response.jsonPath().getJsonObject("data.amount");
System.out.println(amount); System.out.println( response.body().asString());
Assert.assertTrue(amount>0,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString())); Assert.assertTrue(amount>0,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString()));
......
...@@ -444,7 +444,7 @@ public class FlipCard implements Authorization { ...@@ -444,7 +444,7 @@ public class FlipCard implements Authorization {
@Test(description = "用户开红包状态查询", priority = 21) @Test(description = "用户开红包状态查询", priority = 21)
public void 用户开红包状态查询() { public void 用户开红包状态查询() {
ThreadSleepUtils.sleep(1000); ThreadSleepUtils.sleep(3000);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
...@@ -1355,7 +1355,7 @@ public class Lottery implements Authorization { ...@@ -1355,7 +1355,7 @@ public class Lottery implements Authorization {
Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result); Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result);
try { try {
Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery"); Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery");
Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "企业指定访客F未中奖", hasEndRes.body().asString())); Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "团队未指定访客F中奖", hasEndRes.body().asString()));
} catch (Exception e) { } catch (Exception e) {
System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get())); System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get()));
throw e; throw e;
...@@ -1364,22 +1364,22 @@ public class Lottery implements Authorization { ...@@ -1364,22 +1364,22 @@ public class Lottery implements Authorization {
@Test(description = "不在团队指定访客I是否中奖", priority = 93) @Test(description = "不在团队指定访客I是否中奖", priority = 93)
public void 不在团队指定访客I是否中奖() { public void 不在团队指定访客I是否中奖() {
visitorAuth8(); visitorAuth8();
ThreadSleepUtils.sleep(3000); ThreadSleepUtils.sleep(3000);
Map<String, Object> hasEndParam = new HashMap<>(); Map<String, Object> hasEndParam = new HashMap<>();
hasEndParam.put("confId", this.List_ConfId.get(3).getWelfareConfId()); hasEndParam.put("confId", this.List_ConfId.get(3).getWelfareConfId());
hasEndParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); hasEndParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result); Response hasEndRes = network.getResponse(hasEndParam, BasicConfig.USER_result);
try { try {
Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery"); Boolean data = hasEndRes.jsonPath().getBoolean("data.lottery");
Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "企业指定访客I未中奖", hasEndRes.body().asString())); Assert.assertFalse(data, network.message(hasEndParam, BasicConfig.USER_result, "团队未指定访客I中奖", hasEndRes.body().asString()));
} catch (Exception e) { } catch (Exception e) {
System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get())); System.out.println("result = " + JSON.toJSONString(hasEndRes.jsonPath().get()));
throw e; throw e;
} }
} }
@Test(description = "开始第五轮抽奖", priority = 94) @Test(description = "开始第五轮抽奖", priority = 94)
......
...@@ -738,6 +738,7 @@ public class BasicConfig { ...@@ -738,6 +738,7 @@ public class BasicConfig {
public static final String CLUEINFO = HOST + "/kjy/mp/whoSawMe/clue/info"; public static final String CLUEINFO = HOST + "/kjy/mp/whoSawMe/clue/info";
public static final String CLUEADVISE = HOST + "/kjy/mp/whoSawMe/clue/info/advise"; public static final String CLUEADVISE = HOST + "/kjy/mp/whoSawMe/clue/info/advise";
public static final String FOLLOWADVICE = HOST + "/kjy/mp/whoSawMe/clue/followAdvice"; public static final String FOLLOWADVICE = HOST + "/kjy/mp/whoSawMe/clue/followAdvice";
public static final String WHOSAWME_clientInfo = HOST + "/kjy/mp/whoSawMe/clue/clientInfo";
// *************** 运营周报 *************** // *************** 运营周报 ***************
public static final String WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo"; public static final String WEEKLY_INDEXINFO = HOST + "/kjy/mp/weekly/getWeeklyIndexInfo";
...@@ -805,6 +806,7 @@ public class BasicConfig { ...@@ -805,6 +806,7 @@ public class BasicConfig {
public static final String ARTICLE_ENHANCEDCOLUMN_GETFAQS = HOST + "/kjy/mp/enhancedColumn/getFAQs"; public static final String ARTICLE_ENHANCEDCOLUMN_GETFAQS = HOST + "/kjy/mp/enhancedColumn/getFAQs";
public static final String ARTICLE_getQuestionDetail = HOST +"/kjy/mp/explosioncontent/qa/getQuestionDetail"; public static final String ARTICLE_getQuestionDetail = HOST +"/kjy/mp/explosioncontent/qa/getQuestionDetail";
public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = HOST + "/kjy/mp/explosioncontent/getExplosionContentList"; public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = HOST + "/kjy/mp/explosioncontent/getExplosionContentList";
public static final String ARTICLE_interact = HOST + "/kjy/mp/article/interact";
// 风险评测 // 风险评测
public static final String RISKTEST_SENDINFO = ACTIVITY1_HOST + "/kjy/mp/activity/sendInfoForRisk"; public static final String RISKTEST_SENDINFO = ACTIVITY1_HOST + "/kjy/mp/activity/sendInfoForRisk";
...@@ -983,6 +985,10 @@ public class BasicConfig { ...@@ -983,6 +985,10 @@ public class BasicConfig {
//*********************趣味测试************************ //*********************趣味测试************************
public static final String GAME_answerPageList = HOST + "/kjy/mp/game/answerPageList"; public static final String GAME_answerPageList = HOST + "/kjy/mp/game/answerPageList";
public static final String GAME_clueList = HOST + "/kjy/mp/tag/clue/list"; public static final String GAME_clueList = HOST + "/kjy/mp/tag/clue/list";
public static final String GAME_sendInfo= ACTIVITY_HOST + "/kjy/mp/activity/sendInfo";
public static final String GAME_sendInfoForRisk= ACTIVITY_HOST + "/kjy/mp/activity/sendInfoForRisk";
public static final String GAME_consult= ACTIVITY_HOST + "/kjy/mp/activity/consult";
public static final String GAME_button= ACTIVITY_HOST + "/kjy/mp/activity/button";
// *************** 管理后台 *************** // *************** 管理后台 ***************
public static final String SSO_doLogin = SSO_HOST + "/doLogin"; public static final String SSO_doLogin = SSO_HOST + "/doLogin";
...@@ -1012,6 +1018,14 @@ public class BasicConfig { ...@@ -1012,6 +1018,14 @@ public class BasicConfig {
public static final String MANAGER_encryptTku = MANAGER_HOST + "/kjy/manager/testUser/encryptTku"; public static final String MANAGER_encryptTku = MANAGER_HOST + "/kjy/manager/testUser/encryptTku";
public static final String MANAGER_changeCompany = MANAGER_HOST + "/kjy/manager/seller/changeCompany"; public static final String MANAGER_changeCompany = MANAGER_HOST + "/kjy/manager/seller/changeCompany";
public static final String MANAGER_feedBackList = MANAGER_HOST + "/kjy/manager/feedback/list"; public static final String MANAGER_feedBackList = MANAGER_HOST + "/kjy/manager/feedback/list";
public static final String MANAGER_articleInteraction = MANAGER_HOST + "/kjy/manager/interact/article/searchPageList"; public static final String MANAGER_searchAnswerList = MANAGER_HOST + "/kjy/manager/game/searchAnswerList";
public static final String MANAGER_interactSolution = MANAGER_HOST + "/kjy/manager/interact/solution/searchPageList"; public static final String MANAGER_saveActivity = MANAGER_HOST + "/kjy/manager/interact/solution/save";
public static final String MANAGER_updateActivity = MANAGER_HOST + "/kjy/manager/interact/solution/update";
public static final String MANAGER_solutionPageList = MANAGER_HOST + "/kjy/manager/interact/solution/searchPageList";
public static final String MANAGER_saveInteract = MANAGER_HOST + "/kjy/manager/interact/article/save";
public static final String MANAGER_updateInteract = MANAGER_HOST + "/kjy/manager/interact/article/update";
public static final String MANAGER_articlePageList = MANAGER_HOST + "/kjy/manager/interact/article/searchPageList";
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";
} }
...@@ -102,6 +102,18 @@ public class NetworkUtils { ...@@ -102,6 +102,18 @@ public class NetworkUtils {
return response; return response;
} }
// post 头部带参请求
public Response postHeaderResponse(Map<String, Object> params, String path) {
Response response = given()
.cookies(agentCookies)
.params(params)
.post(path);
if (!Objects.equals(response.statusCode(),200)){
System.out.println("请求状态码错误,path=【"+path+"】 code=【"+response.statusCode()+"】");
}
return response;
}
// post 文件上传 // post 文件上传
public Response postFileResponse(String filePath, String path){ public Response postFileResponse(String filePath, String path){
Response response = given() Response response = given()
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
<class name="com.kjj.cases.live.liveConfig.SaveLive"/> <class name="com.kjj.cases.live.liveConfig.SaveLive"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="成功案例"> <test preserve-order="true" name="成功案例">
<classes> <classes>
<class name="com.kjj.cases.live.liveConfig.LiveCase"/> <class name="com.kjj.cases.live.liveConfig.LiveCase"/>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<class name="com.kjj.cases.assistant.homePage.Upload"/> <class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "获取访客"> <test preserve-order="true" name = "获取访客">
<classes> <classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/> <class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
......
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