From 7b1dee6d5df93ab38fe0e54698ab853d4690311e Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 26 Mar 2024 10:44:29 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B0=83=E6=95=B4=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/pages.test.js | 6 +++++- .../webview-screenshot-comparison.test.js | 2 +- pages/webview-screenshot/webview-screenshot.test.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pages/pages.test.js b/pages/pages.test.js index d7a13218..3eff5ba9 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -169,7 +169,11 @@ describe("page screenshot test", () => { const image = await program.screenshot({ fullPage: fullPage }); - expect(image).toMatchImageSnapshot(); + expect(image).toMatchImageSnapshot({ + customSnapshotIdentifier() { + return `__pages_test__/${pages[pageIndex].replace(/\//g, "-").substring(1)}` + } + }) 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 5e245f69..2d0020c7 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js @@ -300,7 +300,7 @@ describe("shot-compare", () => { y: statusBarHeight * devicePixelRatio, }, } - const screenshotPath = `__webview__${pages[pageIndex].replace(/\//g, "-")}`; + const screenshotPath = `__webview_comparison__/${pages[pageIndex].replace(/\//g, "-")}`; // web in webview screenshot let startTime = Date.now(); diff --git a/pages/webview-screenshot/webview-screenshot.test.js b/pages/webview-screenshot/webview-screenshot.test.js index fc34dcfd..16d22013 100644 --- a/pages/webview-screenshot/webview-screenshot.test.js +++ b/pages/webview-screenshot/webview-screenshot.test.js @@ -291,7 +291,7 @@ describe("shot-compare", () => { y: (headerHeight - 44) * devicePixelRatio, }, } - const screenshotPath = `webview-shot__${pages[pageIndex].replace(/\//g, "-")}`; + const screenshotPath = `__webview-shot__/${pages[pageIndex].replace(/\//g, "-")}`; // web in webview screenshot let startTime = Date.now(); -- GitLab