From 965c0628df262185326987676af16512446396e7 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Mon, 27 Nov 2023 23:03:19 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=A7=84=E9=81=BF=20web=20=E7=AB=AF?= =?UTF-8?q?=E4=B8=8D=E5=85=BC=E5=AE=B9=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/get-app/get-app.test.js | 95 +++--- .../globalProperties/globalProperties.test.js | 99 ++++-- .../list-view/list-view-multiplex.test.js | 32 +- pages/component/list-view/list-view.test.js | 10 +- .../sticky-header/sticky-header.test.js | 33 +- .../sticky-section/sticky-section.test.js | 33 +- .../web-view-local/web-view-local.test.js | 48 +-- pages/component/web-view/web-view.test.js | 34 +- pages/pages.test.js | 307 +++++++++--------- 9 files changed, 392 insertions(+), 299 deletions(-) diff --git a/pages/API/get-app/get-app.test.js b/pages/API/get-app/get-app.test.js index 8d01b33e..c61dddaa 100644 --- a/pages/API/get-app/get-app.test.js +++ b/pages/API/get-app/get-app.test.js @@ -1,38 +1,57 @@ -const PAGE_PATH = '/pages/API/get-app/get-app' - -describe('getApp', () => { - let page = null - beforeAll(async () => { - page = await program.navigateTo(PAGE_PATH) - await page.waitFor('view') - }) - it('globalData', async () => { - await page.callMethod('getGlobalData') - let data = await page.data() - expect(data.originGlobalData.str).toBe('default globalData str') - expect(data.originGlobalData.num).toBe(0) - expect(data.originGlobalData.bool).toBe(false) - expect(data.originGlobalData.obj).toEqual({bool: false, num: 0, str: 'default globalData obj str'}) - expect(data.originGlobalData.arr).toEqual([]) - expect(data.originGlobalData.set).toEqual([]) - expect(data.originGlobalData.map).toEqual({}) - expect(data.originGlobalDataFuncRes).toBe('globalData func') - await page.callMethod('setGlobalData') - data = await page.data() - expect(data.newGlobalData.str).toBe('new globalData str') - expect(data.newGlobalData.num).toBe(100) - expect(data.newGlobalData.bool).toBe(true) - expect(data.newGlobalData.obj).toEqual({bool: true, num: 200, str: 'new globalData obj str'}) - expect(data.newGlobalData.arr).toEqual([1,2,3]) - expect(data.newGlobalData.set).toEqual(['a', 'b', 'c']) - expect(data.newGlobalData.map).toEqual({'a': 1, 'b': 2, 'c': 3}) - expect(data.newGlobalDataFuncRes).toBe('new globalData func') - }) - it('method', async () => { - const oldLifeCycleNum = await page.data('lifeCycleNum') - await page.callMethod('_increasetLifeCycleNum') - const newLifeCycleNum = await page.data('lifeCycleNum') - expect(newLifeCycleNum - oldLifeCycleNum).toBe(100) - await page.callMethod('setLifeCycleNum', oldLifeCycleNum) - }) -}) +const PAGE_PATH = '/pages/API/get-app/get-app' + +describe('getApp', () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page = null + beforeAll(async () => { + page = await program.navigateTo(PAGE_PATH) + await page.waitFor('view') + }) + it('globalData', async () => { + await page.callMethod('getGlobalData') + let data = await page.data() + expect(data.originGlobalData.str).toBe('default globalData str') + expect(data.originGlobalData.num).toBe(0) + expect(data.originGlobalData.bool).toBe(false) + expect(data.originGlobalData.obj).toEqual({ + bool: false, + num: 0, + str: 'default globalData obj str' + }) + expect(data.originGlobalData.arr).toEqual([]) + expect(data.originGlobalData.set).toEqual([]) + expect(data.originGlobalData.map).toEqual({}) + expect(data.originGlobalDataFuncRes).toBe('globalData func') + await page.callMethod('setGlobalData') + data = await page.data() + expect(data.newGlobalData.str).toBe('new globalData str') + expect(data.newGlobalData.num).toBe(100) + expect(data.newGlobalData.bool).toBe(true) + expect(data.newGlobalData.obj).toEqual({ + bool: true, + num: 200, + str: 'new globalData obj str' + }) + expect(data.newGlobalData.arr).toEqual([1, 2, 3]) + expect(data.newGlobalData.set).toEqual(['a', 'b', 'c']) + expect(data.newGlobalData.map).toEqual({ + 'a': 1, + 'b': 2, + 'c': 3 + }) + expect(data.newGlobalDataFuncRes).toBe('new globalData func') + }) + it('method', async () => { + const oldLifeCycleNum = await page.data('lifeCycleNum') + await page.callMethod('_increasetLifeCycleNum') + const newLifeCycleNum = await page.data('lifeCycleNum') + expect(newLifeCycleNum - oldLifeCycleNum).toBe(100) + await page.callMethod('setLifeCycleNum', oldLifeCycleNum) + }) + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file diff --git a/pages/API/globalProperties/globalProperties.test.js b/pages/API/globalProperties/globalProperties.test.js index e116b502..0e787f5d 100644 --- a/pages/API/globalProperties/globalProperties.test.js +++ b/pages/API/globalProperties/globalProperties.test.js @@ -1,36 +1,65 @@ -const PAGE_PATH = '/pages/API/globalProperties/globalProperties' - -describe('globalProperties', () => { - let page = null - beforeAll(async () => { - page = await program.navigateTo(PAGE_PATH) - await page.waitFor(500) - }) - it('globalProperties', async () => { - let data = await page.data() - expect(data.myGlobalProperties.str).toBe('default string') - expect(data.myGlobalProperties.num).toBe(0) - expect(data.myGlobalProperties.bool).toBe(false) - expect(data.myGlobalProperties.obj).toEqual({bool: false, num: 0, str: 'default globalProperties obj string'}) - expect(data.myGlobalProperties.arr).toEqual([]) - expect(data.myGlobalProperties.set).toEqual([]) - expect(data.myGlobalProperties.map).toEqual({}) - expect(data.myGlobalProperties.reactiveObj).toEqual({str: 'default reactive string', num: 0, bool: false}) - expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: default string, globalPropertiesNum: 0') - await page.callMethod('updateGlobalProperties') - data = await page.data() - expect(data.myGlobalProperties.str).toBe('new string') - expect(data.myGlobalProperties.num).toBe(100) - expect(data.myGlobalProperties.bool).toBe(true) - expect(data.myGlobalProperties.obj).toEqual({bool: true, num: 100, str: 'new globalProperties obj string'}) - expect(data.myGlobalProperties.arr).toEqual([1,2,3]) - expect(data.myGlobalProperties.set).toEqual(['a', 'b', 'c']) - expect(data.myGlobalProperties.map).toEqual({'a': 1, 'b': 2, 'c': 3}) - expect(data.myGlobalProperties.reactiveObj).toEqual({str: 'new reactive string', num: 200, bool: true}) - expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: new string, globalPropertiesNum: 100') - }) - it('screenshot', async () => { - const image = await program.screenshot({fullPage: true}); - expect(image).toMatchImageSnapshot(); - }) +const PAGE_PATH = '/pages/API/globalProperties/globalProperties' + +describe('globalProperties', () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page = null + beforeAll(async () => { + page = await program.navigateTo(PAGE_PATH) + await page.waitFor(500) + }) + it('globalProperties', async () => { + let data = await page.data() + expect(data.myGlobalProperties.str).toBe('default string') + expect(data.myGlobalProperties.num).toBe(0) + expect(data.myGlobalProperties.bool).toBe(false) + expect(data.myGlobalProperties.obj).toEqual({ + bool: false, + num: 0, + str: 'default globalProperties obj string' + }) + expect(data.myGlobalProperties.arr).toEqual([]) + expect(data.myGlobalProperties.set).toEqual([]) + expect(data.myGlobalProperties.map).toEqual({}) + expect(data.myGlobalProperties.reactiveObj).toEqual({ + str: 'default reactive string', + num: 0, + bool: false + }) + expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: default string, globalPropertiesNum: 0') + await page.callMethod('updateGlobalProperties') + data = await page.data() + expect(data.myGlobalProperties.str).toBe('new string') + expect(data.myGlobalProperties.num).toBe(100) + expect(data.myGlobalProperties.bool).toBe(true) + expect(data.myGlobalProperties.obj).toEqual({ + bool: true, + num: 100, + str: 'new globalProperties obj string' + }) + expect(data.myGlobalProperties.arr).toEqual([1, 2, 3]) + expect(data.myGlobalProperties.set).toEqual(['a', 'b', 'c']) + expect(data.myGlobalProperties.map).toEqual({ + 'a': 1, + 'b': 2, + 'c': 3 + }) + expect(data.myGlobalProperties.reactiveObj).toEqual({ + str: 'new reactive string', + num: 200, + bool: true + }) + expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: new string, globalPropertiesNum: 100') + }) + it('screenshot', async () => { + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toMatchImageSnapshot(); + }) + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } }) diff --git a/pages/component/list-view/list-view-multiplex.test.js b/pages/component/list-view/list-view-multiplex.test.js index 77be035a..5d2b4e01 100644 --- a/pages/component/list-view/list-view-multiplex.test.js +++ b/pages/component/list-view/list-view-multiplex.test.js @@ -1,16 +1,22 @@ describe('component-native-list-view', () => { - let page - beforeAll(async () => { - //打开list-view-multiplex测试页 - page = await program.reLaunch('/pages/component/list-view/list-view-multiplex') - await page.waitFor('list-view') - }) - - //滚动list-view到底部 加载更多 如果异常则直接闪退 - it('check_list_item_multiplex', async () => { - await page.callMethod('listViewScrollByY', 5000) - await page.waitFor(400) - await page.callMethod('listViewScrollByY', 100) - }) + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page + beforeAll(async () => { + //打开list-view-multiplex测试页 + page = await program.reLaunch('/pages/component/list-view/list-view-multiplex') + await page.waitFor('list-view') + }) + //滚动list-view到底部 加载更多 如果异常则直接闪退 + it('check_list_item_multiplex', async () => { + await page.callMethod('listViewScrollByY', 5000) + await page.waitFor(400) + await page.callMethod('listViewScrollByY', 100) + }) + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } }) diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js index 1b31fc1d..7b50721b 100644 --- a/pages/component/list-view/list-view.test.js +++ b/pages/component/list-view/list-view.test.js @@ -1,4 +1,5 @@ -describe('component-native-list-view', () => { +describe('component-native-list-view', () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { let page beforeAll(async () => { //打开list-view测试页 @@ -75,5 +76,10 @@ describe('component-native-list-view', () => { await page.callMethod('item_change_size_enum', 0) expect(scrollLeft-1080).toBeGreaterThanOrEqual(0) }) - + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } }) diff --git a/pages/component/sticky-header/sticky-header.test.js b/pages/component/sticky-header/sticky-header.test.js index 2bd2af47..ba8674e4 100644 --- a/pages/component/sticky-header/sticky-header.test.js +++ b/pages/component/sticky-header/sticky-header.test.js @@ -1,14 +1,21 @@ describe('component-native-sticky-header', () => { - let page - beforeAll(async () => { - page = await program.reLaunch('/pages/component/sticky-header/sticky-header') - await page.waitFor('sticky-header') - }) - - //检测吸顶效果 - it('check_sticky_header', async () => { - await page.callMethod('confirm_scroll_top_input', 600) - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - }) -}) + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page + beforeAll(async () => { + page = await program.reLaunch('/pages/component/sticky-header/sticky-header') + await page.waitFor('sticky-header') + }) + + //检测吸顶效果 + it('check_sticky_header', async () => { + await page.callMethod('confirm_scroll_top_input', 600) + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index 692525de..c7e82b48 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -1,14 +1,21 @@ describe('component-native-sticky-section', () => { - let page - beforeAll(async () => { - page = await program.reLaunch('/pages/component/sticky-section/sticky-section') - await page.waitFor('sticky-section') - }) - - //检测吸顶上推效果 - it('check_sticky_section', async () => { - await page.callMethod('listViewScrollByY', 1000) - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - }) -}) + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page + beforeAll(async () => { + page = await program.reLaunch('/pages/component/sticky-section/sticky-section') + await page.waitFor('sticky-section') + }) + + //检测吸顶上推效果 + it('check_sticky_section', async () => { + await page.callMethod('listViewScrollByY', 1000) + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file 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 f7a01636..767c7702 100644 --- a/pages/component/web-view-local/web-view-local.test.js +++ b/pages/component/web-view-local/web-view-local.test.js @@ -1,23 +1,25 @@ -// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ - -describe('component-native-web-view', () => { - let page; - beforeAll(async () => { - page = await program.reLaunch('/pages/component/web-view-local/web-view-local'); - await page.waitFor(1000); - }); - - it('check_load_url', async () => { - expect(await page.data('loadError')).toBe(false) - }); - - it('screenshot', async () => { - await page.waitFor(async () => { - return await page.data('loadFinish') === true; - }); - const image = await program.screenshot({ - fullPage: true - }); - expect(image).toMatchImageSnapshot(); - }); -}); +// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('component-native-web-view', () => { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/component/web-view-local/web-view-local'); + await page.waitFor(1000); + }); + + it('check_load_url', async () => { + expect(await page.data('loadError')).toBe(false) + }); + + it('screenshot', async () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { + await page.waitFor(async () => { + return await page.data('loadFinish') === true; + }); + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toMatchImageSnapshot(); + } + }); +}); \ 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 bca16763..3ab08625 100644 --- a/pages/component/web-view/web-view.test.js +++ b/pages/component/web-view/web-view.test.js @@ -1,14 +1,20 @@ -// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ - -describe('component-native-web-view', () => { - - let page; - beforeAll(async () => { - page = await program.reLaunch('/pages/component/web-view/web-view'); - await page.waitFor(3000); - }); - - it('check_load_url', async () => { - expect(await page.data('loadError')).toBe(false) - }); -}); +// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('component-native-web-view', () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/component/web-view/web-view'); + await page.waitFor(3000); + }); + + it('check_load_url', async () => { + expect(await page.data('loadError')).toBe(false) + }); + } else { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + } +}); \ No newline at end of file diff --git a/pages/pages.test.js b/pages/pages.test.js index 595bafdf..8a85d605 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -1,150 +1,161 @@ -let pageIndex = 0 -const pages = [ - // component - '/pages/component/button/button', - '/pages/component/checkbox/checkbox', - '/pages/component/general-attribute/general-attribute', - '/pages/component/general-event/general-event', - '/pages/component/image/image-format', - // '/pages/component/image/image-large', // 截图过大 - '/pages/component/image/image-mode', - // '/pages/component/image/image-path', // 网络资源加载,单独测试例截图 - '/pages/component/image/image', - // '/pages/component/input/input', // 自动获取焦点,单独测试例截图 - '/pages/component/list-view/list-view', - '/pages/component/navigator/navigate', - '/pages/component/navigator/navigator', - '/pages/component/navigator/redirect', - // '/pages/component/picker-view/picker-view', //动态内容 - '/pages/component/progress/progress', - '/pages/component/radio/radio', - '/pages/component/rich-text/rich-text-complex', - '/pages/component/rich-text/rich-text-tags', - '/pages/component/rich-text/rich-text', - '/pages/component/scroll-view/scroll-view-custom-refresher-props', - '/pages/component/scroll-view/scroll-view-props', - '/pages/component/scroll-view/scroll-view-refresher-props', - '/pages/component/scroll-view/scroll-view-refresher', - '/pages/component/scroll-view/scroll-view', - '/pages/component/slider/slider', - '/pages/component/slider-100/slider-100', - '/pages/component/swiper/swiper', - '/pages/component/switch/switch', - '/pages/component/text/text-props', - '/pages/component/text/text', - '/pages/component/textarea/textarea', - // '/pages/component/video/video', - '/pages/component/view/view', - // '/pages/component/web-view/web-view', // 动态内容 - // '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图 - '/pages/component/general-event/transition-event', - - // CSS - '/pages/CSS/background/background-color', - '/pages/CSS/background/background-image', - '/pages/CSS/border/complex-border/complex-border', - '/pages/CSS/border/border-bottom', - '/pages/CSS/border/border-color', - '/pages/CSS/border/border-left', - '/pages/CSS/border/border-radius', - '/pages/CSS/border/border-right', - '/pages/CSS/border/border-style', - '/pages/CSS/border/border-top', - '/pages/CSS/border/border-width', - '/pages/CSS/border/border', - // '/pages/CSS/box-shadow/box-shadow', - '/pages/CSS/display/flex', - '/pages/CSS/display/none', - '/pages/CSS/flex/align-content', - '/pages/CSS/flex/align-items', - '/pages/CSS/flex/flex-basis', - '/pages/CSS/flex/flex-direction', - '/pages/CSS/flex/flex-flow', - '/pages/CSS/flex/flex-grow', - '/pages/CSS/flex/flex-shrink', - '/pages/CSS/flex/flex', - '/pages/CSS/flex/justify-content', - '/pages/CSS/layout/height', - '/pages/CSS/layout/max-height', - '/pages/CSS/layout/max-width', - '/pages/CSS/layout/min-height', - '/pages/CSS/layout/min-width', - '/pages/CSS/layout/position', - '/pages/CSS/layout/visibility', - '/pages/CSS/layout/width', - '/pages/CSS/layout/z-index', - '/pages/CSS/margin/margin-bottom', - '/pages/CSS/margin/margin-left', - '/pages/CSS/margin/margin-right', - '/pages/CSS/margin/margin-top', - '/pages/CSS/margin/margin', - '/pages/CSS/padding/padding-bottom', - '/pages/CSS/padding/padding-left', - '/pages/CSS/padding/padding-right', - '/pages/CSS/padding/padding-top', - '/pages/CSS/padding/padding', - '/pages/CSS/text/color', - // '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图 - '/pages/CSS/text/font-size', - '/pages/CSS/text/font-style', - '/pages/CSS/text/font-weight', - '/pages/CSS/text/letter-spacing', - '/pages/CSS/text/line-height', - '/pages/CSS/text/text-align', - '/pages/CSS/text/text-decoration-line', - '/pages/CSS/text/text-overflow', - '/pages/CSS/transform/rotate', - '/pages/CSS/transform/scale', - '/pages/CSS/transform/translate', - '/pages/CSS/transition/transition', - - // tabBar //改动频繁,不再测试 - // '/pages/tabBar/API', - // '/pages/tabBar/component', - // '/pages/tabBar/CSS', - // '/pages/tabBar/template', - - // template - // '/pages/template/calendar/calendar', // 动态内容 - '/pages/template/custom-refresher/custom-refresher', - '/pages/template/custom-tab-bar/custom-tab-bar', - // '/pages/template/drop-card/drop-card', - '/pages/template/half-screen/half-screen', - // '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图 - // '/pages/template/long-list/long-list', // 动态内容 - '/pages/template/navbar-lite/navbar-lite', - '/pages/template/pull-zoom-image/pull-zoom-image', - '/pages/template/scroll-fold-nav/scroll-fold-nav', - '/pages/template/scroll-sticky/scroll-sticky', - '/pages/template/swiper-list/swiper-list', - '/pages/template/swiper-list2/swiper-list2', - // '/pages/template/swiper-vertical-video/swiper-vertical-video' - - // api - '/pages/API/element-draw/element-draw', -] +let pageIndex = 0 +const pages = [ + // component + '/pages/component/button/button', + '/pages/component/checkbox/checkbox', + '/pages/component/general-attribute/general-attribute', + '/pages/component/general-event/general-event', + '/pages/component/image/image-format', + // '/pages/component/image/image-large', // 截图过大 + '/pages/component/image/image-mode', + // '/pages/component/image/image-path', // 网络资源加载,单独测试例截图 + '/pages/component/image/image', + // '/pages/component/input/input', // 自动获取焦点,单独测试例截图 + // '/pages/component/list-view/list-view', + '/pages/component/navigator/navigate', + '/pages/component/navigator/navigator', + '/pages/component/navigator/redirect', + // '/pages/component/picker-view/picker-view', //动态内容 + '/pages/component/progress/progress', + '/pages/component/radio/radio', + '/pages/component/rich-text/rich-text-complex', + '/pages/component/rich-text/rich-text-tags', + '/pages/component/rich-text/rich-text', + '/pages/component/scroll-view/scroll-view-custom-refresher-props', + '/pages/component/scroll-view/scroll-view-props', + '/pages/component/scroll-view/scroll-view-refresher-props', + '/pages/component/scroll-view/scroll-view-refresher', + '/pages/component/scroll-view/scroll-view', + '/pages/component/slider/slider', + '/pages/component/slider-100/slider-100', + '/pages/component/swiper/swiper', + '/pages/component/switch/switch', + '/pages/component/text/text-props', + '/pages/component/text/text', + '/pages/component/textarea/textarea', + // '/pages/component/video/video', + '/pages/component/view/view', + // '/pages/component/web-view/web-view', // 动态内容 + // '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图 + '/pages/component/general-event/transition-event', + + // CSS + '/pages/CSS/background/background-color', + '/pages/CSS/background/background-image', + '/pages/CSS/border/complex-border/complex-border', + '/pages/CSS/border/border-bottom', + '/pages/CSS/border/border-color', + '/pages/CSS/border/border-left', + '/pages/CSS/border/border-radius', + '/pages/CSS/border/border-right', + '/pages/CSS/border/border-style', + '/pages/CSS/border/border-top', + '/pages/CSS/border/border-width', + '/pages/CSS/border/border', + // '/pages/CSS/box-shadow/box-shadow', + '/pages/CSS/display/flex', + '/pages/CSS/display/none', + '/pages/CSS/flex/align-content', + '/pages/CSS/flex/align-items', + '/pages/CSS/flex/flex-basis', + '/pages/CSS/flex/flex-direction', + '/pages/CSS/flex/flex-flow', + '/pages/CSS/flex/flex-grow', + '/pages/CSS/flex/flex-shrink', + '/pages/CSS/flex/flex', + '/pages/CSS/flex/justify-content', + '/pages/CSS/layout/height', + '/pages/CSS/layout/max-height', + '/pages/CSS/layout/max-width', + '/pages/CSS/layout/min-height', + '/pages/CSS/layout/min-width', + '/pages/CSS/layout/position', + '/pages/CSS/layout/visibility', + '/pages/CSS/layout/width', + '/pages/CSS/layout/z-index', + '/pages/CSS/margin/margin-bottom', + '/pages/CSS/margin/margin-left', + '/pages/CSS/margin/margin-right', + '/pages/CSS/margin/margin-top', + '/pages/CSS/margin/margin', + '/pages/CSS/padding/padding-bottom', + '/pages/CSS/padding/padding-left', + '/pages/CSS/padding/padding-right', + '/pages/CSS/padding/padding-top', + '/pages/CSS/padding/padding', + '/pages/CSS/text/color', + // '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图 + '/pages/CSS/text/font-size', + '/pages/CSS/text/font-style', + '/pages/CSS/text/font-weight', + '/pages/CSS/text/letter-spacing', + '/pages/CSS/text/line-height', + '/pages/CSS/text/text-align', + '/pages/CSS/text/text-decoration-line', + '/pages/CSS/text/text-overflow', + '/pages/CSS/transform/rotate', + '/pages/CSS/transform/scale', + '/pages/CSS/transform/translate', + // '/pages/CSS/transition/transition', + + // tabBar //改动频繁,不再测试 + // '/pages/tabBar/API', + // '/pages/tabBar/component', + // '/pages/tabBar/CSS', + // '/pages/tabBar/template', + + // template + // '/pages/template/calendar/calendar', // 动态内容 + '/pages/template/custom-refresher/custom-refresher', + '/pages/template/custom-tab-bar/custom-tab-bar', + // '/pages/template/drop-card/drop-card', + '/pages/template/half-screen/half-screen', + // '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图 + // '/pages/template/long-list/long-list', // 动态内容 + '/pages/template/navbar-lite/navbar-lite', + '/pages/template/pull-zoom-image/pull-zoom-image', + '/pages/template/scroll-fold-nav/scroll-fold-nav', + '/pages/template/scroll-sticky/scroll-sticky', + // '/pages/template/swiper-list/swiper-list', + // '/pages/template/swiper-list2/swiper-list2', + // '/pages/template/swiper-vertical-video/swiper-vertical-video' + + // api + // '/pages/API/element-draw/element-draw', +] + +if (process.env.uniTestPlatformInfo.startsWith('android')) { + // 规避 web 端不支持页面 + pages.push( + "/pages/component/list-view/list-view", + "/pages/CSS/transition/transition", + '/pages/template/swiper-list/swiper-list', + '/pages/template/swiper-list2/swiper-list2', + '/pages/API/element-draw/element-draw', + ) +} -let page; -describe("page screenshot test", () => { - beforeAll(async () => { - console.log("page screenshot test start"); - }); - beforeEach(async () => { - page = await program.reLaunch(pages[pageIndex]); - await page.waitFor(1000); - }); - afterEach(() => { - pageIndex++; - }); - afterAll(() => { - console.log("page screenshot test finish"); - }); - test.each(pages)("%s", async () => { - console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); - const image = await program.screenshot({ - fullPage: true, - }); - expect(image).toMatchImageSnapshot(); - await page.waitFor(500); - }); +let page; +describe("page screenshot test", () => { + beforeAll(async () => { + console.log("page screenshot test start"); + }); + beforeEach(async () => { + page = await program.reLaunch(pages[pageIndex]); + await page.waitFor(1000); + }); + afterEach(() => { + pageIndex++; + }); + afterAll(() => { + console.log("page screenshot test finish"); + }); + test.each(pages)("%s", async () => { + console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); + const image = await program.screenshot({ + fullPage: true, + }); + expect(image).toMatchImageSnapshot(); + await page.waitFor(500); + }); }); -- GitLab