Commit 4ed34f02 authored by 张艳玲's avatar 张艳玲

update

parent 3647d1da
......@@ -3,6 +3,9 @@ package com.kjj.cases.basics;
import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -13,8 +16,8 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Article implements Authorization {
// private static final NetworkUtils network = NetworkUtils.getInstance();
public class Article {
private static final NetworkUtils network = NetworkUtils.getInstance();
public String sid; // 加密的销售ID
public String articleContentId; // 文章的contentId
public String scid; // getScid后的文章id
......@@ -23,8 +26,15 @@ public class Article implements Authorization {
@BeforeClass
public void setUp() {
agentTku();
userTku();
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku",AGENT_TKU);
System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
System.out.println("访客tku:"+VISITOR_TKU);
}
//文章内容页
......@@ -216,21 +226,12 @@ public class Article implements Authorization {
boolean isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertTrue(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"获取代理人日常精准素材个人专栏开关有误",response.body().asString()));
//关闭 代理人个人专栏开关
//开启 代理人个人专栏开关
Map<String, Object> configParams = new HashMap<String, Object>();
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",false);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
//再获取代理人个人专栏
response = network.getResponse(params,ARTICLE_GETENHANCEDCOLUMNCONFIG);
isOpen = response.jsonPath().getBoolean("data.find {it.code == 'personal_document_switch'}.val");
Assert.assertFalse(isOpen,network.message(params,ARTICLE_GETENHANCEDCOLUMNCONFIG,"获取代理人日常精准素材个人专栏开关有误",response.body().asString()));
//再次开启 代理人个人专栏开关
configParams.put("configKey","personal_document_switch");
configParams.put("configValue",true);
response = network.postResponse(configParams,SELLERCONFIG_EDITCONFIG);
}
// 获取代理人个人专栏
......@@ -350,6 +351,7 @@ public class Article implements Authorization {
Assert.assertTrue(favourResult,network.message(likeParams,HASALREADYLIKE,"访客-头部名片点赞数量显示有误",response.body().asString()));
// 点赞名片
ThreadSleepUtils.sleep(500);
likeParams.put("visitTableId",visitId);
response =network.postResponse(likeParams,INTERACTION_LIKE);
boolean isLike = (response.jsonPath().getInt("data.favourTimes") - favourTimes) > 0;
......
package com.kjj.cases.basics;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -28,8 +29,7 @@ public class CircleFriends {
}
@Test(description="是否首次进入",priority = 1)
public void 是否首次进入() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
public void 是否首次进入() {
Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误",response.body().asString()));
......@@ -37,7 +37,7 @@ public class CircleFriends {
// tab列表 后端根据tku自行判断
@Test(description="获取tab列表",priority = 2)
public void 获取tab列表() throws IOException {
public void 获取tab列表() {
Response response = network.getResponse(FRIENDS_GETMATERIALTAGS);
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab
......@@ -55,7 +55,7 @@ public class CircleFriends {
contentId = response.jsonPath().getString("data[0].contentId"); //素材ID
tagId = response.jsonPath().getString("data[0].materialTag"); //素材频道ID
tagName = response.jsonPath().getString("data[0].tagName"); //素材频道名称
Assert.assertEquals(count,30,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
Assert.assertTrue(count>1,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
}
@Test(description="获取全部列表",priority = 4)
......@@ -80,8 +80,7 @@ public class CircleFriends {
Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误",response.body().asString()));
//延迟2秒,存入ES
Thread.sleep(2000);
ThreadSleepUtils.sleep(5000);
//重新获取未读列表
response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
List<String> contentList = response.jsonPath().getList("data.contentId");
......@@ -115,6 +114,7 @@ public class CircleFriends {
@Test(description="素材频道页",priority = 7)
public void 素材频道页() throws IOException {
//频道页 头部
ThreadSleepUtils.sleep(500);
Map<String, Object> params = new HashMap<String, Object>();
params.put("tagId",tagId);
Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL);
......
......@@ -60,7 +60,7 @@ public class Pay {
}
@Test (description = "默认付费_待支付",priority = 2)
public void 默认付费_待支付() throws IOException {
public void 默认付费_待支付() {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
......
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