From eb322adaab374e70ea832b43983b31b06788436f Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 21 Mar 2024 21:40:25 +0800 Subject: [PATCH] =?UTF-8?q?test:=20ios=20=E6=94=AF=E6=8C=81=20webview=20&?= =?UTF-8?q?=20app=20=E6=88=AA=E5=9B=BE=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webview-screenshot-comparison.test.js | 8 ++++++-- pages/webview-screenshot/webview-screenshot.test.js | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js index 355cc54d..239e41f7 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js @@ -243,6 +243,10 @@ describe("shot-compare", () => { shouldCompareScreenShot = version > 9 } + if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { + shouldCompareScreenShot = true + } + if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); @@ -299,6 +303,7 @@ describe("shot-compare", () => { const screenshotPath = `__webview__${pages[pageIndex].replace(/\//g, "-")}`; // web in webview screenshot + let startTime = Date.now(); // 加载依赖页面 if (childToParentPagesMap.get(pages[pageIndex])) { await page.setData({ @@ -316,8 +321,7 @@ describe("shot-compare", () => { isLoaded: false, isCustomNavigationBar, }); - - const startTime = Date.now(); + startTime = Date.now(); await page.waitFor(async () => { const isLoaded = await page.data("isLoaded"); return isLoaded || Date.now() - startTime > 3000; diff --git a/pages/webview-screenshot/webview-screenshot.test.js b/pages/webview-screenshot/webview-screenshot.test.js index d2e40ffa..70b03835 100644 --- a/pages/webview-screenshot/webview-screenshot.test.js +++ b/pages/webview-screenshot/webview-screenshot.test.js @@ -242,6 +242,10 @@ describe("shot-compare", () => { shouldCompareScreenShot = version > 9 } + if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { + shouldCompareScreenShot = true + } + if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); @@ -291,6 +295,7 @@ describe("shot-compare", () => { const screenshotPath = `webview-shot__${pages[pageIndex].replace(/\//g, "-")}`; // web in webview screenshot + let startTime = Date.now(); // 加载依赖页面 if (childToParentPagesMap.get(pages[pageIndex])) { await page.setData({ @@ -309,7 +314,7 @@ describe("shot-compare", () => { needRemoveWebHead: !isNeedAdbScreenshot, }); - const startTime = Date.now(); + startTime = Date.now(); await page.waitFor(async () => { const isLoaded = await page.data("isLoaded"); return isLoaded || Date.now() - startTime > 3000; -- GitLab