Skip to main content

Test Observability on Nightwatch.js

Quick start guide to integrate BrowserStack Test Observability with Nightwatch.js

Prerequisites

  • You have an account with BrowserStack (even a free trial works) and can get your Username and Access Key from your account profile.
  • You have a Nightwatch.js test suite (it is okay even if you do not run your tests on BrowserStack infrastructure).

Integrate with Test Observability

BrowserStack Test Observability can be used regardless of where your tests run - whether on BrowserStack’s devices and browsers, locally on your laptop, CI machines, or using another cloud provider.

Install or update to the latest version of the Nightwatch BrowserStack plugin

Go to your Nightwatch.js project’s root directory and run the following commands to update or install @nightwatch/browserstack and later check the installed version using the following commands:

Terminal
npm install @nightwatch/browserstack
npm list @nightwatch/browserstack


Please ensure to have @nightwatch/browserstack plugin v3.2.1 or higher and nightwatch v2.6.22 (for v2.x) or v3.2.0 (for v3.x) or higher before proceeding.

Set up the config file

Your nightwatch.conf.js should include the following keys as shown below:

nightwatch.conf.js
  module.exports = {
    //...
plugins: ['@nightwatch/browserstack'],

'@nightwatch/browserstack': {
    test_observability: {
    enabled: true,
    user: 'YOUR_USERNAME' || process.env.BROWSERSTACK_USERNAME,
    key: 'YOUR_ACCESS_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"]
    }
   
  },

    //...
  };

The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.

Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.

Run your suite with BrowserStack Test Observability

Use your existing command that you use to trigger a run and data will automatically start getting sent to BrowserStack Test Observability.

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy