Commit a5d6daf8 authored by 龚小红's avatar 龚小红

Merge branch 'feature/20210906-xmc' into 'master'

Feature/20210906 xmc-解决tku失效报错问题

See merge request test-group/kejiji!115
parents 6419470a eb80c1d7
......@@ -32,8 +32,8 @@ public interface Authorization {
//代理人
default void visitor2Tku() {
network.agentCookies.put("tku", VISITOR2_TKU);
System.out.println("代理人tku:" + VISITOR2_TKU);
network.agentCookies.put("tku", AGENT2_TKU);
System.out.println("代理人tku:" + AGENT2_TKU);
}
......
......@@ -71,7 +71,7 @@ public class SignRed implements Authorization {
Assert.assertTrue(attendAmount > 0, network.message(ATTEND_open, "签到失败", response.body().asString()));
}else{
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(ATTEND_open, "重复签到成功", response.body().asString()));
Assert.assertFalse(success, network.message(ATTEND_open, "重复签到成功", response.body().asString()));
}
}
......@@ -86,20 +86,23 @@ public class SignRed implements Authorization {
@Test(description = "代理人账户明细",priority = 7)
public void 代理人账户明细() {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("type", 2);
Params.put("pageNo", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, PAY_accDetail);
System.out.println(response.body().asString());
int changeType1 = response.jsonPath().getInt("data[0].changeType");
String nickname = response.jsonPath().getString("data[0].nickname");
int bizType = response.jsonPath().getInt("data[0].bizType");
String changeMoney = response.jsonPath().getString("data[0].changeMoney");
Assert.assertEquals(changeType1 ,2, network.message(PAY_accDetail, "收益明细类型错误", response.body().asString()));
Assert.assertEquals(nickname, "吉吉",network.message(PAY_accDetail, "签到用户名称错误", response.body().asString()));
Assert.assertEquals(bizType, 16,network.message(PAY_accDetail, "收益明细类型错误", response.body().asString()));
Assert.assertEquals(changeMoney, String.format("%.2f",attendAmount/100),network.message(PAY_accDetail, "收益金额错误", response.body().asString()));
if (!todayAttendFlag) {
agentTku();
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("type", 2);
Params.put("pageNo", 1);
Params.put("pageSize", 20);
Response response = network.getResponse(Params, PAY_accDetail);
System.out.println(response.body().asString());
int changeType1 = response.jsonPath().getInt("data[0].changeType");
String nickname = response.jsonPath().getString("data[0].nickname");
int bizType = response.jsonPath().getInt("data[0].bizType");
String changeMoney = response.jsonPath().getString("data[0].changeMoney");
Assert.assertEquals(changeType1 ,2, network.message(PAY_accDetail, "收益明细类型错误", response.body().asString()));
Assert.assertEquals(nickname, "吉吉",network.message(PAY_accDetail, "签到用户名称错误", response.body().asString()));
Assert.assertEquals(bizType, 16,network.message(PAY_accDetail, "收益明细类型错误", response.body().asString()));
Assert.assertEquals(changeMoney, String.format("%.2f",attendAmount/100),network.message(PAY_accDetail, "收益金额错误", response.body().asString()));
}
}
}
......@@ -86,7 +86,7 @@ public class ForwardAndRead implements Authorization {
// 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 4)
public void 访客阅读文章() throws IOException{
sellerId = decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
sellerId = decodeTku(BasicConfig.AGENT2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
param = new HashMap<>();
param.put("scid", articleScId);
......@@ -265,10 +265,12 @@ public class ForwardAndRead implements Authorization {
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 sellerName = response.jsonPath().getString("data.sellerName");
Map<String, String> infos = new HashMap<>();
infos.put("avatar", avatar);
infos.put("wxName", wxName);
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
infos.put("sellerName", sellerName);
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
return infos;
}
......
......@@ -302,7 +302,7 @@ public class MyCustomer implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFO, "接口请求失败", response.body().asString()));
Long sellerId = response.jsonPath().getLong("data.sellerId");
sessionId = response.jsonPath().getString("data.sessionId");
Assert.assertEquals(sellerId, ForwardAndRead.decodeTku(BasicConfig.VISITOR2_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()));
}
......@@ -795,7 +795,7 @@ public class MyCustomer implements Authorization {
@Test(description = "客户详情页_留言_留言对象是否关注公众号", priority = 44)
public void 客户详情页_留言_留言对象是否关注公众号() throws IOException{
param = new HashMap<>();
param.put("targetSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("targetSid", ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"));
response = network.getResponse(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS);
int subscribe = response.jsonPath().getInt("data.subscribe");
Assert.assertEquals(subscribe, 1, network.message(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS, "判断用户是否关注公众号失败", response.body().asString()));
......@@ -827,7 +827,7 @@ public class MyCustomer implements Authorization {
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
int readFlag = chatLists.get(chatLists.size()-1).getReadFlag();
Assert.assertEquals(senderId, ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(senderId, ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, visitor1UserId, network.message(param, BasicConfig.CHAT_LIST, "接收者userId错误", response.body().asString()));
Assert.assertEquals(content, "Hello", network.message(param, BasicConfig.CHAT_LIST, "消息内容错误", response.body().asString()));
Assert.assertEquals(readFlag, 1, network.message(param, BasicConfig.CHAT_LIST, "消息已读状态错误", response.body().asString()));
......@@ -852,7 +852,7 @@ public class MyCustomer implements Authorization {
long receiverId = response.jsonPath().getLong("data.list[0].receiverId");
String content = response.jsonPath().getString("data.list[0].content");
Assert.assertEquals(senderId, visitor1UserId, network.message(param, BasicConfig.CHAT_NEW, "发送者userID错误", response.body().asString()));
Assert.assertEquals(receiverId, (long)ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_NEW, "接收者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, (long)ForwardAndRead.decodeTku(BasicConfig.AGENT2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_NEW, "接收者sellerId错误", response.body().asString()));
Assert.assertEquals(content, "你好", network.message(param, BasicConfig.CHAT_NEW, "消息内容错误", response.body().asString()));
}
......@@ -892,7 +892,7 @@ public class MyCustomer implements Authorization {
response = network.postResponse(param, BasicConfig.CHAT_READED);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_READED, "访客阅读消息失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
}
// 留言_客户回复消息
......@@ -907,7 +907,7 @@ public class MyCustomer implements Authorization {
response= network.postResponse(param, BasicConfig.CHAT_SEND);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_SEND, "消息发送失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
network.agentCookies.put("tku", BasicConfig.AGENT2_TKU);
}
// 还原用户信息
......
......@@ -5,11 +5,11 @@ import com.kjj.bean.whoSawMe.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import java.io.IOException;
......@@ -42,7 +42,7 @@ public class WhoSawMe implements Authorization {
// 关闭数据看板演示数据
ForwardAndRead.closeDemoData();
xxrUserId = ForwardAndRead.decodeTku(BasicConfig.VISITOR1_TKU).get("userId");
xxrUserId = ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId");
}
// 进入谁看过我主页
......@@ -66,7 +66,7 @@ public class WhoSawMe implements Authorization {
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(BasicConfig.USER_INFO, "接口请求失败", response.body().asString()));
Long userId = response.jsonPath().getLong("data.userId");
Assert.assertEquals(userId, ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("userId"), network.message(BasicConfig.USER_INFO, "代理人userId与预期不符", response.body().asString()));
Assert.assertEquals(userId, ForwardAndRead.decodeTku(AGENT2_TKU).get("userId"), network.message(BasicConfig.USER_INFO, "代理人userId与预期不符", response.body().asString()));
}
// 获取当前页面Tips
......@@ -86,7 +86,7 @@ public class WhoSawMe implements Authorization {
@Test(description = "首页_查询使用版本", priority = 4)
public void 查询代理人当前使用版本() throws IOException {
param.clear();
xxxSellerId = ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
xxxSellerId = ForwardAndRead.decodeTku(AGENT2_TKU).get("sellerId");
String sellerIdEncode = ForwardAndRead.encodeId(xxxSellerId);
param.put("sellerId", sellerIdEncode);
response = network.getResponse(param, BasicConfig.USING_VERSION);
......@@ -151,8 +151,7 @@ public class WhoSawMe implements Authorization {
// 查看谁看过我首页我的访客列表
@Test(description = "查看我的访客列表", priority = 11)
public void 查看我的访客列表() throws IOException{
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
response = network.getResponse(BasicConfig.USER_INFO);
network.agentCookies.put("tku", AGENT2_TKU);
List<Object> customerTagIds = Lists.newArrayList();
param = new HashMap<>();
param.put("customerTagIds", customerTagIds);
......@@ -163,7 +162,7 @@ public class WhoSawMe implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "接口请求失败", response.body().asString()));
String visitorWxName = response.jsonPath().getString("data.list[0].nickName");
boolean isNew = response.jsonPath().getBoolean("data.list[1].isNew");
Assert.assertEquals(visitorWxName, ForwardAndRead.getUserInfo(BasicConfig.VISITOR1_TKU).get("wxName"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
Assert.assertEquals(visitorWxName, ForwardAndRead.getUserInfo(VISITOR1_TKU).get("wxName"), network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "最近访客微信昵称不匹配", response.body().asString()));
Assert.assertTrue(isNew, network.message(param, BasicConfig.WHOSAWME_CUSTCLUELISTV3, "新老客户身份判断错误", response.body().asString()));
clueId = response.jsonPath().getLong("data.list[0].clueId");
......@@ -269,13 +268,15 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.WEEKLY_POSTERINFO);
String positiveAna = response.jsonPath().getString("data.positiveAna");
scid = response.jsonPath().getString("data.scid");
String sellerId = response.jsonPath().getString("data.sellerId");
Assert.assertEquals(sellerId, IdMakeUtil.managerEncodingId(xxxSellerId));
Assert.assertEquals(positiveAna, "不是所有弯路都值得再走一遍,但是每次分享都值得再读一遍", network.message(param, BasicConfig.WEEKLY_POSTERINFO, "海报文案内容错误", response.body().asString()));
Assert.assertEquals(scid, "Kj20MjIyNjk1", network.message(param, BasicConfig.WEEKLY_POSTERINFO, "海报scid错误", response.body().asString()));
}
@Test(description = "运营周报_生成代理人头像二维码", priority = 21)
public void 运营周报_生成代理人头像二维码() throws IOException{
long xxxUserId = ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("userId");
long xxxUserId = ForwardAndRead.decodeTku(AGENT2_TKU).get("userId");
param.clear();
param.put("needAvatarCover", true);
param.put("pageType", 1);
......@@ -387,14 +388,14 @@ public class WhoSawMe implements Authorization {
}
// 代理人加入团队
param = new HashMap<>();
param.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("inviterSid", ForwardAndRead.decodeTku(AGENT2_TKU).get("sellerId"));
param.put("inviteType", 2);
response = network.getResponse(param, BasicConfig.BOSS_BOUND);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(param, BasicConfig.BOSS_BOUND, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.BOSS_BOUND, "添加代理人进入团队失败", response.body().asString()));
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
network.agentCookies.put("tku", AGENT2_TKU);
}
@Test(description = "查看被邀请代理人上级名称", priority = 26)
......@@ -404,7 +405,7 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.BOSS_BOSS);
String bossName = response.jsonPath().getString("data");
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.BOSS_BOSS, "接口请求失败", response.body().asString()));
Assert.assertEquals(bossName, ForwardAndRead.getUserInfo(BasicConfig.VISITOR2_TKU).get("wxName"), network.message(param, BasicConfig.BOSS_BOSS, "被邀请人上级名称与邀请人不一致", response.body().asString()));
Assert.assertEquals(bossName, ForwardAndRead.getUserInfo(AGENT2_TKU).get("sellerName"), network.message(param, BasicConfig.BOSS_BOSS, "被邀请人上级名称与邀请人不一致", response.body().asString()));
}
// 获取代理人团队信息
......@@ -681,7 +682,7 @@ public class WhoSawMe implements Authorization {
Assert.assertEquals(myTaskLists.size(), 0, network.message(param, BasicConfig.MYTASKLIST, "未完成列表不为空", response.body().asString()));
// 切换回团队主管理员
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
network.agentCookies.put("tku", AGENT2_TKU);
}
// 团队管理员检查任务完成状态
......@@ -842,7 +843,7 @@ public class WhoSawMe implements Authorization {
Long custUserId = response.jsonPath().getLong("data.custUserId");
String contentScid = response.jsonPath().getString("data.fromContent.scid");
Assert.assertEquals(visitClueType, 31, network.message(param, BasicConfig.CLUEINFO, "线索类型错误", response.body().asString()));
Assert.assertEquals(custUserId, ForwardAndRead.decodeTku(BasicConfig.VISITOR1_TKU).get("userId"), network.message(param, BasicConfig.CLUEINFO, "线索来源访客userId错误", response.body().asString()));
Assert.assertEquals(custUserId, ForwardAndRead.decodeTku(VISITOR1_TKU).get("userId"), 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()));
}
......
......@@ -78,8 +78,8 @@ public class BasicConfig {
public static String VISITOR_TKU = "T3gM31f18jCGvqvoyJRzyMTdpcPDJWUJJP4VQje7p9sfC4HKmj5NJfCUkxusAyFb5SpkWS31srDTYr6KtV";
// 基础线访客(小雪人) TKU
public static String VISITOR1_TKU = "T3gM31f18jCFXzk692pKjJCqJZdDv8Nb3htkzNk983cPPrfjggTn4Gv1ytpR3XAQusWRz7uTsHaibp6Es8";
// 基础线访客
public static String VISITOR2_TKU = "T3gM31f18jCeKCBVHf5MANgyXeBZGCm8vTJQTuWYXHFr27f8asoYpZASD6JzN5VJsBpQ8NxvzrJFGz2Ame"; // 二度访客用
// 基础线代理人
public static String AGENT2_TKU = "T3gM31f18jCfGaPSWPdym4Tn1bVYCTxrdndNe7hfwWrSpFCcXxnzbW81VZG9nT2gT8MMB52bE2rguiXBDL";
// 访客的sids
public static final String sids = "Kj21MjMwNTU";
// 访客(SuYi) userID:4425
......
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