Commit 6683a357 authored by 龚小红's avatar 龚小红

Merge remote-tracking branch 'origin/master' into 2021073001_gxh

# Conflicts:
#	src/test/java/com/kjj/config/BasicConfig.java
#	src/test/wechatTestNG.xml
parents 343521e0 16e37d73
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ArticlePage {
private String contentType;
private String contentId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ChatList {
private int chatContentType;
private String content;
private long id;
private boolean mine;
private int readFlag;
private Long receiverId;
private Long senderId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class CustFavorite {
private String contentId;
private String userActionTypeEnum;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class LinkList {
private Map<String, Object> session;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class RankingList {
private String sellerId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class RemindInfo {
private String id;
private String remindContent;
private int remindStatus;
private Long remindTime;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
import java.util.List;
@Data
public class VisitRecords {
private List<recordsList> records;
@Data
public static class recordsList{
private String clueId;
private int clueType;
private String contentId;
private String contentType;
private String scid;
}
}
...@@ -20,25 +20,30 @@ public interface Authorization { ...@@ -20,25 +20,30 @@ public interface Authorization {
System.out.println("用户AUTH_KEY:"+ADMIN_KEY); System.out.println("用户AUTH_KEY:"+ADMIN_KEY);
} }
/** /**
* 集客助手相关授权 * 集客助手相关授权
*/ */
//代理人 //代理人吉吉 sid:2991
default void agentTku() { default void agentTku() {
network.agentCookies.put("tku", AGENT_TKU); network.agentCookies.put("tku", AGENT_TKU);
System.out.println("代理人tku:" + AGENT_TKU); System.out.println("代理人tku:" + AGENT_TKU);
} }
// 获取访客tku:Su Yi //代理人
default void visitor2Tku() {
network.agentCookies.put("tku", VISITOR2_TKU);
System.out.println("代理人tku:" + VISITOR2_TKU);
}
// 获取访客tku:Su Yi
default void userTku() { default void userTku() {
network.agentCookies.put("tku", VISITOR_UserTku); network.agentCookies.put("tku", VISITOR_UserTku);
System.out.println("访客tku:" + VISITOR_UserTku); System.out.println("访客tku:" + VISITOR_UserTku);
} }
// 获取访客tku:请勿打扰 // 获取访客tku:请勿打扰
default void userTku1() { default void userTku1() {
network.agentCookies.put("tku", VISITOR_TKU); network.agentCookies.put("tku", VISITOR_TKU);
...@@ -52,14 +57,6 @@ public interface Authorization { ...@@ -52,14 +57,6 @@ public interface Authorization {
} }
// // 获取访客tku
// default void userTkuw() {
// AGENT_TKU = BaseUtils.createTku();
// VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
// network.agentCookies.put("tku", VISITOR_TKU);
// System.out.println("访客tku:" + VISITOR_TKU);
// }
/** /**
* 直播业务相关 * 直播业务相关
...@@ -158,7 +155,7 @@ public interface Authorization { ...@@ -158,7 +155,7 @@ public interface Authorization {
System.out.println("用户AUTH_KEY:" + visitorAuth13); System.out.println("用户AUTH_KEY:" + visitorAuth13);
} }
//访客N(光头强)非实名用户授权,ID:540 //访客N(光头强)非实名用户授权,ID:1495
default void visitorAuth14() { default void visitorAuth14() {
network.agentCookies.put("authKey", visitorAuth14); network.agentCookies.put("authKey", visitorAuth14);
System.out.println("用户AUTH_KEY:" + visitorAuth14); System.out.println("用户AUTH_KEY:" + visitorAuth14);
......
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
......
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
...@@ -12,7 +12,7 @@ import java.io.IOException; ...@@ -12,7 +12,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class homePage implements Authorization { public class HomePage implements Authorization {
public int firstTagId; //获取种草素材标签ID public int firstTagId; //获取种草素材标签ID
public String contentId; //获取素材文章id public String contentId; //获取素材文章id
public String tagId; //获取发圈素材标签ID public String tagId; //获取发圈素材标签ID
...@@ -20,11 +20,14 @@ public class homePage implements Authorization { ...@@ -20,11 +20,14 @@ public class homePage implements Authorization {
public int hotTagId; //获取热榜标签ID public int hotTagId; //获取热榜标签ID
public int posterTagId; //获取海报标签ID public int posterTagId; //获取海报标签ID
public String posterContentId; //获取海报的的contentId public String posterContentId; //获取海报的的contentId
public int caseId; //获取成功案例id
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
agentTku(); agentTku();
userTku(); userTku();
//管理后台登录
BaseUtils.ssoLogin();
} }
//获取种草素材列表页 //获取种草素材列表页
...@@ -217,4 +220,102 @@ public class homePage implements Authorization { ...@@ -217,4 +220,102 @@ public class homePage implements Authorization {
Object obj = response.jsonPath().getJsonObject("data.list"); Object obj = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString())); Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString()));
} }
//获取首页公司专区
@Test(description = "首页_公司专区列表",priority = 15)
public void 首页_公司专区列表(){
Response response = network.getResponse(HOME_getExclusiveArea);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(HOME_getExclusiveArea,"获取公司专区列表失败",response.body().asString()));
}
//管理后台新增成功案例
@Test(description = "管理后台_新增成功案例",priority = 15)
public void 新增成功案例(){
//根据内容ID匹配内容标题
Map<String,Object> params = new HashMap<>();
params.put("itemId",9398);
Response response = network.getResponse(params,MANAGER_getPushContent);
String desc = response.jsonPath().getString("desc");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertEquals(desc,"OK", network.message(params,MANAGER_getPushContent,"内容ID匹配内容标题失败",response.body().asString()));
Assert.assertTrue(success, network.message(params,MANAGER_getPushContent,"内容ID匹配内容标题请求失败",response.body().asString()));
//新增成功案例
Map<String,Object> addParams = new HashMap<>();
addParams.put("beltImg","//yun.dui88.com/kjy/image/20210727/1627369041241.jpeg");
addParams.put("blockImg","//yun.dui88.com/kjy/image/20210727/1627369049937.jpeg");
addParams.put("contentId",9398);
addParams.put("layerImg","//yun.dui88.com/kjy/image/20210727/1627369034207.jpg");
addParams.put("thumbnailImg","//yun.dui88.com/kjy/image/20210727/1627369057234.jpeg");
long timeOpening = System.currentTimeMillis();
addParams.put("timeOpening",timeOpening);
Response addRes = network.postResponse(addParams,MANAGER_addOrUpdateCases);
String addDesc = addRes.jsonPath().getString("desc");
boolean addSuccess = addRes.jsonPath().getBoolean("success");
Assert.assertEquals(addDesc,"OK", network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
Assert.assertTrue(addSuccess, network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_获取成功案例列表",priority = 16)
public void 获取成功案例列表(){
Response response = network.getResponse(MANAGER_caseList);
Object list = response.jsonPath().getJsonObject("data.list");
caseId = response.jsonPath().getInt("data.list.get(0).id");
Assert.assertNotNull(list,network.message(MANAGER_caseList,"获取成功案例列表失败",response.body().asString()));
}
@Test(description = "管理后台_获取案例详情",priority = 17)
public void 获取案例详情(){
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
Response response = network.getResponse(params,MANAGER_successCaseDetail);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,MANAGER_successCaseDetail,"获取案例详情失败",response.body().asString()));
}
@Test(description = "管理后台_编辑案例",priority = 18)
public void 编辑案例(){
//编辑成功案例
Map<String,Object> params = new HashMap<>();
params.put("beltImg","//yun.dui88.com/kjy/image/20210727/1627369041241.jpeg");
params.put("blockImg","//yun.dui88.com/kjy/image/20210727/1627369049937.jpeg");
params.put("contentId",9398);
params.put("id",caseId);
params.put("layerImg","//yun.dui88.com/kjy/image/20210727/1627369034207.jpg");
params.put("thumbnailImg","//yun.dui88.com/kjy/image/20210727/1627369057234.jpeg");
long timeOpening = System.currentTimeMillis();
params.put("timeOpening",timeOpening);
Response addRes = network.postResponse(params,MANAGER_addOrUpdateCases);
String addDesc = addRes.jsonPath().getString("desc");
boolean addSuccess = addRes.jsonPath().getBoolean("success");
Assert.assertEquals(addDesc,"OK", network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
Assert.assertTrue(addSuccess, network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_上架/下架成功案例",priority = 19)
public void 上架成功案例(){
//上架成功案例 status = 2
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
params.put("status",2);
Response response = network.postResponse(params,MANAGER_updateStatus);
boolean data = response.jsonPath().getBoolean("data");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(data,network.message(params,MANAGER_updateStatus,"上架成功案例失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,MANAGER_updateStatus,"上架成功案例失败",response.body().asString()));
//下架成功案例 status = 1
Map<String,Object> updateParams = new HashMap<>();
updateParams.put("id",caseId);
updateParams.put("status",1);
Response updateRes = network.postResponse(params,MANAGER_updateStatus);
boolean updateData = updateRes.jsonPath().getBoolean("data");
boolean updateSuccess = updateRes.jsonPath().getBoolean("success");
Assert.assertTrue(updateData,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString()));
Assert.assertTrue(updateSuccess,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString()));
}
} }
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
......
...@@ -298,7 +298,7 @@ public class GameLottery implements Authorization { ...@@ -298,7 +298,7 @@ public class GameLottery implements Authorization {
@Test(description="访客_打开抽奖链接",priority = 13) @Test(description="访客_打开抽奖链接",priority = 13)
public void 访客_打开抽奖链接(){ public void 访客_打开抽奖链接(){
//切换为访客-请勿打扰 //切换为访客-请勿打扰
userTku1(); // userTku1();
//添加访问记录 //添加访问记录
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
...@@ -550,7 +550,7 @@ public class GameLottery implements Authorization { ...@@ -550,7 +550,7 @@ public class GameLottery implements Authorization {
@Test(description="访客_第二个客户未中奖",priority = 21) @Test(description="访客_第二个客户未中奖",priority = 21)
public void 访客_第二个客户未中奖(){ public void 访客_第二个客户未中奖(){
//切换为请勿打扰 //切换为请勿打扰
userTku1(); // userTku1();
//添加访问记录 //添加访问记录
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
...@@ -659,7 +659,7 @@ public class GameLottery implements Authorization { ...@@ -659,7 +659,7 @@ public class GameLottery implements Authorization {
Assert.assertNotNull(data,network.message(params, LOTTERRY_getDrawRecord,"返回数据为空",response.body().asString())); Assert.assertNotNull(data,network.message(params, LOTTERRY_getDrawRecord,"返回数据为空",response.body().asString()));
int size = response.jsonPath().getInt("data.list.size()"); int size = response.jsonPath().getInt("data.list.size()");
Assert.assertTrue(size==2,network.message(params, LOTTERRY_getDrawRecord,"中奖奖品名称错误",response.body().asString())); Assert.assertTrue(size==1,network.message(params, LOTTERRY_getDrawRecord,"中奖奖品名称错误",response.body().asString()));
} }
@Test(description="代理人_获取概率中奖抽奖活动的中奖人列表(未领奖)",priority = 26) @Test(description="代理人_获取概率中奖抽奖活动的中奖人列表(未领奖)",priority = 26)
......
package com.kjj.cases.assistant.pay;
import com.kjj.cases.admin.Authorization;
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.config.BasicConfig.PAY_CALLOUT;
public class Cashback implements Authorization {
@BeforeClass
public void setUp() {
userTku();
}
public String comboId;
@Test(description = "用户绑定分享关系",priority = 1)
public void 用户绑定分享关系() {
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("fromStr",1);
Params.put("inviterSid",2991);
Params.put("accessSource",22);
Response response = network.getResponse(Params,PAY_distribute);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",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)
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,"365",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion", 2); // 1 通用版 2 保险版
payParams.put("comboId", comboId);
payParams.put("oaId", "1");
payParams.put("paySource", "2");
Response response = network.postResponse(payParams, PAY_create);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调失败
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo", tradeNo);
callbackParams.put("payResult", true);
callbackParams.put("payTradeNo", "test");
response = network.getResponse(callbackParams, PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
response.body().prettyPrint();
Assert.assertTrue(result, network.message(callbackParams, PAY_CALLOUT, "mock微信支付回调成功,但我们订单处理失败", response.body().asString()));
}
@Test(description = "获取用户版本信息",priority = 4)
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();
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);
System.out.println(response.body().asString());
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);
System.out.println(response.body().asString());
Object list1=response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list1,network.message(PAY_distributionList,"已付款好友列表为null",response.body().asString()));
}
@Test(description = "代理人账户信息",priority = 6)
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"));
Assert.assertTrue(totalPromotionEarnings>0,network.message(PAY_accInfo,"总收益为0",response.body().asString()));
double settleMoney=Double.parseDouble(response.jsonPath().getString("data.settleMoney"));
Assert.assertTrue(settleMoney>0,network.message(PAY_accInfo,"待结算金额为0",response.body().asString()));
int canWithdraw=response.jsonPath().getInt("data.canWithdraw");
Assert.assertTrue(canWithdraw==1,network.message(PAY_accInfo,"不可以提现",response.body().asString()));
int minWithdrawMoney=response.jsonPath().getInt("data.minWithdrawMoney");
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>();
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()));
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()));
}
@Test(description = "代理人提现",priority = 8)
public void 代理人提现() {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
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()));
}
}
package com.kjj.cases.assistant; package com.kjj.cases.assistant.pay;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
...@@ -19,19 +19,17 @@ import java.util.HashMap; ...@@ -19,19 +19,17 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class Pay implements Authorization { public class Pay implements Authorization {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
agentTku(); agentTku();
userTku();
} }
public String comboId; public String comboId;
public long id; public long id;
public String promotionCode; public String promotionCode;
@Test (description = "默认付费_付费页",priority = 1) //priority 方法执行优先级 @Test (description = "默认付费_付费页",priority = 1) //priority 方法执行优先级
public void 默认付费_付费页() { public void 默认付费_付费页() {
//付款中间页判断 //付款中间页判断
...@@ -262,8 +260,5 @@ public class Pay implements Authorization { ...@@ -262,8 +260,5 @@ public class Pay implements Authorization {
} }
}
}
package com.kjj.cases.assistant.whoSawMe; package com.kjj.cases.assistant.whoSawMe;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
...@@ -7,8 +8,7 @@ import org.testng.Assert; ...@@ -7,8 +8,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG; import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
...@@ -21,10 +21,11 @@ public class ForwardAndRead implements Authorization { ...@@ -21,10 +21,11 @@ public class ForwardAndRead implements Authorization {
private Long sellerId; private Long sellerId;
private String visitId; private String visitId;
private String insuranceId; private String insuranceId;
private String forwardTime;
@BeforeClass @BeforeClass
public void setUp() throws IOException{ public void setUp() throws IOException{
agentTku(); visitor2Tku();
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
} }
...@@ -39,6 +40,8 @@ public class ForwardAndRead implements Authorization { ...@@ -39,6 +40,8 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString()));
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString())); Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
forwardTime = response.jsonPath().getString("timestamp");
} }
@Test(description = "代理人转发名片", priority = 2) @Test(description = "代理人转发名片", priority = 2)
...@@ -58,8 +61,8 @@ public class ForwardAndRead implements Authorization { ...@@ -58,8 +61,8 @@ public class ForwardAndRead implements Authorization {
// 访客访问素材及产生线索 // 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 3) @Test(description = "访客阅读文章", priority = 3)
public void 访客阅读文章() throws IOException{ public void 访客阅读文章() throws IOException{
sellerId = (Long) getUserInfo(BasicConfig.AGENT_TKU).get("sellerId"); sellerId = decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR_TKU); network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
param = new HashMap<>(); param = new HashMap<>();
param.put("scid", articleScId); param.put("scid", articleScId);
param.put("fromUserId", sellerId); param.put("fromUserId", sellerId);
...@@ -108,7 +111,7 @@ public class ForwardAndRead implements Authorization { ...@@ -108,7 +111,7 @@ public class ForwardAndRead implements Authorization {
@Test(description = "二度访客阅读文章", priority = 6) @Test(description = "二度访客阅读文章", priority = 6)
public void 二度访客阅读文章() throws IOException{ public void 二度访客阅读文章() throws IOException{
Long fromUserId = decodeTku(BasicConfig.VISITOR_TKU).get("sellerId"); Long fromUserId = decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客 network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU); // 切换二度访客
param = new HashMap<>(); param = new HashMap<>();
param.put("scid", articleScId); param.put("scid", articleScId);
...@@ -147,18 +150,16 @@ public class ForwardAndRead implements Authorization { ...@@ -147,18 +150,16 @@ public class ForwardAndRead implements Authorization {
} }
// 获取用户信息 // 获取用户信息
public Map<String, Object> getUserInfo(String userTku){ public Map<String, String> getUserInfo(String userTku){
network.agentCookies.put("tku", userTku); network.agentCookies.put("tku", userTku);
response = network.getResponse(BasicConfig.USER_INFO); response = network.getResponse(BasicConfig.USER_INFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString()));
String avatar = response.jsonPath().getString("data.avatar");
String wxName = response.jsonPath().getString("data.wxName"); String wxName = response.jsonPath().getString("data.wxName");
Long sellerId = response.jsonPath().getLong("data.sellerId"); Map<String, String> infos = new HashMap<>();
Long userId = response.jsonPath().getLong("data.userId"); infos.put("avatar", avatar);
Map<String, Object> infos = new HashMap<>();
infos.put("wxName", wxName); infos.put("wxName", wxName);
infos.put("sellerId", sellerId); network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
infos.put("userId", userId);
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
return infos; return infos;
} }
......
This diff is collapsed.
...@@ -4,7 +4,6 @@ import com.kjj.cases.admin.Authorization; ...@@ -4,7 +4,6 @@ import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; 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.groovy.json.internal.IO;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -27,8 +26,7 @@ public class MyForward implements Authorization { ...@@ -27,8 +26,7 @@ public class MyForward implements Authorization {
public void setUp() throws IOException { public void setUp() throws IOException {
// 登陆管理后台 // 登陆管理后台
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
// 代理人授权 visitor2Tku();
agentTku();
far = new ForwardAndRead(); far = new ForwardAndRead();
// 关闭数据看板演示数据 // 关闭数据看板演示数据
...@@ -237,10 +235,9 @@ public class MyForward implements Authorization { ...@@ -237,10 +235,9 @@ public class MyForward implements Authorization {
param.put("pageSize", 20); param.put("pageSize", 20);
param.put("type", 4); param.put("type", 4);
response = network.getResponse(param, BasicConfig.FORWARD_VISITRECORD); response = network.getResponse(param, BasicConfig.FORWARD_VISITRECORD);
System.out.println(response.body().asString());
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 encodeUserId = response.jsonPath().getString("data.list[0].userId"); String encodeUserId = response.jsonPath().getString("data.list[0].userId");
Assert.assertEquals(encodeUserId, far.encodeId((Long) far.getUserInfo(VISITOR1_TKU).get("userId")), network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString())); Assert.assertEquals(encodeUserId, visitorEncodeUserId, network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString()));
} }
// 获取素材转发关系链 // 获取素材转发关系链
......
...@@ -247,8 +247,5 @@ public class Novice { ...@@ -247,8 +247,5 @@ public class Novice {
return scId; return scId;
} }
@AfterClass
public static void tearDown(){
apiCount += 6;
}
} }
...@@ -41,10 +41,9 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -41,10 +41,9 @@ public class ExtentTestNGIReporterListener implements IReporter {
if (result.size() == 0) { if (result.size() == 0) {
continue; continue;
} }
// 统计suite下的成功、失败、跳过的总用例数 // 统计suite下的成功、失败的总用例数
int suiteFailSize = 0; int suiteFailSize = 0;
int suitePassSize = 0; int suitePassSize = 0;
// int suiteSkipSize = 0;
ExtentTest suiteTest = null; ExtentTest suiteTest = null;
// 存在多个suite的情况下,在报告中将同一个suite的测试结果归为一类,创建一级节点。 // 存在多个suite的情况下,在报告中将同一个suite的测试结果归为一类,创建一级节点。
if (createSuiteNode) { if (createSuiteNode) {
...@@ -80,10 +79,8 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -80,10 +79,8 @@ public class ExtentTestNGIReporterListener implements IReporter {
// 统计SuiteResult下的数据 // 统计SuiteResult下的数据
int passSize = r.getTestContext().getPassedTests().size(); int passSize = r.getTestContext().getPassedTests().size();
int failSize = r.getTestContext().getFailedTests().size(); int failSize = r.getTestContext().getFailedTests().size();
// int skipSize = r.getTestContext().getSkippedTests().size();
suitePassSize += passSize; suitePassSize += passSize;
suiteFailSize += failSize; suiteFailSize += failSize;
// suiteSkipSize += skipSize;
if (failSize > 0) { if (failSize > 0) {
resultNode.getModel().setStatus(Status.FAIL); resultNode.getModel().setStatus(Status.FAIL);
} }
...@@ -129,7 +126,6 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -129,7 +126,6 @@ public class ExtentTestNGIReporterListener implements IReporter {
htmlReporter.config().setChartVisibilityOnOpen(true); htmlReporter.config().setChartVisibilityOnOpen(true);
//报表位置 //报表位置
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP); htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
// htmlReporter.config().setTheme(Theme.STANDARD);
htmlReporter.config().setCSS(".node.level-1 ul{ display:none;} .node.level-1.active ul{display:block;}"); htmlReporter.config().setCSS(".node.level-1 ul{ display:none;} .node.level-1.active ul{display:block;}");
extent = new ExtentReports(); extent = new ExtentReports();
extent.attachReporter(htmlReporter); extent.attachReporter(htmlReporter);
...@@ -178,8 +174,6 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -178,8 +174,6 @@ public class ExtentTestNGIReporterListener implements IReporter {
// 作为子节点进行创建时,设置同父节点的标签一致,便于报告检索。 // 作为子节点进行创建时,设置同父节点的标签一致,便于报告检索。
test = extenttest.createNode(name).assignCategory(categories); test = extenttest.createNode(name).assignCategory(categories);
} }
// test.getModel().setDescription(description.toString());
// test = extent.createTest(result.getMethod().getMethodName());
for (String group : result.getMethod().getGroups()) for (String group : result.getMethod().getGroups())
test.assignCategory(group); test.assignCategory(group);
......
...@@ -16,22 +16,11 @@ public class NetworkUtils { ...@@ -16,22 +16,11 @@ public class NetworkUtils {
// 代理人的 cookies和headers // 代理人的 cookies和headers
public Map<String, Object> agentCookies = new HashMap<String, Object>(); public Map<String, Object> agentCookies = new HashMap<String, Object>();
public Map<String, Object> getAgentCookies() { return agentCookies; }
public void setAgentCookies(Map<String, Object> agentCookies) { this.agentCookies = agentCookies; }
public Map<String, Object> agentHeaders = new HashMap<String, Object>(); public Map<String, Object> agentHeaders = new HashMap<String, Object>();
public Map<String, Object> getAgentHeaders() { return agentHeaders; }
public void setAgentHeaders(Map<String, Object> agentHeaders) { this.agentHeaders = agentHeaders; }
public Map<String, Object> fileHeaders = new HashMap<String, Object>(); public Map<String, Object> fileHeaders = new HashMap<String, Object>();
public Map<String, Object> getFileHeaders() { return fileHeaders; }
public void setFileHeadersHeaders(Map<String, Object> fileHeaders) { this.fileHeaders = fileHeaders; }
// 钉钉的 headers // 钉钉的 headers
public Map<String, Object> dingTalkHeaders = new HashMap<String, Object>(); public Map<String, Object> dingTalkHeaders = new HashMap<String, Object>();
public Map<String, Object> getDingTalkHeaders() { return dingTalkHeaders; }
public void setDingTalkHeaders(Map<String, Object> dingTalkHeaders) { this.dingTalkHeaders = dingTalkHeaders; }
private volatile static NetworkUtils network; private volatile static NetworkUtils network;
// 构造函数 初始化tku、content-type // 构造函数 初始化tku、content-type
...@@ -145,7 +134,7 @@ public class NetworkUtils { ...@@ -145,7 +134,7 @@ public class NetworkUtils {
Response response = given() Response response = given()
.headers(dingTalkHeaders) .headers(dingTalkHeaders)
.body(jsonStr) .body(jsonStr)
.post(DINGTALKPATH); .post(dingTalkPath);
if (!Objects.equals(response.statusCode(),200)){ if (!Objects.equals(response.statusCode(),200)){
System.out.println("请求状态码错误,code=【"+response.statusCode()+"】"); System.out.println("请求状态码错误,code=【"+response.statusCode()+"】");
} }
...@@ -181,9 +170,5 @@ public class NetworkUtils { ...@@ -181,9 +170,5 @@ public class NetworkUtils {
} }
public static void main(String[] args) throws IOException {
}
} }
...@@ -2,71 +2,76 @@ ...@@ -2,71 +2,76 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="集客助手" verbose="1" thread-count="3"> <suite name="集客助手" verbose="1" thread-count="3">
<!-- <test preserve-order="true" name="支付">--> <test preserve-order="true" name="支付">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.Pay"/>--> <class name="com.kjj.cases.assistant.pay.Pay"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "首页">--> <test preserve-order="true" name = "首页">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.homePage"/>--> <class name="com.kjj.cases.assistant.homePage.HomePage"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name="我的名片">--> <test preserve-order="true" name="我的名片">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.card.PersonCard"/>--> <class name="com.kjj.cases.assistant.card.PersonCard"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name="文章中个人名片">--> <test preserve-order="true" name="文章中个人名片">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>--> <class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "种草素材">--> <test preserve-order="true" name = "种草素材">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.RecommendMaterial"/>--> <class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "今日早报">--> <test preserve-order="true" name = "今日早报">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.DailyPaper"/>--> <class name="com.kjj.cases.assistant.homePage.DailyPaper"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "获取访客">--> <test preserve-order="true" name = "获取访客">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>--> <class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "谁看过我">--> <test preserve-order="true" name = "谁看过我">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.whoSawMe.WhoSawMe"/>--> <class name="com.kjj.cases.assistant.whoSawMe.WhoSawMe"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "我的转发">--> <test preserve-order="true" name = "我的转发">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.whoSawMe.MyForward"/>--> <class name="com.kjj.cases.assistant.whoSawMe.MyForward"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "贺卡">--> <test preserve-order="true" name = "我的客户">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>--> <class name="com.kjj.cases.assistant.whoSawMe.MyCustomer"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<!-- <test preserve-order="true" name = "抽奖转盘">--> <test preserve-order="true" name = "贺卡">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.markettools.GameLottery"/>--> <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
<test preserve-order="true" name = "抽奖转盘">
<classes>
<class name="com.kjj.cases.assistant.markettools.GameLottery"/>
</classes>
</test>
<test preserve-order="true" name = "邀请函和趣味测评"> <test preserve-order="true" name = "邀请函和趣味测评">
<classes> <classes>
<class name="com.kjj.cases.assistant.markettools.InvitationLetter"/> <class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>
</classes> </classes>
</test> </test>
<!-- <test preserve-order="true" name = "使用攻略和设置中心">--> <test preserve-order="true" name = "使用攻略和设置中心">
<!-- <classes>--> <classes>
<!-- <class name="com.kjj.cases.assistant.menu.PersonalCenter"/>--> <class name="com.kjj.cases.assistant.menu.PersonalCenter"/>
<!-- </classes>--> </classes>
<!-- </test>--> </test>
</suite> </suite>
<!-- Suite --> <!-- 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