Commit 3772ae45 authored by 龚小红's avatar 龚小红

替换自动化的假用户,并完善集客助手的支付逻辑

parent ecd24611
......@@ -25,14 +25,14 @@ public interface Authorization {
*/
//代理人吉吉 sid:2991
default void agentTku() {
network.agentCookies.put("tku", AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT_TKU);
System.out.println("代理人tku:" + AGENT_TKU);
}
//代理人
default void visitor2Tku() {
network.agentCookies.put("tku", AGENT2_TKU);
default void agent2Tku() {
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
System.out.println("代理人tku:" + AGENT2_TKU);
}
......@@ -40,24 +40,30 @@ public interface Authorization {
// 获取访客tku:Su Yi
default void userTku() {
network.agentCookies.put("tku", VISITOR_UserTku);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_UserTku);
System.out.println("访客tku:" + VISITOR_UserTku);
}
// 获取访客tku:请勿打扰
default void userTku1() {
network.agentCookies.put("tku", VISITOR_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
System.out.println("访客tku:" + VISITOR_TKU);
}
// 获取访客tku:小雪人
// 获取访客tku:Ryan
default void userTku2() {
network.agentCookies.put("tku", VISITOR1_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR1_TKU);
System.out.println("访客tku:" + VISITOR1_TKU);
}
// 获取访客tku:向日葵
default void userTku3() {
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR2_TKU);
System.out.println("访客tku:" + VISITOR2_TKU);
}
//获取代理人tku,180天打卡返现专用:Jovia
default void cashBackTku(){
network.agentCookies.put("tku",CASHBACK_TKU);
network.agentCookies.put(TKU_COOKIE_NAME,CASHBACK_TKU);
System.out.println("打卡返现tku:"+CASHBACK_TKU);
}
......@@ -110,7 +116,7 @@ public interface Authorization {
System.out.println("用户AUTH_KEY:" + visitorAuth5);
}
//访客F(新强)授权,用户ID:82
//访客F(新强)授权,用户ID:82 厦门客户不可中奖
default void visitorAuth6() {
network.agentCookies.put("authKey", visitorAuth6);
System.out.println("用户AUTH_KEY:" + visitorAuth6);
......@@ -241,6 +247,24 @@ public interface Authorization {
System.out.println("用户AUTH_KEY:" + visitorAuth27);
}
//访客 (🍗)ID:213
default void visitorAuth28() {
network.agentCookies.put("authKey", visitorAuth28);
System.out.println("用户AUTH_KEY:" + visitorAuth28);
}
//访客(叶庭玮)ID:211
default void visitorAuth29() {
network.agentCookies.put("authKey", visitorAuth29);
System.out.println("用户AUTH_KEY:" + visitorAuth29);
}
//访客 (袁静怡)ID:1470
default void visitorAuth30() {
network.agentCookies.put("authKey", visitorAuth30);
System.out.println("用户AUTH_KEY:" + visitorAuth30);
}
//自动化假用户
// 用户ID:4054
default void visitorAuto1() {
......
......@@ -19,7 +19,7 @@ public class ArticalPersonCard implements Authorization {
public String sid; // 加密的销售ID
public String articleContentId; // 文章的contentId
public String scid; // getScid后的文章scid
public String scId; // 底部名片获取的scid
public String cardScid; // 底部名片获取的scid
public int userId; // 代理人用户ID
public String visitId; // 访问记录ID
......@@ -128,7 +128,7 @@ public class ArticalPersonCard implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("sid",sid);
response = network.getResponse(params,SELLERCARD_BOTTOMOFCONTENT);
scId = response.jsonPath().getString("data.scid");
cardScid = response.jsonPath().getString("data.scid");
String name = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(name,sellerName,network.message(params,SELLERCARD_BOTTOMOFCONTENT ,",名片信息错误",response.body().asString()));
......@@ -204,19 +204,19 @@ public class ArticalPersonCard implements Authorization {
sleep(2000);
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);//代理人的scid
params.put("cancelPush",false);
params.put("scid",cardScid);//代理人的scid
params.put("sourceScid",scid);
params.put("fromUserId",userId); // 代理人的用户id
params.put("visitPath",1); //访问路径来源 0未知,1个人,2朋友圈,3群
Response response = network.getResponse(params,CONTENT_READ);
visitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(visitId,network.message(params,CONTENT_READ,"访客视角-获取访问记录失败",response.body().asString()));
Response response = network.postResponse(params,CONTENT_visit);
visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId,network.message(params,CONTENT_visit,"访客视角-获取访问记录失败",response.body().asString()));
}
@Test(description="访客_点赞",priority = 11)
public void 访客_点赞(){
//统计点赞数量
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId",scId);
params.put("scId", cardScid);
Response response = network.getResponse(params,HASALREADYLIKE);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
......@@ -228,7 +228,7 @@ public class ArticalPersonCard implements Authorization {
//点赞
params.clear();
params.put("scId",scId);
params.put("scId", cardScid);
params.put("visitTableId",visitId);
response = network.postResponse(params,INTERACTION_LIKE);
success = response.jsonPath().getBoolean("success");
......@@ -250,7 +250,7 @@ public class ArticalPersonCard implements Authorization {
//查看是否点赞成功
params.clear();
params.put("scId",scId);
params.put("scId", cardScid);
response = network.getResponse(params,HASALREADYLIKE);
int favourTimesNew = response.jsonPath().getInt("data.favourTimes");
favourResult = response.jsonPath().getBoolean("data.favourResult");
......
......@@ -21,7 +21,7 @@ public class EnterpriseAgent implements Authorization {
@BeforeClass
public void setup() {
visitor2Tku();
agent2Tku();
superUserLogin();
ssoLogin();
}
......@@ -406,7 +406,7 @@ public class EnterpriseAgent implements Authorization {
@Test(description = "代理人_查看编辑后的活动", priority = 28)
public void 代理人_查看编辑后的活动() {
visitor2Tku();
agent2Tku();
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
Response response = network.getResponse(params, BasicConfig.HOME_activityDetail);
......@@ -436,7 +436,7 @@ public class EnterpriseAgent implements Authorization {
@Test(description = "代理人_查看活动结束", priority = 30)
public void 代理人_查看活动结束() {
visitor2Tku();
agent2Tku();
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
Response response = network.getResponse(params, BasicConfig.HOME_activityDetail);
......
......@@ -3,6 +3,7 @@ import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils;
import org.testng.Assert;
......@@ -27,19 +28,17 @@ public class DailyPaper implements Authorization {
public Object pUrl; //获取早晚安打开图片url
public String aUrl; //获取管理后台打卡图片
public String deleteId; //获取管理后台要删除的早安打卡图片的ID
public long userId; //获取管理后台要删除的早安打卡图片的ID
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
agentTku();
userTku();
userId = ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
}
@Test (description = "今日早报_获取今日早报列表",priority = 1)
public void 代理人_今日早报_获取今日早报列表(){
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String dt = simpleDateFormat.format(new Date());
Map<String,Object> params = new HashMap<>();
params.put("dateDay","20201021");
Response response = network.getResponse(params,Daily_dailyList);
......@@ -63,15 +62,13 @@ public class DailyPaper implements Authorization {
Map<String,Object> infoParams = new HashMap<>();
infoParams.put("scid",data);
infoParams.put("visitPath",0);
Response infoResponse = network.getResponse(infoParams,CONTENT_READ);
String visitId = infoResponse.jsonPath().getString("data.visitId");
System.out.println(visitId);
Assert.assertNotNull(visitId, network.message(params,CONTENT_READ,"访客记录查看素材失败",response.body().asString()));
Response infoResponse = network.postResponse(infoParams,CONTENT_visit);
boolean myself = infoResponse.jsonPath().getBoolean("data.myself");
Assert.assertTrue(myself, network.message(infoParams,CONTENT_visit,"访客记录查看素材失败",infoResponse.body().asString()));
//今日早报转发
Map<String,Object> infoParams2 = new HashMap<>();
infoParams2.put("scId",data);
infoParams2.put("visitId",visitId);
infoParams2.put("forwardType",1);
Response infoResponse2 = network.getResponse(infoParams2,FORWARD);
boolean reData = infoResponse2.jsonPath().getBoolean("data");
......
......@@ -9,6 +9,7 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.bean.marketTools.Activity;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
......@@ -34,7 +35,7 @@ public class HomePage implements Authorization {
public long activity2; //摆摊测试的互动id
public String scid; //获取文章对应的scid
public int sid; //代理人的sid
public int userId; //用户的userId
public long userId; //代理人的userId
public String visitId; //用户的visitId
public String activityScid; //测评对应的scid
public long articleId; //解密后的的文章id
......@@ -45,6 +46,7 @@ public class HomePage implements Authorization {
public void setUp() {
BaseUtils.ssoLogin();
agentTku();
userId = ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
}
//获取种草素材列表页
......@@ -589,7 +591,7 @@ public class HomePage implements Authorization {
@Test(description = "个人中心_我的反馈",priority = 29)
public void 我的反馈(){
//tku 切换为访客的
network.agentCookies.put("tku", VISITOR_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
Map<String,Object> params = new HashMap<>();
params.put("feedbackContent","自动化测试");
params.put("feedbackPics","//yun.dui88.com/kjy/image/20210729/d66257a1efe348819539372d4b53313f.jpg");
......@@ -886,12 +888,11 @@ public class HomePage implements Authorization {
@Test(description = "访客_访问文章并参与测评", priority = 40)
public void 访客_访问文章并参与测评() {
//切换为新用户小葡萄,每次都会产生线索
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
//获取用户信息
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO);
System.out.println(response.body().asString());
userId = response.jsonPath().getInt("data.userId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
//阅读文章
......@@ -899,10 +900,9 @@ public class HomePage implements Authorization {
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()));
response = network.postResponse(params, CONTENT_visit);
visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId, network.message(params, CONTENT_visit, "访客记录查看素材失败", response.body().asString()));
//打开测评
params.clear();
......@@ -916,12 +916,11 @@ public class HomePage implements Authorization {
params.clear();
params.put("scid", activityScid);
params.put("fromUserId", userId); //代理人的用户id
params.put("sourceScId", scid); //代理人的用户id
params.put("sourceScid", scid); //文章对应的Scid
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()));
response = network.postResponse(params, CONTENT_visit);
visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId, network.message(params, CONTENT_visit, "访客记录查看素材失败", response.body().asString()));
//发送测试结果-多次提交接口返回失败
......
package com.kjj.cases.assistant.homePage;
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.assistant.whoSawMe.ForwardAndRead;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
......@@ -22,7 +20,7 @@ public class RecommendMaterial implements Authorization {
public String keyWord; //获取猜你想搜的关键字
public Integer type; //获取赠险类型
public String inId; //获取赠险详情的id,用于删除赠险
public String userId; // 代理人用户ID
public long userId; // 代理人用户ID
public String visitId; // 访问记录ID
public Object bId; //获取资料包id
public String bScid; //获取资料包的scid
......@@ -30,9 +28,9 @@ public class RecommendMaterial implements Authorization {
public String bSid; //获取用户的id
public String aScid; //获取资料包文章内容的scid
public String qId; //获取问答列表中的问题id
@BeforeClass
public void setUp() {
userId= ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
agentTku();
}
......@@ -269,15 +267,16 @@ public class RecommendMaterial implements Authorization {
@Test(description = "访客_记录查看素材", priority = 17)
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("scid", aScid);
params.put("sourceScid", bScid); //代理人的用户id
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()));
Response response = network.postResponse(params, CONTENT_visit);
visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId, network.message(params, CONTENT_visit, "访客记录查看素材失败", response.body().asString()));
}
......@@ -359,7 +358,8 @@ public class RecommendMaterial implements Authorization {
Assert.assertTrue(isOpen, network.message(params, ARTICLE_GETENHANCEDCOLUMNCONFIG, "访客-获取代理人日常精准素材个人专栏开关有误", response.body().asString()));
//tku 切换为代理人的
network.agentCookies.put("tku", AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT_TKU);
//关闭 代理人个人专栏开关
Map<String, Object> configParams = new HashMap<String, Object>();
......@@ -368,7 +368,7 @@ public class RecommendMaterial implements Authorization {
response = network.postResponse(configParams, SELLERCONFIG_EDITCONFIG);
//tku 切换为访客的
network.agentCookies.put("tku", VISITOR_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
//再获取代理人个人专栏
response = network.getResponse(params, ARTICLE_GETENHANCEDCOLUMNCONFIG);
......@@ -376,7 +376,7 @@ public class RecommendMaterial implements Authorization {
Assert.assertFalse(isOpen, network.message(params, ARTICLE_GETENHANCEDCOLUMNCONFIG, "访客-获取代理人日常精准素材个人专栏开关有误", response.body().asString()));
//tku 切换为代理人的
network.agentCookies.put("tku", AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT_TKU);
//再次开启 代理人个人专栏开关
configParams.put("configKey", "personal_document_switch");
......@@ -384,7 +384,7 @@ public class RecommendMaterial implements Authorization {
response = network.postResponse(configParams, SELLERCONFIG_EDITCONFIG);
//tku 切换为访客的
network.agentCookies.put("tku", VISITOR_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
}
// 获取代理人个人专栏
......
......@@ -6,6 +6,7 @@ import com.kjj.bean.marketTools.LotteryTable;
import com.kjj.bean.marketTools.PrizeDetail;
import com.kjj.bean.marketTools.Visitor;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.NetworkUtils;
......@@ -32,6 +33,7 @@ public class GameLottery implements Authorization {
public String visitTableId; //订单id
public int remainingTimes; //剩余抽奖次数
public String winningRecodeId; //中奖记录id
public long userId; //代理人用户id
private static final Long ACTIVITY_ID = 8196L;
......@@ -40,6 +42,7 @@ public class GameLottery implements Authorization {
@BeforeClass
public void setUp(){
BaseUtils.ssoLogin();
userId = ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
}
@Test(description = "代理人_获取抽奖活动重定向地址id",priority = 1)
public void 代理人_获取抽奖活动重定向地址id(){
......@@ -286,13 +289,14 @@ public class GameLottery implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("bizNo",activityConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
visitTableId = response.jsonPath().getString("data.visitId");
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
visitTableId = response.jsonPath().getString("data.userVisitId");
//获取抽奖转盘信息
params.clear();
......@@ -356,13 +360,14 @@ public class GameLottery implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("bizNo",activityConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
visitTableId = response.jsonPath().getString("data.visitId");
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
visitTableId = response.jsonPath().getString("data.userVisitId");
//抽奖
params.clear();
......@@ -485,12 +490,13 @@ public class GameLottery implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",rateScid);
params.put("bizNo",rateConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
params.clear();
params.put("scid",rateScid);
......@@ -538,12 +544,13 @@ public class GameLottery implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",rateScid);
params.put("bizNo",rateConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
//抽奖
params.clear();
......@@ -623,8 +630,8 @@ public class GameLottery implements Authorization {
int size = response.jsonPath().getInt("data.list.size()");
int prizeState = response.jsonPath().getInt("data.list.get(0).prizeState");
Assert.assertTrue(size == 1,network.message(params, LOTTERRY_getDrawWinningRecord,"中奖奖品名称错误",response.body().asString()));
Assert.assertTrue(prizeState == 1,network.message(params, LOTTERRY_getDrawWinningRecord,"中奖奖品名称错误",response.body().asString()));
Assert.assertTrue(size == 1,network.message(params, LOTTERRY_getDrawWinningRecord,"已领奖列表人数错误",response.body().asString()));
Assert.assertTrue(prizeState == 1,network.message(params, LOTTERRY_getDrawWinningRecord,"领奖状态错误",response.body().asString()));
}
@Test(description="代理人_获取概率中奖抽奖活动的参与人列表",priority = 25)
......
......@@ -523,12 +523,13 @@ public class GreetingCrad implements Authorization{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("bizNo",confId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
params.clear();
params.put("scid",scid);
......@@ -623,12 +624,13 @@ public class GreetingCrad implements Authorization{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",giftScid);
params.put("bizNo",giftConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
//打开贺卡
params.clear();
......@@ -663,12 +665,13 @@ public class GreetingCrad implements Authorization{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",giftScid);
params.put("bizNo",giftConfId);
params.put("from",0);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问贺卡记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问贺卡记录失败",response.body().asString()));
//打开贺卡
params.clear();
......
package com.kjj.cases.assistant.markettools;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -20,9 +21,11 @@ public class InvitationLetter implements Authorization{
public String posterConfId; // 海报邀请函配置的confId
public String posterScid; // 海报对应的scid
public String forwardTime; // 动画转发时间
public long userId; //代理人用户id
@BeforeClass
public void setUp(){
agentTku();
userId = ForwardAndRead.decodeTku(AGENT_TKU).get("userId");
}
@Test(description = "代理人_根据page获取当前页面的Tips",priority = 1)
......@@ -236,11 +239,13 @@ public class InvitationLetter implements Authorization{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("bizNo",confId);
Response response = network.getResponse(params, CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params, CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问动画邀请函记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问动画邀请函记录失败",response.body().asString()));
params.clear();
params.put("scid",scid);
......@@ -282,12 +287,14 @@ public class InvitationLetter implements Authorization{
params.clear();
params.put("scid",scid);
params.put("bizNo",confId);
response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
response = network.postResponse(params,CONTENT_visit);
success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
System.out.println(response.body().asString());
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问动画邀请函记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问动画邀请函记录失败",response.body().asString()));
params.clear();
params.put("confId",confId);
......@@ -307,11 +314,13 @@ public class InvitationLetter implements Authorization{
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",posterScid);
params.put("bizNo",posterInvitationId);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getBoolean("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问动画邀请函记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问动画邀请函记录失败",response.body().asString()));
params.clear();
params.put("confId",posterConfId);
......@@ -332,11 +341,13 @@ public class InvitationLetter implements Authorization{
params.put("scid",posterScid);
params.put("bizNo",posterConfId);
Response response = network.getResponse(params,CONTENT_READ);
params.put("fromUserId",userId);
params.put("visitPath",0);
Response response = network.postResponse(params,CONTENT_visit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(params,CONTENT_READ,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_READ,"获取访问动画邀请函记录失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,CONTENT_visit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(params,CONTENT_visit,"获取访问动画邀请函记录失败",response.body().asString()));
params.clear();
params.put("confId",posterConfId);
......
......@@ -5,6 +5,7 @@ import com.beust.jcommander.internal.Lists;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
import com.kjj.config.BasicConfig;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -29,12 +30,12 @@ public class NoviceGuidance implements Authorization {
private String scid; //转发文章的scid
private String visitId; //访问id
public final long ARTICLE_ID = 9692;
public long dataID; //资料包的contentID
public long dataContentID; //资料包的ID
public long articleDataID; //文章插入资料包后的包id
public long clueId; //线索ID
public long qaID; //互助问答ID
public String questionId; //互助问答加密后的ID
private long dataID; //资料包的contentID
private long dataContentID; //资料包的ID
private long articleDataID; //文章插入资料包后的包id
private long clueId; //线索ID
private long qaID; //互助问答ID
private String questionId; //互助问答加密后的ID
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
......@@ -315,18 +316,17 @@ public class NoviceGuidance implements Authorization {
//访客查看文章
Map<String, Object> params = new HashMap<>();
params.clear();
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()));
Response response = network.postResponse(params, CONTENT_visit);
visitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(visitId, network.message(params, CONTENT_visit, "访客记录查看素材失败", response.body().asString()));
}
@Test(description = "代理人点击谁看过我显示备注引导", priority = 22)
public void 代理人点击谁看过我显示备注引导() {
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
Response response = network.getResponse(ROOKIECLUEGUIDE);
boolean success = response.jsonPath().getBoolean("success");
int guideType = response.jsonPath().getInt("data.guideType");
......@@ -387,7 +387,7 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
@Test(description = "代理人查看我的跟进机会列表", priority = 25)
public void 代理人查看我的跟进机会列表() throws IOException {
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
sleep(2000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -506,7 +506,7 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
@Test(description = "代理人查看更新的跟进机会列表", priority = 30)
public void 代理人查看更新的跟进机会列表() throws IOException {
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
sleep(2000);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -572,7 +572,7 @@ public class NoviceGuidance implements Authorization {
// 查看谁看过我首页我的跟进机会列表
@Test(description = "代理人查看最新的跟进机会列表", priority = 34)
public void 代理人查看最新的跟进机会列表() throws IOException {
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
sleep(2000);
Map<String, Object> params = new HashMap<String, Object>();
......
......@@ -13,10 +13,10 @@ import static com.kjj.utils.BaseUtils.tku;
public class PersonalCenter implements Authorization{
private static final NetworkUtils network = NetworkUtils.getInstance();
public String faqId; // 问答的contentId
public String faqId1; // 问答的contentId
public String successCaseId; // 成功案例的contentId
public String strategyId; // 使用攻略的contentId
private String faqId; // 问答的contentId
private String faqId1; // 问答的contentId
private String successCaseId; // 成功案例的contentId
private String strategyId; // 使用攻略的contentId
@BeforeClass
public void setUp(){
agentTku();
......
......@@ -22,13 +22,13 @@ public class Pay implements Authorization {
public void setUp() {
BaseUtils.ssoLogin();
}
public long id;
public String tradeNo;
public String promotionCode;
private long id;
private String tradeNo;
private String promotionCode;
@Test (description = "默认付费_续费页",priority = 1) //priority 方法执行优先级
public void 默认付费_续费页() {
network.agentCookies.put("tku", tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku);
//代理人续费状态
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",3); //入口折扣类型,1-普通,3-邀请,4-优惠码
......@@ -225,7 +225,7 @@ public class Pay implements Authorization {
e.printStackTrace();
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
}
Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString()));
// 检查会员开通结果
response = network.getResponse(USER_INFO);
......
......@@ -13,6 +13,8 @@ import java.io.IOException;
import java.util.*;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
import static com.kjj.config.BasicConfig.TKU_COOKIE_NAME;
import static com.kjj.utils.ThreadSleepUtils.sleep;
// 谁看过我模块测试前执行一次代理人转发素材及访客访问和产生线索
......@@ -24,11 +26,12 @@ public class ForwardAndRead implements Authorization {
private String jjvisitId;
private long forwardTime;
private String questionId;
private String traceId; //访问链路id
public static Map<String, Integer> custClueStatistics;
@BeforeClass
public void setUp() throws IOException{
visitor2Tku();
agent2Tku();
BaseUtils.ssoLogin();
}
......@@ -54,7 +57,7 @@ public class ForwardAndRead implements Authorization {
// 转发文章前记录一个时间
forwardTime = new Date().getTime();
ThreadSleepUtils.sleep(5000);
sleep(5000);
articleScId = getContentScId(BasicConfig.ARTICLE_CONTENTID); // 获取文章scId
param = new HashMap<>();
param.put("scId", articleScId);
......@@ -83,17 +86,18 @@ public class ForwardAndRead implements Authorization {
// 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 4)
public void 访客阅读文章() throws IOException{
sleep(1000);
sellerId = decodeTku(BasicConfig.AGENT2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
agentTku();
param = new HashMap<>();
param.put("scid", articleScId);
param.put("fromUserId", sellerId);
param.put("cancelPush", false);
param.put("visitPath", 0);
response = network.getResponse(param, BasicConfig.CONTENT_READ);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
jjvisitId = response.jsonPath().getString("data.visitId");
Assert.assertNotNull(jjvisitId, network.message(param, BasicConfig.CONTENT_READ, "visitId为空", response.body().asString()));
response = network.postResponse(param, BasicConfig.CONTENT_visit);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
jjvisitId = response.jsonPath().getString("data.userVisitId");
Assert.assertNotNull(jjvisitId, network.message(param, BasicConfig.CONTENT_visit, "visitId为空", response.body().asString()));
traceId = response.jsonPath().getString("data.traceId");
}
......@@ -112,32 +116,32 @@ public class ForwardAndRead implements Authorization {
// 获取新用户
@Test(description = "新用户访问", priority = 7)
public void 新用户访问() throws IOException{
ThreadSleepUtils.sleep(5000);
network.agentCookies.put("tku", BaseUtils.tku);
sleep(5000);
network.agentCookies.put(TKU_COOKIE_NAME, BaseUtils.tku);
response = network.getResponse(BasicConfig.USER_INFO);
System.out.println(response.body().asString());
param.clear();
param.put("scid", articleScId);
param.put("fromUserId", sellerId);
param.put("cancelPush", false);
param.put("visitPath", 0);
response = network.getResponse(param, BasicConfig.CONTENT_READ);
response = network.postResponse(param, BasicConfig.CONTENT_visit);
System.out.println(response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
}
@Test(description = "二度访客阅读文章", priority = 9)
public void 二度访客阅读文章() throws IOException{
ThreadSleepUtils.sleep(5000);
Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客
sleep(5000);
Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("userId");
userTku2(); // 切换二度访客
param = new HashMap<>();
param.put("scid", articleScId);
param.put("fromUserId", fromUserId);
param.put("cancelPush", false);
param.put("traceId", traceId);
param.put("visitPath", 0);
response = network.getResponse(param, BasicConfig.CONTENT_READ);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_READ, "接口调用失败", response.body().asString()));
response = network.postResponse(param, BasicConfig.CONTENT_visit);
jjvisitId = response.jsonPath().getString("data.userVisitId");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
}
@Test(description = "添加访问记录", priority = 10)
......@@ -147,6 +151,16 @@ public class ForwardAndRead implements Authorization {
param.put("scid", articleScId);
response = network.postResponse(param, BasicConfig.DYNAMIC_ADDVISIT);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "添加访问记录失败", response.body().asString()));
//转发
param.clear();
param.put("scId", articleScId);
param.put("visitId", jjvisitId);
param.put("forwardType", 1);
response = network.getResponse(param, BasicConfig.FORWARD);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口调用失败", response.body().asString()));
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "访客转发素材失败", response.body().asString()));
}
@Test(description = "获取文章FAQs", priority = 12)
......@@ -203,7 +217,7 @@ public class ForwardAndRead implements Authorization {
// 获取用户信息
public static Map<String, String> getUserInfo(String userTku){
network.agentCookies.put("tku", userTku);
network.agentCookies.put(TKU_COOKIE_NAME, userTku);
response = network.getResponse(BasicConfig.USER_INFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString()));
String avatar = response.jsonPath().getString("data.avatar");
......@@ -213,7 +227,7 @@ public class ForwardAndRead implements Authorization {
infos.put("avatar", avatar);
infos.put("wxName", wxName);
infos.put("sellerName", sellerName);
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT2_TKU);
return infos;
}
......@@ -222,7 +236,7 @@ public class ForwardAndRead implements Authorization {
// 登陆管理后台
param = new HashMap<>();
param = new HashMap<>();
param.put("tku", tku);
param.put(TKU_COOKIE_NAME, tku);
response = network.getResponse(param, BasicConfig.MANAGER_TKU_DECODE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.MANAGER_TKU_DECODE, "接口请求失败", response.body().asString()));
Long userId = response.jsonPath().getLong("data.userId");
......
......@@ -25,7 +25,7 @@ public class MyForward implements Authorization {
public void setUp() throws IOException {
// 登陆管理后台
BaseUtils.ssoLogin();
visitor2Tku();
agent2Tku();
// 关闭数据看板演示数据
ForwardAndRead.closeDemoData();
......
......@@ -16,6 +16,7 @@ import java.io.IOException;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class WhoSawMe implements Authorization {
......@@ -37,7 +38,7 @@ public class WhoSawMe implements Authorization {
@BeforeClass
public void setUp() throws IOException {
// 代理人授权
visitor2Tku();
agent2Tku();
BaseUtils.ssoLogin();
// 关闭数据看板演示数据
......@@ -151,7 +152,8 @@ public class WhoSawMe implements Authorization {
// 查看谁看过我首页我的访客列表
@Test(description = "查看我的访客列表", priority = 11)
public void 查看我的访客列表() throws IOException{
network.agentCookies.put("tku", AGENT2_TKU);
sleep(3000);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
......@@ -171,6 +173,22 @@ public class WhoSawMe implements Authorization {
// 将新用户标记为老用户(小葡萄)
@Test(description = "标记新用户为老用户", priority = 12)
public void 标记新用户为老用户() throws IOException{
// 检查新用户
param.clear();
param.put("customerTagIds", Lists.newArrayList());
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
int size = response.jsonPath().getInt("data.list.size()");
for (int i = 0;i< size;i++){
String nickName = response.jsonPath().getString("data.list["+i+"].nickName");
if(nickName.equals("小葡萄")){
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
break;
}
}
long xptUserId = ForwardAndRead.decodeTku(BaseUtils.tku).get("userId");
param.clear();
param.put("userId", ForwardAndRead.encodeId(xptUserId));
......@@ -178,15 +196,23 @@ public class WhoSawMe implements Authorization {
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.UPDATENEWTOOLD, "用户身份更新失败", response.body().asString()));
// 检查新用户标记
// 检查新用户标记为老用户
param.clear();
param.put("customerTagIds", Lists.newArrayList());
param.put("lastClueId", 0);
param.put("listType", 1);
param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
for (int i = 0;i< size;i++){
String nickName = response.jsonPath().getString("data.list["+i+"].nickName");
if(nickName.equals("小葡萄")){
boolean isNew = response.jsonPath().getBoolean("data.list["+i+"].isNew");
Assert.assertFalse(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "客户身份未更新为老客户", response.body().asString()));
break;
}
}
}
// 获取代理人标签列表
......@@ -358,7 +384,7 @@ public class WhoSawMe implements Authorization {
// 获取被邀请人sellerId
childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
// 确定被邀请代理人没有上级
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT_TKU);
response = network.getResponse(BasicConfig.BOSS_ROLE);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
while (hasSuperior){
......@@ -395,7 +421,7 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(success, network.message(param, BasicConfig.BOSS_BOUND, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.BOSS_BOUND, "添加代理人进入团队失败", response.body().asString()));
network.agentCookies.put("tku", AGENT2_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
}
@Test(description = "查看被邀请代理人上级名称", priority = 26)
......@@ -481,7 +507,7 @@ public class WhoSawMe implements Authorization {
// 团队架构_删除团队成员
@Test(description = "团队架构_删除团队成员", priority = 100)
public void 团队架构_删除团队成员() throws IOException{
visitor2Tku();
agent2Tku();
List<String> sids = new ArrayList<>();
sids.add(ForwardAndRead.encodeId(childSellerId));
param = new HashMap<>();
......@@ -491,7 +517,7 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(data, network.message(param, BasicConfig.MEMBERREMOVE, "删除成员失败", response.body().asString()));
// 检查被删除成员是否有上级
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT_TKU);
response = network.getResponse(BasicConfig.BOSS_ROLE);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "成员仍有上级", response.body().asString()));
......@@ -611,7 +637,7 @@ public class WhoSawMe implements Authorization {
@Test(description = "接受任务_检查新任务", priority = 40)
public void 接受任务_检查新任务() throws IOException{
// 切换到下级代理人
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT_TKU);
response = network.getResponse(BasicConfig.HASNEWTASK);
boolean data = response.jsonPath().getBoolean("data");
......@@ -683,7 +709,7 @@ public class WhoSawMe implements Authorization {
Assert.assertEquals(myTaskLists.size(), 0, network.message(param, BasicConfig.MYTASKLIST, "未完成列表不为空", response.body().asString()));
// 切换回团队主管理员
network.agentCookies.put("tku", AGENT2_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
}
// 团队管理员检查任务完成状态
......
......@@ -2,6 +2,8 @@ package com.kjj.cases.live.agent;
import com.kjj.bean.agent.CustomerList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -15,7 +17,6 @@ import java.util.Map;
public class Customer implements Authorization {
public String customerId;
public String lastLiveId;
public String id;
@BeforeClass
......@@ -43,12 +44,17 @@ public class Customer implements Authorization {
Map<String, Object> Params = new HashMap<>();
Params.put("pageIndex",1);
Params.put("pageSize",10);
Params.put("lastLiveId",lastLiveId);
Response response = network.getResponse(BasicConfig.MOBILE_lastLiveList);
System.out.println(response.body().asString());
Response response = network.getResponse(Params,BasicConfig.MOBILE_lastLiveList);
Object list=response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list,network.message(BasicConfig.MOBILE_lastLiveList, "代理人最近一场直播客户列表为null", response.body().asString()));
for (int i = 0;i<response.jsonPath().getInt("data.list.size()");i++){
String nickName = response.jsonPath().getString("data.list.get("+i+").nickName");
if(nickName.equals("随波逐流")){
customerId = response.jsonPath().getString("data.list.get("+i+").customerId");
break;
}
}
System.out.println(customerId);
}
@Test(description = "准客户列表", priority = 3)
......@@ -76,8 +82,6 @@ public class Customer implements Authorization {
Object list = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list, network.message(Params, BasicConfig.MOBILE_customerList, "未获取到中奖名单配置信息", response.body().asString()));
List<CustomerList>lists= JsonUtil.parseResponseToPageBean(response,CustomerList.class);
customerId=lists.get(0).getCustomerId();
}
@Test(description = "查询代理人转介绍客户列表", priority = 5)
......@@ -114,7 +118,6 @@ public class Customer implements Authorization {
}
@Test(description = "编辑客户基本信息", priority = 7)
public void 编辑客户基本信息() {
Map<String, Object> Params = new HashMap<>();
......@@ -191,7 +194,6 @@ public class Customer implements Authorization {
}
@Test(description = "查询客户基本信息", priority = 8)
public void 查询客户基本信息() {
Map<String, Object> Params = new HashMap<>();
......@@ -210,11 +212,11 @@ public class Customer implements Authorization {
Response response = network.getResponse(Params,BasicConfig.MOBILE_customerDetail);
System.out.println(response.body().asString());
String nickName=response.jsonPath().getString("data.nickName");
Assert.assertEquals(nickName,"朱志勇", network.message(BasicConfig.MOBILE_customerDetail, "昵称不匹配", response.body().asString()));
Assert.assertEquals(nickName,"随波逐流", network.message(Params,BasicConfig.MOBILE_customerDetail, "昵称不匹配", response.body().asString()));
int clueLevel=response.jsonPath().getInt("data.clueLevel");
Assert.assertTrue(clueLevel==3, network.message(BasicConfig.MOBILE_customerDetail, "不是高价值线索", response.body().asString()));
Assert.assertTrue(clueLevel==3, network.message(Params,BasicConfig.MOBILE_customerDetail, "不是高价值线索", response.body().asString()));
int customerType=response.jsonPath().getInt("data.customerType");
Assert.assertTrue(customerType==1, network.message(BasicConfig.MOBILE_customerDetail, "不是准客户", response.body().asString()));
Assert.assertTrue(customerType==1, network.message(Params,BasicConfig.MOBILE_customerDetail, "不是准客户", response.body().asString()));
}
......@@ -231,23 +233,22 @@ public class Customer implements Authorization {
}
@Test(description = "修改客户备注名", priority = 11)
public void 修改客户备注名() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveUserId",customerId);
Params.put("remarkName","朱志勇");
Params.put("liveUserId", customerId);
Params.put("remarkName","逐波流");
Response response = network.postResponse(Params,BasicConfig.MOBILE_updateRemarkName);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(BasicConfig.MOBILE_updateRemarkName, "直播场次为null", response.body().asString()));
Assert.assertTrue(data, network.message(Params,BasicConfig.MOBILE_updateRemarkName, "修改备注名失败", response.body().asString()));
}
@Test(description = "跟进机会列表", priority = 12)
public void 跟进机会列表() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveVisitorId",customerId);
Params.put("liveVisitorId", customerId);
Params.put("pageIndex",1);
Params.put("pageSize",5);
Response response = network.getResponse(Params,BasicConfig.MOBILE_followChanceList);
......@@ -281,6 +282,4 @@ public class Customer implements Authorization {
Assert.assertTrue(question.equals("一度问题1")||question.equals("一度问题2")||question.equals("一度问题3"),network.message(BasicConfig.MOBILE_followChanceDetail, "咨询问题为null", response.body().asString()));
}
}
......@@ -116,97 +116,6 @@ public class LiveLater implements Authorization {
Assert.assertEquals(customerType,1,network.message(params,BasicConfig.MOBILE_ClueList,"准客户标签错误",response.body().asString()));
}
// 代理人端改版,客户页不再调用clueList接口
/*
// 获取直播结束我的客户页面直接邀请tab;
@Test(description="直接邀请tab数据",priority = 6)
public void 直接邀请tab数据() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
params.put("actionTypeList",26);
Response response = network.getResponse(params,BasicConfig.MOBILE_ClueList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
long totalCount =response.jsonPath().getLong("data.totalCount");
Assert.assertTrue(totalCount>0, network.message(params, BasicConfig.MOBILE_ClueList, "直接邀请线索数量不对", response.body().asString()));
}
// 获取直播结束我的客户页面转介绍tab;
@Test(description="转介绍tab数据",priority = 7)
public void 转介绍tab数据() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
params.put("actionTypeList",22);
Response response = network.getResponse(params,BasicConfig.MOBILE_ClueList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
long totalCount =response.jsonPath().getLong("data.totalCount");
Assert.assertTrue(totalCount>10, network.message(params, BasicConfig.MOBILE_ClueList, "转介绍线索数量不对", response.body().asString()));
}
// 获取直播结束我的客户页面中奖tab;
@Test(description="中奖tab数据",priority = 8)
public void 中奖tab数据() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
params.put("actionTypeList",17);
Response response = network.getResponse(params,BasicConfig.MOBILE_ClueList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
long totalCount =response.jsonPath().getLong("data.totalCount");
Assert.assertTrue(totalCount>0, network.message(params, BasicConfig.MOBILE_ClueList, "中奖线索数量不对", response.body().asString()));
}
// 获取直播结束我的客户页面报名tab;
@Test(description="报名tab数据",priority = 9)
public void 报名tab数据() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
params.put("actionTypeList",20);
Response response = network.getResponse(params,BasicConfig.MOBILE_ClueList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
long totalCount =response.jsonPath().getLong("data.totalCount");
Assert.assertTrue(totalCount==2, network.message(params, BasicConfig.MOBILE_ClueList, "报名线索数量不对", response.body().asString()));
}
// 获取直播结束我的客户页面观看20分钟+tab;
@Test(description="观看20分钟+tab数据",priority = 10)
public void 观看20分钟以上tab数据() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("pageIndex",1);
params.put("pageSize",30);
params.put("actionTypeList",4);
Response response = network.getResponse(params,BasicConfig.MOBILE_ClueList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
long totalCount =response.jsonPath().getLong("data.totalCount");
Assert.assertTrue(totalCount==0, network.message(params, BasicConfig.MOBILE_ClueList, "观看20分钟线索数量不对", response.body().asString()));
}
*/
@Test(description = "获取本场直播客户统计", priority = 8)
public void 获取本场直播客户统计() {
Map<String, Object> custStatPar = new HashMap<>();
......@@ -261,7 +170,6 @@ public class LiveLater implements Authorization {
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("liveUserId",this.liveUserId.get(0).getLiveUserId());
Response response = network.getResponse(params,BasicConfig.MOBILE_getClueDetail);
System.out.println(response.body().asString());
int visitorInviteNum=response.jsonPath().getInt("data.visitorInviteNum");
Assert.assertTrue(visitorInviteNum==1, network.message(params, BasicConfig.MOBILE_getClueDetail, "访客邀请数不对", response.body().asString()));
int speakNum=response.jsonPath().getInt("data.speakNum");
......@@ -307,7 +215,6 @@ public class LiveLater implements Authorization {
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");
params.put("liveUserId",this.liveUserId.get(0).getLiveUserId());
Response response = network.getResponse(params,BasicConfig.MOBILE_getReplyAdvice);
Object data = response.jsonPath().getJsonObject("data");
......@@ -321,7 +228,6 @@ public class LiveLater implements Authorization {
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");
params.put("liveUserId",this.liveUserId.get(0).getLiveUserId());
params.put("pageIndex",1);
params.put("pageSize",10);
......
......@@ -116,7 +116,6 @@ public class LiveVisitors implements Authorization
@Test(description = "访客端表单资料查询", priority = 4)
public ResourceForm 访客端系统表单资料查询()
{
visitorAuth1();
Map<String, Object> params = new HashMap<>();
params.put("confId",confId_form);
Response response = network.getResponse(params, BasicConfig.MOBILE_Form);
......@@ -131,7 +130,6 @@ public class LiveVisitors implements Authorization
@Test(description = "访客端表单资料提交", priority = 5)
public void 访客端系统表单资料提交()
{
visitorAuth1();
ResourceForm list = 访客端系统表单资料查询();
Map<String, Object> params = new HashMap<>();
params.put("confId", confId_form);
......@@ -187,7 +185,6 @@ public class LiveVisitors implements Authorization
@Test(description = "访客端免费领资料领取", priority = 8)
public void 访客端免费领资料领取()
{
visitorAuth1();
Map<String, Object> params = new HashMap<>();
params.put("confId", confId_free);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -362,6 +359,7 @@ public class LiveVisitors implements Authorization
@Test(description = "访客端获取关联测试免费领权益详情", priority = 18)
public void 访客端获取关联测试免费领权益详情() {
visitorAuth1();
sleep(1000);
Map<String, Object> params = new HashMap<>();
params.put("confId", confId_freeWithEva);
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......
......@@ -35,7 +35,7 @@ public class PersonalPage implements Authorization {
}
// 个人首页
@Test(description = "访客查看我的福利", priority = 4)
@Test(description = "访客查看我的福利", priority = 1)
public void 访客查看我的福利() {
params = new HashMap<>();
params.put("pageSize", 10);
......@@ -43,14 +43,11 @@ public class PersonalPage implements Authorization {
Response response = network.getResponse(params, BasicConfig.USER_welfareList);
System.out.println("访客福利列表:" + response.body().asString());
List<WelfareList> welfareLists = JsonUtil.parseResponseToPageBean(response, WelfareList.class);
// WelfareList welfareList = welfareLists.get(0);
// Assert.assertEquals(welfareList.getLiveId(), LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()), network.message(params, BasicConfig.USER_welfareList, "最新福利对应直播id不正确", response.body().asString()));
Map<String, Object> getLotteryDetailPar = new HashMap<>();
getLotteryDetailPar.put("confId", Lottery.lotteryConfId);
Response getLotteryDetailRes = network.getResponse(getLotteryDetailPar, BasicConfig.USER_findLottryDetail);
welfareRecordId = getLotteryDetailRes.jsonPath().getString("data.recordId");
Assert.assertNotNull(welfareRecordId, network.message(getLotteryDetailPar, BasicConfig.USER_findLottryDetail, "获取福利领取记录id获取失败", getLotteryDetailRes.body().asString()));
// Assert.assertEquals(welfareList.getRecordId(), welfareRecordId, network.message(params, BasicConfig.USER_welfareList, "最新福利对应领取记录id不正确", response.body().asString()));
boolean hasRecord = false;
for (WelfareList welfareList : welfareLists){
......@@ -63,13 +60,14 @@ public class PersonalPage implements Authorization {
Assert.assertTrue(hasRecord, network.message(params, BasicConfig.USER_welfareList, "上场直播有抽奖福利未记录", response.body().asString()));
}
@Test(description = "访客查看我的资料", priority = 5)
@Test(description = "访客查看我的资料", priority = 2)
public void 访客查看我的资料() {
System.out.println("params:" + params);
Response response = network.getResponse(params, BasicConfig.USER_resourceList);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_resourceList, "接口调用失败", response.body().asString()));
List<ResourceList> resourceLists = JsonUtil.parseResponseToPageBean(response, ResourceList.class);
ResourceList resourceList = resourceLists.get(0);
companyName = resourceList.getCompanyName(); // 获取领取资料的公司名称
System.out.println(companyName);
sourceRecordId = resourceList.getRecordId();
Assert.assertEquals(sourceRecordId, LiveVisitors.freeForEvaReceiveRecordId, network.message(params, BasicConfig.USER_resourceList, "资料领取记录id不正确", response.body().asString()));
String liveId = resourceList.getLiveId();
......@@ -84,12 +82,9 @@ public class PersonalPage implements Authorization {
}
}
companyName = resourceList.getCompanyName(); // 获取领取资料的公司名称
System.out.println(companyName);
}
@Test(description = "获取访客最近观看的公司", priority = 6)
@Test(description = "获取访客最近观看的公司", priority = 3)
public void 获取访客最近观看的公司() {
// 管理后台根据公司名称查询公司id
......@@ -110,7 +105,7 @@ public class PersonalPage implements Authorization {
}
// 访客主页视角
@Test(description = "访客视角查看公司详情", priority = 7)
@Test(description = "访客视角查看公司详情", priority = 4)
public void 访客视角查看公司详情(){
params.clear();
params.put("companyId", encodeCompanyId);
......@@ -120,7 +115,7 @@ public class PersonalPage implements Authorization {
Assert.assertNotNull(data, network.message(params, BasicConfig.USER_getCompanyInfo, "查看公司详情失败", getCompanyDetailRes.body().asString()));
}
@Test(description = "查看公司直播列表", priority = 8)
@Test(description = "查看公司直播列表", priority = 5)
public void 查看公司直播列表(){
// 访客端查看公司正在直播列表
params.clear();
......@@ -144,7 +139,7 @@ public class PersonalPage implements Authorization {
}
@Test(description = "获取公司已结束直播列表", priority = 9)
@Test(description = "获取公司已结束直播列表", priority = 6)
public void 获取公司已结束直播列表() {
params.clear();
params.put("companyId", encodeCompanyId);
......@@ -162,7 +157,7 @@ public class PersonalPage implements Authorization {
}
}
@Test(description = "获取公司首页分享信息", priority = 10)
@Test(description = "获取公司首页分享信息", priority = 7)
public void 获取公司首页分享信息() {
params.clear();
params.put("companyId", encodeCompanyId);
......@@ -175,7 +170,7 @@ public class PersonalPage implements Authorization {
/*
精彩视频
*/
@Test(description = "精彩视频包含代理人卡片信息", priority = 11)
@Test(description = "精彩视频包含代理人卡片信息", priority = 8)
public void 精彩视频包含代理人卡片信息() {
params.clear();
params.put("companyId", encodeCompanyId);
......@@ -189,7 +184,7 @@ public class PersonalPage implements Authorization {
}
}
@Test(description = "获取公司最近一场直播中直播", priority = 12)
@Test(description = "获取公司最近一场直播中直播", priority = 9)
public void 获取公司最近一场直播中直播() {
Response getLivingRes = network.getResponse(params, BasicConfig.USER_companyLiving);
Assert.assertTrue(getLivingRes.jsonPath().getBoolean("success"), network.message(params, BasicConfig.USER_companyLiving, "接口请求失败", getLivingRes.body().asString()));
......@@ -198,7 +193,7 @@ public class PersonalPage implements Authorization {
else {System.out.println(data);}
}
@Test(description = "查看福利详情", priority = 13)
@Test(description = "查看福利详情", priority = 10)
public void 查看福利详情() {
params.clear();
params.put("recordId", welfareRecordId);
......@@ -214,7 +209,7 @@ public class PersonalPage implements Authorization {
}
}
@Test(description = "查看资料详情", priority = 14)
@Test(description = "查看资料详情", priority = 11)
public void 查看资料详情() {
params.clear();
params.put("recordId", sourceRecordId);
......@@ -228,7 +223,7 @@ public class PersonalPage implements Authorization {
}
}
@Test(description = "查看测试详情", priority = 15)
@Test(description = "查看测试详情", priority = 12)
public void 查看测试详情() {
params.clear();
params.put("recordId", testRecordId);
......
......@@ -40,7 +40,6 @@ public class Comment implements Authorization {
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Params.put("spokeList", commtens);
Response response = network.postResponse(Params, BasicConfig.MANAGER_send);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_send, "评论库发送评论失败", response.body().asString()));
}
......@@ -54,7 +53,6 @@ public class Comment implements Authorization {
Params.put("msg", "希望能好运");
Params.put("type", 1);
Response response = network.postResponse(Params, BasicConfig.MOBILE_SpokeSend);
System.out.println(response.body().asString());
Assert.assertNotNull(response, network.message(Params, BasicConfig.MOBILE_SpokeSend, "访客端发表评论失败", response.body().asString()));
}
......@@ -64,10 +62,9 @@ public class Comment implements Authorization {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("msg", "你一定会好运");
Params.put("replyUserId", IdMakeUtil.encodingId(107L));
Params.put("replyUserId", IdMakeUtil.encodingId(343L));
Params.put("type", "2");
Response response = network.postResponse(Params, BasicConfig.MOBILE_SpokeSend);
System.out.println(response.body().asString());
Assert.assertNotNull(response, network.message(Params, BasicConfig.MOBILE_SpokeSend, "访客端回复评论失败", response.body().asString()));
}
......@@ -77,7 +74,7 @@ public class Comment implements Authorization {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("msg", "你也会好运的!");
Params.put("replyUserId", IdMakeUtil.encodingId(122L));
Params.put("replyUserId", IdMakeUtil.encodingId(101L));
Params.put("type", "2");
Response response = network.postResponse(Params, BasicConfig.MOBILE_SpokeSend);
System.out.println(response.body().asString());
......@@ -89,7 +86,7 @@ public class Comment implements Authorization {
adminAuth();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("userId", IdMakeUtil.encodingId(89L));
Params.put("userId", IdMakeUtil.encodingId(100L));
Response response = network.getResponse(Params, BasicConfig.MOBILE_bannedSpoke);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("success");
......@@ -103,7 +100,7 @@ public class Comment implements Authorization {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("msg", "你们都看不见我");
Params.put("replyUserId", IdMakeUtil.encodingId(122L));
Params.put("replyUserId", IdMakeUtil.encodingId(101L));
Params.put("type", "2");
Response response = network.postResponse(Params, BasicConfig.MOBILE_SpokeSend);
System.out.println(response.body().asString());
......@@ -137,8 +134,8 @@ public class Comment implements Authorization {
Assert.assertNotNull(list, network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "历史评论空", response.body().asString()));
Assert.assertEquals(voList.size(),7, network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "历史评论数量错误", response.body().asString()));
Assert.assertEquals(voList.get(3).getReplyName(),"", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客A发表评论有回复者昵称", response.body().asString()));
Assert.assertEquals(voList.get(4).getReplyName(),"朱志勇", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客B回复评论的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(5).getReplyName(),"阿茶吖", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客C回复访客B的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(4).getReplyName(),"随波逐流", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客B回复评论的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(5).getReplyName(),"Porco", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客C回复访客B的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(6).getReplyName(), "小马甲A", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "访客C回复小马甲的回复者昵称错误", response.body().asString()));
}
......@@ -175,7 +172,7 @@ public class Comment implements Authorization {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("msg", "我看你们都在");
Params.put("replyUserId", IdMakeUtil.encodingId(107L));
Params.put("replyUserId", IdMakeUtil.encodingId(343L));
Params.put("type", "2");
Response response = network.postResponse(Params, BasicConfig.MOBILE_SpokeSend);
System.out.println(response.body().asString());
......@@ -223,7 +220,7 @@ public class Comment implements Authorization {
Assert.assertNotNull(list, network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "历史评论空", response.body().asString()));
Assert.assertEquals(voList.size(),11, network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "历史评论数量错误", response.body().asString()));
Assert.assertEquals(voList.get(7).getReplyName(),"", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "代理人A发表评论有回复者昵称", response.body().asString()));
Assert.assertEquals(voList.get(8).getReplyName(),"朱志勇", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "代理人A回复访客A评论的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(8).getReplyName(),"随波逐流", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "代理人A回复访客A评论的回复者昵称错误", response.body().asString()));
Assert.assertEquals(voList.get(10).getReplyName(),"小马甲B", network.message(Params, BasicConfig.MOBILE_SpokeAdmin, "代理人B回复代理人A评论的回复者昵称错误", response.body().asString()));
}
......
......@@ -34,7 +34,7 @@ public class EvaluationConf implements Authorization {
Response addEvaResourceRes = network.postResponse(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource);
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "直播中编辑关联测试ID成功", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
......@@ -55,7 +55,7 @@ public class EvaluationConf implements Authorization {
Response formRes = network.postResponse(formParam, BasicConfig.MANAGER_saveForm);
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "直播中编辑关联测试ID成功", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
......@@ -75,7 +75,7 @@ public class EvaluationConf implements Authorization {
Response FreeRes = network.postResponse(freeParam, BasicConfig.MANAGER_saveFree);
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "直播中编辑关联测试ID成功", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
......@@ -95,7 +95,7 @@ public class EvaluationConf implements Authorization {
Response response = network.postResponse(Params, BasicConfig.MANAGER_resource);
try {
boolean success = addEvaResourceRes.jsonPath().getBoolean("success");
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
Assert.assertFalse(success, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "直播中编辑关联测试ID成功", addEvaResourceRes.body().asString()));
Assert.assertEquals(addEvaResourceRes.jsonPath().getString("desc"), "直播进行中,无法更新测评id", network.message(params, BasicConfig.MANAGER_evaluation_saveEvaResource, "失败原因错误", addEvaResourceRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
......
......@@ -74,8 +74,8 @@ public class LiveBinding implements Authorization {
this.shareSign=share();
}
@Test(description = "代理人A与访客A邀请关系绑定", priority = 3)
public void 代理人A与访客A邀请关系绑定() {
@Test(description = "代理人A与访客邀请关系绑定", priority = 3)
public void 代理人A与访客邀请关系绑定() {
visitorAuth1();
binding(this.shareSign);
token();
......@@ -87,7 +87,6 @@ public class LiveBinding implements Authorization {
visitorAuth10();
binding(this.shareSign);;
token();
}
//不同团队代理人绑定邀请关系
@Test(description = "代理人B分享直播间", priority = 4)
......@@ -149,6 +148,17 @@ public class LiveBinding implements Authorization {
binding(this.shareSign);;
token();
visitorAuth28();
binding(this.shareSign);;
token();
visitorAuth29();
binding(this.shareSign);;
token();
visitorAuth30();
binding(this.shareSign);;
token();
}
@Test(description = "访客J_分享直播间", priority = 8)
......
......@@ -915,7 +915,7 @@ public class LiveMaterial implements Authorization {
}
// 检查测试状态
ThreadSleepUtils.sleep(1000);
ThreadSleepUtils.sleep(2000);
Map<String, Object> getEnablePar = new HashMap<>();
getEnablePar.put("companyId", companyId);
Response getEnableRes = network.getResponse(getEnablePar, BasicConfig.MANAGER_evaluation_getEnable);
......
......@@ -64,7 +64,7 @@ public class SaveLive implements Authorization {
Params.put("regionType",2);
Params.put("preAwardUrl","https://yun.dui88.com/kjy/image/20210629/1624949155842.png");
Params.put("preWindowUrl","https://yun.dui88.com/kjy/image/20210629/1624949098093.png");
Params.put("distributionType", 0);
Params.put("distributionType", 1);//奖品分发方式0-代理人领奖1-快递寄送
Params.put("existSeriesPoster", 0);
Params.put("followPushState", 0); // 关注直播间用户是否推送开关,0 = false
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
......@@ -161,7 +161,6 @@ public class SaveLive implements Authorization {
@Test(description = "直播资料", priority = 5)
public void 直播资料() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
List<Material> ids = new ArrayList<>();
......
......@@ -3,6 +3,8 @@ import com.kjj.bean.lottery.LotteryList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
......@@ -358,10 +360,9 @@ public class DesignatedWinner implements Authorization {
public void 代理人指定访客A中奖表单提交() {
Map<String, Object> SubmitParam = new HashMap<>();
SubmitParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
SubmitParam.put("visitorId","Kj20ODYz");
SubmitParam.put("visitorId", IdMakeUtil.encodingId(343L));
Response SubmitRes = network.postResponse(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit);
Object data = SubmitRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(SubmitParam, BasicConfig.MOBILE_AgentSpecifyAwardSubmit, "代理人指定中奖提交失败", SubmitRes.body().asString()));
}
......
......@@ -4,6 +4,7 @@ import com.kjj.bean.lottery.ConfIdList;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
......@@ -37,9 +38,6 @@ public class Lottery implements Authorization {
visitorAuth2();
connectSuccess();
visitorAuto1();
connectSuccess();
}
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
......@@ -364,9 +362,8 @@ public class Lottery implements Authorization {
visitorAuth13();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareUserId","Kj20ODYz");
Params.put("shareUserId", IdMakeUtil.encodingId(343L));
Response response = network.postResponse(Params, BasicConfig.MOBILE_receiverOpen);
System.out.println( response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_receiverOpen, "访客M领取好运红包失败", response.body().asString()));
......@@ -378,7 +375,7 @@ public class Lottery implements Authorization {
ThreadSleepUtils.sleep(3000);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareUserId","Kj20ODYz");
Params.put("shareUserId",IdMakeUtil.encodingId(343L));
Response response = network.getResponse(Params, BasicConfig.MOBILE_joinRecord);
System.out.println( response.body().asString());
int redStatus = response.jsonPath().getInt("data.redStatus");
......@@ -396,7 +393,7 @@ public class Lottery implements Authorization {
ThreadSleepUtils.sleep(500);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareUserId","Kj20ODYz");
Params.put("shareUserId",IdMakeUtil.encodingId(343L));
Response response = network.getResponse(Params, BasicConfig.MOBILE_joinRecord);
System.out.println( response.body().asString());
int redStatus = response.jsonPath().getJsonObject("data.redStatus");
......@@ -974,8 +971,8 @@ public class Lottery implements Authorization {
//企业已指定不能再中奖
@Test(description = "团队指定访客E是否中奖", priority = 90)
public void 团队指定访客E是否中奖() {
@Test(description = "企业已指定E不可再次中奖", priority = 90)
public void 企业已指定E不可再次中奖() {
visitorAuth5();
ThreadSleepUtils.sleep(3000);
Map<String, Object> hasEndParam = new HashMap<>();
......@@ -1011,8 +1008,13 @@ public class Lottery implements Authorization {
visitorAuth10();
Response hasEndResB = network.getResponse(hasEndParam, BasicConfig.USER_result);
boolean dataB = getData(hasEndResB);
String responseBody = "A=" + hasEndResA.body().asString() + ", B=" + hasEndResB.body().asString();
Assert.assertTrue(dataA || dataB || dataC, network.message(hasEndParam, BasicConfig.USER_result, "指定访客未中奖", responseBody));
//用户B
visitorAuth2();
Response hasEndResD = network.getResponse(hasEndParam, BasicConfig.USER_result);
boolean dataD = getData(hasEndResD);
String responseBody = "A=" + hasEndResA.body().asString() + ", B=" + hasEndResB.body().asString()+ ", C=" + hasEndResC.body().asString()+ ", D=" + hasEndResD.body().asString();
Assert.assertTrue(dataA || dataB || dataC || dataD, network.message(hasEndParam, BasicConfig.USER_result, "指定访客未中奖", responseBody));
}
private boolean getData(Response hasEndRes) {
......@@ -1028,7 +1030,7 @@ public class Lottery implements Authorization {
//不在公司指定区域内的用户
@Test(description = "团队指定访客非区域F是否中奖", priority = 92)
public void 非团队指定访客F是否中奖() {
public void 团队指定访客非区域F是否中奖() {
visitorAuth6();
ThreadSleepUtils.sleep(3000);
Map<String, Object> hasEndParam = new HashMap<>();
......@@ -1079,7 +1081,6 @@ public class Lottery implements Authorization {
@Test(description = "查询第五轮正在抽奖的福利", priority = 95)
public void 查询第五轮正在抽奖的福利() {
visitorAuth6();
ThreadSleepUtils.sleep(1000);
Map<String, Object> infoParam = new HashMap<>();
infoParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -1137,8 +1138,18 @@ public class Lottery implements Authorization {
visitorAuth10();
Response hasEndResB = network.getResponse(hasEndParam, BasicConfig.USER_result);
boolean dataB = getDataLottery(hasEndResB);
String responseBody = "A=" + hasEndResA.body().asString() + ", B=" + hasEndResB.body().asString();
Assert.assertTrue(dataA || dataB || dataC, network.message(hasEndParam, BasicConfig.USER_result, "访客未中奖", responseBody));
visitorAuth2();
Response hasEndResD = network.getResponse(hasEndParam, BasicConfig.USER_result);
boolean dataD = getData(hasEndResD);
String responseBody = "A=" + hasEndResA.body().asString() + ", B=" + hasEndResB.body().asString()+ ", C=" + hasEndResC.body().asString()+ ", D=" + hasEndResD.body().asString();
Assert.assertTrue(dataA || dataB || dataC || dataD, network.message(hasEndParam, BasicConfig.USER_result, "访客未中奖", responseBody));
//用户I
visitorAuth8();
Response hasEndResE = network.getResponse(hasEndParam, BasicConfig.USER_result);
boolean dataE = getDataLottery(hasEndResE);
Assert.assertTrue(dataE, network.message(hasEndParam, BasicConfig.USER_result, "代理人B团队的访客I未中奖", hasEndResE.body().asString()));
}
......
......@@ -204,6 +204,6 @@ public class RelativeLottery implements Authorization {
String nickname = response.jsonPath().getString("data.userDetail.receiverInfoList.get(0).nickname");
Assert.assertEquals(userAcceptStatus, 1,network.message(getLiveAwardListParam, MOBILE_confLottery, "一度用户未领取亲友券", response.body().asString()));
Assert.assertEquals(receiverInfoList, 1,network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券已接受人数错误", response.body().asString()));
Assert.assertEquals(nickname, "小米粥",network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券领取人错误", response.body().asString()));
Assert.assertEquals(nickname, "猫爷1234567890",network.message(getLiveAwardListParam, MOBILE_confLottery, "亲友配置券领取人错误", response.body().asString()));
}
}
......@@ -17,6 +17,7 @@ import org.testng.annotations.Test;
import java.util.*;
import static com.kjj.utils.BaseUtils.connectSuccess;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class SecondKill implements Authorization {
......@@ -30,6 +31,9 @@ public class SecondKill implements Authorization {
@BeforeClass
public void setUp(){
BaseUtils.ssoLogin();
//假用户到场
visitorAuto1();
connectSuccess();
}
/**
......
......@@ -126,6 +126,33 @@ public class KjyUserDB {
return list;
}
/**
* 执行更新语句
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return void
* @throws SQLException
*/
public void updataSql(String sql, Object ...params) throws SQLException{
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
initConnection();
}
Map<String, Object> map = new HashMap<String, Object>();
int index = 1;
pstmt = connection.prepareStatement(sql);
if(params != null && !(params.length==0)){
for(int i=0; i<params.length; i++){
pstmt.setObject(index++, params[i]);
}
}
System.out.println("sql:"+pstmt.toString());
pstmt.executeUpdate();//返回更新结果
}
/**
* 释放数据库连接
*/
......
......@@ -6,5 +6,4 @@ public class UserSqlFactory {
public static final String selectUserIdByUnionId = "select id from tb_users where union_id=?";
public static final String selectUserIdByOpenId = "SELECT user_id FROM `tb_users_wx_ext` WHERE `open_id` = ?";
}
......@@ -54,7 +54,7 @@ public class BaseUtils {
/**
* 小葡萄关注客集集微信公众号
*/
public static void subscribe() throws SQLException {
public static Object subscribe() throws SQLException {
//关注公众号
// network.agentHeaders.put("Content-Type","text/plain");
String str = "<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[osi5w5kT-smQ42Fc-ByO4G8C-E1M]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>";
......@@ -66,7 +66,7 @@ public class BaseUtils {
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, "osi5w5kT-smQ42Fc-ByO4G8C-E1M");
Object userId = result.get("user_id");
Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<>();
params.put("userId",userId);
params.put("validDays",365);
response = network.getResponse(params,MANAGER_encryptTku);
......@@ -75,6 +75,7 @@ public class BaseUtils {
tku = response.jsonPath().getString("data");
network.agentCookies.put("tku", tku);
System.out.println("小葡萄tku:" + tku);
return userId;
}
/**
......
......@@ -28,7 +28,7 @@ public class NetworkUtils {
//cookies中的tku
agentCookies.put("tku",AGENT_TKU);
//多场景测试标志
// agentCookies.put("_duibaServiceGroupKey","miria-2652");
agentCookies.put("_duibaServiceGroupKey","miria-2738");
//json类型的headers
agentHeaders.put("Content-Type","application/json");
//二进制文件的headers
......
......@@ -7,22 +7,22 @@
<class name="com.kjj.cases.live.liveConfig.LiveMaterial"/>
</classes>
</test>
<test preserve-order="true" name="配置秒杀商品">
<classes>
<class name="com.kjj.cases.live.secondKill.ManagerConfGoods"/>
</classes>
</test>
<test preserve-order="true" name="团队管理">
<classes>
<class name="com.kjj.cases.live.liveConfig.Team"/>
</classes>
</test>
<test preserve-order="true" name="精彩视频">
<classes>
<class name="com.kjj.cases.live.liveConfig.Video"/>
</classes>
</test>
<!-- <test preserve-order="true" name="配置秒杀商品">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.secondKill.ManagerConfGoods"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="团队管理">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.liveConfig.Team"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="精彩视频">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.liveConfig.Video"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="创建直播">
<classes>
......@@ -121,6 +121,12 @@
</classes>
</test>
<test preserve-order="true" name="砸金蛋">
<classes>
<class name="com.kjj.cases.live.treasure.GoldenEgg" />
</classes>
</test>
<test preserve-order="true" name="助播-开启直播">
<classes>
<class name="com.kjj.cases.live.anchor.OpenLive"/>
......@@ -267,15 +273,5 @@
<class name="com.kjj.cases.live.customer.PersonalPage" />
</classes>
</test>
<test preserve-order="true" name="创建简易直播">
<classes>
<class name="com.kjj.cases.live.liveConfig.SimpleLiveConfig" />
</classes>
</test>
<test preserve-order="true" name="砸金蛋">
<classes>
<class name="com.kjj.cases.live.treasure.GoldenEgg" />
</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