diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js index 355cc54dd130a716f904d238fdcc524ed9aef473..239e41f7eee2aa96805e6186f9810b89ed03308f 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 d2e40ffa66a95d7ec0abc73fbc0b097f1b0bd9aa..70b038356672a682fcdddeb8acfd7c5516bcfa54 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;