From 4850475d4726abeacd6331848f15e7c8e207702a Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Mon, 21 Oct 2024 18:15:09 +0800 Subject: [PATCH] =?UTF-8?q?test(saveImageToPhotosAlbum):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../save-image-to-photos-album.test.js | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js b/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js index 46e34fcf..61b247f1 100644 --- a/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js +++ b/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js @@ -1,25 +1,26 @@ -// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ -describe('API-saveImageToPhotosAlbum', () => { - if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { - it('pass', async () => { - expect(1).toBe(1); - }); - return; - } - - let page; - beforeAll(async () => { - page = await program.reLaunch('/pages/API/save-image-to-photos-album/save-image-to-photos-album'); - await page.waitFor(500); - }); - - it('test saveImageToPhotosAlbum', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { - await program.adbCommand( - 'pm grant io.dcloud.uniappx android.permission.WRITE_EXTERNAL_STORAGE'); - await page.waitFor(500); - } - await page.callMethod('saveImage'); - expect(await page.data('success')).toBe(true); - }); +const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() +const isAndroid = platformInfo.startsWith('android') + + +describe('API-saveImageToPhotosAlbum', () => { + if (!isAndroid) { + it('pass', async () => { + expect(1).toBe(1); + }); + return; + } + + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/API/save-image-to-photos-album/save-image-to-photos-album'); + await page.waitFor(500); + }); + + it('test saveImageToPhotosAlbum', async () => { + await program.adbCommand( + 'pm grant io.dcloud.uniappx android.permission.WRITE_EXTERNAL_STORAGE'); + await page.waitFor(500); + await page.callMethod('saveImage'); + expect(await page.data('success')).toBe(true); + }); }); -- GitLab