From 691efae3ed40483cb723fec4d0c2cfc984c34787 Mon Sep 17 00:00:00 2001 From: xty Date: Tue, 22 Oct 2024 15:47:19 +0800 Subject: [PATCH] =?UTF-8?q?iOS=2014.5=2013.7=2012.4=20=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BE=9D=E8=B5=96uts=E6=8F=92=E4=BB=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/event-bus/uts-event-bus.test.js | 156 ++++++++++++---------- 1 file changed, 84 insertions(+), 72 deletions(-) diff --git a/pages/API/event-bus/uts-event-bus.test.js b/pages/API/event-bus/uts-event-bus.test.js index 4156af3b..83bd6715 100644 --- a/pages/API/event-bus/uts-event-bus.test.js +++ b/pages/API/event-bus/uts-event-bus.test.js @@ -1,73 +1,85 @@ -// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ -const PAGE_PATH = '/pages/API/event-bus/uts-event-bus' - - -describe('event-bus', () => { - - if ( !process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { - it('pass', async () => { - expect(1).toBe(1); - }); - return; - } - - let page - beforeAll(async () => { - page = await program.reLaunch(PAGE_PATH) - await page.waitFor('view') - }) - - it('on', async () => { - await page.callMethod('clear') - await page.callMethod('JsOnUts') - await page.callMethod('emitFromUts') - const l1 = (await page.data()).log.length - expect(l1).toBeGreaterThan(0) - - - await page.callMethod('clear') - await page.callMethod('offUts') - await page.callMethod('emitFromUts') - const l2 = (await page.data()).log.length - expect(l2).toBe(0) - - await page.callMethod('clear') - await page.callMethod('UtsOnJS') - await page.callMethod('emitFormJS') - const l3 = (await page.data()).log.length - expect(l3).toBeGreaterThan(0) - - await page.callMethod('clear') - await page.callMethod('offJs') - await page.callMethod('emitFormJS') - const l4 = (await page.data()).log.length - console.log(l4) - expect(l4).toBe(0) - await page.callMethod('clear') - }) - - it('once', async () => { - await page.callMethod('clear') - await page.callMethod('JsOnUtsOnce') - await page.callMethod('emitFromUts') - const l1 = (await page.data()).log.length - expect(l1).toBeGreaterThan(0) - await page.callMethod('clear') - await page.callMethod('emitFromUts') - const l2 = (await page.data()).log.length - expect(l2).toBe(0) - - await page.callMethod('clear') - await page.callMethod('UtsOnJSOnce') - await page.callMethod('emitFormJS') - const l3 = (await page.data()).log.length - expect(l3).toBeGreaterThan(0) - await page.callMethod('clear') - await page.callMethod('emitFormJS') - const l4 = (await page.data()).log.length - expect(l4).toBe(0) - - await page.callMethod('clear') - }) - +// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ +const PAGE_PATH = '/pages/API/event-bus/uts-event-bus' + + +describe('event-bus', () => { + const platformInfo = process.env.uniTestPlatformInfo.toLowerCase() + if (!platformInfo.startsWith('ios')) { + it('pass', async () => { + expect(1).toBe(1); + }); + return; + } + + if ( + platformInfo.indexOf('14.5') != -1 || + platformInfo.indexOf('13.7') != -1 || + platformInfo.indexOf('12.4') != -1 + ) { + it('iOS 14.5 13.7 12.4 不支持依赖uts插件测试', () => { + expect(1).toBe(1) + }) + return + } + + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor('view') + }) + + it('on', async () => { + await page.callMethod('clear') + await page.callMethod('JsOnUts') + await page.callMethod('emitFromUts') + const l1 = (await page.data()).log.length + expect(l1).toBeGreaterThan(0) + + + await page.callMethod('clear') + await page.callMethod('offUts') + await page.callMethod('emitFromUts') + const l2 = (await page.data()).log.length + expect(l2).toBe(0) + + await page.callMethod('clear') + await page.callMethod('UtsOnJS') + await page.callMethod('emitFormJS') + const l3 = (await page.data()).log.length + expect(l3).toBeGreaterThan(0) + + await page.callMethod('clear') + await page.callMethod('offJs') + await page.callMethod('emitFormJS') + const l4 = (await page.data()).log.length + console.log(l4) + expect(l4).toBe(0) + await page.callMethod('clear') + }) + + it('once', async () => { + await page.callMethod('clear') + await page.callMethod('JsOnUtsOnce') + await page.callMethod('emitFromUts') + const l1 = (await page.data()).log.length + expect(l1).toBeGreaterThan(0) + await page.callMethod('clear') + await page.callMethod('emitFromUts') + const l2 = (await page.data()).log.length + expect(l2).toBe(0) + + await page.callMethod('clear') + await page.callMethod('UtsOnJSOnce') + await page.callMethod('emitFormJS') + const l3 = (await page.data()).log.length + expect(l3).toBeGreaterThan(0) + await page.callMethod('clear') + await page.callMethod('emitFormJS') + const l4 = (await page.data()).log.length + expect(l4).toBe(0) + + await page.callMethod('clear') + }) + }) -- GitLab