From bae81356d1104a5290451a179282b33c53f38fc9 Mon Sep 17 00:00:00 2001 From: Konrad Dysput Date: Wed, 4 Dec 2024 10:32:00 +0100 Subject: [PATCH] Use DOM if possible and disable FPS flag - no longer needed --- wdio-android-app/README.md | 2 +- wdio-android-app/package.json | 4 ++-- wdio-android-app/tests/specs/visual.spec.ts | 18 ++++++++---------- wdio-ios-app/README.md | 2 +- wdio-ios-app/package.json | 4 ++-- wdio-ios-app/tests/specs/visual.spec.ts | 20 +++++++------------- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/wdio-android-app/README.md b/wdio-android-app/README.md index 85fb515d..86a7bc94 100644 --- a/wdio-android-app/README.md +++ b/wdio-android-app/README.md @@ -28,7 +28,7 @@ apt-get install nodejs -y ```sh { name=clone } git clone https://github.com/saucelabs/visual-examples -cd visual-examples/wdio +cd visual-examples/wdio-android-app ``` - install npm dependencies: diff --git a/wdio-android-app/package.json b/wdio-android-app/package.json index 7626c68e..5a075a7c 100644 --- a/wdio-android-app/package.json +++ b/wdio-android-app/package.json @@ -15,8 +15,8 @@ "typescript": "^5.4.3" }, "scripts": { - "sauce-visual": "FPS=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", - "sauce-visual-check": "FPS=true VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", + "sauce-visual": "wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", + "sauce-visual-check": "VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", "sauce-visual-emulator": "wdio run ./tests/configs/wdio.saucelabs.emulator.conf.ts --spec tests/specs/visual.spec.ts", "sauce-visual-emulator-check": "VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.emulator.conf.ts --spec tests/specs/visual.spec.ts" }, diff --git a/wdio-android-app/tests/specs/visual.spec.ts b/wdio-android-app/tests/specs/visual.spec.ts index f2dd3aee..1a272bf1 100644 --- a/wdio-android-app/tests/specs/visual.spec.ts +++ b/wdio-android-app/tests/specs/visual.spec.ts @@ -26,6 +26,7 @@ describe('Android Native App', () => { const prices = await App.productPrices; await browser.sauceVisualCheck(`App Catalog`, { + captureDom: true, regions: [ // Ignore any changes on the first image { @@ -44,19 +45,16 @@ describe('Android Native App', () => { it('Captures only catalog content', async () => { const catalogContent = await App.catalogContent; await browser.sauceVisualCheck(`Catalog Fragment`, { + captureDom: true, clipElement: catalogContent, }); }); - // NOTE: Full page screenshot for native apps is in beta stage - // some of the functionality may not work as expected (especially virtual devices, clipping, ignore regions) - if (!!process.env.FPS) { - it('Full Page - Check App Catalog', async () => { - await browser.sauceVisualCheck(`Full Page - App Catalog`, { - fullPage: { - scrollElement: $('//androidx.recyclerview.widget.RecyclerView') - } - }); + it('Full Page - Check App Catalog', async () => { + await browser.sauceVisualCheck(`Full Page - App Catalog`, { + fullPage: { + scrollElement: $("//androidx.recyclerview.widget.RecyclerView"), + }, }); - } + }).timeout(1000 * 60 * 6); }); diff --git a/wdio-ios-app/README.md b/wdio-ios-app/README.md index a5919f41..6b392c00 100644 --- a/wdio-ios-app/README.md +++ b/wdio-ios-app/README.md @@ -28,7 +28,7 @@ apt-get install nodejs -y ```sh { name=clone } git clone https://github.com/saucelabs/visual-examples -cd visual-examples/wdio +cd visual-examples/wdio-ios-app ``` - install npm dependencies: diff --git a/wdio-ios-app/package.json b/wdio-ios-app/package.json index ba99593e..b24683d9 100644 --- a/wdio-ios-app/package.json +++ b/wdio-ios-app/package.json @@ -15,8 +15,8 @@ "typescript": "^5.4.3" }, "scripts": { - "sauce-visual": "FPS=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", - "sauce-visual-check": "FPS=true VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", + "sauce-visual": "wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", + "sauce-visual-check": "VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.mobile.conf.ts --spec tests/specs/visual.spec.ts", "sauce-visual-simulator": "wdio run ./tests/configs/wdio.saucelabs.simulator.conf.ts --spec tests/specs/visual.spec.ts", "sauce-visual-simulator-check": "VISUAL_CHECK=true wdio run ./tests/configs/wdio.saucelabs.simulator.conf.ts --spec tests/specs/visual.spec.ts" }, diff --git a/wdio-ios-app/tests/specs/visual.spec.ts b/wdio-ios-app/tests/specs/visual.spec.ts index daae9bf7..7a474147 100644 --- a/wdio-ios-app/tests/specs/visual.spec.ts +++ b/wdio-ios-app/tests/specs/visual.spec.ts @@ -48,17 +48,11 @@ describe('iOS Native App', () => { }); }); - // NOTE: Full page screenshot for native apps is in beta stage - // some of the functionality may not work as expected (especially virtual devices, clipping, ignore regions) - if (!!process.env.FPS) { - it('Full Page - Check App Catalog', async () => { - await browser.sauceVisualCheck(`Full Page - App Catalog`, { - fullPage: { - scrollElement: $('//XCUIElementTypeCollectionView') - } - }); - - - }).timeout(4 * 60 * 1000); // scrolling on ios require more time - } + it('Full Page - Check App Catalog', async () => { + await browser.sauceVisualCheck(`Full Page - App Catalog`, { + fullPage: { + scrollElement: $("//XCUIElementTypeCollectionView"), + }, + }); + }).timeout(4 * 60 * 1000); // scrolling on ios require more time });