BackstopJS-like Visual Regression Tests for BrowserStack Automate

Usage no npm install needed!

<script type="module">
  import bsbs from '';



A BackstopJS-like Visual Regression Testing Tool for BrowserStack Automate

npx bsbs
  --file=<path to the backstop.json or backstop.js>
  --capabilities=<path to the selenium capability config>
  (--filter=<regexp of scenario>)

See Example

See example report here:

Example Report

and its configurations:


  1. Capture Reference Pages:
    npx bsbs --mode=reference --file=backstop.json --capabilities=capabilities.json
  2. Capture Test Pages:
    npx bsbs --mode=test --file=backstop.json --capabilities=capabilities.json
  3. Compare and Generate Test Report:
    npx bsbs --mode=report --file=backstop.json --capabilities=capabilities.json



  • reference: run tests on reference pages
  • test: run tests on test pages
  • report: generate test reports (reference & test must be done before this)


Path to BackstopJS Test: backstop.json | backstop.js



Path to Selenium Capabilities Configuration for BrowserStack Automate.


This file also can be provided in .json ({ ... }) or in .js (with module.exports = { ... };)

--filter (Optional)

filter scenarios to run by RegExp given (e.g.: --filter="my-top-page.*")

--local (Optional)

enable BrowserStack local testing (using your internal network)


Environment Variables

You can also always give your default Environment Variables by placing .env file. See example.env for example.

BROWSERSTACK_USERNAME (Required unless given in capabilities file)

The User ID for BrowserStack Automate


BROWSERSTACK_ACCESS_KEY (Required unless given in capabilities file)

The Access Key for BrowserStack Automate



Path to the Directory for Reference Screenshots

(default: ${working directory}/artifacts/reference/)


Path to the Directory for Test Screenshots

(default: ${working directory}/artifacts/test/)


Path to the Directory for Difference Images

(default: ${working directory}/artifacts/difference/)


Path to the Directory for Test Reports

(default: ${working directory}/artifacts/)