Commit 48c27fe2 authored by xiamengchen's avatar xiamengchen

优化逻辑

parent a948910d
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class tagList {
private int count;
private String id;
private String tagName;
}
...@@ -10,7 +10,6 @@ import io.restassured.response.Response; ...@@ -10,7 +10,6 @@ import io.restassured.response.Response;
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;
import org.testng.collections.Lists;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
...@@ -67,7 +66,7 @@ public class MyCustomer implements Authorization { ...@@ -67,7 +66,7 @@ public class MyCustomer implements Authorization {
} }
// 标签管理页_新建标签 // 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =3) @Test(description = "标签管理_新建标签", priority =4)
public void 标签管理_新建标签() throws IOException{ public void 标签管理_新建标签() throws IOException{
// 添加标签 // 添加标签
param = new HashMap<>(); param = new HashMap<>();
...@@ -87,7 +86,7 @@ public class MyCustomer implements Authorization { ...@@ -87,7 +86,7 @@ public class MyCustomer implements Authorization {
} }
// 标签管理_修改标签 // 标签管理_修改标签
@Test(description = "标签管理_修改标签", priority = 4) @Test(description = "标签管理_修改标签", priority = 5)
public void 标签管理_修改标签() throws IOException{ public void 标签管理_修改标签() throws IOException{
// 修改标签 // 修改标签
param = new HashMap<>(); param = new HashMap<>();
...@@ -106,24 +105,25 @@ public class MyCustomer implements Authorization { ...@@ -106,24 +105,25 @@ public class MyCustomer implements Authorization {
} }
// 标签管理_删除标签 // 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 100) @Test(description = "标签管理_删除标签", priority = 3)
public void 标签管理_删除标签() throws IOException{ public void 标签管理_删除标签() throws IOException{
// 删除标签
List<String> ids = Lists.newArrayList(); List<String> ids = new ArrayList<>();
ids.add(createTagId); // 删除所有标签
Response getTagListRes = network.getResponse(BasicConfig.TAG_GETLIST);
List<tagList> tagLists = JsonUtil.parseResponseToListBean(getTagListRes, tagList.class);
for(tagList tagList : tagLists){
String tagId = tagList.getId();
ids.add(tagId);
}
param = new HashMap<>(); param = new HashMap<>();
param.put("ids", ids); param.put("ids", ids);
response = network.postResponse(param, BasicConfig.TAG_DELETE); Response delTagsRes = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_DELETE, "接口请求失败", response.body().asString())); Assert.assertTrue(delTagsRes.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", delTagsRes.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", response.body().asString()));
//查看标签列表 // 检查是否完全删除
response = network.getResponse(BasicConfig.TAG_GETLIST); tagLists = JsonUtil.parseResponseToListBean(network.getResponse(BasicConfig.TAG_GETLIST), tagList.class);
List<Object> tagLists = response.jsonPath().getJsonObject("data"); Assert.assertEquals(tagLists.size(), 0, network.message(param, BasicConfig.TAG_GETLIST, "标签列表内容未全部删除", network.getResponse(BasicConfig.TAG_GETLIST).body().asString()));
for(int i = 0; i < tagLists.size(); i++){
String tagId = response.jsonPath().getString("data["+ i + "].id");
Assert.assertNotEquals(tagId, createTagId, network.message(BasicConfig.TAG_GETLIST, "标签未删除成功", response.body().asString()));
}
} }
// 我的客户首页_获取全部客户列表_最近访问 // 我的客户首页_获取全部客户列表_最近访问
......
...@@ -356,30 +356,41 @@ public class WhoSawMe implements Authorization { ...@@ -356,30 +356,41 @@ public class WhoSawMe implements Authorization {
@Test(description = "其他代理人加入该代理人团队", priority = 25) @Test(description = "其他代理人加入该代理人团队", priority = 25)
public void 邀请加入团队() throws IOException{ public void 邀请加入团队() throws IOException{
// 切换代理人加入团队 // 获取被邀请人sellerId
network.agentCookies.put("tku", BasicConfig.AGENT_TKU); childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
// 确定被邀请代理人没有上级 // 确定被邀请代理人没有上级
response = network.getResponse(BasicConfig.BOSS_ROLE); // network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior"); // response = network.getResponse(BasicConfig.BOSS_ROLE);
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人已有上级", response.body().asString())); // boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
// while (hasSuperior){
// 获取上级昵称
Map<String, Object> bossNamePar = new HashMap<>();
bossNamePar.put("sellerId", childSellerId);
Response getBossNameRes = network.getResponse(bossNamePar, BasicConfig.BOSS_BOSS);
String bossName = getBossNameRes.jsonPath().getString("data");
// 获取上级sellerId
Map<String, Object> bossSIdPar = new HashMap<>();
bossSIdPar.put("sellerName", bossName);
bossSIdPar.put("fuzzyFlag", true);
bossSIdPar.put("pageNo", 1);
bossSIdPar.put("pageSize", 20);
Response getBossSIdRes = network.getResponse(bossSIdPar, BasicConfig.MANAGER_vipList);
// }
// 代理人加入团队 // 代理人加入团队
param = new HashMap<>(); // param = new HashMap<>();
param.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId")); // param.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("inviteType", 2); // param.put("inviteType", 2);
response = network.getResponse(param, BasicConfig.BOSS_BOUND); // response = network.getResponse(param, BasicConfig.BOSS_BOUND);
boolean success = response.jsonPath().getBoolean("success"); // boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(param, BasicConfig.BOSS_BOUND, "接口请求失败", response.body().asString())); // 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())); // 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", BasicConfig.VISITOR2_TKU);
} }
@Test(description = "查看被邀请代理人上级名称", priority = 26) @Test(description = "查看被邀请代理人上级名称", priority = 26)
public void 查看上级名称() throws IOException{ public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId
childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>(); param = new HashMap<>();
param.put("sellerId", childSellerId); param.put("sellerId", childSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS); response = network.getResponse(param, BasicConfig.BOSS_BOSS);
...@@ -683,6 +694,7 @@ public class WhoSawMe implements Authorization { ...@@ -683,6 +694,7 @@ public class WhoSawMe implements Authorization {
param.put("taskStatus", 2); param.put("taskStatus", 2);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST); response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
List<TeamTaskList> teamTaskLists = JsonUtil.parseResponseToPageBean(response, TeamTaskList.class); List<TeamTaskList> teamTaskLists = JsonUtil.parseResponseToPageBean(response, TeamTaskList.class);
System.out.println(response.body().asString());
int id = teamTaskLists.get(0).getId(); int id = teamTaskLists.get(0).getId();
int taskAchieverNum = teamTaskLists.get(0).getTaskAchieverNum(); int taskAchieverNum = teamTaskLists.get(0).getTaskAchieverNum();
int taskStatus = teamTaskLists.get(0).getTaskStatus(); int taskStatus = teamTaskLists.get(0).getTaskStatus();
......
...@@ -6,46 +6,46 @@ ...@@ -6,46 +6,46 @@
<class name="com.kjj.cases.assistant.menu.NoviceGuidance"/> <class name="com.kjj.cases.assistant.menu.NoviceGuidance"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="支付"> <!-- <test preserve-order="true" name="支付">-->
<classes> <!-- <classes>-->
<class name="com.kjj.cases.assistant.pay.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.pay.Cashback"/> <!-- <class name="com.kjj.cases.assistant.pay.Cashback"/>-->
</classes> <!-- </classes>-->
</test> <!-- </test>-->
<test preserve-order="true" name = "首页"> <!-- <test preserve-order="true" name = "首页">-->
<classes> <!-- <classes>-->
<class name="com.kjj.cases.assistant.homePage.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.homePage.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.homePage.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.homePage.Upload"/> <!-- <class name="com.kjj.cases.assistant.homePage.Upload"/>-->
</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"/>
...@@ -66,26 +66,26 @@ ...@@ -66,26 +66,26 @@
<class name="com.kjj.cases.assistant.whoSawMe.MyCustomer"/> <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.GreetingCrad"/> <!-- <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>-->
</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.GameLottery"/>-->
</classes> <!-- </classes>-->
</test> <!-- </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