Commit 4937689e authored by 龚小红's avatar 龚小红

访问重构:针对同一文章同一用户不同时间访问,访问次数只记录1次

parent cdbac803
...@@ -75,271 +75,270 @@ public class Cashback implements Authorization { ...@@ -75,271 +75,270 @@ public class Cashback implements Authorization {
// Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString())); // Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
} }
@Test(description = "邀请的待支付好友列表",priority = 3) // @Test(description = "邀请的待支付好友列表",priority = 3)
public void 邀请的待支付好友列表() { // public void 邀请的待支付好友列表() {
agentTku(); // agentTku();
Map<String, Object> Params = new HashMap<String, Object>(); // Map<String, Object> Params = new HashMap<String, Object>();
Params.put("distributionListType",1); // Params.put("distributionListType",1);
Params.put("pageIndex",1); // Params.put("pageIndex",1);
Params.put("pageSize",10); // Params.put("pageSize",10);
Response response = network.getResponse(Params,PAY_distributionList); // Response response = network.getResponse(Params,PAY_distributionList);
Object list=response.jsonPath().getJsonObject("data.list"); // Object list=response.jsonPath().getJsonObject("data.list");
String nickname=response.jsonPath().getString("data.list.get(0).nickname"); // String nickname=response.jsonPath().getString("data.list.get(0).nickname");
Assert.assertNotNull(list,network.message(PAY_distributionList,"待付款好友列表为null",response.body().asString())); // Assert.assertNotNull(list,network.message(PAY_distributionList,"待付款好友列表为null",response.body().asString()));
// Assert.assertEquals(nickname,"小葡萄",network.message(PAY_distributionList,"待付款微信昵称错误",response.body().asString())); // }
} //
// @Test (description = "返现用户付费_一级用户下单并支付成功",priority = 4)
@Test (description = "返现用户付费_一级用户下单并支付成功",priority = 4) // public void 返现用户付费_一级用户下单并支付成功() {
public void 返现用户付费_一级用户下单并支付成功() { // newUser1();
newUser1(); // //创建支付
//创建支付 // Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); // params.put("entryDiscountType",1);
params.put("entryDiscountType",1); // params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码 // params.put("paySource","2");
params.put("paySource","2"); // Response response = network.postResponse(params,PAY_create);
Response response = network.postResponse(params,PAY_create); // tradeNo = response.jsonPath().getString("data.tradeNo");
tradeNo = response.jsonPath().getString("data.tradeNo"); // Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空 //
// params.clear();
params.clear(); // int data = 2;
int data = 2; // int i = 0;
int i = 0; // try {
try { // // 轮训下单接口
// 轮训下单接口 // while (data == 2){
while (data == 2){ // sleep(2000);
sleep(2000); //
// params.put("tradeNo",tradeNo);
params.put("tradeNo",tradeNo); // response = network.getResponse(params,PAY_result);
response = network.getResponse(params,PAY_result); // data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常 // i++;
i++; // if (i == 10){
if (i == 10){ // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString())); // break;
break; // }
} // }
} // }catch (Exception e){
}catch (Exception e){ // e.printStackTrace();
e.printStackTrace(); // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString())); // }
} // Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString()));
Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString())); // // 检查会员开通结果
// 检查会员开通结果 // response = network.getResponse(USER_INFO);
response = network.getResponse(USER_INFO); // boolean isVip = response.jsonPath().getBoolean("data.vipValid");
boolean isVip = response.jsonPath().getBoolean("data.vipValid"); // Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString())); //
// }
} //
//
// @Test (description = "默认付费_续费页",priority = 5) //priority 方法执行优先级
@Test (description = "默认付费_续费页",priority = 5) //priority 方法执行优先级 // public void 默认付费_续费页() {
public void 默认付费_续费页() { // sleep(2000);
sleep(2000); // //代理人续费状态
//代理人续费状态 // Map<String, Object> payParams = new HashMap<String, Object>();
Map<String, Object> payParams = new HashMap<String, Object>(); // payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码 // Response response = network.getResponse(PAY_info);
Response response = network.getResponse(PAY_info); // int discountType = response.jsonPath().getInt("data.discountType");
int discountType = response.jsonPath().getInt("data.discountType"); // int validity = response.jsonPath().getInt("data.validity");
int validity = response.jsonPath().getInt("data.validity"); // int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice"); // Assert.assertEquals(discountType,2,network.message(PAY_info,"非续费逻辑",response.body().asString()));
Assert.assertEquals(discountType,2,network.message(PAY_info,"非续费逻辑",response.body().asString())); // Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",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()));
Assert.assertEquals(preferentialPrice,2,network.message(PAY_info,"续费价格非0.02",response.body().asString())); //
// //会员类型版本判断
//会员类型版本判断 // Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); // params.put("t",System.currentTimeMillis());
params.put("t",System.currentTimeMillis()); // response = network.getResponse(params, version_info);
response = network.getResponse(params, version_info); // int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
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(userVersion,2,network.message(params, version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString())); // }
} //
// @Test (description = "返现用户付费_一级用户续费并支付成功",priority = 6)
@Test (description = "返现用户付费_一级用户续费并支付成功",priority = 6) // public void 返现用户付费_一级用户续费并支付成功() {
public void 返现用户付费_一级用户续费并支付成功() { // //创建支付
//创建支付 // Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); // params.put("entryDiscountType",1);
params.put("entryDiscountType",1); // params.put("discountType",2); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("discountType",2); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码 // params.put("paySource","2");
params.put("paySource","2"); // Response response = network.postResponse(params,PAY_create);
Response response = network.postResponse(params,PAY_create); // tradeNo = response.jsonPath().getString("data.tradeNo");
tradeNo = response.jsonPath().getString("data.tradeNo"); // Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空 //
// params.clear();
params.clear(); // int data = 2;
int data = 2; // int i = 0;
int i = 0; // try {
try { // // 轮训下单接口
// 轮训下单接口 // while (data == 2){
while (data == 2){ // sleep(2000);
sleep(2000); //
// params.put("tradeNo",tradeNo);
params.put("tradeNo",tradeNo); // response = network.getResponse(params,PAY_result);
response = network.getResponse(params,PAY_result); // data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常 // i++;
i++; // if (i == 10){
if (i == 10){ // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString())); // break;
break; // }
} // }
} // }catch (Exception e){
}catch (Exception e){ // e.printStackTrace();
e.printStackTrace(); // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString())); // }
} // Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString()));
Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString())); // }
} //
// @Test(description = "二级用户绑定分享合伙人关系",priority = 7)
@Test(description = "二级用户绑定分享合伙人关系",priority = 7) // public void 二级用户绑定分享合伙人关系() {
public void 二级用户绑定分享合伙人关系() { // newUser2();
newUser2(); // Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); // params.put("sellerId",sellerId2);
params.put("sellerId",sellerId2); // params.put("inviterSid",sellerId);
params.put("inviterSid",sellerId); // params.put("openId",openId2);
params.put("openId",openId2); // params.put("userId",userId2);
params.put("userId",userId2); // params.put("oaId",1);
params.put("oaId",1); // params.put("scene",1);
params.put("scene",1); // Response response = network.postResponse(params,PAY_bind);
Response response = network.postResponse(params,PAY_bind); // boolean bindResult=response.jsonPath().getBoolean("data.bindResult");
boolean bindResult=response.jsonPath().getBoolean("data.bindResult"); // Assert.assertTrue(bindResult,network.message(PAY_bind,"用户绑定失败",response.body().asString()));
Assert.assertTrue(bindResult,network.message(PAY_bind,"用户绑定失败",response.body().asString())); // }
} //
// @Test (description = "默认付费_二级用户邀请付费页",priority = 8) //priority 方法执行优先级
@Test (description = "默认付费_二级用户邀请付费页",priority = 8) //priority 方法执行优先级 // public void 默认付费_二级用户邀请付费页() {
public void 默认付费_二级用户邀请付费页() { // Map<String, Object> payParams = new HashMap<String, Object>();
Map<String, Object> payParams = new HashMap<String, Object>(); // payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码 // Response response = network.getResponse(PAY_info);
Response response = network.getResponse(PAY_info); // int discountType = response.jsonPath().getInt("data.discountType");
int discountType = response.jsonPath().getInt("data.discountType"); // String superiorName = response.jsonPath().getString("data.invitation.superiorName");
String superiorName = response.jsonPath().getString("data.invitation.superiorName"); // int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice"); // Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString())); //// Assert.assertEquals(superiorName,"小葡萄",network.message(PAY_info,"上级邀请人错误",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()));
Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString())); // }
} //
// @Test (description = "返现用户付费_二级用户下单并支付成功",priority = 9)
@Test (description = "返现用户付费_二级用户下单并支付成功",priority = 9) // public void 返现用户付费_二级用户下单并支付成功() {
public void 返现用户付费_二级用户下单并支付成功() { // //创建支付
//创建支付 // Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); // params.put("entryDiscountType",1);
params.put("entryDiscountType",1); // params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
params.put("discountType",3); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码 // params.put("paySource","2");
params.put("paySource","2"); // Response response = network.postResponse(params,PAY_create);
Response response = network.postResponse(params,PAY_create); // tradeNo = response.jsonPath().getString("data.tradeNo");
tradeNo = response.jsonPath().getString("data.tradeNo"); // Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
Assert.assertNotNull(tradeNo,network.message(params, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空 //
// params.clear();
params.clear(); // int data = 2;
int data = 2; // int i = 0;
int i = 0; // try {
try { // // 轮训下单接口
// 轮训下单接口 // while (data == 2){
while (data == 2){ // sleep(2000);
sleep(2000); //
// params.put("tradeNo",tradeNo);
params.put("tradeNo",tradeNo); // response = network.getResponse(params,PAY_result);
response = network.getResponse(params,PAY_result); // data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常 // i++;
i++; // if (i == 10){
if (i == 10){ // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训支付结果超过10次", response.body().asString())); // break;
break; // }
} // }
} // }catch (Exception e){
}catch (Exception e){ // e.printStackTrace();
e.printStackTrace(); // Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString()));
Assert.fail(network.message(params, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", response.body().asString())); // }
} // Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString()));
Assert.assertEquals(data,3,network.message(USER_INFO,"支付失败",response.body().asString())); // // 检查会员开通结果
// 检查会员开通结果 // response = network.getResponse(USER_INFO);
response = network.getResponse(USER_INFO); // boolean isVip = response.jsonPath().getBoolean("data.vipValid");
boolean isVip = response.jsonPath().getBoolean("data.vipValid"); // Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString())); //
// }
} //
// @Test(description = "获取用户版本信息",priority = 10)
@Test(description = "获取用户版本信息",priority = 10) // public void 获取用户版本信息() {
public void 获取用户版本信息() { // agentTku();
agentTku(); // Response response = network.getResponse(USER_INFO);
Response response = network.getResponse(USER_INFO); // boolean isInsuranceVersion=response.jsonPath().getBoolean("data.isInsuranceVersion");
boolean isInsuranceVersion=response.jsonPath().getBoolean("data.isInsuranceVersion"); // Assert.assertTrue(isInsuranceVersion,network.message(USER_INFO,"不是保险版本",response.body().asString()));
Assert.assertTrue(isInsuranceVersion,network.message(USER_INFO,"不是保险版本",response.body().asString())); //
// }
} //
// @Test(description = "邀请的已支付好友列表",priority = 11)
@Test(description = "邀请的已支付好友列表",priority = 11) // public void 邀请的已支付好友列表() {
public void 邀请的已支付好友列表() { // sleep(2000);
sleep(2000); // Map<String, Object> Params = new HashMap<String, Object>();
Map<String, Object> Params = new HashMap<String, Object>(); // Params.put("pageIndex",1);
Params.put("pageIndex",1); // Params.put("pageSize",10);
Params.put("pageSize",10); // Params.put("distributionListType",2);
Params.put("distributionListType",2); // Response response = network.getResponse(Params,PAY_distributionList);
Response response = network.getResponse(Params,PAY_distributionList); // Object list=response.jsonPath().getJsonObject("data.list");
Object list=response.jsonPath().getJsonObject("data.list"); // String nickname=response.jsonPath().getString("data.list.get(0).nickname");
String nickname=response.jsonPath().getString("data.list.get(0).nickname"); // Assert.assertNotNull(list,network.message(PAY_distributionList,"已付款好友列表为null",response.body().asString()));
Assert.assertNotNull(list,network.message(PAY_distributionList,"已付款好友列表为null",response.body().asString())); //// Assert.assertEquals(nickname,"小葡萄",network.message(PAY_distributionList,"已付款微信昵称错误",response.body().asString()));
// Assert.assertEquals(nickname,"小葡萄",network.message(PAY_distributionList,"已付款微信昵称错误",response.body().asString())); // }
} //
// @Test(description = "代理人账户信息",priority = 12)
@Test(description = "代理人账户信息",priority = 12) // public void 代理人账户信息() {
public void 代理人账户信息() { // Response response = network.getResponse(PAY_accInfo);
Response response = network.getResponse(PAY_accInfo); // double balance=Double.parseDouble(response.jsonPath().getString("data.balance"));
double balance=Double.parseDouble(response.jsonPath().getString("data.balance")); // Assert.assertTrue(balance>0,network.message(PAY_accInfo,"当前余额为0",response.body().asString()));
Assert.assertTrue(balance>0,network.message(PAY_accInfo,"当前余额为0",response.body().asString())); // double totalPromotionEarnings=Double.parseDouble(response.jsonPath().getString("data.totalPromotionEarnings"));
double totalPromotionEarnings=Double.parseDouble(response.jsonPath().getString("data.totalPromotionEarnings")); // Assert.assertTrue(totalPromotionEarnings>0,network.message(PAY_accInfo,"总收益为0",response.body().asString()));
Assert.assertTrue(totalPromotionEarnings>0,network.message(PAY_accInfo,"总收益为0",response.body().asString())); // double settleMoney=Double.parseDouble(response.jsonPath().getString("data.settleMoney"));
double settleMoney=Double.parseDouble(response.jsonPath().getString("data.settleMoney")); // Assert.assertTrue(settleMoney>0,network.message(PAY_accInfo,"待结算金额为0",response.body().asString()));
Assert.assertTrue(settleMoney>0,network.message(PAY_accInfo,"待结算金额为0",response.body().asString())); // int canWithdraw=response.jsonPath().getInt("data.canWithdraw");
int canWithdraw=response.jsonPath().getInt("data.canWithdraw"); // Assert.assertTrue(canWithdraw==1,network.message(PAY_accInfo,"不可以提现",response.body().asString()));
Assert.assertTrue(canWithdraw==1,network.message(PAY_accInfo,"不可以提现",response.body().asString())); // int minWithdrawMoney=response.jsonPath().getInt("data.minWithdrawMoney");
int minWithdrawMoney=response.jsonPath().getInt("data.minWithdrawMoney"); // Assert.assertTrue(minWithdrawMoney==1,network.message(PAY_accInfo,"最小可提现金额不等于1",response.body().asString()));
Assert.assertTrue(minWithdrawMoney==1,network.message(PAY_accInfo,"最小可提现金额不等于1",response.body().asString())); // int maxWithdrawMoney=response.jsonPath().getInt("data.maxWithdrawMoney");
int maxWithdrawMoney=response.jsonPath().getInt("data.maxWithdrawMoney"); // Assert.assertTrue(maxWithdrawMoney==5000,network.message(PAY_accInfo,"最大可提现金额不等于5000",response.body().asString()));
Assert.assertTrue(maxWithdrawMoney==5000,network.message(PAY_accInfo,"最大可提现金额不等于5000",response.body().asString())); // }
} //
// @Test(description = "合伙人账户明细",priority = 13)
@Test(description = "合伙人账户明细",priority = 13) // public void 合伙人账户明细() {
public void 合伙人账户明细() { // Map<String, Object> Params = new HashMap<>();
Map<String, Object> Params = new HashMap<>(); // Params.put("type", 1);
Params.put("type", 1); // Params.put("pageNo", 1);
Params.put("pageNo", 1); // Params.put("pageSize", 20);
Params.put("pageSize", 20); // Response response = network.getResponse(Params, PAY_accDetail);
Response response = network.getResponse(Params, PAY_accDetail); // int size = response.jsonPath().getInt("data.size()");
int size = response.jsonPath().getInt("data.size()"); // Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString())); //
// Params.put("type", 2);
Params.put("type", 2); // response = network.getResponse(Params, PAY_accDetail);
response = network.getResponse(Params, PAY_accDetail); // size = response.jsonPath().getInt("data.size()");
size = response.jsonPath().getInt("data.size()"); // Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString())); // float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney");
float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney"); // Assert.assertTrue(changeMoney1 ==30.0, network.message(PAY_accDetail, "二级付费合伙人返现金额不为30", response.body().asString()));
Assert.assertTrue(changeMoney1 ==30.0, network.message(PAY_accDetail, "二级付费合伙人返现金额不为30", response.body().asString())); // float changeMoney2 = response.jsonPath().getFloat("data[1].changeMoney");
float changeMoney2 = response.jsonPath().getFloat("data[1].changeMoney"); // Assert.assertTrue(changeMoney2 ==50.0, network.message(PAY_accDetail, "一级付费合伙人返现金额不为50", response.body().asString()));
Assert.assertTrue(changeMoney2 ==50.0, network.message(PAY_accDetail, "一级付费合伙人返现金额不为50", response.body().asString())); // }
} //
// @Test(description = "代理人提现",priority = 14)
@Test(description = "代理人提现",priority = 14) // public void 代理人提现() {
public void 代理人提现() { // Map<String, Object> Params = new HashMap<>();
Map<String, Object> Params = new HashMap<>(); // Params.put("withdrawMoney", 1);
Params.put("withdrawMoney", 1); // Response response = network.getResponse(Params, PAY_withdraw);
Response response = network.getResponse(Params, PAY_withdraw); // 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())); // }
} //
// @Test(description = "普通代理人账户明细",priority = 15)
@Test(description = "普通代理人账户明细",priority = 15) // public void 普通代理人账户明细() {
public void 普通代理人账户明细() { // newUser1();
newUser1(); // Map<String, Object> Params = new HashMap<>();
Map<String, Object> Params = new HashMap<>(); // Params.put("type", 2);
Params.put("type", 2); // Params.put("pageNo", 1);
Params.put("pageNo", 1); // Params.put("pageSize", 20);
Params.put("pageSize", 20); // Response response = network.getResponse(Params, PAY_accDetail);
Response response = network.getResponse(Params, PAY_accDetail); // int size = response.jsonPath().getInt("data.size()");
int size = response.jsonPath().getInt("data.size()"); // Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString()));
Assert.assertTrue(size >0, network.message(PAY_accDetail, "提现记录为null", response.body().asString())); // float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney");
float changeMoney1 = response.jsonPath().getFloat("data[0].changeMoney"); // Assert.assertTrue(changeMoney1 ==35.0, network.message(PAY_accDetail, "一级付费普通代理人返现金额不为35", response.body().asString()));
Assert.assertTrue(changeMoney1 ==35.0, network.message(PAY_accDetail, "一级付费普通代理人返现金额不为35", response.body().asString())); //
// deleteTestUser(userId);
deleteTestUser(userId); // deleteTestUser(userId2);
deleteTestUser(userId2); // }
}
} }
...@@ -23,9 +23,7 @@ public class MyCustomer implements Authorization { ...@@ -23,9 +23,7 @@ public class MyCustomer implements Authorization {
private Map<String, Object> param; private Map<String, Object> param;
private String createTagId; private String createTagId;
private long visitor1UserId; private long visitor1UserId;
private String sessionId;
private String id; // 自定义提醒事项id private String id; // 自定义提醒事项id
private long lastMessageId;
private long newUserId; private long newUserId;
@BeforeClass @BeforeClass
...@@ -185,13 +183,9 @@ public class MyCustomer implements Authorization { ...@@ -185,13 +183,9 @@ public class MyCustomer implements Authorization {
response = network.getResponse(param, BasicConfig.CUSTINFO); response = network.getResponse(param, BasicConfig.CUSTINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFO, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFO, "接口请求失败", response.body().asString()));
Long sellerId = response.jsonPath().getLong("data.sellerId"); Long sellerId = response.jsonPath().getLong("data.sellerId");
sessionId = response.jsonPath().getString("data.sessionId");
Assert.assertEquals(sellerId, ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CUSTINFO, "访客所属销售员sellerId不符", response.body().asString())); Assert.assertEquals(sellerId, ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CUSTINFO, "访客所属销售员sellerId不符", response.body().asString()));
Assert.assertNotNull(sessionId, network.message(param, BasicConfig.CUSTINFO, "访客sessionId为空", response.body().asString()));
} }
// 客户详情页_设置备注 // 客户详情页_设置备注
@Test(description = "客户详情页_设置备注", priority = 18) @Test(description = "客户详情页_设置备注", priority = 18)
public void 客户详情页_设置备注() throws IOException{ public void 客户详情页_设置备注() throws IOException{
...@@ -222,9 +216,9 @@ public class MyCustomer implements Authorization { ...@@ -222,9 +216,9 @@ public class MyCustomer implements Authorization {
int visitCount = response.jsonPath().getInt("data.visitCount"); int visitCount = response.jsonPath().getInt("data.visitCount");
int grassNum = response.jsonPath().getInt("data.grassNum"); int grassNum = response.jsonPath().getInt("data.grassNum");
int datagramNum = response.jsonPath().getInt("data.datagramNum"); int datagramNum = response.jsonPath().getInt("data.datagramNum");
Assert.assertEquals(grassNum, ForwardAndRead.custClueStatistics.get("grassNum") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数未正确增加", response.body().asString())); Assert.assertEquals(grassNum, ForwardAndRead.custClueStatistics.get("grassNum") +0, network.message(param, BasicConfig.CLUESTATISTICS, "访客阅读种草文章记录次数增加", response.body().asString()));
Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount") + 2, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString())); Assert.assertEquals(visitCount, ForwardAndRead.custClueStatistics.get("visitCount")+0, network.message(param, BasicConfig.CLUESTATISTICS, "访客来访记录次数未正确增加", response.body().asString()));
Assert.assertEquals(datagramNum, ForwardAndRead.custClueStatistics.get("datagramNum") + 1, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString())); Assert.assertEquals(datagramNum, ForwardAndRead.custClueStatistics.get("datagramNum") +0, network.message(param, BasicConfig.CLUESTATISTICS, "访客领取资料次数未正确增加", response.body().asString()));
} }
// //客户详情页_阅读偏好------访问重构未更新 // //客户详情页_阅读偏好------访问重构未更新
......
...@@ -15,6 +15,7 @@ import java.util.List; ...@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.tku1;
public class MyForward implements Authorization { public class MyForward implements Authorization {
private Response response; private Response response;
...@@ -189,7 +190,7 @@ public class MyForward implements Authorization { ...@@ -189,7 +190,7 @@ public class MyForward implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD_VISITRECORD, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD_VISITRECORD, "接口请求失败", response.body().asString()));
String visitorUserIdEncode = response.jsonPath().getString("data.list[0].userId"); String visitorUserIdEncode = response.jsonPath().getString("data.list[0].userId");
// 获取访客加密的userId // 获取访客加密的userId
visitorEncodeUserId = ForwardAndRead.encodeId(ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId")); visitorEncodeUserId = ForwardAndRead.encodeId(ForwardAndRead.decodeTku(tku1).get("userId"));
Assert.assertEquals(visitorUserIdEncode, visitorEncodeUserId, network.message(param, BasicConfig.FORWARD_VISITRECORD, "转发素材访客记录中首条记录用户userId不正确", response.body().asString())); Assert.assertEquals(visitorUserIdEncode, visitorEncodeUserId, network.message(param, BasicConfig.FORWARD_VISITRECORD, "转发素材访客记录中首条记录用户userId不正确", response.body().asString()));
} }
...@@ -206,6 +207,7 @@ public class MyForward implements Authorization { ...@@ -206,6 +207,7 @@ public class MyForward implements Authorization {
List<Object> custLists = response.jsonPath().getList("data.list"); List<Object> custLists = response.jsonPath().getList("data.list");
for(int i = 0; i < custLists.size(); i++){ for(int i = 0; i < custLists.size(); i++){
boolean areClued = response.jsonPath().getBoolean("data.list["+i+"].clued"); boolean areClued = response.jsonPath().getBoolean("data.list["+i+"].clued");
Assert.assertTrue(areClued, network.message(param, BasicConfig.FORWARD_VISITRECORD, "筛选结果中第"+i+"条记录为未留下线索的访客", response.body().asString())); Assert.assertTrue(areClued, network.message(param, BasicConfig.FORWARD_VISITRECORD, "筛选结果中第"+i+"条记录为未留下线索的访客", response.body().asString()));
} }
} }
...@@ -238,15 +240,4 @@ public class MyForward implements Authorization { ...@@ -238,15 +240,4 @@ public class MyForward implements Authorization {
String encodeUserId = response.jsonPath().getString("data.list[0].userId"); String encodeUserId = response.jsonPath().getString("data.list[0].userId");
Assert.assertEquals(encodeUserId, visitorEncodeUserId, network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString())); Assert.assertEquals(encodeUserId, visitorEncodeUserId, network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString()));
} }
// 获取素材转发关系链----访问重构
@Test(description = "文章详情_访客记录_转发关系", priority = 14)
public void 文章详情_访客记录_转发关系() throws IOException{
param = new HashMap<>();
param.put("scid", ForwardAndRead.getContentScId(BasicConfig.ARTICLE_CONTENTID));
param.put("pageIndex", 1);
param.put("pageSize", 20);
response = network.getResponse(param, BasicConfig.INVITATIONCHAIN);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.INVITATIONCHAIN, "接口请求失败", response.body().asString()));
}
} }
\ No newline at end of file
...@@ -147,8 +147,8 @@ public class WhoSawMe implements Authorization { ...@@ -147,8 +147,8 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(success, network.message(BasicConfig.VISITHEADER, "接口请求失败", response.body().asString())); Assert.assertTrue(success, network.message(BasicConfig.VISITHEADER, "接口请求失败", response.body().asString()));
int todayClueNum = response.jsonPath().getInt("data.todayClueNum"); int todayClueNum = response.jsonPath().getInt("data.todayClueNum");
int todayVisitNum = response.jsonPath().getInt("data.todayVisitNum"); int todayVisitNum = response.jsonPath().getInt("data.todayVisitNum");
Assert.assertTrue(todayClueNum >= 0, network.message(BasicConfig.VISITHEADER, "获取今日线索数有误", response.body().asString())); Assert.assertTrue(todayClueNum == 1, network.message(BasicConfig.VISITHEADER, "获取今日线索数有误", response.body().asString()));
Assert.assertTrue(todayVisitNum >= 2, network.message(BasicConfig.VISITHEADER, "获取今日访问数有误", response.body().asString())); Assert.assertTrue(todayVisitNum == 1, network.message(BasicConfig.VISITHEADER, "获取今日访问数有误", response.body().asString()));
} }
// 查看谁看过我首页我的访客列表 // 查看谁看过我首页我的访客列表
...@@ -160,9 +160,7 @@ public class WhoSawMe implements Authorization { ...@@ -160,9 +160,7 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.WHOSAWME_visitList); response = network.getResponse(param, BasicConfig.WHOSAWME_visitList);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_visitList, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_visitList, "接口请求失败", response.body().asString()));
String visitId = response.jsonPath().getString("data.list[0].customerInfo.customerUserId"); String visitId = response.jsonPath().getString("data.list[0].customerInfo.customerUserId");
Assert.assertEquals(visitId, IdMakeUtil.encodingId(xxrUserId), network.message(param, BasicConfig.WHOSAWME_visitList, "最近访客微信用户ID不匹配", response.body().asString())); Assert.assertEquals(visitId, IdMakeUtil.encodingId(userId), network.message(param, BasicConfig.WHOSAWME_visitList, "最近访客微信用户ID不匹配", response.body().asString()));
clueId = response.jsonPath().getString("data.list[1].clueInfoList[1].clueId");
} }
// 将新用户标记为老用户(小葡萄) // 将新用户标记为老用户(小葡萄)
...@@ -837,32 +835,6 @@ public class WhoSawMe implements Authorization { ...@@ -837,32 +835,6 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.COMPLETEGUIDE, "完成该引导失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.COMPLETEGUIDE, "完成该引导失败", response.body().asString()));
} }
// 销售线索_线索详情
@Test(description = "销售线索_线索详情", priority = 54)
public void 销售线索_线索详情() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
response = network.getResponse(param, BasicConfig.CLUEINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUEINFO, "接口请求失败", response.body().asString()));
int clueBizType = response.jsonPath().getInt("data.clueBizType");
String customerUserId = response.jsonPath().getString("data.customerUserId");
String contentScid = response.jsonPath().getString("data.sourceContent.scid");
Assert.assertEquals(clueBizType, 3, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(customerUserId, IdMakeUtil.encodingId(xxrUserId), network.message(param, BasicConfig.CLUEINFO, "线索来源访客userId错误", response.body().asString()));
Assert.assertEquals(contentScid, ForwardAndRead.getContentScId(BasicConfig.ARTICLE_CONTENTID), network.message(param, BasicConfig.CLUEINFO, "线索来源素材id错误", response.body().asString()));
}
// 销售线索_跟进建议
@Test(description = "销售线索_跟进建议", priority = 55)
public void 销售线索_跟进建议() throws IOException{
param = new HashMap<>();
param.put("clueId", clueId);
response = network.getResponse(param, BasicConfig.CLUEADVISE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CLUEADVISE, "接口请求失败", response.body().asString()));
List<Object> adviseList = response.jsonPath().getJsonObject("data.adviceList");
Assert.assertNotNull(adviseList, network.message(param, BasicConfig.CLUEADVISE, "跟进建议内容为空", response.body().asString()));
}
// 管理客户信息 // 管理客户信息
@Test(description = "管理客户信息", priority = 56) @Test(description = "管理客户信息", priority = 56)
public void 管理客户信息() throws IOException{ public void 管理客户信息() throws IOException{
......
...@@ -385,4 +385,41 @@ public class BaseUtils { ...@@ -385,4 +385,41 @@ public class BaseUtils {
//put company Id //put company Id
network.agentCookies.put("companyId","Kj20MjE1"); network.agentCookies.put("companyId","Kj20MjE1");
} }
/**
* 销售员登录销售工作台
*/
public static void otoSellerLogin(){
ThreadSleepUtils.sleep(2000);
// 调用登录接口
Map<String, Object> params = new HashMap<String, Object>();
params.put("phone","15136361308");
Response response = network.getResponse(params,BasicConfig.WORK_getCaptcha);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,BasicConfig.WORK_getCaptcha,"获取验证码失败",response.body().asString()));
//专用于自动化获取验证码
params.clear();
params.put("phone","15136361308");
Response autoTestRes = network.getResponse(params,BasicConfig.CORP_getCaptchaForAutoTest);
String captcha = autoTestRes.jsonPath().getString("data");
System.out.println(captcha);
//登录接口
ThreadSleepUtils.sleep(2000);
params.clear();
params.put("phone","15136361308");
params.put("captcha",captcha);
Response loginRes = network.postResponse(params,BasicConfig.WORK_login);
boolean success = loginRes.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params,BasicConfig.WORK_login,"登录失败",loginRes.body().asString()));
//获取cookie
String header = loginRes.getHeader("Set-Cookie");
String cookieStr = header.split(";")[0];
String[] cookieKeyValue = cookieStr.split("=");
officeCookieKey = cookieKeyValue[0];
officeCookieValue = cookieKeyValue[1];
network.agentCookies.put(officeCookieKey,officeCookieValue); //存入cookies
}
} }
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