From 354384a3187a365f0e6c1b26aa50ba5f539d1219 Mon Sep 17 00:00:00 2001 From: taohebin Date: Fri, 24 May 2024 13:05:56 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E6=94=B9=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E8=AE=BF=E9=97=AE=E7=BD=91=E7=BB=9Capi=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E4=BE=8B=EF=BC=8C?= =?UTF-8?q?=E5=B1=8F=E8=94=BD14=E5=8F=8A=E4=BB=A5=E4=B8=8B=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/download-file/download-file.test.js | 44 +++++++++++-------- pages/API/request/request.test.js | 21 ++++++--- pages/API/upload-file/upload-file.test.js | 24 ++++++---- 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/pages/API/download-file/download-file.test.js b/pages/API/download-file/download-file.test.js index 75aec1d7..fe16cece 100644 --- a/pages/API/download-file/download-file.test.js +++ b/pages/API/download-file/download-file.test.js @@ -20,24 +20,30 @@ describe('ExtApi-DownloadFile', () => { it('Check ', async () => { expect(res).toBe(true); - }); - - - if (!process.env.uniTestPlatformInfo.startsWith('web')) { - it('Check uni.env', async () => { - await page.callMethod('jest_downloadFile_with_uni_env'); - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true); - }); - - it('Check Download File In UTS Module', async () => { - res = await page.callMethod('jest_uts_module_invoked') - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true) - }) - } + }); + + + if (!process.env.uniTestPlatformInfo.startsWith('web')) { + it('Check uni.env', async () => { + await page.callMethod('jest_downloadFile_with_uni_env'); + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true); + }); + + // 15以下的模拟器所对应的xcode不能编译自定义插件 + let version = process.env.uniTestPlatformInfo + let split = version.split(" ") + version = parseInt(split[split.length - 1]) + if(!process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios') || version > 14) { + it('Check Download File In UTS Module', async () => { + res = await page.callMethod('jest_uts_module_invoked') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }) + } + } let shouldTestCookie = false @@ -65,4 +71,4 @@ describe('ExtApi-DownloadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 3dfdafd9..1931eac7 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -98,7 +98,7 @@ describe('ExtApi-Request', () => { shouldTestCookie = version > 9 } - if (process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { + if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { shouldTestCookie = true } @@ -130,10 +130,17 @@ describe('ExtApi-Request', () => { res = await page.data('jest_result'); expect(res).toBe(true) }) - it('Check Post In UTS Module', async () => { - res = await page.callMethod('jest_uts_module_invoked') - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true) - }) + + // 15以下的模拟器所对应的xcode不能编译自定义插件 + let version = process.env.uniTestPlatformInfo + let split = version.split(" ") + version = parseInt(split[split.length - 1]) + if(!process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios') || version > 14) { + it('Check Post In UTS Module', async () => { + res = await page.callMethod('jest_uts_module_invoked') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }) + } }); diff --git a/pages/API/upload-file/upload-file.test.js b/pages/API/upload-file/upload-file.test.js index 98163266..2789b9e9 100644 --- a/pages/API/upload-file/upload-file.test.js +++ b/pages/API/upload-file/upload-file.test.js @@ -34,14 +34,20 @@ describe('ExtApi-UploadFile', () => { await page.waitFor(2000); res = await page.data('jest_result'); expect(res).toBe(true) - }); - - it('Check Upload File In UTS Module', async () => { - res = await page.callMethod('jest_uts_module_invoked') - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true) - }) + }); + + // 15以下的模拟器所对应的xcode不能编译自定义插件 + let version = process.env.uniTestPlatformInfo + let split = version.split(" ") + version = parseInt(split[split.length - 1]) + if(!process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios') || version > 14) { + it('Check Upload File In UTS Module', async () => { + res = await page.callMethod('jest_uts_module_invoked') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }) + } let shouldTestCookie = false if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { @@ -66,4 +72,4 @@ describe('ExtApi-UploadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); -- GitLab