Commit 8a836d4d authored by 龚小红's avatar 龚小红

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

Feature/20211201 gxh

See merge request test-group/kejiji!178
parents 6503093a c5571665
...@@ -53,9 +53,9 @@ public class NoviceGuidance implements Authorization { ...@@ -53,9 +53,9 @@ public class NoviceGuidance implements Authorization {
@Test(description = "小葡萄关注公众号并切换为会员", priority = 2) @Test(description = "小葡萄关注公众号并切换为会员", priority = 2)
public void 小葡萄关注公众号并切换为会员() throws SQLException { public void 小葡萄关注公众号并切换为会员() throws SQLException {
//关注公众号 //关注公众号
userId = (long) subscribe(); subscribe();
//切换会员 //切换会员
updateTypeOrDate(userId,true); updateTypeOrDate(0L,true);
} }
@Test(description = "创建资料包", priority = 3) @Test(description = "创建资料包", priority = 3)
......
package com.kjj.cases.assistant.pay; package com.kjj.cases.assistant.pay;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -12,81 +13,80 @@ import java.util.HashMap; ...@@ -12,81 +13,80 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.PAY_CALLOUT;
import static com.kjj.utils.BaseUtils.updateTypeOrDate; import static com.kjj.utils.BaseUtils.updateTypeOrDate;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class Cashback implements Authorization { public class Cashback implements Authorization {
public String tradeNo;
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
userTku(); userTku2();
BaseUtils.ssoLogin();
} }
public String comboId; public String comboId;
// @Test(description = "用户绑定分享关系",priority = 1) @Test(description = "用户绑定分享关系",priority = 1)
// public void 用户绑定分享关系() { public void 用户绑定分享关系() {
// Map<String, Object> Params = new HashMap<String, Object>(); updateTypeOrDate(3054,false);
// Params.put("fromStr",1); Map<String, Object> params = new HashMap<String, Object>();
// Params.put("inviterSid",2991); params.put("sellerId",3054);
// Params.put("accessSource",22); params.put("inviterSid",2991);
// Response response = network.getResponse(Params,PAY_distribute); params.put("openId","osi5w5pQIuvXWnUoN4EV23DAcL-4");
// System.out.println(response.body().asString()); params.put("userId",5577);
// boolean data=response.jsonPath().getBoolean("data"); params.put("oaId",1);
// Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",response.body().asString())); 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 = "用户支付后是否有180天打卡权限",priority = 2) }
// public void 用户支付后是否有180天打卡权限() {
// Response response = network.getResponse(PAY_clockPayInfo);
// System.out.println(response.body().asString());
// boolean isClockPay=response.jsonPath().getBoolean("data.isClockPay");
// Assert.assertFalse(isClockPay,network.message(PAY_clockPayInfo,"有180天打卡权限",response.body().asString()));
// }
//
// @Test (description = "默认付费_邀请付费页",priority = 3) //priority 方法执行优先级
// public void 默认付费_邀请付费页() {
// updateTypeOrDate(5495,false);
// //代理人续费状态
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.put("entryDiscountType",3); //入口折扣类型,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,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
// Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
// Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
// }
@Test (description = "默认付费_邀请付费页",priority = 3) //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,"吉吉",network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
}
// @Test (description = "返现用户付费_微信支付后回调",priority = 3) // @Test (description = "返现用户付费_微信支付后回调",priority = 4)
// public void 返现用户付费_微信支付后回调() { // public void 返现用户付费_微信支付后回调() {
// //获取付费价格
// Response actualPayMoneyResponse = network.getResponse(PAY_combo);
// System.out.println(actualPayMoneyResponse.body().asString());
// comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id");
// Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString()));
// String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
// Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
//
// //创建支付 // //创建支付
// Map<String, Object> payParams = new HashMap<String, Object>(); // Map<String, Object> params = new HashMap<String, Object>();
// payParams.put("userVersion", 2); // 1 通用版 2 保险版 // params.put("entryDiscountType",1);
// payParams.put("comboId", comboId); // params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
// payParams.put("oaId", "1"); // params.put("paySource","2");
// payParams.put("paySource", "2"); // Response response = network.postResponse(params,PAY_create);
// Response response = network.postResponse(payParams, PAY_create); // tradeNo = response.jsonPath().getString("data.tradeNo");
// String 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);
// //
// // mock微信回调失败 // params.put("tradeNo",tradeNo);
// Map<String, Object> callbackParams = new HashMap<String, Object>(); // response = network.getResponse(params,PAY_result);
// callbackParams.put("tradeNo", tradeNo); // data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
// callbackParams.put("payResult", true); // i++;
// callbackParams.put("payTradeNo", "test"); // if (i == 10){
// response = network.getResponse(callbackParams, PAY_CALLOUT); // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
// boolean result = response.jsonPath().getBoolean("data"); // break;
// Assert.assertTrue(result, network.message(callbackParams, PAY_CALLOUT, "mock微信支付回调成功,但我们订单处理失败", response.body().asString())); // }
// }
// }catch (Exception e){
// e.printStackTrace();
// Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
// }
// //
// //
// } // }
...@@ -170,8 +170,6 @@ public class Cashback implements Authorization { ...@@ -170,8 +170,6 @@ public class Cashback implements Authorization {
System.out.println(response.body().asString()); System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(PAY_withdraw, "提现失败", response.body().asString())); Assert.assertTrue(data, network.message(PAY_withdraw, "提现失败", response.body().asString()));
} }
} }
...@@ -780,14 +780,10 @@ public class BasicConfig { ...@@ -780,14 +780,10 @@ public class BasicConfig {
public static final String PAY_create = HOST + "/kjj/vip/order/create"; public static final String PAY_create = HOST + "/kjj/vip/order/create";
public static final String PAY_cancel = HOST + "/kjj/vip/order/cancel"; public static final String PAY_cancel = HOST + "/kjj/vip/order/cancel";
public static final String PAY_CALLOUT = HOST + "/kjj/order/payCallout"; public static final String PAY_CALLOUT = HOST + "/kjj/order/payCallout";
public static final String PAY_exchange= HOST + "/kjy/mp/version/exchange";
public static final String PAY_status= HOST + "/kjy/order/status";
public static final String PAY_isRenewCondition= HOST + "/kjy/mp/combo/isRenewCondition";
public static final String MANAGER_typeList = MANAGER_HOST + "/kjy/manager/promotionCode/typeList"; public static final String MANAGER_typeList = MANAGER_HOST + "/kjy/manager/promotionCode/typeList";
public static final String MANAGER_batchCreateV2 = MANAGER_HOST + "/kjy/manager/promotionCode/batchCreateV2"; public static final String MANAGER_batchCreateV2 = MANAGER_HOST + "/kjy/manager/promotionCode/batchCreateV2";
public static final String PAY_distribute = HOST + "/kjy/sp/visitorPayment/distribute";
public static final String PAY_clockPayInfo = HOST + "/kjy/mp/combo/clockPayInfo";
public static final String PAY_accInfo = HOST + "/kjy/sp/seller/acc/info"; public static final String PAY_accInfo = HOST + "/kjy/sp/seller/acc/info";
public static final String PAY_clockPayInfo = HOST + "/kjy/mp/combo/clockPayInfo";
public static final String PAY_distributionList = HOST + "/kjy/sp/seller/distributionList"; public static final String PAY_distributionList = HOST + "/kjy/sp/seller/distributionList";
public static final String PAY_accDetail = HOST + "/kjy/sp/seller/acc/detail"; public static final String PAY_accDetail = HOST + "/kjy/sp/seller/acc/detail";
public static final String PAY_withdraw = HOST + "/kjy/sp/seller/acc/withdraw"; public static final String PAY_withdraw = HOST + "/kjy/sp/seller/acc/withdraw";
...@@ -795,6 +791,8 @@ public class BasicConfig { ...@@ -795,6 +791,8 @@ public class BasicConfig {
public static final String PAY_list = HOST + "/kjj/vip/order/success/list"; public static final String PAY_list = HOST + "/kjj/vip/order/success/list";
public static final String PAY_result = HOST + "/kjj/vip/order/pay/result"; public static final String PAY_result = HOST + "/kjj/vip/order/pay/result";
public static final String PAY_popup = HOST + "/kjj/vip/order/other/popup"; 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 SELLERCARD_topOfDetail = HOST + "/kjy/mp/sellerCardV5/topOfDetail"; public static final String SELLERCARD_topOfDetail = HOST + "/kjy/mp/sellerCardV5/topOfDetail";
......
...@@ -54,7 +54,7 @@ public class BaseUtils { ...@@ -54,7 +54,7 @@ public class BaseUtils {
/** /**
* 小葡萄关注客集集微信公众号 * 小葡萄关注客集集微信公众号
*/ */
public static Object subscribe() throws SQLException { public static void subscribe() throws SQLException {
//关注公众号 //关注公众号
// network.agentHeaders.put("Content-Type","text/plain"); // 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[osi5w5kT-smQ42Fc-ByO4G8C-E1M]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>";
...@@ -75,7 +75,6 @@ public class BaseUtils { ...@@ -75,7 +75,6 @@ public class BaseUtils {
tku = response.jsonPath().getString("data"); tku = response.jsonPath().getString("data");
network.agentCookies.put("tku", tku); network.agentCookies.put("tku", tku);
System.out.println("小葡萄tku:" + tku); System.out.println("小葡萄tku:" + tku);
return userId;
} }
/** /**
...@@ -111,12 +110,18 @@ public class BaseUtils { ...@@ -111,12 +110,18 @@ public class BaseUtils {
* 切换会员 * 切换会员
* choice-1切换为非会员,choice为其他切换为会员 * choice-1切换为非会员,choice为其他切换为会员
*/ */
public static void updateTypeOrDate(long userId,boolean choice){ public static void updateTypeOrDate(long sId,boolean choice){
//找到用户的sellerid Response response;
long sellerId;
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO); if(choice) {
int sellerId = response.jsonPath().getInt("data.sellerId"); //找到用户的sellerid
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString())); response = network.getResponse(USER_INFO);
sellerId = response.jsonPath().getLong("data.sellerId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"), network.message(USER_INFO, "获取用户信息失败", response.body().asString()));
}else {
sellerId = sId;
}
//切换代理人公司 //切换代理人公司
params.clear(); params.clear();
...@@ -126,7 +131,6 @@ public class BaseUtils { ...@@ -126,7 +131,6 @@ public class BaseUtils {
System.out.println(params.toString()); System.out.println(params.toString());
boolean success = response.jsonPath().getBoolean("success"); boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getBoolean("data"); boolean result = response.jsonPath().getBoolean("data");
System.out.println(response.body().asString());
Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString())); Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_changeCompany,"返回数据为空",response.body().asString())); Assert.assertTrue(result,network.message(params,MANAGER_changeCompany,"返回数据为空",response.body().asString()));
......
...@@ -27,6 +27,8 @@ public class NetworkUtils { ...@@ -27,6 +27,8 @@ public class NetworkUtils {
private NetworkUtils(){ private NetworkUtils(){
//cookies中的tku //cookies中的tku
agentCookies.put("tku",AGENT_TKU); agentCookies.put("tku",AGENT_TKU);
//多场景测试标志
agentCookies.put("_duibaServiceGroupKey","miria-2652");
//json类型的headers //json类型的headers
agentHeaders.put("Content-Type","application/json"); agentHeaders.put("Content-Type","application/json");
//二进制文件的headers //二进制文件的headers
......
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