From 97357816e314658a439d91c2de36b1a314bd6b1c Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Sat, 27 Jan 2024 17:51:44 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B0=83=E6=95=B4=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BE=8B=E5=85=BC=E5=AE=B9web=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/download-file/download-file.uvue | 6 +++--- pages/API/get-system-setting/get-system-setting.test.js | 8 +++++++- pages/API/request/request.uvue | 4 ++-- pages/API/upload-file/upload-file.uvue | 8 ++++---- pages/component/navigator/navigator.test.js | 8 +++++++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/pages/API/download-file/download-file.uvue b/pages/API/download-file/download-file.uvue index 55a0b9c3..5e719754 100644 --- a/pages/API/download-file/download-file.uvue +++ b/pages/API/download-file/download-file.uvue @@ -73,7 +73,7 @@ jest_set_cookie(){ uni.request({ - url: "http://request.dcloud.net.cn/api/http/header/setCookie", + url: "https://request.dcloud.net.cn/api/http/header/setCookie", method: "GET", timeout: 6000, sslVerify: false, @@ -90,7 +90,7 @@ jest_delete_cookie(){ uni.request({ - url: "http://request.dcloud.net.cn/api/http/header/deleteCookie", + url: "https://request.dcloud.net.cn/api/http/header/deleteCookie", method: "GET", timeout: 6000, sslVerify: false, @@ -106,7 +106,7 @@ }, jest_cookie_download(needCookie: boolean){ uni.downloadFile({ - url: "http://request.dcloud.net.cn/api/http/header/download", + url: "https://request.dcloud.net.cn/api/http/header/download", success: () => { this.jest_result = needCookie ? true : false; }, diff --git a/pages/API/get-system-setting/get-system-setting.test.js b/pages/API/get-system-setting/get-system-setting.test.js index 851dd076..779c2a5e 100644 --- a/pages/API/get-system-setting/get-system-setting.test.js +++ b/pages/API/get-system-setting/get-system-setting.test.js @@ -1,6 +1,12 @@ const PAGE_PATH = '/pages/API/get-system-setting/get-system-setting' -describe('ExtApi-GetSystemSetting', () => { +describe('ExtApi-GetSystemSetting', () => { + if (process.env.uniTestPlatformInfo.indexOf('web') > -1) { + it('web', () => { + expect(1).toBe(1) + }) + return + } let page; let res; diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index 33489f39..3d3c80b7 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -87,7 +87,7 @@ title: 'request', res: '', task: null as RequestTask | null, - host: "http://request.dcloud.net.cn", + host: "https://request.dcloud.net.cn", url: "/api/http/method/get", method: "GET" as RequestMethod | null, data: null as any | null, @@ -287,4 +287,4 @@ }, } } - + diff --git a/pages/API/upload-file/upload-file.uvue b/pages/API/upload-file/upload-file.uvue index 7cd45b4f..1a59f61d 100644 --- a/pages/API/upload-file/upload-file.uvue +++ b/pages/API/upload-file/upload-file.uvue @@ -97,7 +97,7 @@ }, jest_set_cookie() { uni.request({ - url: "http://request.dcloud.net.cn/api/http/header/setCookie", + url: "https://request.dcloud.net.cn/api/http/header/setCookie", method: "GET", timeout: 6000, sslVerify: false, @@ -114,7 +114,7 @@ jest_delete_cookie() { uni.request({ - url: "http://request.dcloud.net.cn/api/http/header/deleteCookie", + url: "https://request.dcloud.net.cn/api/http/header/deleteCookie", method: "GET", timeout: 6000, sslVerify: false, @@ -131,7 +131,7 @@ jest_cookie_upload(needCookie : boolean) { const imageSrc = "/static/uni.png"; this.task = uni.uploadFile({ - url: 'http://request.dcloud.net.cn/api/http/header/upload', + url: 'https://request.dcloud.net.cn/api/http/header/upload', filePath: imageSrc, name: 'file', success: (res : UploadFileSuccess) => { @@ -196,4 +196,4 @@ font-size: 19px; color: #808080; } - + diff --git a/pages/component/navigator/navigator.test.js b/pages/component/navigator/navigator.test.js index 3263e687..6e68aba0 100644 --- a/pages/component/navigator/navigator.test.js +++ b/pages/component/navigator/navigator.test.js @@ -4,7 +4,13 @@ const PAGE_PATH_REDIRECT = '/pages/component/navigator/redirect' describe('navigator', () => { let page - beforeAll(async () => {}) + beforeAll(async () => { + if(process.env.uniTestPlatformInfo.startsWith('web')) { + // 由于开发期间跳转页面需要编译,web端先跳转一次 + await program.reLaunch(PAGE_PATH_NAVIGATE) + await program.reLaunch(PAGE_PATH_REDIRECT) + } + }) it('navigate', async () => { page = await program.reLaunch(PAGE_PATH) await page.waitFor(500) -- GitLab