From 2a37ccd06109a28d8ea0ee9d268e7482838d0175 Mon Sep 17 00:00:00 2001 From: anne-xml Date: Fri, 22 Nov 2024 11:44:19 +0800 Subject: [PATCH] =?UTF-8?q?test(vuex.test.js)=EF=BC=9A=E8=A7=84=E9=81=BF?= =?UTF-8?q?=E6=9F=90=E4=BA=9Bios=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/vuex-vue/vuex.test.js | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/pages/template/vuex-vue/vuex.test.js b/pages/template/vuex-vue/vuex.test.js index 1aff0ee7..3dc9234a 100644 --- a/pages/template/vuex-vue/vuex.test.js +++ b/pages/template/vuex-vue/vuex.test.js @@ -1,6 +1,8 @@ -let page, nvuePath, vuepath,containsVite, isApp; -containsVite = process.env.UNI_CLI_PATH.includes('uniapp-cli-vite') -isApp = process.env.UNI_PLATFORM.includes('app') +let page; +const containsVite = process.env.UNI_CLI_PATH.includes('uniapp-cli-vite'); +const isApp = process.env.UNI_PLATFORM.includes('app'); +const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase(); + function createTests(pagePath, type) { return describe(`测试页面路径: ${pagePath}`, () => { async function toScreenshot(imgName) { @@ -15,10 +17,16 @@ function createTests(pagePath, type) { }) await page.waitFor(500); } + if (platformInfo === 'ios_simulator 13.7') { + it('skip', async () => { + expect(1).toBe(1) + }) + return + } beforeAll(async () => { page = await program.reLaunch(pagePath) await page.waitFor('view'); - console.log(type,page); + console.log(type, page); await toScreenshot(type) }); afterAll(async () => { @@ -59,25 +67,25 @@ function createTests(pagePath, type) { } // vue3-nvue不支持自动化测试 -nvuePath = '/pages/template/vuex-nvue/vuex-nvue' -vuepath = '/pages/template/vuex-vue/vuex-vue' +const nvuePath = '/pages/template/vuex-nvue/vuex-nvue' +const vuepath = '/pages/template/vuex-vue/vuex-vue' if (containsVite) { console.log('vue3: ', containsVite); - if(isApp){ + if (isApp) { createTests(vuepath, 'vue3-App-vue'); - }else if(process.env.UNI_PLATFORM == 'h5'){ + } else if (process.env.UNI_PLATFORM == 'h5') { createTests(vuepath, 'vue3-H5-vue'); - }else{ + } else { createTests(vuepath, 'vue3-Mp-vue'); } -} else{ +} else { console.log('vue2'); - if(isApp){ + if (isApp) { createTests(nvuePath, 'vue2-App-nvue'); createTests(vuepath, 'vue2-App-vue'); - }else if(process.env.UNI_PLATFORM == 'h5'){ + } else if (process.env.UNI_PLATFORM == 'h5') { createTests(vuepath, 'vue2-H5-vue'); - }else{ + } else { createTests(vuepath, 'vue2-Mp-vue'); } }