-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
180 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const percyScreenshot = require('./index'); | ||
const wd = require('wd'); | ||
let asserters = wd.asserters; | ||
|
||
// Note: While this example shows how to use percyScreenshot with Browserstack App | ||
// Automate, percyScreenshot method just expects a initialized driver object and does | ||
// not care if its connected to App Automate or any other appium server. | ||
// You are free to create `driver` object anyway you want and can pass it | ||
// to the percyScreenshot function. | ||
|
||
const desiredCaps = { | ||
// Set BStack options that would allow App Automate to run | ||
'bstack:options': { | ||
userName: 'pradumkumar_USRpXW', | ||
accessKey: 'x2Eq6HxMrgzNphqsZcsz' | ||
}, | ||
|
||
// Percy Options (defaults) | ||
percyOptions: { | ||
enabled: true, | ||
ignoreErrors: true | ||
}, | ||
// Set URL of the application under test | ||
app: 'bs://8f063eac036c00823c233970e4f14c1a37a8f0d7', | ||
|
||
// Specify device and os_version for testing | ||
device: 'Google Pixel 7 Pro', | ||
os_version: '13', | ||
|
||
// Set other BrowserStack capabilities | ||
project: 'First Node App Percy Project', | ||
build: 'App Percy wd Android', | ||
name: 'first_visual_test' | ||
}; | ||
|
||
// Initialize the remote Webdriver using BrowserStack remote URL | ||
// and desired capabilities defined above | ||
const driver = wd.promiseRemote('https://hub-cloud.browserstack.com/wd/hub'); | ||
|
||
// Test case for the BrowserStack sample Android app. | ||
// If you have uploaded your app, update the test case here. | ||
driver.init(desiredCaps) | ||
.then(function() { | ||
// wait for app to load | ||
return new Promise((resolve) => setTimeout(resolve, 2000)); | ||
}) | ||
.then(function() { | ||
percyScreenshot(driver, 'Home Screen', { sync: true }); | ||
}) | ||
.fin(function() { | ||
// Invoke driver.quit() after the test is done to indicate that the test is completed. | ||
return driver.quit(); | ||
}) | ||
.done(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.