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();
......
......@@ -4,36 +4,32 @@ import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.StringUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.updateTypeOrDate;
import static com.kjj.utils.BaseUtils.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class Cashback implements Authorization {
public String tradeNo;
private String tradeNo;
@BeforeClass
public void setUp() {
userTku2();
BaseUtils.ssoLogin();
}
public String comboId;
@Test(description = "用户绑定分享关系",priority = 1)
public void 用户绑定分享关系() {
updateTypeOrDate(3054,false);
@Test(description = "一级用户绑定分享合伙人关系",priority = 1)
public void 一级用户绑定分享合伙人关系() {
updateTypeOrDate(186,false);
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",3054);
params.put("sellerId",186);
params.put("inviterSid",2991);
params.put("openId","osi5w5pQIuvXWnUoN4EV23DAcL-4");
params.put("userId",5577);
params.put("openId","osi5w5hV9U4Pix8FBY6X5zcUbIEY");
params.put("userId",373);
params.put("oaId",1);
params.put("scene",1);
Response response = network.postResponse(params,PAY_bind);
......@@ -41,8 +37,8 @@ public class Cashback implements Authorization {
Assert.assertTrue(bindResult,network.message(PAY_bind,"用户绑定失败",response.body().asString()));
}
@Test (description = "默认付费_邀请付费页",priority = 3) //priority 方法执行优先级
public void 默认付费_邀请付费页() {
@Test (description = "默认付费_一级用户邀请付费页",priority = 2) //priority 方法执行优先级
public void 默认付费_一级用户邀请付费页() {
//代理人续费状态
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
......@@ -51,81 +47,195 @@ public class Cashback implements Authorization {
String superiorName = response.jsonPath().getString("data.invitation.superiorName");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
Assert.assertEquals(superiorName,"吉吉",network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(superiorName,"吉吉",network.message(PAY_info,"上级不是吉吉",response.body().asString()));
Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
}
// @Test (description = "返现用户付费_微信支付后回调",priority = 4)
// public void 返现用户付费_微信支付后回调() {
// //创建支付
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("entryDiscountType",1);
// params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
// params.put("paySource","2");
// Response response = network.postResponse(params,PAY_create);
// tradeNo = response.jsonPath().getString("data.tradeNo");
// Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
//
// params.clear();
// int data = 2;
// int i = 0;
// try {
// // 轮训下单接口
// while (data == 2){
// sleep(2000);
//
// params.put("tradeNo",tradeNo);
// response = network.getResponse(params,PAY_result);
// data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
// i++;
// if (i == 10){
// Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
// break;
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
// }
//
//
// }
@Test(description = "获取用户版本信息",priority = 4)
@Test(description = "邀请的待支付好友列表",priority = 3)
public void 邀请的待支付好友列表() {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("distributionListType",1);
Params.put("pageIndex",1);
Params.put("pageSize",10);
Response response = network.getResponse(Params,PAY_distributionList);
Object list=response.jsonPath().getJsonObject("data.list");
String nickname=response.jsonPath().getString("data.list.get(0).nickname");
Assert.assertNotNull(list,network.message(PAY_distributionList,"待付款好友列表为null",response.body().asString()));
Assert.assertEquals(nickname,"Ryan",network.message(PAY_distributionList,"待付款微信昵称错误",response.body().asString()));
}
@Test (description = "返现用户付费_一级用户下单并支付成功",priority = 4)
public void 返现用户付费_一级用户下单并支付成功() {
userTku2();
//创建支付
Map<String, Object> params = new HashMap<String, Object>();
params.put("entryDiscountType",1);
params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("paySource","2");
Response response = network.postResponse(params,PAY_create);
tradeNo = response.jsonPath().getString("data.tradeNo");
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
params.clear();
int data = 2;
int i = 0;
try {
// 轮训下单接口
while (data == 2){
sleep(2000);
params.put("tradeNo",tradeNo);
response = network.getResponse(params,PAY_result);
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
i++;
if (i == 10){
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
break;
}
}
}catch (Exception e){
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);
boolean isVip = response.jsonPath().getBoolean("data.vipValid");
Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
}
@Test (description = "返现用户付费_一级用户续费并支付成功",priority = 5)
public void 返现用户付费_一级用户续费并支付成功() {
//创建支付
Map<String, Object> params = new HashMap<String, Object>();
params.put("entryDiscountType",1);
params.put("discountType",2); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("paySource","2");
Response response = network.postResponse(params,PAY_create);
tradeNo = response.jsonPath().getString("data.tradeNo");
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
params.clear();
int data = 2;
int i = 0;
try {
// 轮训下单接口
while (data == 2){
sleep(2000);
params.put("tradeNo",tradeNo);
response = network.getResponse(params,PAY_result);
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
i++;
if (i == 10){
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
break;
}
}
}catch (Exception e){
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()));
}
@Test(description = "二级用户绑定分享合伙人关系",priority = 6)
public void 二级用户绑定分享合伙人关系() {
userTku3();
updateTypeOrDate(207,false);
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerId",207);
params.put("inviterSid",186);
params.put("openId","osi5w5qvNVe8sWzVitVDZVdUkoZ8");
params.put("userId",359);
params.put("oaId",1);
params.put("scene",1);
Response response = network.postResponse(params,PAY_bind);
boolean bindResult=response.jsonPath().getBoolean("data.bindResult");
Assert.assertTrue(bindResult,network.message(PAY_bind,"用户绑定失败",response.body().asString()));
}
@Test (description = "默认付费_二级用户邀请付费页",priority = 7) //priority 方法执行优先级
public void 默认付费_二级用户邀请付费页() {
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
Response response = network.getResponse(PAY_info);
int discountType = response.jsonPath().getInt("data.discountType");
String superiorName = response.jsonPath().getString("data.invitation.superiorName");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
Assert.assertEquals(superiorName,"Ryan",network.message(PAY_info,"上级邀请人错误",response.body().asString()));
Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
}
@Test (description = "返现用户付费_二级用户下单并支付成功",priority = 8)
public void 返现用户付费_二级用户下单并支付成功() {
//创建支付
Map<String, Object> params = new HashMap<String, Object>();
params.put("entryDiscountType",1);
params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("paySource","2");
Response response = network.postResponse(params,PAY_create);
tradeNo = response.jsonPath().getString("data.tradeNo");
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
params.clear();
int data = 2;
int i = 0;
try {
// 轮训下单接口
while (data == 2){
sleep(2000);
params.put("tradeNo",tradeNo);
response = network.getResponse(params,PAY_result);
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
i++;
if (i == 10){
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
break;
}
}
}catch (Exception e){
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);
boolean isVip = response.jsonPath().getBoolean("data.vipValid");
Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
}
@Test(description = "获取用户版本信息",priority = 9)
public void 获取用户版本信息() {
agentTku();
Response response = network.getResponse(USER_INFO);
System.out.println(response.body().asString());
boolean isInsuranceVersion=response.jsonPath().getBoolean("data.isInsuranceVersion");
Assert.assertTrue(isInsuranceVersion,network.message(USER_INFO,"不是保险版本",response.body().asString()));
}
@Test(description = "邀请的好友列表",priority = 5)
public void 邀请的好友列表() {
agentTku();
@Test(description = "邀请的已支付好友列表",priority = 10)
public void 邀请的已支付好友列表() {
sleep(2000);
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("distributionListType",1);
Params.put("pageIndex",1);
Params.put("pageSize",10);
Params.put("distributionListType",2);
Response response = network.getResponse(Params,PAY_distributionList);
Object list=response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list,network.message(PAY_distributionList,"待付款好友列表为null",response.body().asString()));
Params.put("distributionListType",2);
response = network.getResponse(Params,PAY_distributionList);
Object list1=response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list1,network.message(PAY_distributionList,"已付款好友列表为null",response.body().asString()));
String nickname=response.jsonPath().getString("data.list.get(0).nickname");
Assert.assertNotNull(list,network.message(PAY_distributionList,"已付款好友列表为null",response.body().asString()));
Assert.assertEquals(nickname,"Ryan",network.message(PAY_distributionList,"已付款微信昵称错误",response.body().asString()));
}
@Test(description = "代理人账户信息",priority = 6)
@Test(description = "代理人账户信息",priority = 11)
public void 代理人账户信息() {
agentTku();
Response response = network.getResponse(PAY_accInfo);
System.out.println(response.body().asString());
double balance=Double.parseDouble(response.jsonPath().getString("data.balance"));
Assert.assertTrue(balance>0,network.message(PAY_accInfo,"当前余额为0",response.body().asString()));
double totalPromotionEarnings=Double.parseDouble(response.jsonPath().getString("data.totalPromotionEarnings"));
......@@ -138,38 +248,58 @@ public class Cashback implements Authorization {
Assert.assertTrue(minWithdrawMoney==1,network.message(PAY_accInfo,"最小可提现金额不等于1",response.body().asString()));
int maxWithdrawMoney=response.jsonPath().getInt("data.maxWithdrawMoney");
Assert.assertTrue(maxWithdrawMoney==5000,network.message(PAY_accInfo,"最大可提现金额不等于5000",response.body().asString()));
}
@Test(description = "代理人账户明细",priority = 7)
public void 代理人账户明细() {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
@Test(description = "合伙人账户明细",priority = 12)
public void 合伙人账户明细() {
Map<String, Object> Params = new HashMap<>();
Params.put("type", 1);
Params.put("pageNo", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, PAY_accDetail);
System.out.println(response.body().asString());
int changeType = response.jsonPath().getInt("data[0].changeType");
Assert.assertTrue(changeType ==1, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
Params.put("type", 2);
response = network.getResponse(Params, PAY_accDetail);
System.out.println(response.body().asString());
int changeType1 = response.jsonPath().getInt("data[0].changeType");
Assert.assertTrue(changeType1 ==2, network.message(PAY_accDetail, "收益明细为null", response.body().asString()));
size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney");
Assert.assertTrue(changeMoney1 ==30.0, network.message(PAY_accDetail, "二级付费合伙人返现金额不为30", response.body().asString()));
float changeMoney2 = response.jsonPath().getFloat("data[1].changeMoney");
Assert.assertTrue(changeMoney2 ==50.0, network.message(PAY_accDetail, "一级付费合伙人返现金额不为50", response.body().asString()));
}
@Test(description = "代理人提现",priority = 8)
@Test(description = "代理人提现",priority = 13)
public void 代理人提现() {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
Map<String, Object> Params = new HashMap<>();
Params.put("withdrawMoney", 1);
Response response = network.getResponse(Params, PAY_withdraw);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(PAY_withdraw, "提现失败", response.body().asString()));
}
@Test(description = "普通代理人账户明细",priority = 14)
public void 普通代理人账户明细() {
userTku2();
Map<String, Object> Params = new HashMap<>();
Params.put("type", 2);
Params.put("pageNo", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, PAY_accDetail);
int size = response.jsonPath().getInt("data.size()");
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney");
Assert.assertTrue(changeMoney1 ==35.0, network.message(PAY_accDetail, "一级付费普通代理人返现金额不为35", response.body().asString()));
}
@Test(description = "删除邀请关系",priority = 15)
public void 删除邀请关系() {
Map<String, Object> Params = new HashMap<>();
Params.put("sellerId", 186);
Response response = network.postResponse(Params, PAY_delete);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(PAY_delete, "删除失败", response.body().asString()));
}
}
......@@ -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");
......
......@@ -14,6 +14,8 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
// 我的客户-首页
public class MyCustomer implements Authorization {
private Response response;
......@@ -27,7 +29,8 @@ public class MyCustomer implements Authorization {
@BeforeClass
public void setUp() throws IOException{
BaseUtils.ssoLogin();
visitor2Tku();
agent2Tku();
visitor1UserId = ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId");
}
// 我的客户首页_客户统计
......@@ -41,29 +44,30 @@ public class MyCustomer implements Authorization {
Assert.assertTrue(totalCount >= 1, network.message(BasicConfig.CUSTOMERSTATISTICS, "累计获客数小于1", response.body().asString()));
}
// 我的客户首页_查询未读信息
@Test(description = "首页_查询未读信息", priority = 49)
public void 首页_查询未读信息() throws IOException{
response = network.getResponse(BasicConfig.SELLERUNREADMESSAGE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.SELLERUNREADMESSAGE, "接口请求失败", response.body().asString()));
int unreadCount = response.jsonPath().getInt("data.unreadCount");
Assert.assertEquals(unreadCount, 1, network.message(param, BasicConfig.SELLERUNREADMESSAGE, "代理人未读消息数有误", response.body().asString()));
}
// 消息通知页_对话记录
@Test(description = "消息通知页_对话记录", priority = 51)
public void 消息通知页_对话记录() throws IOException{
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 3)
public void 标签管理_删除标签() throws IOException{
List<String> ids = new ArrayList<>();
// 删除所有标签
Response getTagListRes = network.getResponse(BasicConfig.TAG_GETLIST);
List<tagList> tagLists = JsonUtil.parseResponseToListBean(getTagListRes, tagList.class);
for(tagList tagList : tagLists){
String tagId = tagList.getId();
ids.add(tagId);
}
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 90);
response = network.getResponse(param, BasicConfig.CHAT_LINKMANLIST);
List<LinkList> linkLists = JsonUtil.parseResponseToPageBean(response, LinkList.class);
String sessionIds = (String) linkLists.get(0).getSession().get("sessionId");
String lastContent = (String) linkLists.get(0).getSession().get("lastContent");
Assert.assertEquals(sessionIds, sessionId, network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录sessionId有误", response.body().asString()));
Assert.assertEquals(lastContent, "你好", network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录最后一条内容错误", response.body().asString()));
param.put("ids", ids);
Response delTagsRes = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(delTagsRes.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", delTagsRes.body().asString()));
// 检查是否完全删除
tagLists = JsonUtil.parseResponseToListBean(network.getResponse(BasicConfig.TAG_GETLIST), tagList.class);
Assert.assertEquals(tagLists.size(), 0, network.message(param, BasicConfig.TAG_GETLIST, "标签列表内容未全部删除", network.getResponse(BasicConfig.TAG_GETLIST).body().asString()));
}
// 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =4)
public void 标签管理_新建标签() throws IOException{
......@@ -84,6 +88,8 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(newTagName, "新标签", network.message(BasicConfig.TAG_GETLIST, "新增标签名称错误", response.body().asString()));
}
// 标签管理_修改标签
@Test(description = "标签管理_修改标签", priority = 5)
public void 标签管理_修改标签() throws IOException{
......@@ -103,93 +109,17 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(newTagName, "新标签2", network.message(BasicConfig.TAG_GETLIST, "新增标签名称错误", response.body().asString()));
}
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 3)
public void 标签管理_删除标签() throws IOException{
List<String> ids = new ArrayList<>();
// 删除所有标签
Response getTagListRes = network.getResponse(BasicConfig.TAG_GETLIST);
List<tagList> tagLists = JsonUtil.parseResponseToListBean(getTagListRes, tagList.class);
for(tagList tagList : tagLists){
String tagId = tagList.getId();
ids.add(tagId);
}
param = new HashMap<>();
param.put("ids", ids);
Response delTagsRes = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(delTagsRes.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", delTagsRes.body().asString()));
// 检查是否完全删除
tagLists = JsonUtil.parseResponseToListBean(network.getResponse(BasicConfig.TAG_GETLIST), tagList.class);
Assert.assertEquals(tagLists.size(), 0, network.message(param, BasicConfig.TAG_GETLIST, "标签列表内容未全部删除", network.getResponse(BasicConfig.TAG_GETLIST).body().asString()));
}
// 我的客户首页_获取全部客户列表_最近访问
@Test(description = "客户列表_最近访问", priority = 6)
public void 客户列表_最近访问() throws IOException{
visitor1UserId = ForwardAndRead.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString()));
}
// 我的客户首页_获取全部客户列表_按照访问次数排列
@Test(description = "客户列表_访问次数", priority = 7)
public void 客户列表_访问次数() throws IOException{
// 降序排列
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 1);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
int visitCountFirst = response.jsonPath().getInt("data.list[0].visitCount");
int visitCountSecond = response.jsonPath().getInt("data.list[1].visitCount");
int visitCountThird = response.jsonPath().getInt("data.list[2].visitCount");
boolean compareOne = visitCountFirst >= visitCountSecond;
boolean compareTwo = visitCountSecond >= visitCountThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
// 升序排列
// 客户详情页_设置特别关注
@Test(description = "客户详情页_设置特别关注", priority = 9)
public void 客户详情页_设置特别关注() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 2);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
visitCountFirst = response.jsonPath().getInt("data.list[0].visitCount");
visitCountSecond = response.jsonPath().getInt("data.list[1].visitCount");
visitCountThird = response.jsonPath().getInt("data.list[2].visitCount");
compareOne = visitCountFirst <= visitCountSecond;
compareTwo = visitCountSecond <= visitCountThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "访问次数筛选结果排列顺序错误", response.body().asString()));
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 1);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "设置特别关注失败", response.body().asString()));
}
// 我的客户首页_获取全部客户列表_按客户意向排列
@Test(description = "客户列表_客户意向", priority = 8)
public void 客户列表_客户意向() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 5);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
int customerIntentionFirst = response.jsonPath().getInt("data.list[0].customerIntention");
int customerIntentionSecond = response.jsonPath().getInt("data.list[1].customerIntention");
int customerIntentionThird = response.jsonPath().getInt("data.list[2].customerIntention");
boolean compareOne = customerIntentionFirst >= customerIntentionSecond;
boolean compareTwo = customerIntentionSecond >= customerIntentionThird;
Assert.assertTrue(compareOne, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户意向筛选结果排列顺序错误", response.body().asString()));
Assert.assertTrue(compareTwo, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户意向筛选结果排列顺序错误", response.body().asString()));
}
//我的客户首页_获取客户列表_特别关注客户
@Test(description = "客户列表_特别关注", priority = 10)
......@@ -220,6 +150,17 @@ public class MyCustomer implements Authorization {
int specialCustomerTotal = response.jsonPath().getInt("data.specialCustomerTotal");
Assert.assertEquals(specialCustomerTotal, specialCustLists.size(), network.message(param, BasicConfig.totalSpecial, "特别关注客户总数错误", response.body().asString()));
}
// 客户详情页_取消特别关注
@Test(description = "客户详情页_取消特别关注", priority = 11)
public void 客户详情页_取消特别关注() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 0);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "取消特别关注失败", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_七日活跃", priority = 12)
......@@ -248,38 +189,6 @@ public class MyCustomer implements Authorization {
List<Object> lists = response.jsonPath().getList("data.list");
Assert.assertTrue(lists.size() >= 1, network.message(param, BasicConfig.CUSTOMERSEARCH, "直接转发客户数为0", response.body().asString()));
}
// 我的客户首页_获取客户列表_筛选客户
@Test(description = "客户列表_好友转发", priority = 14)
public void 客户列表_好友转发() throws IOException{
param = new HashMap<>();
param.put("custOrigin", 2);
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
Long custUserId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(custUserId, ForwardAndRead.decodeTku(BasicConfig.VISITOR1_TKU).get("userId"), network.message(param, BasicConfig.CUSTOMERSEARCH, "好友转发的访客userId与预期不一致", response.body().asString()));
}
// 客户列表_标签
@Test(description = "客户列表_标签", priority = 31)
public void 客户列表_标签() throws IOException{
// 等待5s获取新建的标签
ThreadSleepUtils.sleep(5000);
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "筛选结果与预期不符", response.body().asString()));
}
// 客户详情页_头部信息栏
@Test(description = "客户详情页_头部信息栏", priority = 16)
public void 客户详情页_头部信息栏() throws IOException{
......@@ -306,27 +215,7 @@ public class MyCustomer implements Authorization {
Assert.assertNotNull(sessionId, network.message(param, BasicConfig.CUSTINFO, "访客sessionId为空", response.body().asString()));
}
// 客户详情页_设置特别关注
@Test(description = "客户详情页_设置特别关注", priority = 9)
public void 客户详情页_设置特别关注() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 1);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "设置特别关注失败", response.body().asString()));
}
// 客户详情页_取消特别关注
@Test(description = "客户详情页_设置特别关注", priority = 11)
public void 客户详情页_取消特别关注() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("isSpecialCustomer", 0);
response = network.postResponse(param, BasicConfig.UPDATESPECIAL);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.UPDATESPECIAL, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATESPECIAL, "取消特别关注失败", response.body().asString()));
}
// 客户详情页_设置备注
@Test(description = "客户详情页_设置备注", priority = 18)
......@@ -392,12 +281,14 @@ public class MyCustomer implements Authorization {
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("custUserId", visitor1UserId);
param.put("custUserId", 373);
param.put("filterType", 1);
param.put("timeType", 2);
param.put("timeOrderType", 2);
param.put("timeOrderType", 1);
response = network.getResponse(param, BasicConfig.CUSTVISITLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTVISITLIST, "接口请求失败", response.body().asString()));
List<VisitRecords> visitRecords = JsonUtil.parseResponseToPageBean(response, VisitRecords.class);
System.out.println();
VisitRecords.recordsList recordsOfContent = visitRecords.get(0).getRecords().get(0);
VisitRecords.recordsList recordsOfClue = visitRecords.get(0).getRecords().get(1);
String contentId = recordsOfContent.getContentId();
......@@ -479,7 +370,7 @@ public class MyCustomer implements Authorization {
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTFAVORITE);
List<CustFavorite> custFavorites = JsonUtil.parseResponseToListBean(response, CustFavorite.class);
Assert.assertTrue(custFavorites.size() >= 1, network.message(param, BasicConfig.CUSTFAVORITE, "数据记录数有误", response.body().asString()));
Assert.assertTrue(custFavorites.size() >= 0, network.message(param, BasicConfig.CUSTFAVORITE, "数据记录数有误", response.body().asString()));
String userActionTypeEnum = custFavorites.get(0).getUserActionTypeEnum();
String contentId = custFavorites.get(0).getContentId();
Assert.assertEquals(userActionTypeEnum, "FORWARD", network.message(param, BasicConfig.CUSTFAVORITE, "用户动作类型记录有误", response.body().asString()));
......@@ -518,6 +409,23 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(tagId, createTagId, network.message(param, BasicConfig.GETTAGANDREMIND, "标签id与预期不符", response.body().asString()));
}
// 客户列表_标签
@Test(description = "客户列表_标签", priority = 31)
public void 客户列表_标签() throws IOException{
// 等待5s获取新建的标签
ThreadSleepUtils.sleep(5000);
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 3);
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "筛选结果与预期不符", response.body().asString()));
}
// 客户信息_客户管理_自定义提醒事项
@Test(description = "客户信息_客户管理_自定义提醒事项", priority = 32)
public void 客户信息_客户管理_自定义提醒事项() throws IOException{
......@@ -608,16 +516,18 @@ public class MyCustomer implements Authorization {
// 客户信息_客户管理_查询已提醒事件列表
@Test(description = "客户信息_客户管理_查询已提醒事件列表", priority = 35)
public void 客户信息_客户管理_查询已提醒事件列表() throws IOException{
//此时间为手动添加
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("userId", 373);
param.put("remindStatus", 1);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
String remindContent = remindInfos.get(0).getRemindContent();
int remindStatus = remindInfos.get(0).getRemindStatus();
Assert.assertEquals(remindContent, "吃饭", network.message(param, BasicConfig.GETREMINDINFOS, "筛选结果事件内容不正确", response.body().asString()));
Assert.assertEquals(remindContent, "已提醒事件", network.message(param, BasicConfig.GETREMINDINFOS, "筛选结果事件内容不正确", response.body().asString()));
Assert.assertEquals(remindStatus, 1, network.message(param, BasicConfig.GETREMINDINFOS, "筛选结果状态非已提醒", response.body().asString()));
}
......@@ -697,7 +607,7 @@ public class MyCustomer implements Authorization {
param.put("custUserId", ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("userId"));
response = network.getResponse(param, BasicConfig.RELATIONINFO_HEADER);
String name = response.jsonPath().getString("data.name");
Assert.assertEquals(name, BasicConfig.WECHAT_NAME, network.message(param, BasicConfig.RELATIONINFO_HEADER, "客户姓名不正确", response.body().asString()));
Assert.assertEquals(name, "备注昵称", network.message(param, BasicConfig.RELATIONINFO_HEADER, "客户姓名不正确", response.body().asString()));
}
// 客户信息_客户关系链_人脉列表
......@@ -810,55 +720,12 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_SEND, "消息发送失败", response.body().asString()));
}
// 客户详情页_留言_聊天内容
@Test(description = "客户详情页_留言_聊天内容", priority = 48)
public void 客户详情页_留言_聊天内容() throws IOException{
param = new HashMap<>();
param.put("pageSize", 30);
param.put("isPushMessage", true);
param.put("role", 1);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_LIST);
List<ChatList> chatLists = JsonUtil.parseResponseToPageBean(response, ChatList.class);
if(chatLists.size() != 0){
Long senderId = chatLists.get(chatLists.size()-1).getSenderId();
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
int readFlag = chatLists.get(chatLists.size()-1).getReadFlag();
Assert.assertEquals(senderId, ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, visitor1UserId, network.message(param, BasicConfig.CHAT_LIST, "接收者userId错误", response.body().asString()));
Assert.assertEquals(content, "Hello", network.message(param, BasicConfig.CHAT_LIST, "消息内容错误", response.body().asString()));
Assert.assertEquals(readFlag, 1, network.message(param, BasicConfig.CHAT_LIST, "消息已读状态错误", response.body().asString()));
}else {
Assert.fail(network.message(param, BasicConfig.CHAT_LIST, "聊天记录为空", response.body().asString()));
}
}
// 客户详情页_留言_最新信息
@Test(description = "客户详情页_留言_最新信息", priority = 50)
public void 客户详情页_留言_最新信息() throws IOException{
// 获取当前时间戳
Date current = new Date();
long timestamp = current.getTime();
param.clear();
param.put("role", 1);
param.put("sessionId", sessionId);
param.put("lastId", lastMessageId);
param.put("timestamp", timestamp);
response = network.getResponse(param, BasicConfig.CHAT_NEW);
long senderId = response.jsonPath().getLong("data.list[0].senderId");
long receiverId = response.jsonPath().getLong("data.list[0].receiverId");
String content = response.jsonPath().getString("data.list[0].content");
Assert.assertEquals(senderId, visitor1UserId, network.message(param, BasicConfig.CHAT_NEW, "发送者userID错误", response.body().asString()));
Assert.assertEquals(receiverId, (long)ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_NEW, "接收者sellerId错误", response.body().asString()));
Assert.assertEquals(content, "你好", network.message(param, BasicConfig.CHAT_NEW, "消息内容错误", response.body().asString()));
}
// 留言_客户接收消息
@Test(description = "留言_客户接收消息", priority = 46)
public void 留言_客户接收消息() throws IOException{
String scid = ForwardAndRead.getContentScId(BasicConfig.ARTICLE_CONTENTID);
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR1_TKU);
param.clear();
param.put("scid", scid);
......@@ -890,13 +757,38 @@ public class MyCustomer implements Authorization {
response = network.postResponse(param, BasicConfig.CHAT_READED);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_READED, "访客阅读消息失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT2_TKU);
}
// 客户详情页_留言_聊天内容
@Test(description = "客户详情页_留言_聊天内容", priority = 48)
public void 客户详情页_留言_聊天内容() throws IOException{
param = new HashMap<>();
param.put("pageSize", 30);
param.put("isPushMessage", true);
param.put("role", 1);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_LIST);
List<ChatList> chatLists = JsonUtil.parseResponseToPageBean(response, ChatList.class);
if(chatLists.size() != 0){
Long senderId = chatLists.get(chatLists.size()-1).getSenderId();
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
int readFlag = chatLists.get(chatLists.size()-1).getReadFlag();
Assert.assertEquals(senderId, ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, visitor1UserId, network.message(param, BasicConfig.CHAT_LIST, "接收者userId错误", response.body().asString()));
Assert.assertEquals(content, "Hello", network.message(param, BasicConfig.CHAT_LIST, "消息内容错误", response.body().asString()));
Assert.assertEquals(readFlag, 1, network.message(param, BasicConfig.CHAT_LIST, "消息已读状态错误", response.body().asString()));
}else {
Assert.fail(network.message(param, BasicConfig.CHAT_LIST, "聊天记录为空", response.body().asString()));
}
}
// 留言_客户回复消息
@Test(description = "留言_客户回复消息", priority = 49)
public void 留言_客户回复消息() throws IOException{
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR1_TKU);
param.clear();
param.put("content", "你好");
......@@ -905,11 +797,54 @@ public class MyCustomer implements Authorization {
response= network.postResponse(param, BasicConfig.CHAT_SEND);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_SEND, "消息发送失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
network.agentCookies.put(TKU_COOKIE_NAME, BasicConfig.AGENT2_TKU);
}
// 我的客户首页_查询未读信息
@Test(description = "首页_查询未读信息", priority = 50)
public void 首页_查询未读信息() throws IOException{
response = network.getResponse(BasicConfig.SELLERUNREADMESSAGE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.SELLERUNREADMESSAGE, "接口请求失败", response.body().asString()));
int unreadCount = response.jsonPath().getInt("data.unreadCount");
Assert.assertEquals(unreadCount, 1, network.message(param, BasicConfig.SELLERUNREADMESSAGE, "代理人未读消息数有误", response.body().asString()));
}
// 客户详情页_留言_最新信息
@Test(description = "客户详情页_留言_最新信息", priority = 51)
public void 客户详情页_留言_最新信息() throws IOException{
// 获取当前时间戳
Date current = new Date();
long timestamp = current.getTime();
param.clear();
param.put("role", 1);
param.put("sessionId", sessionId);
param.put("lastId", lastMessageId);
param.put("timestamp", timestamp);
response = network.getResponse(param, BasicConfig.CHAT_NEW);
long senderId = response.jsonPath().getLong("data.list[0].senderId");
long receiverId = response.jsonPath().getLong("data.list[0].receiverId");
String content = response.jsonPath().getString("data.list[0].content");
Assert.assertEquals(senderId, visitor1UserId, network.message(param, BasicConfig.CHAT_NEW, "发送者userID错误", response.body().asString()));
Assert.assertEquals(receiverId, (long)ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_NEW, "接收者sellerId错误", response.body().asString()));
Assert.assertEquals(content, "你好", network.message(param, BasicConfig.CHAT_NEW, "消息内容错误", response.body().asString()));
}
// 消息通知页_对话记录
@Test(description = "消息通知页_对话记录", priority = 52)
public void 消息通知页_对话记录() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 90);
response = network.getResponse(param, BasicConfig.CHAT_LINKMANLIST);
List<LinkList> linkLists = JsonUtil.parseResponseToPageBean(response, LinkList.class);
String sessionIds = (String) linkLists.get(0).getSession().get("sessionId");
String lastContent = (String) linkLists.get(0).getSession().get("lastContent");
Assert.assertEquals(sessionIds, sessionId, network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录sessionId有误", response.body().asString()));
Assert.assertEquals(lastContent, "你好", network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录最后一条内容错误", response.body().asString()));
}
// 还原用户信息
@Test(description = "还原用户详细信息", priority = 55)
@Test(description = "还原用户详细信息", priority = 53)
public void 还原用户详细信息() throws IOException{
// 关闭生日提醒
param = new HashMap<>();
......
......@@ -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");
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();
}
/**
......
......@@ -2,25 +2,22 @@ package com.kjj.cases.live.treasure;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.bean.manager.TreasureAward;
import com.kjj.bean.manager.TreasureCode;
import com.kjj.bean.manager.TreasureRed;
import com.kjj.bean.manager.WelfareList;
import com.kjj.bean.manager.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.live.liveConfig.LiveBinding;
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;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static com.kjj.cases.live.anchor.CloseLive.closeLive;
import static com.kjj.cases.live.anchor.OpenLive.openLive;
......@@ -32,7 +29,7 @@ public class GoldenEgg implements Authorization {
@BeforeClass
public void setUp() {
ssoLogin();
visitorAuth1();
}
public String ConfId;
public String shareSign;
......@@ -40,23 +37,7 @@ public class GoldenEgg implements Authorization {
public String interactConfId;
public List<WelfareList> id;
/**
* 添加代理人绑定关系
*/
@Test(description = "代理人绑定", priority = 1)
public void 代理人绑定() {
agentAuth();
LiveBinding.binding(this.shareSign);
this.shareSign = LiveBinding.share();
}
@Test(description = "代理人A与访客A邀请关系绑定", priority = 2)
public void 代理人A与访客A邀请关系绑定() {
visitorAuth1();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "查询配置奖品列表", priority = 3)
@Test(description = "查询配置奖品列表", priority = 1)
public void 查询配置奖品列表() {
Map<String, Object> getListParam = new HashMap<>();
getListParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -72,7 +53,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "创建砸金蛋配置", priority = 4)
@Test(description = "创建砸金蛋配置", priority = 2)
public void 创建砸金蛋配置() {
Map<String, Object> saveParam = new HashMap<>();
saveParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -112,21 +93,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "查询砸金蛋配置详情", priority = 5)
public void 查询砸金蛋配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail);
System.out.println(response.body().asString());
Integer openCondition = response.jsonPath().getInt("data.openCondition");
Assert.assertTrue(openCondition > 0, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "查询砸金蛋配置详情失败", response.body().asString()));
Assert.assertEquals(response.jsonPath().getInt("data.confStatus"), 1, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "砸金蛋配置开启状态错误", response.body().asString()));
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "开启砸金蛋配置", priority = 5)
@Test(description = "开启砸金蛋配置", priority = 3)
public void 开启砸金蛋配置() {
Map<String, Object> switchStatusParam = new HashMap<>();
switchStatusParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -138,7 +105,20 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "查询砸金蛋配置数据", priority = 8)
@Test(description = "查询砸金蛋配置详情", priority = 4)
public void 查询砸金蛋配置详情() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response response = network.getResponse(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail);
int confStatus = response.jsonPath().getInt("data.confStatus");
int openCondition = response.jsonPath().getInt("data.openCondition");
Assert.assertEquals(openCondition ,1, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "查询砸金蛋配置详情失败", response.body().asString()));
Assert.assertEquals(confStatus,1, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "砸金蛋配置状态错误", response.body().asString()));
treasureConf = JSON.parseObject(JSON.toJSONString(response.jsonPath().get("data")));
}
@Test(description = "查询砸金蛋配置数据", priority = 5)
public void 查询砸金蛋配置数据() {
visitorAuth1();
Map<String, Object> getLiveAwardListParam = new HashMap<>();
......@@ -157,7 +137,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "查询直播前砸金蛋配置详情", priority = 9)
@Test(description = "查询直播前砸金蛋配置详情", priority = 6)
public void 查询直播前砸金蛋配置详情() {
sleep(2000);
Map<String, Object> detailParam = new HashMap<>();
......@@ -170,7 +150,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "获取跑马灯数据", priority = 10)
@Test(description = "获取跑马灯数据", priority = 7)
public void 获取跑马灯数据() {
Map<String, Object> chooseAwardParam = new HashMap<>();
chooseAwardParam.put("pageSize",10);
......@@ -181,15 +161,8 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "代理人A与访客A邀请关系绑定", priority = 11)
public void 代理人A与访客G邀请关系绑定() {
visitorAuth7();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "黑名单用户仅不可砸中实物", priority = 12)
public void 黑名单用户仅不可砸中实物() {
@Test(description = "黑名单用户G仅不可砸中实物", priority = 8)
public void 黑名单用户G仅不可砸中实物() {
visitorAuth7();
Map<String, Object> chooseAwardParam = new HashMap<>();
chooseAwardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -214,7 +187,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "第1个访客A砸金蛋砸出实物", priority = 13)
@Test(description = "第1个访客A砸金蛋砸出实物", priority = 9)
public void 1个访客A砸金蛋砸出实物() {
visitorAuth1();
sleep(2000);
......@@ -222,7 +195,6 @@ public class GoldenEgg implements Authorization {
chooseAwardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
chooseAwardParam.put("treasureConfId",ConfId);
Response response = network.postResponse(chooseAwardParam, BasicConfig.MOBILE_goldenEgg_open);
System.out.println(response.body().asString());
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(chooseAwardParam, BasicConfig.MOBILE_goldenEgg_open, "砸金蛋失败", response.body().asString()));
......@@ -238,17 +210,9 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(receiveStatus,5, network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "砸金蛋失败", response.body().asString()));
Assert.assertEquals(treasureType, 3,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "砸出奖品非实物", response.body().asString()));
Assert.assertEquals(helperList, 0,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "助力人数错误", response.body().asString()));
interactConfId = response.jsonPath().getString("data.award.interactConfId");
}
@Test(description = "代理人A与访客B邀请关系绑定", priority = 14)
public void 代理人A与访客B邀请关系绑定() {
visitorAuth7();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第2个访客B砸金蛋砸出抽奖码", priority = 15)
@Test(description = "第2个访客B砸金蛋砸出抽奖码", priority = 10)
public void 2个访客B砸金蛋砸出抽奖码() {
visitorAuth2();
sleep(2000);
......@@ -274,7 +238,7 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(helperList,0, network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "助力人数错误", response.body().asString()));
}
@Test(description = "增加实物奖品数量", priority = 16)
@Test(description = "增加实物奖品数量", priority = 11)
public void 增加实物奖品数量() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("totalNum",2);//-1无限制,1限制1次
......@@ -285,7 +249,7 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(treasureConf, BasicConfig.MANAGER_goldenEgg_saveOrUpdate, "增加实物奖品数量失败", response.body().asString()));
}
@Test(description = "实物奖品增加后数量变化", priority = 17)
@Test(description = "实物奖品增加后数量变化", priority = 12)
public void 实物奖品增加后数量变化() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -299,14 +263,7 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(receiveNum ,0, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "实物奖品已领取错误", response.body().asString()));
}
@Test(description = "代理人A与访客C邀请关系绑定", priority = 18)
public void 代理人A与访客C邀请关系绑定() {
visitorAuth3();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第3个访客C砸金蛋砸出实物", priority = 19)
@Test(description = "第3个访客C砸金蛋砸出实物", priority = 13)
public void 3个访客C砸金蛋砸出实物() {
visitorAuth3();
Map<String, Object> chooseAwardParam = new HashMap<>();
......@@ -331,7 +288,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "减少实物奖品数量", priority = 20)
@Test(description = "减少实物奖品数量", priority = 14)
public void 减少实物奖品数量() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("totalNum",1);//-1无限制,1限制1次
......@@ -342,7 +299,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "第3个访客C砸金蛋超时", priority = 21)
@Test(description = "第3个访客C砸金蛋超时", priority = 15)
public void 3个访客C砸金蛋超时() {
visitorAuth3();
sleep(2000);
......@@ -363,7 +320,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "第3个访客C超时后重新砸蛋砸出实物奖品", priority = 22)
@Test(description = "第3个访客C超时后重新砸蛋砸出实物奖品", priority = 16)
public void 3个访客C超时后重新砸蛋砸出实物奖品() {
visitorAuth3();
sleep(2000);
......@@ -390,7 +347,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "第3个访客C再次砸金蛋超时", priority = 23)
@Test(description = "第3个访客C再次砸金蛋超时", priority = 17)
public void 3个访客C再次砸金蛋超时() {
visitorAuth3();
sleep(2000);
......@@ -411,14 +368,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "代理人A与访客D邀请关系绑定", priority = 24)
public void 代理人A与访客D邀请关系绑定() {
visitorAuth4();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第3个用户再次超时后访客D砸蛋砸出实物奖品", priority = 25)
@Test(description = "第3个用户再次超时后访客D砸蛋砸出实物奖品", priority = 18)
public void 3个用户再次超时后访客D砸蛋砸出实物奖品() {
visitorAuth4();
sleep(2000);
......@@ -445,14 +395,7 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(helperList, 0,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "助力人数错误", response.body().asString()));
}
@Test(description = "代理人A与访客E邀请关系绑定", priority = 26)
public void 代理人A与访客E邀请关系绑定() {
visitorAuth5();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第5个用户E砸蛋砸出抽奖码", priority = 27)
@Test(description = "第5个用户E砸蛋砸出抽奖码", priority = 19)
public void 5个用户E砸蛋砸出抽奖码() {
visitorAuth5();
sleep(2000);
......@@ -479,22 +422,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "访客A获取分享加密串", priority = 28)
public void 访客A获取分享加密串() {
visitorAuth1();
this.shareSign = LiveBinding.share();
}
@Test(description = "访客E与访客A邀请关系绑定", priority = 29)
public void 访客F与访客A邀请关系绑定() {
visitorAuth6();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "修改实物奖品数量为无限制", priority = 30)
@Test(description = "修改实物奖品数量为无限制", priority = 20)
public void 修改实物奖品数量为无限制() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
treasureAward.put("totalNum",-1);
......@@ -505,9 +433,9 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(treasureConf, BasicConfig.MANAGER_goldenEgg_saveOrUpdate, "修改实物奖品为无限制失败", response.body().asString()));
}
@Test(description = "第5个访客F砸蛋砸出实物奖品", priority = 31)
public void 5个访客F砸蛋砸出实物奖品() {
visitorAuth6();
@Test(description = "第5个访客J砸蛋砸出实物奖品", priority = 21)
public void 5个访客J砸蛋砸出实物奖品() {
visitorAuth10();
sleep(5000);
Map<String, Object> chooseAwardParam = new HashMap<>();
chooseAwardParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -529,10 +457,11 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(receiveStatus, 5,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "砸金蛋失败", response.body().asString()));
Assert.assertEquals(treasureType, 3,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "砸出奖品非实物", response.body().asString()));
Assert.assertEquals(helperList, 0,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "助力人数错误", response.body().asString()));
interactConfId = response.jsonPath().getString("data.award.interactConfId");
}
@Test(description = "修改红包概率为100%", priority = 32)
@Test(description = "修改红包概率为100%", priority = 22)
public void 修改红包概率为100() {
JSONObject treasureAward = treasureConf.getJSONObject("treasureAward");
JSONObject treasureRed = treasureConf.getJSONObject("treasureRed");
......@@ -544,7 +473,7 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(treasureConf, BasicConfig.MANAGER_goldenEgg_saveOrUpdate, "修改红包概率失败", response.body().asString()));
}
@Test(description = "黑名单用户G砸金蛋超时", priority = 33)
@Test(description = "黑名单用户G砸金蛋超时", priority = 23)
public void 黑名单用户G砸金蛋超时() {
visitorAuth7();
Map<String, Object> param = new HashMap<>();
......@@ -564,7 +493,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "黑名单用户G超时后仅能砸出抽奖码", priority = 34)
@Test(description = "黑名单用户G超时后仅能砸出抽奖码", priority = 24)
public void 黑名单用户G超时后仅能砸出抽奖码() {
visitorAuth7();
sleep(2000);
......@@ -591,15 +520,8 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "访客I与访客A邀请关系绑定", priority = 35)
public void 访客I与访客A邀请关系绑定() {
visitorAuth8();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第6个访客F砸出红包", priority = 36)
public void 6个访客F砸出红包() {
@Test(description = "第6个访客I砸出红包", priority = 25)
public void 6个访客I砸出红包() {
visitorAuth8();
sleep(2000);
Map<String, Object> chooseAwardParam = new HashMap<>();
......@@ -625,14 +547,7 @@ public class GoldenEgg implements Authorization {
}
@Test(description = "访客H与访客A邀请关系绑定", priority = 37)
public void 访客H与访客A邀请关系绑定() {
visitorAuth9();
LiveBinding.binding(this.shareSign);;
LiveBinding.token();
}
@Test(description = "第7个访客H砸出抽奖码", priority = 38)
@Test(description = "第7个访客H砸出抽奖码", priority = 26)
public void 7个访客H砸出抽奖码() {
visitorAuth9();
sleep(2000);
......@@ -658,7 +573,7 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(helperList, 0,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "助力人数错误", response.body().asString()));
}
@Test(description = "砸金蛋进行中数量变化", priority = 39)
@Test(description = "砸金蛋进行中数量变化", priority = 27)
public void 砸金蛋进行中数量变化() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -679,9 +594,17 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(receiveNum ,0, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "实物奖品已领取错误", response.body().asString()));
}
@Test(description = "用户B给用户A助力", priority = 40)
public void 用户B给用户A助力() {
visitorAuth2();
@Test(description = "访客J获取分享加密串", priority = 28)
public void 访客J获取分享加密串() {
visitorAuth10();
this.shareSign = LiveBinding.share();
}
@Test(description = "其他用户给用户J助力", priority = 29)
public void 其他用户给用户J助力() {
visitorAuth28();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareType",15);
......@@ -701,9 +624,9 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_assist, "用户B给用户H助力失败", response.body().asString()));
}
@Test(description = "访客A实物兑奖成功", priority = 41)
public void 访客A实物兑奖成功() {
visitorAuth1();
@Test(description = "访客A实物兑奖成功", priority = 30)
public void 访客J实物兑奖成功() {
visitorAuth10();
sleep(2000);
Map<String, Object> param = new HashMap<>();
param.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -716,15 +639,15 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(helperList,1,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "邀请头像数量错误", response.body().asString()));
}
@Test(description = "访客B获取分享加密串", priority = 42)
@Test(description = "访客B获取分享加密串", priority = 31)
public void 访客B获取分享加密串() {
visitorAuth2();
this.shareSign = LiveBinding.share();
}
@Test(description = "用户C给用户B助力", priority = 43)
public void 用户C给用户B助力() {
visitorAuth3();
@Test(description = "其他用户给用户B助力", priority = 32)
public void 其他用户给用户B助力() {
visitorAuth29();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareType",15);
......@@ -744,7 +667,7 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_assist, "用户B给用户H助力失败", response.body().asString()));
}
@Test(description = "访客B抽奖码兑奖成功", priority = 44)
@Test(description = "访客B抽奖码兑奖成功", priority = 33)
public void 访客B抽奖码兑奖成功() {
visitorAuth2();
sleep(2000);
......@@ -759,15 +682,15 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(helperList,1,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "邀请头像数量错误", response.body().asString()));
}
@Test(description = "访客F获取分享加密串", priority = 45)
public void 访客F获取分享加密串() {
@Test(description = "访客I获取分享加密串", priority = 34)
public void 访客I获取分享加密串() {
visitorAuth8();
this.shareSign = LiveBinding.share();
}
@Test(description = "用户D给用户F助力", priority = 46)
public void 用户D给用户F助力() {
visitorAuth5();
@Test(description = "其他用户给用户I助力", priority = 35)
public void 其他用户给用户I助力() {
visitorAuth30();
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("shareType",15);
......@@ -787,8 +710,8 @@ public class GoldenEgg implements Authorization {
Assert.assertTrue(data, network.message(Params, BasicConfig.MOBILE_assist, "用户B给用户H助力失败", response.body().asString()));
}
@Test(description = "访客F红包兑奖成功", priority = 47)
public void 访客F红包兑奖成功() {
@Test(description = "访客I红包兑奖成功", priority = 36)
public void 访客I红包兑奖成功() {
visitorAuth8();
sleep(2000);
Map<String, Object> param = new HashMap<>();
......@@ -798,11 +721,11 @@ public class GoldenEgg implements Authorization {
System.out.println(response.body().asString());
int receiveStatus =response.jsonPath().getInt("data.receiveStatus");
int helperList =response.jsonPath().getInt("data.helperList.size()");
Assert.assertEquals(receiveStatus,2,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "实物兑奖失败", response.body().asString()));
Assert.assertEquals(receiveStatus,2,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "红包兑奖失败", response.body().asString()));
Assert.assertEquals(helperList,1,network.message(param, BasicConfig.MOBILE_goldenEgg_joinInfo, "邀请头像数量错误", response.body().asString()));
}
@Test(description = "砸金蛋已领取数量变化", priority = 48)
@Test(description = "砸金蛋已领取数量变化", priority = 37)
public void 砸金蛋已领取数量变化() {
Map<String, Object> confDetailParam = new HashMap<>();
confDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......@@ -824,9 +747,9 @@ public class GoldenEgg implements Authorization {
Assert.assertEquals(receiveNum ,1, network.message(confDetailParam, BasicConfig.MANAGER_goldenEgg_detail, "实物奖品已领取错误", response.body().asString()));
}
@Test(description = "查询用户是否未提交收货地址", priority = 49)
@Test(description = "查询用户是否未提交收货地址", priority = 38)
public void 查询用户是否未提交收货地址() {
visitorAuth1();
visitorAuth10();
ThreadSleepUtils.sleep(1000);
Map<String, Object> locationResultParam = new HashMap<>();
locationResultParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
......@@ -837,9 +760,8 @@ public class GoldenEgg implements Authorization {
Assert.assertNotNull(winnerRegion, network.message(locationResultParam, BasicConfig.USER_locationResult, "查询用户是否提交收货地址失败", locationResultRes.body().asString()));
}
@Test(description = "提交收货地址", priority = 50)
@Test(description = "提交收货地址", priority = 39)
public void 提交收货地址() {
visitorAuth1();
ArrayList<String> region = new ArrayList<>();
region.add("浙江省");
region.add("杭州市");
......@@ -852,42 +774,68 @@ public class GoldenEgg implements Authorization {
submitInfoParam.put("location", "西湖区数娱大厦");
submitInfoParam.put("phoneNum", "13498765432");
Response submitInfoRes = network.postResponse(submitInfoParam, BasicConfig.USER_submitInfo);
System.out.println(submitInfoRes.body().asString());
Boolean result = submitInfoRes.jsonPath().getBoolean("success");
Assert.assertTrue(result, network.message(submitInfoParam, BasicConfig.USER_submitInfo, "提交收货地址失败", submitInfoRes.body().asString()));
ThreadSleepUtils.sleep(3000);
}
@Test(description = "查询用户是否提交收货地址", priority = 51)
@Test(description = "查询用户是否提交收货地址", priority = 40)
public void 查询用户是否提交收货地址() {
visitorAuth1();
ThreadSleepUtils.sleep(1000);
ThreadSleepUtils.sleep(3000);
Map<String, Object> locationResultParam = new HashMap<>();
locationResultParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
locationResultParam.put("scene", 1);
Response locationResultRes = network.getResponse(locationResultParam, BasicConfig.USER_locationResult);
System.out.println(locationResultRes.body().asString());
Object winnerRegion = locationResultRes.jsonPath().getJsonObject("data.winnerRegion");
Assert.assertNotNull(winnerRegion, network.message(locationResultParam, BasicConfig.USER_locationResult, "查询用户是否提交收货地址失败", locationResultRes.body().asString()));
}
@Test(description = "获取直播配置详情", priority = 52)
public void 获取直播配置详情() {
adminAuth();
Map<String, Object> ConfDetailParam = new HashMap<>();
ConfDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response ConfDetailRes = network.getResponse(ConfDetailParam, BasicConfig.ANCHOR_getConfDetail);
Object data = ConfDetailRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(ConfDetailParam, BasicConfig.ANCHOR_getConfDetail, "获取直播配置详情失败", ConfDetailRes.body().asString()));
}
@Test(description = "开始直播", priority = 53)
public void 开启直播() {
openLive(LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
}
@Test(description = "结束直播", priority = 54)
public void 结束直播() {
closeLive(LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
@Test(description = "更新奖品分发为联系领奖", priority = 41)
public void 更新奖品分发为联系领奖() {
Map<String, Object> Params = new HashMap<>();
Params.put("posterUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/e36cb31828e14a3ebb9d01e6be79ad66.jpg");
Params.put("videoUrl", "http://streamimg.kjjcrm.com/kjy/image/20210201/1612171657348.mp4");
Params.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
Params.put("coverUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/d4093b24aaca49da8f0e3e276721feea.jpg");
Params.put("mpShareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/182f3659e39b4ea6898af781cc6344a1.jpg");
Params.put("title", "直播测试" + RandomUtils.nextInt(1, 100));
Params.put("mpShareTitle", "自动化直播");
Params.put("companyId", 101);//公司
Params.put("agentInviteAuthType", 1);
Params.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
Params.put("noticeTime", noticeTime);
Params.put("broadcastTime", broadcastTime);
Params.put("shareContent", "自动化直播 #{shortLink}");
Params.put("shelfStatus", 2);
Params.put("secondPoster", "https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg");
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);//奖品分发方式0-代理人领奖1-快递寄送
Params.put("existSeriesPoster", 0);
Params.put("followPushState", 0); // 关注直播间用户是否推送开关,0 = false
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
ProvinceCityCodeList save = new ProvinceCityCodeList();
save.setProvinceCode(110000);
save.setCityCode(null);
provinceCityCode.add(save);
ProvinceCityCodeList save1 = new ProvinceCityCodeList();
save1.setProvinceCode(420000);
save1.setCityCode(420900);
provinceCityCode.add(save1);
ProvinceCityCodeList save2 = new ProvinceCityCodeList();
save2.setProvinceCode(330000);
save2.setCityCode(330100);
provinceCityCode.add(save2);
Params.put("provinceCityCodeList", provinceCityCode);
Params.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
Response saveResponse = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_0);
boolean success = saveResponse.jsonPath().getJsonObject("success");
Assert.assertTrue(success, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_0, "更新领奖方式错误", saveResponse.body().asString()));
}
}
\ No newline at end of file
......@@ -5,72 +5,81 @@ public class BasicConfig {
public static final boolean isPushReport =true; //true
// 代理人微信昵称
public static final String WECHAT_NAME = "吉吉";
public static final String TKU_COOKIE_NAME = "tku";
/**
* 直播账号授权key
*/
//自动化假用户 UserID:4055 ,liveUserID;81
public static String visitorAuto1 ="5MgSyboxqzAQZZJEsTf43nVX4vbZ5hG86sgJ5fSN7NzKxCH5WfE2XDHGMFm785nWo1pHKu5V5GPuQZHz3AfUEPenT5jh";
//直播管理员(吉吉)
public static String ADMIN_KEY="zFNkBc7JtvLPL6ifAfXbcgXf7k8AofD7jRHCDreREzhP8iW4bahfqRFePosTb9G6ESGPwScVFCQyuZBcc4brtRfaNz";
// 直播代理人 (艳玲)ID:826
public static String AUTH_KEY ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRCuzyKj3hQkSYMpkYma5RmZHQAbv8fiPzFX5BgoJgjF2gUVz175wz3dY";
// 直播代理人 (小疙瘩)ID:995
public static String agentAuth ="LEH7epeHVDJWzhZ6DiexTHnsaP1faXTzcymSLsZVqAY5WqZQrdzjC38jMagiDc4FuL29DuBPCvuyHwDfmewFfwyW7rFLZ";
//直播访客 (志勇)ID:107
public static String visitorAuth="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRL1y3zwSbNpp1aULAhVJCVAEKsjT2ZbJ5DZhH3ZjeaCEGLsecXdXZW6n";
//直播访客 (茶仔)ID:122
public static String visitorAuth2 ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRL1y3zwSbNpp1aULAhVJCVBDufTzdTS5XKuxkvj7isT9B8DKxEfDKT5V";
// 直播代理人 (陈家梦)ID:210
public static String agentAuth ="LEH7epeHVDJWzhZ6DiexTHnserXQHEH2m81qW19iFaHnxksF9ujtq2D5q2yNrSJvXtWdBXjNTVa2KvbDj4Mpbs2Kc3LUf";
//直播访客 (随波逐流)ID:343
public static String visitorAuth="LEH7epeHVDJWzhZ6DiexTHnserXQHEuKCxVgdZuBLF7iVyUDgnmQWGD8hwPhJQr1XHoGAvgv1ufg9N11YubEfdG3K7cC7";
//直播访客 (Porco)ID:101
public static String visitorAuth2 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEtqkXCZyaLnoBnFXfapLWsxe5PueLWgboXNs6UQ2SiAJkjtA3bbVn3pPmodoXnTm";
//直播访客 (刘超)ID:811
public static String visitorAuth3 ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRCuzyKj3hQkSYMpkYma5RmZkAMTNFNjYjcnJswy8qpVdguBY2N4mUQn4";
//直播访客 (李执)ID:89
public static String visitorAuth4 ="5MgSyboxqzAQZZJEsTf43nVUKEmLf2YTZut7GhTAVmw4xseWCUJTmXK1AE8XFHrUG3J5ULR4ETo7WX8i8ttPSbGPNmwQ";
//直播访客 (加夕😏溪👿)ID:100
public static String visitorAuth4 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEuW5atrdYQAa2zPjhfreHfoXJsRXu5bn79CUcHcwRJk3oiGiMFi3zsy5cfJT5Vi3";
//直播访客 (吉吉)ID:907
public static String visitorAuth9 ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRpVDVGzx7dWtF6qSrZH5EJekTCXsUVsZSSj1giy6aNiJSTN1JdVtPHgU";
//直播访客 (周成)ID:812
public static String visitorAuth5 ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRCuzyKj3hQkSYMpkYma5RmZjtcLQiQJi9xEEF7iUENqjA4ZiENKx5aSE";
//直播访客 (新强)ID:82
public static String visitorAuth6 ="5MgSyboxqzAQZZJEsTf43nVUKEmLf2YTZut7GhqYXLE5gFuKiVz7CzpN8oMnvPDyBjHDXnh2s6T5A3H4DN9fuYCZzZj9";
//直播访客 (熊二)ID:719
public static String visitorAuth7 ="LEH7epeHVDJWzhZ6DiexTHnfZVkhkqorGGQahRL1y3zwSbNpp1aULAhVJCfFh6cujPTXfQ99d2qDCrKPgSvwrQ6diTkZR";
//直播访客 (熊大)ID:946
public static String visitorAuth8 ="2Tsc8MwHZmXJKPfze38rXm37UEbpakoFFxPjXnhCqixY2dghFrfLxdsKoqHrPNabbQxNUSStUGGBirKk993ogwuBZqKgm9C";
//直播访客 (日落)ID:703
public static String visitorAuth10 ="LEH7epeHVDJWzhZ6DiexTHnsaP1qQoaA7tAWpG56Y1NNQvM7gfDV7k263cKpHrAnmSrXY1MMhficzJT8UftKVVeobhNQH";
//直播访客 (梦阳)ID:345
public static String visitorAuth7 ="LEH7epeHVDJWzhZ6DiexTHnsiKZvYuJyTdE9MaQQynBXMpHKBgLt9S9ri8r1Y7rjQ6GtEcwRyf5ajjhJHXMpe6umA9aiY";
//直播访客 (anno)ID:197
public static String visitorAuth8 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEtviPA5WevCD4KhhULvUSEecBhkBJPRScYUAyqLofjUhhrUJYnRPxa4BafZKEsmf";
//直播访客 (晴天)ID:198
public static String visitorAuth10 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEtydEfpLfViM9wsoSMGAqgSkDKP5VK19VfmguVFovu3NFDqWPVnfnqaHUyLx9XyW";
//直播访客 (小四)ID:108
public static String visitorAuth11 ="LEH7epeHVDJWzhZ6DiexTHnsaP1qQtqg4bchCs73vvVo9tdZjkmmjNMWkCsgrygU4cJaXfwzr7j51EK9Xcxdt2YdXnQjU";
//直播访客 (饺子)ID:97
public static String visitorAuth12 ="5MgSyboxqzAQZZJEsTf43nVX38FgyAUo2fAxaP2wGJUTHcnhCNQ6xm4rZ8nMSjRk2BTsYwRhe1kABXuFmTA7JsepCEpa";
//直播访客 (大妹子)ID:299
public static String visitorAuth13 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oWNN5DjmEBUV6rxQBX1gPqEDy6fBAMhJF4ZNUHR681CqgJaAwkQttsd8aB5WdCDf";
//直播访客 (光头强)ID:1495
public static String visitorAuth14 ="2Tsc8MwHZmXJKPfze38rXm37UEpohGG4fZ8hUsUgQKTh6dmCmCVsKPv5xnwP7HZcjhZ1LvGYRW9UJQfY6HVxCiytxd8nkk7";
//直播访客 (热心市民兔兔🐰)ID:763
public static String visitorAuth14 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEu6tjwYtPs6oMRKERaq4BZbFe6PfLGG1EXK8Z76FmwQmW3WX1bPqoSgTrP81S9Tr";
//直播访客 (少侠)ID:788
public static String visitorAuth15 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oWNQGsjS7kCzWj4MRh8UEgj65qMf774qQKtXQCskA56o29SkFTd6Zvc82mKjQ2P1";
//直播访客 (抬头有飞碟)ID:99
public static String visitorAuth16 ="5MgSyboxqzAQZZJEsTf43nVX38FgxYNfT62QtXBfd44D2QpfhS1MHjzggYiRmLtzAqHLps4SB7m5PsqQQYkjS7hcPHSu";
//直播访客 (烟独坷)ID:279
public static String visitorAuth16 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEv8aXBmmKx3FnF2xfVqkz51BmoTq5Xf9UboKwKxFth7aXj7Logu66Bi7MigZSssx";
//直播访客 (枫城)ID:77
public static String visitorAuth17 ="5MgSyboxqzAQZZJEsTf43nVX38FgxYNfR7C5mkWn1EaJAymDPCSQyz3eaqsq7Wn47NU1cUqKXMHSEEbHfhXiv9Bq6XCc";
//直播访客 (小老弟来了)ID:726
public static String visitorAuth18 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oXAbLLH4y37kY1Bh1zjcGqq8H65TzBAApa8c4h8PYXwogLPa8swFPNEpBqgqBRPH";
//直播访客 (林国芸)ID:786
public static String visitorAuth19 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oXAUTTB6fYfPQ57LstgL84LnTWTZRadaM23vPXd7x2Q8Dos7RdCpWYg9AcJeUDz5";
//直播访客 (孙心桂)ID:785
public static String visitorAuth20 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oXATWauEgZhrnVmFDGYrbyvfbCiHrAsmpMp7LRpUYvHTCCVYrfQJZZZeAGXs5q9B";
//直播访客 (谢翊美)ID:791
public static String visitorAuth21 ="LEH7epeHVDJWzhZ6DiexTHnsaN9w9oX4LYmRiH4EYLayw7oTtnaZ4YpLUcVaMTnAUuz5jSPcnRQgDm7R2XRS6AQgJqtta";
//直播访客 (zzz666)ID:849
public static String visitorAuth22 ="LEH7epeHVDJWzhZ6DiexTHnsaMYwdGZ6gcwfZgyDxbCXekMNKoXXNy7hieT2Bt6KwShiHYjnNViCm9EmjvN1msbTomJta";
//直播访客 (七凉)ID:179
public static String visitorAuth23 ="LEH7epeHVDJWzhZ6DiexTHnsaRU4euCKXGmUiCDXuHaG6DznL4Mfk9SGwWCnwMvA6urFmXu4Qe9sCCcXMdojZMU4xN39V";
//直播访客 (超_越梦想)ID:270
public static String visitorAuth18 ="LEH7epeHVDJWzhZ6DiexTHnserXQHEvEsFYsdSYFjVg5hL2rvi1XgeZJdSJFEPmjGdmRN6mc9N2TXDb72UNQG2pjtbUnc";
//直播访客 (Shinawatra)ID:269
public static String visitorAuth19 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDsMmNB16ADSz9dDfuF5b4wjSt5yYNUKa7gxHhnKF6Mnen1s7QXikay2aUT6EM7La";
//直播访客 (抬tou有飞碟)ID:99
public static String visitorAuth20 ="5MgSyboxqzAQZZJEsTf43nVX493oxnWY2jY56GrsHSmnvbPMY9CK2tqyAN7sRqMu5hjLTJHgHaL9goPSZa95Pegs3Ztx";
//直播访客 (魏剑帆)ID:104
public static String visitorAuth21 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDsYVVyeHu8YKNZKRpdq7mkXnpXzZNn7KMCQa9ato9WSo7dY1V66hPuwJTXbj67HJ";
//直播访客 (母笑阳)ID:105
public static String visitorAuth22 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDsbTbzxwM2qy8dueqLVvzaTLbiHoTdFVx1yBQKLb17VhdbQwPgPhsnm2Du42cSAr";
//直播访客 (黄知恒)ID:556
public static String visitorAuth23 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDsicD17M2jqrLJ9QK3hZWSbSSeZoVG1uSNuapXLV2muoUEMzD3tX5ZEnPkQq2ew6";
//直播访客 (奶汪)ID:1170 实名用户
public static String visitorAuth24 ="2Tsc8MwHZmXJKPfze38rXm37UEX1EtfvfjxjLr1GZDVAdRXD3hSK2j6WjZQgFaqHHJcT5yk3tB64Ebu38fmuJymWQtPcAdr";
//直播访客 (亦心)ID:96 实名用户
public static String visitorAuth25 ="5MgSyboxqzAQZZJEsTf43nVX38cJBxsCHATPDDoWL7qHS5PaPehMLbSmTNWgySTMFYevyw9tSxYKVU2VfhR9fW1FrWTk";
//直播访客 (小米粥)ID:749
public static String visitorAuth26 ="LEH7epeHVDJWzhZ6DiexTHnfbvr9gocGu9FvH3CVz6g4Cez7hNpJpzWTAnDH2FiQ3oj3dDx5W6NQYDzd3ToQiPbQpbtag";
//直播访客 (兑吧集团)ID:947
public static String visitorAuth27 ="LEH7epeHVDJWzhZ6DiexTHnfbvr9gocGu9ExJDb9xHoegrcNGiGyvUPrCXu5VECCsW6HDaVZMFu1Rph5WvdbB3jbkGcM9";
//直播访客 (猫爷1234567890)ID:277
public static String visitorAuth26 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDtgDuBeQ6YTdBy3kXuhjv2YNiVJwF6BUMHFmFb585gHatzpGU3dpzyGFYyKVfHmM";
//直播访客 (momo)ID:207
public static String visitorAuth27 ="LEH7epeHVDJWzhZ6DiexTHnserXQHDtkmr6LgbqN177V2MSYyEtub4zu9i2aXYGeVQobJ8fpde5YaDk8wJHkYYZR6EMqP";
//直播访客 (🍗)ID:213
public static String visitorAuth28 ="LEH7epeHVDJWzhZ6DiexTHnserXQHCthtbhzxPM8gVabuoWkeLKcsLcRKXopdfTdDowGoRafx6y2viyvpkN5GwNYrHDvi";
//直播访客 (叶庭玮)ID:211
public static String visitorAuth29 ="LEH7epeHVDJWzhZ6DiexTHnserXQHCtM8rNeniNbC71CxsgmmfFgGJ7aKtkJ7LiLe759DtAzp1miMwGP2GVPK6BrD8hgR";
//直播访客 (袁静怡)ID:1470
public static String visitorAuth30 ="2Tsc8MwHZmXJKPfze38rXm37Ua5bBkXUECt1BQhT2U2csy4dyb7wA2YMxV7aSRVhXXWFyZqrNgBSreXUWbnYnVqd5xsvBAX";
//自动化假用户 UserID:4055 ,liveUserID;81
public static String visitorAuto1 ="5MgSyboxqzAQZZJEsTf43nVX4vbZ5hG86sgJ5fSN7NzKxCH5WfE2XDHGMFm785nWo1pHKu5V5GPuQZHz3AfUEPenT5jh";
/**
* 集客助手授权key
......@@ -79,9 +88,11 @@ public class BasicConfig {
public static String AGENT_TKU = "T3gM31f18jCFEcfTyJdjfJAfSjDmKNMHfH7CvpLDC6UCLbai6Pc41VyJK3bXHe1wg7Hb5FGFZheeLvHjbE";
// 基础线访客 TKU---"请勿打扰"
public static String VISITOR_TKU = "T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV";
// 基础线访客(小雪人) TKU
public static String VISITOR1_TKU = "T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPPrfjggTn4Gv1ytpR3XAQusWRz7uTsHaibp6Es8";
// 基础线代理人
// 基础线一级邀请访客(Ryan) sid:186
public static String VISITOR1_TKU = "2LYYwKJ1AqodGS5GJhJ9UU2CvroNP4oXBdXzWMjCXMZrpHnZQ6GNsAVoiDvyJbaiSVgzJGtkad6EnP4i";
// 基础线二级邀请访客(向日葵) sid:207
public static String VISITOR2_TKU = "2LYYwKJ1AqodEgCNM1c5ELXqhopphgtgqJgFo2jF3S9pexv9m2j5oGrwmxPuLHzuJfz1Rwb93FrZ1vmt";
// 基础线代理人(xxx),sid: 3844
public static String AGENT2_TKU = "T3gM31f18jCfGaPSWPdym4Tn1bVYCTxrdndNe7hfwWrSpFCcXxnzbW81VZG9nT2gT8MMB52bE2rguiXBDL";
// 访客的sids
public static final String sids = "Kj21MjMwNTU";
......@@ -752,13 +763,11 @@ public class BasicConfig {
// *************** 公共 ***************
public static final String version_info = HOST + "/kjy/mp/version/info";
public static final String isVipSubscribe = HOST + "/kjy/mp/seller/isVipSubscribe";
public static final String USER_INFO = HOST + "/kjy/mp/user/info";
public static final String FORWARD = HOST + "/kjy/mp/forward";
public static final String GETSCID = HOST + "/kjy/mp/seller/getScId";
public static final String HASALREADYLIKE = HOST + "/kjy/mp/interaction/hasAlreadyLike";
public static final String CHECKUNREAD = HOST + "/kjy/mp/chat/checkUnread";
public static final String CONTENT_READ = HOST + "/kjy/mp/content/read";
public static final String INTERACTION_LIKE = HOST + "/kjy/mp/interaction/like";
public static final String GETTIPSBYPAGE = HOST + "/kjy/mp/tips/getTipsByPage";
public static final String USING_VERSION = HOST + "/kjy/mp/version/getInUseVersion";
......@@ -774,6 +783,7 @@ public class BasicConfig {
public static final String UPLOAD_image= HOST + "/kjy/mp/upload/image";
public static final String DYNAMIC_addVisit= HOST + "/kjy/mp/seller/dynamic/addVisit";
public static final String ROOKIEGUIDE_homeGuide= HOST + "/kjy/mp/rookieGuide/homeGuide";
public static final String CONTENT_visit= HOST + "/kjj/content/clue/visit";//新的访问接口
// *************** 支付 ***************
public static final String PAY_combo = HOST + "/kjy/mp/combo/list/v2";
......@@ -793,6 +803,7 @@ public class BasicConfig {
public static final String PAY_popup = HOST + "/kjj/vip/order/other/popup";
public static final String PAY_distribute = HOST + "/kjj/auto/test/proCode/distribute";
public static final String PAY_bind = HOST + "/kjj/auto/test/invitation/bind";
public static final String PAY_delete = HOST + "/kjj/auto/test/invitation/delete";
// *************** 名片 ***************
public static final String SELLERCARD_topOfDetail = HOST + "/kjy/mp/sellerCardV5/topOfDetail";
......@@ -1187,6 +1198,7 @@ public class BasicConfig {
public static final String MANAGER_article_edit = MANAGER_HOST + "/kjy/manager/grassContent/edit";
public static final String MANAGER_qa_pageList = MANAGER_HOST + "/kjy/manager/qa/pageList";
public static final String MANAGER_qa_del = MANAGER_HOST + "/kjy/manager/qa/del";
public static final String MANAGER_conf_getDetail = MANAGER_HOST + "/kjy/manager/live/pre/conf/getDetail";
// 管理后台—企业后台
public static final String MANAGER_cockpitSaveOrUpdate = MANAGER_HOST +"/kjy/manager/corp/cockpit/saveOrUpdate";
......
......@@ -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