Commit b2643e61 authored by xiamengchen's avatar xiamengchen

Merge branch 'master' into feature/20210730-xmc

parents 53c80cba c7c5f249
package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*;
import com.kjj.utils.NetworkUtils;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
......@@ -12,12 +14,15 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Upload {
private static final NetworkUtils network = NetworkUtils.getInstance();
public class Upload implements Authorization {
@BeforeClass
public void setUp() {
System.out.println();
// System.out.println();
agentTku();
// userTku();
//管理后台登录
BaseUtils.ssoLogin();
}
// @Test(description="会员判断",priority = 1)
......@@ -92,6 +97,7 @@ public class Upload {
public void 上传_视频链接() throws IOException{
//待上传的视频链接
String videoLink = "https://v.douyin.com/oEahcd/ 复制此链接,打开【抖音短视频】,直接观看视频!";
//String videoLink = "https://www.douyin.com/video/6935725226881715460?previous_page=video_detail";
//开始上传
Map<String, Object> params = new HashMap<String, Object>();
......@@ -151,26 +157,8 @@ public class Upload {
Assert.assertEquals(shareLink, network_link,network.message(updateParams, UPLOAD_UPDATEANDSHARE,"传其他链接-上传和分享调用失败",response.body().asString()));
}
@Test(description = "上传_本地视频",priority = 8)
public void 上传_本地视频() throws IOException {
//1.上传视频到oss
String videoFile = "src/test/java/com/kjj/resource/uploadCase.mp4";
Response response = network.postFileResponse(videoFile, UPLOAD_UPLOADVEDIO);
String videoUrl = response.jsonPath().getString("data.videoUrl");
String firstFrameUrl = response.jsonPath().getString("data.firstFrameUrl");
Assert.assertNotNull(videoUrl, network.message(UPLOAD_UPLOADVEDIO,"上传本地视频-上传oss失败",response.body().asString()));
//2.开始上传视频
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("videoUrl",videoUrl);
// params.put("firstFrameUrl",firstFrameUrl);
// params.put("contentTitle","=自动化测试=");
// response = network.postResponse(params, UPLOAD_SELLERUPLOADVEDIO);
// String contentId = response.jsonPath().getString("data.contentId");
// Assert.assertNotNull(contentId,network.message(params, UPLOAD_SELLERUPLOADVEDIO,"上传本地视频-上传第2步失败"));
}
@Test(description="大家都在转_榜单列表",priority = 9)
@Test(description="大家都在转_榜单列表",priority = 8)
public void 大家都在转_榜单列表() throws IOException{
//获取文章的榜单
Response response = network.getResponse(UPLOAD_HOT);
......@@ -188,7 +176,7 @@ public class Upload {
}
//我的上传:
@Test(description="我的上传",priority = 10)
@Test(description="我的上传",priority = 9)
public void 我的上传() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1);
......@@ -197,29 +185,30 @@ public class Upload {
//获取文章的列表
params.put("type","article");
Response response = network.getResponse(params,UPLOAD_LIST);
Response response = network.getResponse(params,UPLOAD_listV2);
int length = response.jsonPath().getInt("data.size()");
String contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 1, network.message(params, UPLOAD_LIST,"获取我的上传-文章列表内容有误",response.body().asString()));
Assert.assertEquals(contentType, "article", network.message(params, UPLOAD_LIST,"获取我的上传-文章列表数量有误",response.body().asString()));
Assert.assertEquals(length, 1, network.message(params, UPLOAD_listV2,"获取我的上传-文章列表内容有误",response.body().asString()));
Assert.assertEquals(contentType, "article", network.message(params, UPLOAD_listV2,"获取我的上传-文章列表数量有误",response.body().asString()));
//获取视频的列表
params.put("type","video");
response = network.getResponse(params, UPLOAD_LIST);
params.put("pageNo",1);
response = network.getResponse(params, UPLOAD_listV2);
length = response.jsonPath().getInt("data.size()");
contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 1, network.message(params, UPLOAD_LIST,"获取我的上传-视频列表内容有误",response.body().asString()));//因为有一篇抖音,一篇本地,所以数量是2
Assert.assertEquals(contentType, "video", network.message(params, UPLOAD_LIST,"获取我的上传-视频列表数量有误",response.body().asString()));
Assert.assertEquals(length, 1, network.message(params, UPLOAD_listV2,"获取我的上传-视频列表内容有误",response.body().asString()));//因为有一篇抖音,一篇本地,所以数量是2
Assert.assertEquals(contentType, "video", network.message(params, UPLOAD_listV2,"获取我的上传-视频列表数量有误",response.body().asString()));
//获取其他的列表
params.put("type","network_link");
response = network.getResponse(params, UPLOAD_LIST);
response = network.getResponse(params, UPLOAD_listV2);
String network_linkId = response.jsonPath().getString("data[0].id");//获取列表的第一篇素材
length = response.jsonPath().getInt("data.size()");
contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 1, network.message(params, UPLOAD_LIST,"获取我的上传-其他列表失败",response.body().asString()));
Assert.assertEquals(contentType, "network_link", network.message(params, UPLOAD_LIST,"获取我的上传-其他列表数量有误",response.body().asString()));
Assert.assertEquals(length, 1, network.message(params, UPLOAD_listV2,"获取我的上传-其他列表失败",response.body().asString()));
Assert.assertEquals(contentType, "network_link", network.message(params, UPLOAD_listV2,"获取我的上传-其他列表数量有误",response.body().asString()));
//删除其他列表的素材
Map<String, Object> unbindParams = new HashMap<String, Object>();
......@@ -229,9 +218,10 @@ public class Upload {
Assert.assertTrue(data,network.message(unbindParams, UPLOAD_UNBIND,"删除我的上传-其他列表的素材失败",response.body().asString()));
//再次获取其他的列表, 检查删除是否生效
response = network.getResponse(params, UPLOAD_LIST);
response = network.getResponse(params, UPLOAD_listV2);
length = response.jsonPath().getInt("data.size()");
Assert.assertEquals(length, 0, network.message(params, UPLOAD_LIST,"获取我的上传-其他列表数量有误",response.body().asString()));
Assert.assertEquals(length, 0, network.message(params, UPLOAD_listV2,"获取我的上传-其他列表数量有误",response.body().asString()));
}
}
\ No newline at end of file
......@@ -694,6 +694,7 @@ public class BasicConfig {
public static final String UPLOAD_HOT = HOST + "/kjy/mp/seller/import/hot";
public static final String UPLOAD_VIDEOHOT = HOST + "/kjy/mp/seller/import/video/hot";
public static final String UPLOAD_LIST = HOST + "/kjy/mp/seller/import/list";
public static final String UPLOAD_listV2 = HOST + "/kjy/mp/seller/import/listV2";
public static final String UPLOAD_UNBIND = HOST + "/kjy/mp/seller/import/unbind";
public static final String UPLOAD_supportDomain = HOST + "/kjy/mp/supportDomain";
public static final String UPLOAD_sellerFirstVisit = HOST + "/kjy/mp/newFunction/sellerFirstVisit";
......
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