From 256adf1ce0e69e00d877dda1dcef4dec4919f5d6 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Sat, 20 Jan 2024 00:13:53 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BC=98=E5=8C=96=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webview-screenshot-comparison.test.js | 21 ++++----- .../webview-screenshot-comparison.uvue | 45 ++++++++----------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js index 36220b03..72aed05c 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js @@ -192,12 +192,12 @@ const pages = [ // "pages/component/sticky-section/sticky-section", // pages/API/facial-recognition-verify/facial-recognition-verify // pages/API/get-file-system-manager/get-file-system-manager - // "pages/API/install-apk/install-apk", - // "pages/template/scroll-sticky/scroll-sticky", - // "pages/API/exit/exit", + // "pages/API/install-apk/install-apk", + // "pages/template/scroll-sticky/scroll-sticky", + // "pages/API/exit/exit", // "pages/API/element-takesnapshot/element-takesnapshot", - // 仅 web + // 仅 web // pages/template/browser-canvas/browser-canvas // pages/template/schema/schema // pages/template/share/share @@ -210,8 +210,8 @@ const childToParentPagesMap = new Map([ ]); const customNavigationPages = [ - "pages/template/navbar-lite/navbar-lite", - "pages/template/pull-zoom-image/pull-zoom-image", + "pages/template/navbar-lite/navbar-lite", + "pages/template/pull-zoom-image/pull-zoom-image", "pages/template/scroll-fold-nav/scroll-fold-nav" ] @@ -267,7 +267,7 @@ describe("shot-compare", () => { test.each(pages)("%s", async () => { const isNeedAdbScreenshot = needAdbScreenshot(pages[pageIndex]); - const isCustomNavigation = customNavigationPages.includes(pages[pageIndex]); + const isCustomNavigationBar = customNavigationPages.includes(pages[pageIndex]); const { headerHeight, devicePixelRatio @@ -299,7 +299,7 @@ describe("shot-compare", () => { await page.setData({ src: `${baseSrc}${pages[pageIndex]}`, isLoaded: false, - needRemoveWebHead: !isNeedAdbScreenshot, + isCustomNavigationBar, }); const startTime = Date.now(); @@ -315,7 +315,8 @@ describe("shot-compare", () => { // web 端非 adb 截图时设置 offsetY 移除导航栏 const webSnapshot = await program.screenshot({ ...screenshotParams, - offsetY: `${isCustomNavigation ? 0 : headerHeight}` + id: 'webview-screenshot-comparison', + offsetY: `${isCustomNavigationBar ? 0 : 44}` }); expect(webSnapshot).toMatchImageSnapshot({ customSnapshotIdentifier() { @@ -344,4 +345,4 @@ describe("shot-compare", () => { expect(1).toBe(1); }); } -}); +}); diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue b/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue index c25418f7..bd9e698a 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue @@ -1,4 +1,5 @@