Skip to content

Commit

Permalink
Add wdio example for native apps full page screenshot (#775)
Browse files Browse the repository at this point in the history
* android

* ios
  • Loading branch information
paweltomaszewskisaucelabs authored Oct 21, 2024
1 parent 9c5c3ec commit f9e95cc
Show file tree
Hide file tree
Showing 7 changed files with 1,941 additions and 461 deletions.
Binary file modified wdio-android-app/app/SauceLabs-Demo-App.apk
Binary file not shown.
1,910 changes: 1,612 additions & 298 deletions wdio-android-app/package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions wdio-android-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
"typescript": "^5.4.3"
},
"scripts": {
"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": "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-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"
},
"dependencies": {
"@saucelabs/wdio-sauce-visual-service": "^0.6.0",
"@saucelabs/wdio-sauce-visual-service": "^0.7.0",
"@wdio/globals": "^9.1.2",
"readline-sync": "^1.4.10",
"saucectl": "^0.180.0",
"update-dotenv": "^1.1.1"
Expand Down
12 changes: 12 additions & 0 deletions wdio-android-app/tests/specs/visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ describe('Android 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: $('//androidx.recyclerview.widget.RecyclerView')
}
});
});
}

it('Captures only catalog content', async () => {
const catalogContent = await App.catalogContent;
await browser.sauceVisualCheck(`Catalog Fragment`, {
Expand Down
453 changes: 296 additions & 157 deletions wdio-ios-app/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions wdio-ios-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"typescript": "^5.4.3"
},
"scripts": {
"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": "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-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"
},
"dependencies": {
"@saucelabs/wdio-sauce-visual-service": "^0.6.0",
"@saucelabs/wdio-sauce-visual-service": "^0.7.0",
"readline-sync": "^1.4.10",
"saucectl": "^0.180.0",
"update-dotenv": "^1.1.1"
Expand Down
14 changes: 14 additions & 0 deletions wdio-ios-app/tests/specs/visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ 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('Captures only catalog content', async () => {
const catalogContent = await App.catalogContent;
await browser.sauceVisualCheck(`Catalog Fragment`, {
Expand Down

0 comments on commit f9e95cc

Please sign in to comment.