diff --git a/pages/API/download-file/download-file.test.js b/pages/API/download-file/download-file.test.js index 85ed9b054d2912dbb24bb579cfe735341f658af6..8a64b2b55678c731a8ba66af09615d878af8d17e 100644 --- a/pages/API/download-file/download-file.test.js +++ b/pages/API/download-file/download-file.test.js @@ -23,7 +23,7 @@ describe('ExtApi-DownloadFile', () => { }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -47,4 +47,4 @@ describe('ExtApi-DownloadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); diff --git a/pages/API/navigator/new-page/onLoad.test.js b/pages/API/navigator/new-page/onLoad.test.js index 1140f99636060d13c3a7b985462d1a7a1286becd..2a5101dd6261e48c8c0711b725a91f2913d4fe90 100644 --- a/pages/API/navigator/new-page/onLoad.test.js +++ b/pages/API/navigator/new-page/onLoad.test.js @@ -22,7 +22,7 @@ describe("onLoad", () => { expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); }); it("navigateBack", async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "navigateBack"); @@ -89,7 +89,7 @@ describe("onLoad", () => { expect(image).toMatchImageSnapshot({ failureThreshold: 0.05, failureThresholdType: "percent", - }); + }); }); it("showModal", async () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); @@ -127,4 +127,4 @@ describe("onLoad", () => { failureThresholdType: "percent", }); }); -}); +}); diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 9d772378a3ca2bc2b0028666e0d32250059a311d..67cde3b79ec2162a93a8dc3993146f7917bebf32 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -86,7 +86,7 @@ describe('ExtApi-Request', () => { }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -107,11 +107,11 @@ describe('ExtApi-Request', () => { await page.waitFor(2000); res = await page.data('jest_result'); expect(res).toBe(true) - }); - it('Check Get With Data', async () => { + }); + it('Check Get With Data', async () => { res = await page.callMethod('jest_get_with_data') await page.waitFor(2000); res = await page.data('jest_result'); - expect(res).toBe(true) + expect(res).toBe(true) }) -}); +}); diff --git a/pages/API/upload-file/upload-file.test.js b/pages/API/upload-file/upload-file.test.js index 6f26d3ee46ea0fb8fd8d0d72f28b2fed02dba41e..c23bd72a3b0ccd80b7cf9e3a3ad2341ea303408d 100644 --- a/pages/API/upload-file/upload-file.test.js +++ b/pages/API/upload-file/upload-file.test.js @@ -27,17 +27,17 @@ describe('ExtApi-UploadFile', () => { it('Check ', async () => { expect(res).toBe(true); - }); - - it('Check files upload', async () => { - res = await page.callMethod('jest_files_upload') - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true) + }); + + it('Check files upload', async () => { + res = await page.callMethod('jest_files_upload') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -59,4 +59,4 @@ describe('ExtApi-UploadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); diff --git a/pages/CSS/overflow/overflow.test.js b/pages/CSS/overflow/overflow.test.js index d22653b6ce06b9b6c35237d4204aa4a5d178a075..dd7f5ae3af25bd068be88e78378a3b7e9f8a5755 100644 --- a/pages/CSS/overflow/overflow.test.js +++ b/pages/CSS/overflow/overflow.test.js @@ -1,14 +1,14 @@ -describe('component-native-overflow', () => { - let page +describe('component-native-overflow', () => { + let page beforeAll(async () => { - //打开list-view测试页 - page = await program.reLaunch('/pages/CSS/overflow/overflow') - await page.waitFor("image") + //打开list-view测试页 + page = await program.reLaunch('/pages/CSS/overflow/overflow') + await page.waitFor("image") }) //检测overflow设置hidden,visible it('check_view_overflow', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) //安卓7模拟器不截图 导致闪退 @@ -21,5 +21,5 @@ describe('component-native-overflow', () => { fullPage: true, }); expect(image).toMatchImageSnapshot(); - }) + }) }) diff --git a/pages/component/general-event/general-event.test.js b/pages/component/general-event/general-event.test.js index 4d6b63f857a1d396b93d0693641ac1b2f1c81ce3..46939cc7955786e5d899cd6cb704054850bc8d16 100644 --- a/pages/component/general-event/general-event.test.js +++ b/pages/component/general-event/general-event.test.js @@ -10,7 +10,7 @@ describe('event trigger sequence', () => { }) it('touch', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await el.touchstart({ touches: [{ identifier: 1, @@ -56,10 +56,10 @@ describe('event trigger sequence', () => { }) it('longPress', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await el.longpress() const data = await page.data() expect(data.onLongPressTime).toBeGreaterThan(0) } }) -}) +}) diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js index 0c031b7235b1d266b6df20f2bb4d0abb671b385b..03378d848e0a45d37fe205b06686e52e734f7401 100644 --- a/pages/component/image/image.test.js +++ b/pages/component/image/image.test.js @@ -30,7 +30,7 @@ describe('component-native-image', () => { expect(await page.data('loadError')).toBe(true) }) - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { it('check-cookie', async () => { await page.setData({ autoTest: true, diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index 99c34fea64d0834c93afc7271aedd0ad65b78696..2cb57d0b886adf6d794e73f0495581df0c1d17f2 100644 --- a/pages/component/scroll-view/scroll-view-refresher.test.js +++ b/pages/component/scroll-view/scroll-view-refresher.test.js @@ -1,21 +1,21 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ describe('component-native-scroll-view-refresher', () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher'); await page.waitFor(300); }); - - it('scroll-view-refresher-screenshot', async () => { - //禁止滚动条 - await page.setData({ - showScrollbar: false - }) - await page.waitFor(300); - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); + + it('scroll-view-refresher-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false + }) + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); }) it('check_refresher', async () => { @@ -30,4 +30,4 @@ describe('component-native-scroll-view-refresher', () => { expect(1).toBe(1) }) } -}); +}); diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index 378af0a434fdd1daf821df5ed41c61d3bca8049c..459755783818e631581496d24eda96971a2d39f0 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -19,7 +19,7 @@ describe('component-native-sticky-section', () => { await page.setData({ scrolling: 'true' }) - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { //跳转到id为C的StickyHeader位置 await page.callMethod('gotoStickyHeader', 'C') } @@ -29,4 +29,4 @@ describe('component-native-sticky-section', () => { const image = await program.screenshot(); expect(image).toMatchImageSnapshot(); }) -}) +}) 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 767c77025422b3319fb57a94e628356f352444da..37c9e2c2bdd327ba9186b8643e7b29f2d6c61872 100644 --- a/pages/component/web-view-local/web-view-local.test.js +++ b/pages/component/web-view-local/web-view-local.test.js @@ -12,7 +12,7 @@ describe('component-native-web-view', () => { }); it('screenshot', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await page.waitFor(async () => { return await page.data('loadFinish') === true; }); diff --git a/pages/component/web-view/web-view.test.js b/pages/component/web-view/web-view.test.js index 3ab086250608610f10a810b0c78e7e86d2430d9d..7995ecc6d4f22535352eed4280872e74e8c34950 100644 --- a/pages/component/web-view/web-view.test.js +++ b/pages/component/web-view/web-view.test.js @@ -1,7 +1,7 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ describe('component-native-web-view', () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/web-view/web-view'); diff --git a/pages/pages.test.js b/pages/pages.test.js index a90a6d9f938b607360e7f1ef095b559b75c45b8a..d7a13218bd8decd022629f6302e4cc297cd6418e 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -121,7 +121,7 @@ const pages = [ // '/pages/API/element-draw/element-draw', ] -if (process.env.uniTestPlatformInfo.startsWith('android')) { +if (process.env.uniTestPlatformInfo.startsWith('android')&& !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { // 规避 web 端不支持页面 pages.push( "/pages/component/list-view/list-view", @@ -133,18 +133,18 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) { '/pages/template/pull-zoom-image/pull-zoom-image', '/pages/template/scroll-fold-nav/scroll-fold-nav', '/pages/template/scroll-sticky/scroll-sticky', - '/pages/template/custom-refresher/custom-refresher', - '/pages/template/custom-tab-bar/custom-tab-bar', + '/pages/template/custom-refresher/custom-refresher', + '/pages/template/custom-tab-bar/custom-tab-bar', '/pages/template/half-screen/half-screen', ) -} - -// 设置position: fixed的页面不能截取完整内容 -const notFullPages = [ - '/pages/CSS/layout/position', - '/pages/CSS/layout/z-index' -] - +} + +// 设置position: fixed的页面不能截取完整内容 +const notFullPages = [ + '/pages/CSS/layout/position', + '/pages/CSS/layout/z-index' +] + let page; describe("page screenshot test", () => { beforeAll(async () => { @@ -162,14 +162,14 @@ describe("page screenshot test", () => { }); test.each(pages)("%s", async () => { console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); - let fullPage = true; - if (notFullPages.includes(pages[pageIndex])) { - fullPage = false; + let fullPage = true; + if (notFullPages.includes(pages[pageIndex])) { + fullPage = false; } const image = await program.screenshot({ fullPage: fullPage - }); + }); expect(image).toMatchImageSnapshot(); await page.waitFor(500); }); -}); +}); diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js index b3a0f718ad8ed53e5b009b9f5407bedb5da58dfa..355cc54dd130a716f904d238fdcc524ed9aef473 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js @@ -8,7 +8,7 @@ const pages = [ "pages/component/text/text-props", "pages/component/progress/progress", "pages/component/form/form", - "pages/component/button/button", + "pages/component/button/button", "pages/component/button/buttonstatus", "pages/component/radio/radio", "pages/component/rich-text/rich-text", @@ -237,7 +237,7 @@ const PAGE_PATH = describe("shot-compare", () => { let shouldCompareScreenShot = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldCompareScreenShot = version > 9 @@ -246,7 +246,7 @@ describe("shot-compare", () => { if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); - }); + }); return } @@ -355,4 +355,4 @@ describe("shot-compare", () => { }, }); }); -}); +}); diff --git a/pages/webview-screenshot/webview-screenshot.test.js b/pages/webview-screenshot/webview-screenshot.test.js index faa41945ae0a3218afb09e7ae6e0f59851c479cf..d2e40ffa66a95d7ec0abc73fbc0b097f1b0bd9aa 100644 --- a/pages/webview-screenshot/webview-screenshot.test.js +++ b/pages/webview-screenshot/webview-screenshot.test.js @@ -236,7 +236,7 @@ const PAGE_PATH = describe("shot-compare", () => { let shouldCompareScreenShot = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldCompareScreenShot = version > 9 @@ -245,7 +245,7 @@ describe("shot-compare", () => { if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); - }); + }); return } let page = null; @@ -330,4 +330,4 @@ describe("shot-compare", () => { }, }); }); -}); +});