Commit 6e40e65c authored by xiamengchen's avatar xiamengchen

新增我的转发页面+我的客户页面cases

修改谁看过我页面cases
parent 7cfac76e
...@@ -10,6 +10,7 @@ import org.testng.Assert; ...@@ -10,6 +10,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 javax.crypto.MacSpi;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -157,6 +158,18 @@ public class ForwardAndRead implements Authorization { ...@@ -157,6 +158,18 @@ public class ForwardAndRead implements Authorization {
return sellerId; return sellerId;
} }
// 获取用户信息
public Map<String, Object> getUserInfo(String userTku){
network.agentCookies.put("tku", userTku);
response = network.getResponse(BasicConfig.USER_INFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString()));
String wxName = response.jsonPath().getString("data.wxName");
Map<String, Object> infos = new HashMap<>();
infos.put("wxName", wxName);
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
return infos;
}
// 解密tku // 解密tku
public HashMap<String, Long> decodeTku(String tku){ public HashMap<String, Long> decodeTku(String tku){
// 登陆管理后台 // 登陆管理后台
......
...@@ -200,7 +200,7 @@ public class MyForward implements Authorization { ...@@ -200,7 +200,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 = far.encodeId(far.decodeTku(BasicConfig.VISITOR_TKU).get("userId")); visitorEncodeUserId = far.encodeId(far.decodeTku(VISITOR1_TKU).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()));
} }
......
...@@ -21,16 +21,15 @@ public class WhoSawMe implements Authorization { ...@@ -21,16 +21,15 @@ public class WhoSawMe implements Authorization {
private Response response; private Response response;
private Map<String, Object> param; private Map<String, Object> param;
private String AGENT1_TKU;
private ForwardAndRead far; private ForwardAndRead far;
private Long childSellerId;
@BeforeClass @BeforeClass
public void setUp() throws IOException { public void setUp() throws IOException {
// 代理人授权 // 代理人授权
agentTku(); agentTku();
BaseUtils.ssoLogin(); BaseUtils.ssoLogin();
// 赋值
AGENT1_TKU = "T3gM31f18jCeKCBVHf5MANgyXeBZGCm8vTJQTuWYXHFqxAxq2TQ27ozxyRsZykZBimiwFTrzQnGLWkvAs4";
far = new ForwardAndRead(); far = new ForwardAndRead();
// 关闭数据看板演示数据 // 关闭数据看板演示数据
...@@ -205,7 +204,7 @@ public class WhoSawMe implements Authorization { ...@@ -205,7 +204,7 @@ public class WhoSawMe implements Authorization {
public void 邀请加入团队() throws IOException{ public void 邀请加入团队() throws IOException{
// 切换代理人加入团队 // 切换代理人加入团队
Long sellerId = far.getSellerId(); Long sellerId = far.getSellerId();
network.agentCookies.put("tku", AGENT1_TKU); network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
// 确定被邀请代理人没有上级 // 确定被邀请代理人没有上级
response = network.getResponse(BasicConfig.BOSS_ROLE); response = network.getResponse(BasicConfig.BOSS_ROLE);
...@@ -227,9 +226,9 @@ public class WhoSawMe implements Authorization { ...@@ -227,9 +226,9 @@ public class WhoSawMe implements Authorization {
@Test(description = "查看被邀请代理人上级名称", priority = 16) @Test(description = "查看被邀请代理人上级名称", priority = 16)
public void 查看上级名称() throws IOException{ public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId // 获取被邀请代理人sellerId
Long sellerId = far.decodeTku(AGENT1_TKU).get("sellerId"); childSellerId = far.decodeTku(BasicConfig.VISITOR1_TKU).get("sellerId");
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", sellerId); param.put("sellerId", childSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS); response = network.getResponse(param, BasicConfig.BOSS_BOSS);
String bossName = response.jsonPath().getString("data"); String bossName = response.jsonPath().getString("data");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString()));
...@@ -238,9 +237,6 @@ public class WhoSawMe implements Authorization { ...@@ -238,9 +237,6 @@ public class WhoSawMe implements Authorization {
@Test(description = "删除团队成员", priority = 17) @Test(description = "删除团队成员", priority = 17)
public void 删除团队成员() throws IOException{ public void 删除团队成员() throws IOException{
// 获取下级代理人sellerId
Long childSellerId = far.decodeTku(AGENT1_TKU).get("sellerId");
// 登陆管理后台调用管理后台接口删除成员 // 登陆管理后台调用管理后台接口删除成员
param = new HashMap<>(); param = new HashMap<>();
param.put("superiorSid", far.getSellerId()); param.put("superiorSid", far.getSellerId());
...@@ -249,7 +245,7 @@ public class WhoSawMe implements Authorization { ...@@ -249,7 +245,7 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.MANAGER_SELLERTEAM_REMOVEMEMBER, "删除成员失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.MANAGER_SELLERTEAM_REMOVEMEMBER, "删除成员失败", response.body().asString()));
// 切换到被删除代理人确认已没有上级 // 切换到被删除代理人确认已没有上级
network.agentCookies.put("tku", AGENT1_TKU); network.agentCookies.put("tku", BasicConfig.VISITOR1_TKU);
response = network.getResponse(BasicConfig.BOSS_ROLE); response = network.getResponse(BasicConfig.BOSS_ROLE);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior"); boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人还有上级", response.body().asString())); Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人还有上级", response.body().asString()));
...@@ -357,9 +353,8 @@ public class WhoSawMe implements Authorization { ...@@ -357,9 +353,8 @@ public class WhoSawMe implements Authorization {
param.put("listType", 1); param.put("listType", 1);
param.put("pageSize", 20); param.put("pageSize", 20);
response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3); response = network.postResponse(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3);
System.out.println(response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString())); Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
String visitorWxName = response.jsonPath().getString("data.list[0].nickName"); String visitorWxName = response.jsonPath().getString("data.list[0].nickName");
Assert.assertEquals(visitorWxName, "xxx", network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "访客微信昵称不匹配", response.body().asString())); Assert.assertEquals(visitorWxName, far.getUserInfo(BasicConfig.VISITOR1_TKU).get("wxName"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "访客微信昵称不匹配", response.body().asString()));
} }
} }
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