From a089887d0d764b6d0ab079759162c1a6681560b1 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 7 Nov 2023 13:42:23 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=20set-custom-navigation-bar-color=20?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E6=B5=8B=E8=AF=95=E9=80=82=E9=85=8D=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E5=88=86=E8=BE=A8=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../set-custom-navigation-bar-color.test.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js index 54cb43f3..0f271efb 100644 --- a/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js +++ b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js @@ -4,8 +4,19 @@ const CURRENT_PAGE_PATH = describe("setCustomNavigationBarColor", () => { let page; let originLifeCycleNum; + const screenShotArea = { x: 880, y: 0, width: 100, height: 60 }; beforeAll(async () => { + console.log('process.env.uniTestPlatformInfo', process.env.uniTestPlatformInfo ) page = await program.navigateTo(CURRENT_PAGE_PATH); + if(process.env.uniTestPlatformInfo.startsWith('android 6')){ + screenShotArea.x = 535 + screenShotArea.width = 90 + screenShotArea.height = 50 + }else if(process.env.uniTestPlatformInfo.startsWith('android 12')){ + screenShotArea.x = 1160 + screenShotArea.width = 140 + screenShotArea.height = 80 + } await page.waitFor(1000); originLifeCycleNum = await page.callMethod("getLifeCycleNum"); }); @@ -21,7 +32,7 @@ describe("setCustomNavigationBarColor", () => { await page.waitFor(1000); const image = await program.screenshot({ adb: true, - area: { x: 880, y: 0, width: 100, height: 60 }, + area: screenShotArea, }); expect(image).toMatchImageSnapshot(); const lifeCycleNum = await page.callMethod("getLifeCycleNum"); @@ -33,7 +44,7 @@ describe("setCustomNavigationBarColor", () => { await page.waitFor(1000); const image = await program.screenshot({ adb: true, - area: { x: 880, y: 0, width: 100, height: 60 }, + area: screenShotArea, }); expect(image).toMatchImageSnapshot(); const lifeCycleNum = await page.callMethod("getLifeCycleNum"); -- GitLab