Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gliff-ai/jest-browserstack-automate

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gliff-ai/jest-browserstack-automate

Simple harness for running Automate tests with Jest

  • 5.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
78
increased by1014.29%
Maintainers
3
Weekly downloads
 
Created
Source

Wrapper to setup broswer stack and run Selenium tests with Jest

To Use:

// Replaces the Jest global `test` with our function, which has a selenium driver as an arg. This handles sending pass/failure status to Browserstack.
const {
  wrapper,
  test,
  webdriver,
} = require("@gliff-ai/jest-browserstack-automate")();

const { TARGET_URL = "http://localhost:3000/" } = process.env;

// Wrappper is a jest describe with before/after hooks to setup browserstack and the local tunnel
wrapper(() => {
  describe("Load page", () => {
    test("Loads the page", async (driver, percySnapshot) => {
      await driver.get(TARGET_URL);

      await driver.wait(webdriver.until.titleMatches(/Title/i), 5000);
      const title = await driver.getTitle();

      expect(title).toEqual("PAGE TITLE");
    });
  });
});

run with jest --no-colors as we send the message to browserstack so don't want the colour codes.

If no env vars are set, it will run locally, you will need the driver installed for the selected browser.

If BROWSERSTACK_NAME is set, it will use Browserstack for the driver (capabilities can be passed as the final arg to test)

If BROWSERSTACK_ACCESS_KEY is set, the Browserstack local proxy will be set up, which allows the use of local URLs.

Percy

The second argument passed to test is a wrapper for percySnapshot that will create only 1 snapshot rather than 1 for each browser (import the original from "@percy/selenium-webdriver" to create a snapshot for every browser)

PERCY_TOKEN=xxxx percy exec -- jest --no-colors

FAQs

Package last updated on 22 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc