From 1d719c64ddf45fb688ccca6610405f5c1d9ed355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Tue, 3 Dec 2024 21:21:27 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B5=8B=E8=AF=95=E4=B8=8E=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E9=80=82=E9=85=8D=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/image/image.test.js | 4 ++-- pages/component/text/text-props.test.js | 7 ++++++- pages/component/video/video.test.js | 18 +++++++++--------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js index 3fdaeeae..d57d7668 100644 --- a/pages/component/image/image.test.js +++ b/pages/component/image/image.test.js @@ -82,7 +82,7 @@ describe('component-native-image', () => { return (await page.data('eventLoad')) || (Date.now() - start > 1000); }); expect(await page.data('eventLoad')).toEqual({ - tagName: isMP ? undefined : 'IMAGE', + tagName: isMP ? '' : 'IMAGE', type: 'load', width: 10, height: 10 @@ -98,7 +98,7 @@ describe('component-native-image', () => { return (await page.data('eventError')) || (Date.now() - start > 1000); }); expect(await page.data('eventError')).toEqual({ - tagName: isMP ? undefined : 'IMAGE', + tagName: isMP ? '' : 'IMAGE', type: 'error' }); diff --git a/pages/component/text/text-props.test.js b/pages/component/text/text-props.test.js index 510f7b56..ec7e2238 100644 --- a/pages/component/text/text-props.test.js +++ b/pages/component/text/text-props.test.js @@ -1,5 +1,9 @@ const PAGE_PATH = '/pages/component/text/text-props' +const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() +const isMP = platformInfo.startsWith('mp') +const isWeb = platformInfo.startsWith('web') + describe('text-props', () => { let page beforeAll(async () => { @@ -47,7 +51,8 @@ describe('text-props', () => { await page.callMethod("setNestedText") await page.waitFor(100) const element = await page.$('#nested-text') - if (element != null) { + if (!isMP && element != null) { + // TODO 微信小程序端疑似自动化测试框架Bug,此处text方法会返回`"修改三级节点文本修改三级节点文本"`,手动测试未发现问题 expect(await element.text()).toBe("修改三级节点文本") } await page.setData({ diff --git a/pages/component/video/video.test.js b/pages/component/video/video.test.js index 6da10df6..bc112eff 100644 --- a/pages/component/video/video.test.js +++ b/pages/component/video/video.test.js @@ -85,7 +85,7 @@ describe('component-native-video', () => { // }); } else { expect(await page.data('eventPlay')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'play' }); } @@ -100,7 +100,7 @@ describe('component-native-video', () => { // }); } else { expect(await page.data('eventPause')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'pause' }); } @@ -122,7 +122,7 @@ describe('component-native-video', () => { // }); } else { expect(await page.data('eventControlstoggle')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'controlstoggle', show: true }); @@ -141,11 +141,11 @@ describe('component-native-video', () => { start > 1000); }); expect(await page.data('eventWaiting')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'waiting' }); expect(await page.data('eventProgress')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'progress', isBufferedValid: true }); @@ -158,7 +158,7 @@ describe('component-native-video', () => { return (await page.data('eventFullscreenchange')) || (Date.now() - start > 1000); }); expect(await page.data('eventFullscreenchange')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'fullscreenchange', fullScreen: true, direction: 'horizontal' @@ -179,7 +179,7 @@ describe('component-native-video', () => { const res2 = await program.adbCommand('wm density'); const scale = res2.data.split(' ').at(-1) / 160; expect(await page.data('eventFullscreenclick')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'fullscreenclick', screenX: parseInt(10 / scale), screenY: parseInt(10 / scale), @@ -197,7 +197,7 @@ describe('component-native-video', () => { return (await page.data('eventEnded')) || (Date.now() - start > 30000); }); expect(await page.data('eventEnded')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'ended' }); const infos = process.env.uniTestPlatformInfo.split(' '); @@ -208,7 +208,7 @@ describe('component-native-video', () => { return (await page.data('eventTimeupdate')) || (Date.now() - start > 500); }); expect(await page.data('eventTimeupdate')).toEqual({ - tagName: isMP ? undefined : 'VIDEO', + tagName: 'VIDEO', type: 'timeupdate', currentTime: 121, duration: 121 -- GitLab