From 1a14443ec1a557eb874c1d6806fe9b46431fe093 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 2 Apr 2024 16:33:37 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B0=83=E6=95=B4=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=AF=BC=E8=88=AA=E6=A0=8F=EF=BC=8C=E9=80=82?= =?UTF-8?q?=E9=85=8D=E8=B7=A8=E5=B9=B3=E5=8F=B0=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../get-element-by-id-multiple-root-node.test.js | 2 +- .../API/get-element-by-id/get-element-by-id.test.js | 2 +- pages/API/load-font-face/load-font-face.test.js | 4 ++-- pages/API/navigator/new-page/onLoad.test.js | 2 +- pages/CSS/background/background-image.test.js | 4 ++-- .../general-attribute/general-attribute.test.js | 4 ++-- .../component/list-view/list-view-multiplex.test.js | 4 ++-- pages/component/list-view/list-view-refresh.test.js | 2 +- .../nested-scroll-body/nested-scroll-body.test.js | 2 +- .../nested-scroll-header.test.js | 2 +- .../component/scroll-view/scroll-view-props.test.js | 2 +- .../scroll-view/scroll-view-refresher.test.js | 2 +- pages/component/scroll-view/scroll-view.test.js | 2 +- pages/component/sticky-header/sticky-header.test.js | 2 +- .../component/sticky-section/sticky-section.test.js | 4 ++-- ...aveSnapshot-toSaveImageSnapshot-template.test1.js | 12 ++++++------ 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js index e0ec97be..daa1d2cf 100644 --- a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js +++ b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js @@ -16,7 +16,7 @@ describe("getElementByIdForMultipleRootNode", () => { await page.callMethod("changeTextColor"); await page.callMethod("changeViewStyle"); await page.waitFor(500); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }); diff --git a/pages/API/get-element-by-id/get-element-by-id.test.js b/pages/API/get-element-by-id/get-element-by-id.test.js index 3f7933f3..80cf9185 100644 --- a/pages/API/get-element-by-id/get-element-by-id.test.js +++ b/pages/API/get-element-by-id/get-element-by-id.test.js @@ -15,7 +15,7 @@ describe("getElementById", () => { await page.callMethod("changeTextColor"); await page.callMethod("changeViewStyle"); await page.waitFor(500); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }); diff --git a/pages/API/load-font-face/load-font-face.test.js b/pages/API/load-font-face/load-font-face.test.js index 0f78bfb9..e0b3d124 100644 --- a/pages/API/load-font-face/load-font-face.test.js +++ b/pages/API/load-font-face/load-font-face.test.js @@ -7,13 +7,13 @@ describe("loadFontFace", () => { await page.waitFor(4000); }); it("parent screenshot", async () => { - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); it("child screenshot", async () => { const page = await program.navigateTo(CHILD_PAGE_PATH); await page.waitFor(3000); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }); diff --git a/pages/API/navigator/new-page/onLoad.test.js b/pages/API/navigator/new-page/onLoad.test.js index 124eb4b0..f2d2188f 100644 --- a/pages/API/navigator/new-page/onLoad.test.js +++ b/pages/API/navigator/new-page/onLoad.test.js @@ -10,7 +10,7 @@ describe("onLoad", () => { await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "adjustData"); await page.waitFor(1000); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); it("navigateTo", async () => { diff --git a/pages/CSS/background/background-image.test.js b/pages/CSS/background/background-image.test.js index 2ed0a6c4..e2a60d20 100644 --- a/pages/CSS/background/background-image.test.js +++ b/pages/CSS/background/background-image.test.js @@ -8,14 +8,14 @@ describe('background-image-test', () => { it('background-image-screenshot', async () => { await page.waitFor(300); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); it('background-image-select', async () => { await page.callMethod('updateBackgroundSelect') await page.waitFor(300); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }); diff --git a/pages/component/general-attribute/general-attribute.test.js b/pages/component/general-attribute/general-attribute.test.js index 0bce1aef..9e5ec5df 100644 --- a/pages/component/general-attribute/general-attribute.test.js +++ b/pages/component/general-attribute/general-attribute.test.js @@ -8,7 +8,7 @@ describe('general attribute', () => { await page.waitFor('view') }) it("class & style", async () => { - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); it('validateGeneralAttributes', async () => { @@ -21,7 +21,7 @@ describe('general attribute', () => { const button = await page.$(".btn-ref"); await button.tap(); await page.waitFor(500); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }) diff --git a/pages/component/list-view/list-view-multiplex.test.js b/pages/component/list-view/list-view-multiplex.test.js index 402f80bf..ae8aded5 100644 --- a/pages/component/list-view/list-view-multiplex.test.js +++ b/pages/component/list-view/list-view-multiplex.test.js @@ -20,7 +20,7 @@ describe('component-native-list-view', () => { return await page.data('list_show') === true; }); await page.waitFor(200) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) @@ -31,7 +31,7 @@ describe('component-native-list-view', () => { return await page.data('displayArrow') === true; }); await page.waitFor(600) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/component/list-view/list-view-refresh.test.js b/pages/component/list-view/list-view-refresh.test.js index 146c00ab..09699044 100644 --- a/pages/component/list-view/list-view-refresh.test.js +++ b/pages/component/list-view/list-view-refresh.test.js @@ -18,7 +18,7 @@ describe('component-native-list-view-refresh', () => { }); //等待下拉刷新结束 await page.waitFor(500) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/component/nested-scroll-body/nested-scroll-body.test.js b/pages/component/nested-scroll-body/nested-scroll-body.test.js index f6f62db0..a39a2358 100644 --- a/pages/component/nested-scroll-body/nested-scroll-body.test.js +++ b/pages/component/nested-scroll-body/nested-scroll-body.test.js @@ -17,7 +17,7 @@ describe('component-native-nested-scroll-body', () => { it('check_scroll_into_view_left', async () => { await page.callMethod('testBodyScrollBy', 400) await page.waitFor(300) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/component/nested-scroll-header/nested-scroll-header.test.js b/pages/component/nested-scroll-header/nested-scroll-header.test.js index f8ce2976..d4eb2bb7 100644 --- a/pages/component/nested-scroll-header/nested-scroll-header.test.js +++ b/pages/component/nested-scroll-header/nested-scroll-header.test.js @@ -15,7 +15,7 @@ describe('component-native-nested-scroll-header', () => { it('check_nested-scroll-header', async () => { - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/component/scroll-view/scroll-view-props.test.js b/pages/component/scroll-view/scroll-view-props.test.js index f124bd91..d54c3bd0 100644 --- a/pages/component/scroll-view/scroll-view-props.test.js +++ b/pages/component/scroll-view/scroll-view-props.test.js @@ -89,7 +89,7 @@ describe('component-native-scroll-view-props', () => { showScrollbar: false }) await page.waitFor(300); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index 07e55034..ee54b2e6 100644 --- a/pages/component/scroll-view/scroll-view-refresher.test.js +++ b/pages/component/scroll-view/scroll-view-refresher.test.js @@ -14,7 +14,7 @@ describe('component-native-scroll-view-refresher', () => { showScrollbar: false }) await page.waitFor(300); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) diff --git a/pages/component/scroll-view/scroll-view.test.js b/pages/component/scroll-view/scroll-view.test.js index a2cdadde..646710a3 100644 --- a/pages/component/scroll-view/scroll-view.test.js +++ b/pages/component/scroll-view/scroll-view.test.js @@ -12,7 +12,7 @@ describe('component-native-scroll-view', () => { showScrollbar: false }) await page.waitFor(300); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }); }); diff --git a/pages/component/sticky-header/sticky-header.test.js b/pages/component/sticky-header/sticky-header.test.js index 212f7f59..2f56803a 100644 --- a/pages/component/sticky-header/sticky-header.test.js +++ b/pages/component/sticky-header/sticky-header.test.js @@ -8,7 +8,7 @@ describe('component-native-sticky-header', () => { //检测吸顶效果 it('check_sticky_header', async () => { await page.callMethod('confirm_scroll_top_input', 600) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index ca55a242..2e2d47be 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -8,7 +8,7 @@ describe('component-native-sticky-section', () => { //检测吸顶上推效果 it('check_sticky_section', async () => { await page.callMethod('listViewScrollByY', 1000) - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) @@ -30,7 +30,7 @@ describe('component-native-sticky-section', () => { await page.waitFor(async () => { return await page.data('scrolling') === false; }); - const image = await program.screenshot(); + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) }) diff --git a/pages/toSaveSnapshot-toSaveImageSnapshot-template.test1.js b/pages/toSaveSnapshot-toSaveImageSnapshot-template.test1.js index bfd7db8c..17762981 100644 --- a/pages/toSaveSnapshot-toSaveImageSnapshot-template.test1.js +++ b/pages/toSaveSnapshot-toSaveImageSnapshot-template.test1.js @@ -29,15 +29,15 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => { }) it('test toSaveImageSnapshot 1', async () => { - const img1 = await program.screenshot(); + const img1 = await program.screenshot({fullPage: true}); expect(img1).toSaveImageSnapshot() - const img2 = await program.screenshot(); + const img2 = await program.screenshot({fullPage: true}); expect(img2).toSaveImageSnapshot() }) it('test toSaveImageSnapshot 2', async () => { - const img1 = await program.screenshot(); + const img1 = await program.screenshot({fullPage: true}); expect(img1).toSaveImageSnapshot({ customSnapshotsDir: './customDir/__image_snapshots__', customSnapshotIdentifier() { @@ -45,16 +45,16 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => { }, }) - const img2 = await program.screenshot(); + const img2 = await program.screenshot({fullPage: true}); expect(img2).toSaveImageSnapshot({ customSnapshotsDir: './customDir/__image_snapshots__', }) - const img3 = await program.screenshot(); + const img3 = await program.screenshot({fullPage: true}); expect(img3).toSaveImageSnapshot({ customSnapshotIdentifier() { return 'test-toSaveImageSnapshot-2-3'; }, }) }) -}); +}); -- GitLab