Commit bd89ae1d authored by Su-Yi's avatar Su-Yi

新增发圈素材case

parent 2abaeb6d
...@@ -18,7 +18,7 @@ import java.util.HashMap; ...@@ -18,7 +18,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class Article { public class Article {
private static NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
String sid = ""; // 加密的销售ID String sid = ""; // 加密的销售ID
String articleContentId = ""; // 文章的contentId String articleContentId = ""; // 文章的contentId
String scid = ""; // getScid后的文章id String scid = ""; // getScid后的文章id
...@@ -256,11 +256,10 @@ public class Article { ...@@ -256,11 +256,10 @@ public class Article {
} }
@Test(description="访客_文章内容页",priority = 12) @Test(description="访客_文章内容页",priority = 13)
public void 访客_文章内容页() throws IOException public void 访客_文章内容页() throws IOException
{ {
// 访客视角的scid是直接从转发出来的url里取的,且URL里那个scid就是代理人视角里h5info接口里取出来的那个值,所以访客视角不用重新获取 // 访客视角的scid是直接从转发出来的url里取的,且URL里那个scid就是代理人视角里h5info接口里取出来的那个值,所以访客视角不用重新获取
Map<String, Object> infoParams = new HashMap<String, Object>(); Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid",scid); infoParams.put("scid",scid);
Response response = network.getResponse(infoParams,ARTICLE_H5INFO); Response response = network.getResponse(infoParams,ARTICLE_H5INFO);
......
package com.kjj.qa.cases;
import com.google.inject.internal.asm.$TypePath;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.apache.commons.lang3.ObjectUtils;
import org.codehaus.groovy.antlr.UnicodeEscapingReader;
import org.testng.Assert;
import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.qa.config.BasicConfig.*;
public class CircleFriends {
private static final NetworkUtil network = NetworkUtil.getInstance();
int firstTagId = 0;
String contentId = "";
String tagId = "";
String tagName = "";
@BeforeClass
public void setUp() {
}
@Test(description="是否首次进入",priority = 1)
public void 是否首次进入() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误"));
}
// tab列表 后端根据tku自行判断
@Test(description="获取tab列表",priority = 2)
public void 获取tab列表() throws IOException {
Response response = network.getResponse(FRIENDS_GETMATERIALTAGS);
int tabCount = response.jsonPath().getInt("data.size()");
int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab
firstTagId = response.jsonPath().getInt("data[0].id");//第一个标签的ID
Assert.assertEquals(tabCount,6,network.message(FRIENDS_GETMATERIALTAGS,"获取tab数量有误"));
Assert.assertEquals(id,595,network.message(FRIENDS_GETMATERIALTAGS,"获取tab中不包含保险"));
}
@Test(description="获取推荐(未读)列表",priority = 3)
public void 获取推荐列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("firstTagId",firstTagId);
Response response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
int count = response.jsonPath().getInt("data.size()");
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,"获取推荐列表有误"));
}
@Test(description="获取全部列表",priority = 4)
public void 获取全部列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("firstTagId",firstTagId);
params.put("pageIndex",1);
params.put("pageSize",10);
Response response = network.getResponse(params,FRIENDS_GETTIMELINELIST);
int count = response.jsonPath().getInt("data.list.size()");
Assert.assertEquals(count,10,"获取未读列表有误");
}
@Test(description="素材标记为已读",priority = 5)
public void 素材标记为已读() throws IOException, InterruptedException {
//标记为已读
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
params.put("firstTagId",firstTagId);
Response response = network.postResponse(params,FRIENDS_ASYNCMARKTIMELINEREAD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误"));
//延迟2秒,存入ES
Thread.currentThread().sleep(2000);
//重新获取未读列表
response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
List<String> contentList = response.jsonPath().getList("data.contentId");
boolean unRead = contentList.contains(contentId); //检查是否未读,false为已读,true为未读
Assert.assertFalse(unRead,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"已读后,未读接口没有过滤已读素材"));
}
@Test(description="收藏素材",priority = 6)
public void 收藏素材() throws IOException {
// 收藏素材
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
params.put("operate",1);
Response response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
boolean isAdd = response.jsonPath().getBoolean("data");
Assert.assertTrue(isAdd,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"收藏素材失败"));
// 查看收藏列表
params.put("pageSize",12);
response = network.getResponse(params,FRIENDS_QUERYLISTFORCOLLECT);
String collectContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertEquals(collectContentId,contentId,network.message(params,FRIENDS_QUERYLISTFORCOLLECT,"收藏列表有误"));
// 取消收藏
params.put("operate",2);
response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
boolean isCancel = response.jsonPath().getBoolean("data");
Assert.assertTrue(isCancel,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"取消收藏素材失败"));
}
@Test(description="素材频道页",priority = 7)
public void 素材频道页() throws IOException {
//频道页 头部
Map<String, Object> params = new HashMap<String, Object>();
params.put("tagId",tagId);
Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL);
String name = response.jsonPath().getString("data.tagName");
Assert.assertEquals(name,tagName,network.message(params,FRIENDS_CHANNELDETAIL,"素材频道页-头部获取有误"));
//频道页 列表
params.put("pageSize",10);
params.put("pageNo",1);
response = network.getResponse(params,FRIENDS_GETCHANNELLIST);
String collectTagtId = response.jsonPath().getString("data[0].materialTag"); //素材ID
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertEquals(collectTagtId,tagId,network.message(params,FRIENDS_GETCHANNELLIST, "素材列表获取有误"));
Assert.assertTrue(hasList,network.message(params,FRIENDS_GETCHANNELLIST,"素材频道列表-获取有误"));
}
@Test(description="从首页发圈列表页进入",priority = 8)
public void 从首页发圈列表页进入() throws IOException {
// 获取首页发圈素材列表
Response response = network.getResponse(HOME_GETHOMETIMELINECONTENT);
String currentId = response.jsonPath().getString("data.materialVos[0].contentId");
Assert.assertNotNull(currentId,network.message(HOME_GETHOMETIMELINECONTENT,"获取首页发圈列表有误"));
// 进入发圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("currentId",currentId);
response = network.getResponse(params,FRIENDS_GETCURRENTINFO);
String topContentId = response.jsonPath().getString("data.contentId");
Assert.assertEquals(topContentId,currentId,network.message(params,FRIENDS_GETCURRENTINFO,"从首页进入发圈的头部素材有误"));
}
@AfterClass
public static void tearDown(){
apiCount += 13;
}
}
...@@ -13,7 +13,7 @@ import java.util.Map; ...@@ -13,7 +13,7 @@ import java.util.Map;
public class Home { public class Home {
NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
@BeforeClass @BeforeClass
......
...@@ -16,7 +16,7 @@ import java.util.Map; ...@@ -16,7 +16,7 @@ import java.util.Map;
public class Novice { public class Novice {
NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
......
...@@ -15,7 +15,7 @@ import java.util.Map; ...@@ -15,7 +15,7 @@ import java.util.Map;
public class Pay { public class Pay {
NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
@BeforeClass @BeforeClass
public static void setUp() { public static void setUp() {
......
...@@ -14,7 +14,7 @@ import java.util.HashMap; ...@@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class SellerCard { public class SellerCard {
NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
private String scid = ""; private String scid = "";
private String sellerId = ""; private String sellerId = "";
......
...@@ -13,7 +13,7 @@ import java.util.HashMap; ...@@ -13,7 +13,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class Upload { public class Upload {
NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
......
package com.kjj.qa.cases; package com.kjj.qa.cases;
public class Video { public class Video {
} }
...@@ -14,9 +14,9 @@ public class BasicConfig { ...@@ -14,9 +14,9 @@ public class BasicConfig {
// *************** 钉钉机器人 *************** // *************** 钉钉机器人 ***************
// 线上-告警群 // 线上-告警群
public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2"; // public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
// 测试 // 测试
// public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd"; public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd";
; ;
// *************** 客集集域名 *************** // *************** 客集集域名 ***************
...@@ -35,7 +35,6 @@ public class BasicConfig { ...@@ -35,7 +35,6 @@ public class BasicConfig {
public static final String UPLOAD_CONTENTID = "Kj21NjA1NTE"; public static final String UPLOAD_CONTENTID = "Kj21NjA1NTE";
// *************** 公共 *************** // *************** 公共 ***************
public static final String VERSION_INFO = "/kjy/mp/version/info"; public static final String VERSION_INFO = "/kjy/mp/version/info";
...@@ -55,6 +54,7 @@ public class BasicConfig { ...@@ -55,6 +54,7 @@ public class BasicConfig {
public static final String INTERACTION_LIKE = "/kjy/mp/interaction/like"; public static final String INTERACTION_LIKE = "/kjy/mp/interaction/like";
// *************** 支付 *************** // *************** 支付 ***************
public static final String PAY_GETMIDDLEDETAIL = "/kjy/mp/payMiddle/getMiddleDetail"; public static final String PAY_GETMIDDLEDETAIL = "/kjy/mp/payMiddle/getMiddleDetail";
...@@ -154,11 +154,38 @@ public class BasicConfig { ...@@ -154,11 +154,38 @@ public class BasicConfig {
public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = "/kjy/mp/explosioncontent/getExplosionContentList"; public static final String ARTICLE_GETEXPLOSIONCONTENTLIST = "/kjy/mp/explosioncontent/getExplosionContentList";
// ************** 发圈素材 ***************
public static final String FRIENDS_GETMATERIALTAGS = "/kjy/mp/materialContent/getmaterialTags";
public static final String FRIENDS_ISUSERFIRSTENTERANDCOLLECT = "/kjy/mp/materialContent/isUserFirstEnterAndCollect";
public static final String FRIENDS_COUNTBYFIRSTTAG = "/kjy/mp/timelineContent/countByFirstTag";
public static final String FRIENDS_GETUNREADTIMELINSLIST = "/kjy/mp/timelineContent/getUnreadTimelineList";
public static final String FRIENDS_GETTIMELINELIST = "/kjy/mp/timelineContent/getTimelineList";
public static final String FRIENDS_GETNEWESTCOUNTBYTYPE = "/kjy/mp/home/getNewestCountByType";
public static final String FRIENDS_ASYNCMARKTIMELINEREAD = "/kjy/mp/timelineContent/asyncMarkTimelineRead";
public static final String FRIENDS_ADDORCANCELCOLLECT = "/kjy/mp/materialContent/addOrCancelCollect";
public static final String FRIENDS_QUERYLISTFORCOLLECT = "/kjy/mp/materialContent/queryListForCollect";
public static final String FRIENDS_GETCHANNELLIST = "/kjy/mp/materialContent/getChannelList";
public static final String FRIENDS_CHANNELDETAIL = "/kjy/mp/materialContent/channelDetail";
public static final String FRIENDS_GETCURRENTINFO ="/kjy/mp/timelineContent/getCurrentInfo";
// ************** 首页 ****************
public static final String HOME_GETHOMETIMELINECONTENT = "/kjy/mp/home/getHomeTimeLineContent";
// ************** 设置中心 *************** // ************** 设置中心 ***************
public static final String SELLERCONFIG_EDITCONFIG = "/kjy/mp/sellerConfig/editConfig"; public static final String SELLERCONFIG_EDITCONFIG = "/kjy/mp/sellerConfig/editConfig";
// ************************* 管理后台 ************************** // ************************* 管理后台 **************************
public static final String TESTUSER_DISABLEUSER = "kjj-mng.duibatest.com.cn/kjy/manager/testUser/disableUser"; public static final String TESTUSER_DISABLEUSER = "kjj-mng.duibatest.com.cn/kjy/manager/testUser/disableUser";
......
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
<class name="com.kjj.qa.cases.Article"/> <class name="com.kjj.qa.cases.Article"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="发圈">
<classes>
<class name="com.kjj.qa.cases.CircleFriends"/>
</classes>
</test>
<!-- 监听器--> <!-- 监听器-->
<listeners> <listeners>
<listener class-name="com.kjj.qa.config.ExtentTestNGIReporterListener"/> <listener class-name="com.kjj.qa.config.ExtentTestNGIReporterListener"/>
......
This diff is collapsed.
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