This repository demonstrates how to run Appium tests in Nightwatch on BrowserStack App Automate.
Nightwatch Integration with BrowserStack.
-
Clone the repo
-
Install the dependencies using
npm install
-
Export the environment variables for the Username and Access Key of your BrowserStack account, which you can get directly from the app automate dashboard
export BROWSERSTACK_USERNAME=<browserstack-username> && export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
- To run a single android test, run
npm run single-android
- To run a single ios test, run
npm run single-ios
- To run local tests, run
npm run local
Please run the above tests once before running parallel tests, so that the apps can be uploaded on the respective custom id.
- To run parallel tests, run
npm run parallel
- To run parallel tests on different devices, run
npm run parallel-devices
- To run test suite, run
npm run suite
- To run parallel local tests, run
npm run parallel-local
Understand how many parallel sessions you need by using our Parallel Test Calculator
- You can view your test results on the BrowserStack app automate dashboard
- To test on a different set of browsers, check out our capabilities generator
You can specify proxy settings in Nightwatch by adding the proxy
key in your *.conf.js
test_settings: {
default: {
desiredCapabilities: {
// Your capabilities
},
proxy: {
"host": "", // "127.0.0.1"
"port": "", // "8081"
"protocol": "" // "http"
}
}
}
Test Observability is a reporting tool that helps you isolate the genuine test failures after eliminating noise from flaky and always failing tests and also helps with root cause analysis of failed tests.
With Test Observability, you can not only complete your run verification in minutes, you will also be empowered with rich historical data to understand the overall health of your test suites, uncover burning issues impacting the stability of your tests, and help you optimize your tests.
You can learn more about what the product has to offer and why you should be using it.
Please add the following code snippet to your nightwatch.conf.js.
module.exports = {
//...
plugins: ['@nightwatch/browserstack'],
'@nightwatch/browserstack': {
test_observability: {
enabled: true,
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
projectName: "Enter Static Project Name Here",
buildName: "Enter Static Project Name Here",
buildTag: ["Custom Tag 1","Custom Tag 2"]
}
},
//...
};
To get started with the Test Observability integration with your Nightwatch Project, please refer to this documentation.