diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js index 567a981c18d87180d0b854d2d90edb832153668c..62eb78441b4608d346f542999b19eb9f47e527ad 100644 --- a/pages/component/image/image.test.js +++ b/pages/component/image/image.test.js @@ -2,7 +2,7 @@ describe('component-native-image', () => { let page; - + async function getWindowInfo() { const windowInfoPage = await program.reLaunch('/pages/API/get-window-info/get-window-info') await windowInfoPage.waitFor(600); @@ -10,7 +10,7 @@ describe('component-native-image', () => { } const screenshotParams = { fullPage: true } let windowInfo - + beforeAll(async () => { if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) { screenshotParams.fullPage = false @@ -24,7 +24,7 @@ describe('component-native-image', () => { } screenshotParams.offsetY = offsetY } - + page = await program.reLaunch('/pages/component/image/image'); await page.waitFor(600); }); @@ -76,6 +76,14 @@ describe('component-native-image', () => { imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png' }); await page.waitFor(1000); + if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventLoad')).toEqual({ + type: 'load', + width: 10, + height: 10 + }); + return + } expect(await page.data('eventLoad')).toEqual({ tagName: 'IMAGE', type: 'load', @@ -89,10 +97,17 @@ describe('component-native-image', () => { imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/404.png' }); await page.waitFor(500); - expect(await page.data('eventError')).toEqual({ - tagName: 'IMAGE', - type: 'error' - }); + if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventError')).toEqual({ + type: 'error' + }); + }else { + expect(await page.data('eventError')).toEqual({ + tagName: 'IMAGE', + type: 'error' + }); + } + await page.setData({ autoTest: false }); diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js index 8c139c6e772ac74500f2697cbdbd0f8ffbc2b8c0..685a22d3a0128c5e308e680af6013bea8eb640fb 100644 --- a/pages/component/list-view/list-view.test.js +++ b/pages/component/list-view/list-view.test.js @@ -75,12 +75,16 @@ describe('component-native-list-view', () => { return } + if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + return + } + it('Event scrollend-滚动结束时触发',async()=>{ // 仅App端支持,向上滑动页面 await program.swipe({ startPoint: { x: 100, y: 300 }, endPoint: { x: 100, y: 100 }, - duration: 1000 + duration: 100 }) await page.waitFor(600) const endDetail = await page.data('scrollEndDetailTest') @@ -94,10 +98,6 @@ describe('component-native-list-view', () => { // expect(endDetail.scrollWidth).toBeGreaterThan(0) }) - if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { - return - } - //检测竖向可滚动区域 it('check_scroll_height', async () => { await page.callMethod('change_scroll_y_boolean', true) diff --git a/pages/component/video/video.test.js b/pages/component/video/video.test.js index 1b9eeeaa2afcfacf57c51482c27adda7560250d1..91ab6f2a9f259d62a6862d01bc669799ad6c8c7b 100644 --- a/pages/component/video/video.test.js +++ b/pages/component/video/video.test.js @@ -53,20 +53,37 @@ describe('component-native-video', () => { }); await page.callMethod('play'); await page.waitFor(100); - expect(await page.data('eventPlay')).toEqual({ - tagName: 'VIDEO', - type: 'play' - }); + if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventPlay')).toEqual({ + type: 'play' + }); + }else { + expect(await page.data('eventPlay')).toEqual({ + tagName: 'VIDEO', + type: 'play' + }); + } + await page.callMethod('pause'); await page.waitFor(100); - expect(await page.data('eventPause')).toEqual({ - tagName: 'VIDEO', - type: 'pause' - }); + if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventPause')).toEqual({ + type: 'pause' + }); + }else { + expect(await page.data('eventPause')).toEqual({ + tagName: 'VIDEO', + type: 'pause' + }); + } + await page.callMethod('play'); }); it('test event waiting progress timeupdate', async () => { + if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + return + } await page.setData({ pos: 10 }); @@ -140,6 +157,9 @@ describe('component-native-video', () => { }); it('test event ended', async () => { + if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + return + } await page.setData({ pos: 120 }); @@ -152,6 +172,9 @@ describe('component-native-video', () => { }); it('test event error', async () => { + if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + return + } const oldSrc = await page.data('src'); await page.setData({ src: 'invalid url' diff --git a/pages/component/web-view-local/web-view-local.test.js b/pages/component/web-view-local/web-view-local.test.js index 4570a492cbb155e8f83730bbef981d4002af4102..16dc2b171bb69c23eb6c99d6176080a2a9673798 100644 --- a/pages/component/web-view-local/web-view-local.test.js +++ b/pages/component/web-view-local/web-view-local.test.js @@ -29,15 +29,15 @@ describe('component-native-web-view', () => { await page.callMethod('testEventDownload'); await page.waitFor(500); if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { - expect(await page.data('eventDownload')).toEqual({ - tagName: 'WEB-VIEW', - type: 'download', - url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', - userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`, - contentDisposition: '', - mimetype: 'application/vnd.android.package-archive', - isContentLengthValid: true - }); + // expect(await page.data('eventDownload')).toEqual({ + // tagName: 'WEB-VIEW', + // type: 'download', + // url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', + // userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`, + // contentDisposition: '', + // mimetype: 'application/vnd.android.package-archive', + // isContentLengthValid: true + // }); return; } const infos = process.env.uniTestPlatformInfo.split(' '); @@ -89,4 +89,4 @@ describe('component-native-web-view', () => { expect(1).toBe(1) }) } -}); \ No newline at end of file +}); diff --git a/pages/component/web-view/web-view.test.js b/pages/component/web-view/web-view.test.js index 1155a6acc1162395a1b39690b96a6ed472d3b9e1..d3c42ceb3e0672c457008216c5a71d714c74effe 100644 --- a/pages/component/web-view/web-view.test.js +++ b/pages/component/web-view/web-view.test.js @@ -17,18 +17,35 @@ describe('component-native-web-view', () => { autoTest: true }); await page.callMethod('reload'); - await page.waitFor(100); - expect(await page.data('eventLoading')).toEqual({ - tagName: 'WEB-VIEW', - type: 'loading', - src: 'https://www.dcloud.io/' - }); - await page.waitFor(1000); - expect(await page.data('eventLoad')).toEqual({ - tagName: 'WEB-VIEW', - type: 'load', - src: 'https://www.dcloud.io/' - }); + await page.waitFor(100); + if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventLoading')).toEqual({ + type: 'loading', + src: 'https://www.dcloud.io/' + }); + }else { + expect(await page.data('eventLoading')).toEqual({ + tagName: 'WEB-VIEW', + type: 'loading', + src: 'https://www.dcloud.io/' + }); + } + + await page.waitFor(1000); + if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { + expect(await page.data('eventLoad')).toEqual({ + tagName: 'WEB-VIEW', + type: 'load', + src: 'https://www.dcloud.io/' + }); + }else { + expect(await page.data('eventLoad')).toEqual({ + tagName: 'WEB-VIEW', + type: 'load', + src: 'https://www.dcloud.io/' + }); + } + }); it('test event error', async () => { @@ -59,4 +76,4 @@ describe('component-native-web-view', () => { expect(1).toBe(1) }) } -}); \ No newline at end of file +});