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;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import java.io.IOException;
import java.util.*;
......@@ -67,7 +66,7 @@ public class MyCustomer implements Authorization {
}
// 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =3)
@Test(description = "标签管理_新建标签", priority =4)
public void 标签管理_新建标签() throws IOException{
// 添加标签
param = new HashMap<>();
......@@ -87,7 +86,7 @@ public class MyCustomer implements Authorization {
}
// 标签管理_修改标签
@Test(description = "标签管理_修改标签", priority = 4)
@Test(description = "标签管理_修改标签", priority = 5)
public void 标签管理_修改标签() throws IOException{
// 修改标签
param = new HashMap<>();
......@@ -106,24 +105,25 @@ public class MyCustomer implements Authorization {
}
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 100)
@Test(description = "标签管理_删除标签", priority = 3)
public void 标签管理_删除标签() throws IOException{
// 删除标签
List<String> ids = Lists.newArrayList();
ids.add(createTagId);
List<String> ids = new ArrayList<>();
// 删除所有标签
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.put("ids", ids);
response = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TAG_DELETE, "接口请求失败", response.body().asString()));
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", response.body().asString()));
Response delTagsRes = network.postResponse(param, BasicConfig.TAG_DELETE);
Assert.assertTrue(delTagsRes.jsonPath().getBoolean("data"), network.message(param, BasicConfig.TAG_DELETE, "标签删除失败", delTagsRes.body().asString()));
//查看标签列表
response = network.getResponse(BasicConfig.TAG_GETLIST);
List<Object> tagLists = response.jsonPath().getJsonObject("data");
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()));
}
// 检查是否完全删除
tagLists = JsonUtil.parseResponseToListBean(network.getResponse(BasicConfig.TAG_GETLIST), tagList.class);
Assert.assertEquals(tagLists.size(), 0, network.message(param, BasicConfig.TAG_GETLIST, "标签列表内容未全部删除", network.getResponse(BasicConfig.TAG_GETLIST).body().asString()));
}
// 我的客户首页_获取全部客户列表_最近访问
......
......@@ -356,30 +356,41 @@ public class WhoSawMe implements Authorization {
@Test(description = "其他代理人加入该代理人团队", priority = 25)
public void 邀请加入团队() throws IOException{
// 切换代理人加入团队
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
// 获取被邀请人sellerId
childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
// 确定被邀请代理人没有上级
response = network.getResponse(BasicConfig.BOSS_ROLE);
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");
Assert.assertFalse(hasSuperior, network.message(BasicConfig.BOSS_ROLE, "该代理人已有上级", response.body().asString()));
// network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
// response = network.getResponse(BasicConfig.BOSS_ROLE);
// 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.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_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);
// param = new HashMap<>();
// param.put("inviterSid", ForwardAndRead.decodeTku(BasicConfig.VISITOR2_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);
}
@Test(description = "查看被邀请代理人上级名称", priority = 26)
public void 查看上级名称() throws IOException{
// 获取被邀请代理人sellerId
childSellerId = ForwardAndRead.decodeTku(BasicConfig.AGENT_TKU).get("sellerId");
param = new HashMap<>();
param.put("sellerId", childSellerId);
response = network.getResponse(param, BasicConfig.BOSS_BOSS);
......@@ -683,6 +694,7 @@ public class WhoSawMe implements Authorization {
param.put("taskStatus", 2);
response = network.getResponse(param, BasicConfig.BOSS_TEAMTASKLIST);
List<TeamTaskList> teamTaskLists = JsonUtil.parseResponseToPageBean(response, TeamTaskList.class);
System.out.println(response.body().asString());
int id = teamTaskLists.get(0).getId();
int taskAchieverNum = teamTaskLists.get(0).getTaskAchieverNum();
int taskStatus = teamTaskLists.get(0).getTaskStatus();
......
......@@ -6,46 +6,46 @@
<class name="com.kjj.cases.assistant.menu.NoviceGuidance"/>
</classes>
</test>
<test preserve-order="true" name="支付">
<classes>
<class name="com.kjj.cases.assistant.pay.Pay"/>
</classes>
</test>
<test preserve-order="true" name="邀请返现">
<classes>
<class name="com.kjj.cases.assistant.pay.Cashback"/>
</classes>
</test>
<test preserve-order="true" name = "首页">
<classes>
<class name="com.kjj.cases.assistant.homePage.HomePage"/>
</classes>
</test>
<test preserve-order="true" name="我的名片">
<classes>
<class name="com.kjj.cases.assistant.card.PersonCard"/>
</classes>
</test>
<test preserve-order="true" name="文章中个人名片">
<classes>
<class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>
</classes>
</test>
<test preserve-order="true" name = "种草素材">
<classes>
<class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>
</classes>
</test>
<test preserve-order="true" name = "今日早报">
<classes>
<class name="com.kjj.cases.assistant.homePage.DailyPaper"/>
</classes>
</test>
<test preserve-order="true" name = "上传链接">
<classes>
<class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes>
</test>
<!-- <test preserve-order="true" name="支付">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.pay.Pay"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="邀请返现">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.pay.Cashback"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "首页">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.HomePage"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="我的名片">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.card.PersonCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="文章中个人名片">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.card.ArticalPersonCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "种草素材">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "今日早报">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.DailyPaper"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "上传链接">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.homePage.Upload"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name = "获取访客">
<classes>
<class name="com.kjj.cases.assistant.whoSawMe.ForwardAndRead"/>
......@@ -66,26 +66,26 @@
<class name="com.kjj.cases.assistant.whoSawMe.MyCustomer"/>
</classes>
</test>
<test preserve-order="true" name = "贺卡">
<classes>
<class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>
</classes>
</test>
<test preserve-order="true" name = "抽奖转盘">
<classes>
<class name="com.kjj.cases.assistant.markettools.GameLottery"/>
</classes>
</test>
<test preserve-order="true" name = "邀请函和趣味测评">
<classes>
<class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>
</classes>
</test>
<test preserve-order="true" name = "使用攻略和设置中心">
<classes>
<class name="com.kjj.cases.assistant.menu.PersonalCenter"/>
</classes>
</test>
<!-- <test preserve-order="true" name = "贺卡">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.GreetingCrad"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "抽奖转盘">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.GameLottery"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "邀请函和趣味测评">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.markettools.InvitationLetter"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name = "使用攻略和设置中心">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.assistant.menu.PersonalCenter"/>-->
<!-- </classes>-->
<!-- </test>-->
</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