Commit 6fc34cdb authored by 龚小红's avatar 龚小红

Merge branch 'Feature/20211215-gxh' into 'master'

将新用户与邀请返现结合

See merge request test-group/kejiji!191
parents 66ea59dd e18de8fa
......@@ -42,14 +42,14 @@ public interface Authorization {
//代理人吉吉 sid:2991
default void agentTku() {
network.agentCookies.put(TKU_COOKIE_NAME, AGENT_TKU);
System.out.println("代理人tku:" + AGENT_TKU);
System.out.println("代理人吉吉tku:" + AGENT_TKU);
}
//代理人
default void agent2Tku() {
network.agentCookies.put(TKU_COOKIE_NAME, AGENT2_TKU);
System.out.println("代理人tku:" + AGENT2_TKU);
System.out.println("代理人梦晨tku:" + AGENT2_TKU);
}
......@@ -57,30 +57,31 @@ public interface Authorization {
// 获取访客tku:Su Yi
default void userTku() {
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_UserTku);
System.out.println("访客tku:" + VISITOR_UserTku);
System.out.println("访客tku:" + VISITOR_UserTku);
}
// 获取访客tku:请勿打扰
default void userTku1() {
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR_TKU);
System.out.println("访客tku:" + VISITOR_TKU);
System.out.println("访客tku:" + VISITOR_TKU);
}
// 获取访客tku:Ryan
default void userTku2() {
network.agentCookies.put(TKU_COOKIE_NAME, VISITOR1_TKU);
System.out.println("访客tku:" + 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:小葡萄
default void newUser1() {
network.agentCookies.put(TKU_COOKIE_NAME, tku1);
System.out.println("新用户小葡萄tku:" + tku1);
}
//获取代理人tku,180天打卡返现专用:Jovia
default void cashBackTku(){
network.agentCookies.put(TKU_COOKIE_NAME,CASHBACK_TKU);
System.out.println("打卡返现tku:"+CASHBACK_TKU);
// 获取访客tku:小米粥
default void newUser2() {
network.agentCookies.put(TKU_COOKIE_NAME, tku2);
System.out.println("新用户米粥tku:" + tku2);
}
/**
......
package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import org.testng.Assert;
import org.testng.annotations.*;
import io.restassured.response.Response;
import java.util.*;
import java.text.SimpleDateFormat;
public class CashBack implements Authorization {
public String sid; //加密的销售id
public String grassContentId; //文章内容id
public String scId; //获取文章id
public Integer clockTimes; //获取打卡的总次数
@BeforeClass
public void setUp() {
//打卡返现专用TKU
cashBackTku();
}
//种草文章转发
@Test(description = "种草素材转发", priority = 1)
public void 种草素材转发() {
//获取种草素材列表页
Response listRes = network.getResponse(ARTICLE_GETEXPLOSIONCONTENTLIST);
grassContentId = listRes.jsonPath().getString("data[0].contentId");
//根据种草素材的ContentId获取Scid
Map<String, Object> getScIdParams = new HashMap<>();
getScIdParams.put("contentId", grassContentId);
Response getScIdRes = network.getResponse(getScIdParams, GETSCID);
scId = getScIdRes.jsonPath().getString("data");
//种草文章转发
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId", scId);
params.put("forwardType", 1);
Response response = network.getResponse(params, FORWARD);
Boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString()));
}
@Test(description = "打卡任务进度",priority = 2)
public void 打卡任务进度(){
Response response = network.getResponse(HOME_dailyProgress);
Object dayStatus = response.jsonPath().getJsonObject("data.dayStatus");
String desc = response.jsonPath().getString("desc");
clockTimes = response.jsonPath().getInt("data.clockInTimes");
Assert.assertEquals(dayStatus,2, network.message(HOME_dailyProgress,"打卡任务查询失败",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(HOME_dailyProgress,"打卡任务查询失败",response.body().asString()));
}
@Test(description = "打卡数据统计",priority = 3)
public void 打卡数据统计(){
Response response = network.getResponse(HOME_statistic);
Object clockInTimes = response.jsonPath().getJsonObject("data.clockInTimes");
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(clockInTimes,clockTimes, network.message(HOME_dailyProgress,"打卡数据统计错误",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(HOME_dailyProgress,"打卡数据统计错误",response.body().asString()));
}
@Test(description = "打卡记录",priority = 4)
public void 打卡记录(){
Map<String,Object> params = new HashMap<>();
params.put("dayStatus",2);
Response response = network.getResponse(params,HOME_record);
Object doneTime = response.jsonPath().getJsonObject("data.list.get(0).doneTime");
//获取当天时间
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String today = simpleDateFormat.format(date.getTime());
//获取当天凌晨的时间戳
long current = System.currentTimeMillis();
long currentDate = current-(current+ TimeZone.getDefault().getRawOffset())%(1000*3600*24);
Assert.assertEquals(doneTime,currentDate,network.message(params,HOME_record,"获取当日打卡记录成功",response.body().asString()));
}
}
......@@ -2,7 +2,7 @@ package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.BaseUtils.tku;
import static com.kjj.utils.BaseUtils.tku1;
import static com.kjj.utils.IdMakeUtil.decodingId;
import static com.kjj.utils.IdMakeUtil.encodingId;
import static com.kjj.utils.ThreadSleepUtils.sleep;
......@@ -1095,7 +1095,7 @@ public class HomePage implements Authorization {
@Test(description = "访客_访问文章并参与测评", priority = 54)
public void 访客_访问文章并参与测评() {
//切换为新用户小葡萄,每次都会产生线索
network.agentCookies.put(TKU_COOKIE_NAME, tku);
network.agentCookies.put(TKU_COOKIE_NAME, tku1);
//获取用户信息
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO);
......
package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.cases.admin.Authorization;
import com.kjj.cases.assistant.whoSawMe.ForwardAndRead;
......@@ -116,7 +117,7 @@ public class RecommendMaterial implements Authorization {
params.put("pageSize", 30);
params.put("keywords", keyWord);
Response response = network.getResponse(params, GRASS_searchContent);
ThreadSleepUtils.sleep(1000);
sleep(1000);
String gameContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertNotNull(gameContentId, network.message(params, GRASS_searchContent, "获取动画种草素材列表失败", response.body().asString()));
}
......@@ -269,9 +270,9 @@ public class RecommendMaterial implements Authorization {
//tKu 切换为访客
network.agentCookies.put("tku", VISITOR_TKU);
sleep(3000);
Map<String, Object> params = new HashMap<>();
params.put("scid", aScid);
params.put("sourceScid", bScid); //代理人的用户id
params.put("scid", scid);
params.put("fromUserId", userId); //代理人的用户id
params.put("visitPath", 1);
Response response = network.postResponse(params, CONTENT_visit);
......
......@@ -9,7 +9,6 @@ import org.testng.annotations.*;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku;
public class PersonalCenter implements Authorization{
private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.cases.assistant.pay;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku;
import static com.kjj.utils.BaseUtils.tku1;
import static com.kjj.utils.BaseUtils.updateTypeOrDate;
import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
import org.testng.Assert;
......@@ -26,29 +25,23 @@ public class Pay implements Authorization {
private String tradeNo;
private String promotionCode;
@Test (description = "默认付费_续费页",priority = 1) //priority 方法执行优先级
public void 默认付费_续费页() {
network.agentCookies.put(TKU_COOKIE_NAME, tku);
//代理人续费状态
@Test (description = "默认付费_正常付费页",priority = 2) //priority 方法执行优先级
public void 默认付费_正常付费页() {
userTku();
updateTypeOrDate(2105,false);
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",3); //入口折扣类型,1-普通,3-邀请,4-优惠码
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
Response response = network.getResponse(PAY_info);
int discountType = response.jsonPath().getInt("data.discountType");
int validity = response.jsonPath().getInt("data.validity");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,2,network.message(PAY_info,"非续费逻辑",response.body().asString()));
Assert.assertEquals(discountType,1,network.message(PAY_info,"非正常付费逻辑",response.body().asString()));
Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(preferentialPrice,2,network.message(PAY_info,"续费价格非0.02",response.body().asString()));
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
response = network.getResponse(params, version_info);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
Assert.assertEquals(userVersion,2,network.message(params, version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
Assert.assertEquals(preferentialPrice,4,network.message(PAY_info,"正常价格非0.04",response.body().asString()));
}
@Test (description = "获取开通会员跑马灯",priority = 2) //priority 方法执行优先级
@Test (description = "获取开通会员跑马灯",priority = 3) //priority 方法执行优先级
public void 获取开通会员跑马灯() {
Response response = network.getResponse(PAY_list);
String nickname = response.jsonPath().getString("data.get(0).nickname");
......@@ -57,22 +50,6 @@ public class Pay implements Authorization {
Assert.assertNotNull(avatar,network.message(PAY_list,"会员头像为空",response.body().asString()));
}
@Test (description = "默认付费_正常付费页",priority = 3) //priority 方法执行优先级
public void 默认付费_正常付费页() {
userTku();
updateTypeOrDate(2105,false);
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");
int validity = response.jsonPath().getInt("data.validity");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,1,network.message(PAY_info,"非正常付费逻辑",response.body().asString()));
Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(preferentialPrice,4,network.message(PAY_info,"正常价格非0.04",response.body().asString()));
}
@Test (description = "默认付费_待支付",priority = 4)
public void 默认付费_待支付() {
//创建支付
......
......@@ -3,7 +3,6 @@ package com.kjj.cases.assistant.whoSawMe;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
......@@ -12,8 +11,8 @@ import org.testng.annotations.Test;
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.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.DYNAMIC_addVisit;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.ThreadSleepUtils.sleep;
......@@ -28,12 +27,14 @@ public class ForwardAndRead implements Authorization {
private long forwardTime;
private String questionId;
private String traceId; //访问链路id
private Long fromUserId;
public static Map<String, Integer> custClueStatistics;
@BeforeClass
public void setUp() throws IOException{
agent2Tku();
ssoLogin();
fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("userId");
}
// 获取二度访客起始线索数据
......@@ -99,6 +100,15 @@ public class ForwardAndRead implements Authorization {
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");
param.clear();
param.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(param,DYNAMIC_addVisit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(param, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString()));
}
......@@ -118,22 +128,32 @@ public class ForwardAndRead implements Authorization {
@Test(description = "新用户访问", priority = 7)
public void 新用户访问() throws IOException{
sleep(5000);
network.agentCookies.put(TKU_COOKIE_NAME, BaseUtils.tku);
newUser1();
response = network.getResponse(BasicConfig.USER_INFO);
System.out.println(response.body().asString());
param.clear();
param.put("scid", articleScId);
param.put("fromUserId", sellerId);
param.put("fromUserId", fromUserId);
param.put("traceId", traceId);
param.put("visitPath", 0);
response = network.postResponse(param, BasicConfig.CONTENT_visit);
System.out.println(response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CONTENT_visit, "接口调用失败", response.body().asString()));
param.clear();
param.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(param,DYNAMIC_addVisit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(param, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString()));
}
@Test(description = "二度访客阅读文章", priority = 9)
public void 二度访客阅读文章() throws IOException{
sleep(5000);
Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("userId");
userTku2(); // 切换二度访客
param = new HashMap<>();
param.put("scid", articleScId);
......@@ -148,10 +168,13 @@ public class ForwardAndRead implements Authorization {
@Test(description = "添加访问记录", priority = 10)
public void 添加访问记录() throws IOException{
param.clear();
param.put("forwardTime", forwardTime); // 添加访问记录的时间要小于代理人转发时间
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.put("scid",articleScId);
param.put("forwardTime",System.currentTimeMillis());
response = network.postResponse(param, DYNAMIC_addVisit);
boolean success = response.jsonPath().getBoolean("success");
Object data = response.jsonPath().getJsonObject("data");
Assert.assertTrue(success,network.message(param,DYNAMIC_addVisit,"接口返回失败",response.body().asString()));
Assert.assertNotNull(data,network.message(param, DYNAMIC_addVisit,"接口返回数据为空",response.body().asString()));
//转发
param.clear();
......@@ -160,8 +183,8 @@ public class ForwardAndRead implements Authorization {
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()));
boolean result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result, network.message(param, BasicConfig.FORWARD, "访客转发素材失败", response.body().asString()));
}
@Test(description = "获取文章FAQs", priority = 12)
......
......@@ -15,6 +15,7 @@ import java.io.IOException;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku1;
// 我的客户-首页
public class MyCustomer implements Authorization {
......@@ -25,12 +26,14 @@ public class MyCustomer implements Authorization {
private String sessionId;
private String id; // 自定义提醒事项id
private long lastMessageId;
private long newUserId;
@BeforeClass
public void setUp() throws IOException{
BaseUtils.ssoLogin();
agent2Tku();
visitor1UserId = ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId");
newUserId = ForwardAndRead.decodeTku(tku1).get("userId");
}
// 我的客户首页_客户统计
......@@ -189,11 +192,11 @@ 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 = 16)
public void 客户详情页_头部信息栏() throws IOException{
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
param.put("custUserId", newUserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFOHEADER, "接口请求失败", response.body().asString()));
List<Object> custOrigins = response.jsonPath().getList("data.custOrigins");
......@@ -264,7 +267,7 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(visitCountHere, ForwardAndRead.custClueStatistics.get("visitCount") + 1, network.message(param, BasicConfig.CUSTSTATISTIC, "用户来访次数有误", response.body().asString()));
}
// 客户详情页_阅读偏好
//客户详情页_阅读偏好------访问重构未更新
@Test(description = "客户详情页_阅读偏好", priority = 22)
public void 客户详情页_阅读偏好() throws IOException{
param = new HashMap<>();
......
......@@ -189,7 +189,7 @@ public class WhoSawMe implements Authorization {
break;
}
}
long xptUserId = ForwardAndRead.decodeTku(BaseUtils.tku).get("userId");
long xptUserId = ForwardAndRead.decodeTku(BaseUtils.tku1).get("userId");
param.clear();
param.put("userId", ForwardAndRead.encodeId(xptUserId));
response = network.getResponse(param, BasicConfig.UPDATENEWTOOLD);
......
......@@ -100,8 +100,12 @@ public class BasicConfig {
public static String VISITOR_UserTku = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp";
// 钉钉机器人 线上-告警群
public static final String dingTalkPath = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
// 180天打卡专用代理人 TKU (Jovia),sid :3591
public static String CASHBACK_TKU = "T3gM31f18jCeXXZ8mG3oRE5KGiKg8r7x3Kqf81G5TYpPDL2evLbGxhnkJpUxTr1LvrUd1ZGJqxf6jEHoUY";
//小葡萄的openId
public static final String openId1 = "osi5w5kT-smQ42Fc-ByO4G8C-E1M";
//小米粥的openId
public static final String openId2 = "osi5w5pEY4SxORlLJEE4FkyxQ9E4";
// *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn";
public static final String ACTIVITY_HOST = "https://kjj-activity.duibatest.com.cn";
......@@ -1268,4 +1272,8 @@ public class BasicConfig {
public static final String HOME_customerList = HOST + "/kjy/corp/employee/customer/list";
public static final String HOME_customerStatistic = HOST + "/kjy/corp/employee/customer/statistic";
public static final String HOME_customerLiveClue = HOST + "/kjy/corp/employee/customer/liveClue";
//自动化用户
public static final String TEST_testerSave = MOBILE_HOST + "/test/user/test/save";
public static final String TEST_testerDelete = MOBILE_HOST + "/test/user/test/delete";
}
......@@ -6,10 +6,8 @@ import com.kjj.sql.KjyUserDB;
import com.kjj.sql.UserSqlFactory;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
......@@ -18,7 +16,9 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public class BaseUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
public static String tku;
public static String tku1;
public static String tku2;
public static String superCookieKey;
public static String superCookieValue;
public static String companyCookieKey;
......@@ -61,16 +61,16 @@ public class BaseUtils {
/**
* 小葡萄关注客集集微信公众号
*/
public static Object subscribe() throws SQLException {
public static String subscribe(String openId) 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>";
String str = "<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA["+openId+"]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>";
Response response = network.postXMLResponse(str,MANAGER_oamsg);
System.out.println("关注\n"+response.body().asString());
sleep(1000);
network.agentHeaders.put("Content-Type","application/json");
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, "osi5w5kT-smQ42Fc-ByO4G8C-E1M");
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, openId);
Object userId = result.get("user_id");
Map<String, Object> params = new HashMap<>();
......@@ -79,21 +79,19 @@ public class BaseUtils {
response = network.getResponse(params,MANAGER_encryptTku);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(ROOKIEGUIDE_homeGuide,"接口返回失败",response.body().asString()));
tku = response.jsonPath().getString("data");
network.agentCookies.put(TKU_COOKIE_NAME, tku);
System.out.println("小葡萄tku:" + tku);
return userId;
String data = response.jsonPath().getString("data");
return data;
}
/**
* 小葡萄取关客集集微信公众号
*/
public static Object unsubscribe() throws SQLException {
public static Object unsubscribe(String openId) 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>1628040963</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[unsubscribe]]></Event></xml>";
String str = "<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA["+openId+"]]></FromUserName><CreateTime>1628040963</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[unsubscribe]]></Event></xml>";
Response response = network.postXMLResponse(str,MANAGER_oamsg);
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, "osi5w5kT-smQ42Fc-ByO4G8C-E1M");
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, openId);
System.out.println("取关\n"+response.body().asString());
network.agentHeaders.put("Content-Type","application/json");
Object userId = result.get("user_id");
......@@ -168,6 +166,28 @@ public class BaseUtils {
}
}
/*
* 增加测试假用户
* */
public static void insertTestUser(long userId) {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("userId", userId);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.TEST_testerSave);
boolean data = subscribeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.TEST_testerSave, "增加测试用户失败", subscribeRes.body().asString()));
}
/*
* 删除测试假用户
* */
public static void deleteTestUser(long userId) {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("userId", userId);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.TEST_testerDelete);
boolean data = subscribeRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.TEST_testerDelete, "删除测试用户失败", subscribeRes.body().asString()));
}
/*
* 访客到场
* */
......
......@@ -28,7 +28,7 @@ public class NetworkUtils {
//cookies中的tku
agentCookies.put("tku",AGENT_TKU);
//多场景测试标志
agentCookies.put("_duibaServiceGroupKey","miria-2738");
// agentCookies.put("_duibaServiceGroupKey","miria-2679");
//json类型的headers
agentHeaders.put("Content-Type","application/json");
//二进制文件的headers
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="集客助手" verbose="1" thread-count="3">
<test preserve-order="true" name = "新手引导">
<classes>
<class name="com.kjj.cases.assistant.menu.NoviceGuidance"/>
</classes>
</test>
<test preserve-order="true" name="支付">
<classes>
<class name="com.kjj.cases.assistant.pay.Pay"/>
......@@ -16,6 +11,11 @@
<class name="com.kjj.cases.assistant.pay.Cashback"/>
</classes>
</test>
<test preserve-order="true" name = "新手引导">
<classes>
<class name="com.kjj.cases.assistant.menu.NoviceGuidance"/>
</classes>
</test>
<test preserve-order="true" name = "首页">
<classes>
<class name="com.kjj.cases.assistant.homePage.HomePage"/>
......
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