# @gliff-ai/jest-browserstack-automate

> Simple harness for running Automate tests with Jest

Latest version **6.0.8** (published 2022-05-20) · AGPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install @gliff-ai/jest-browserstack-automate
pnpm add @gliff-ai/jest-browserstack-automate
yarn add @gliff-ai/jest-browserstack-automate
bun add @gliff-ai/jest-browserstack-automate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.8 |
| Published | 2022-05-20 |
| First published | 2021-11-09 |
| Weekly downloads | 0 |
| License | AGPL-3.0-only |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 49.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Craig Cooper |
| Maintainers | cooper667, chasnelson1990, christiannyadu |

## Links

- npm: https://www.npmjs.com/package/@gliff-ai/jest-browserstack-automate
- Repository: https://github.com/gliff-ai/jest-browserstack-automate
- Homepage: https://github.com/gliff-ai/jest-browserstack-automate#readme
- Issues: https://github.com/gliff-ai/jest-browserstack-automate/issues
- npm.io page: https://npm.io/package/@gliff-ai/jest-browserstack-automate

## Recent versions

- 6.0.8 (latest) — 2022-05-20
- 6.0.7 — 2022-05-19
- 6.0.6 — 2022-05-19
- 6.0.5 — 2022-05-19
- 6.0.4 — 2022-05-19
- 6.0.3 — 2022-05-19
- 6.0.2 — 2022-05-18
- 6.0.1 — 2022-05-18
- 6.0.0 — 2022-05-04
- 5.2.8 — 2022-05-03
- 5.2.7 — 2022-05-03
- 5.2.6 — 2022-05-03
- 5.2.5 — 2022-05-03
- 5.2.4 — 2022-04-29
- 5.2.3 — 2022-04-29
- … 38 more at https://npm.io/package/@gliff-ai/jest-browserstack-automate/versions

## README

# gliff.ai [test] jest-browserstack-automate

![Repo License](https://img.shields.io/github/license/gliff-ai/jest-browserstack-automate?color=0078FF&style=flat-square) ![Repository Size](https://img.shields.io/github/repo-size/gliff-ai/jest-browserstack-automate?style=flat-square&color=f2f2f2) ![Latest Tag](https://img.shields.io/github/v/tag/gliff-ai/jest-browserstack-automate?&label=latest_tag&style=flat-square&color=f2f2f2) ![Number of Open Issues](https://img.shields.io/github/issues/gliff-ai/jest-browserstack-automate?style=flat-square&color=yellow) ![Number of Open Pull Requests](https://img.shields.io/github/issues-pr/gliff-ai/jest-browserstack-automate?style=flat-square&color=yellow)

👋 **Welcome in!** 👋

This repository contains the Open Source code for [gliff.ai](https://gliff.ai)’s [Browserstack Automate tests using Jest](https://www.browserstack.com/guide/jest-framework-tutorial).

This [test] repository aims to create vital tests which help catch any technical or visual breakages in the code or performance and alert the [gliff.ai](https://gliff.ai) team. This simple test harness is a collection of stubs, driver and other support tools that enables Browserstack Automate tests to be run with Jest and generate a test report.

❌ **This repository does not accept most contributions unfortunately! However, an issue can still be raised if you recognise a problem you wish to bring to the gliff.ai teams attention.** ❌

## Table of Contents

Looking for something specific? 🔍

- [Repository Introduction](#gliffai-jest-browserstack-automate)
- [Table of Contents](#table-of-contents)
- [Setup](#setup)
- [Contribute](#contribute)
- [Contact](#contact)
- [License](#license)

## Setup

[{{back to navigation}}](#table-of-contents)

Below is the wrapper you should use to setup **BrowerStack** and run Selenium tests using Jest.

```javascript
// 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.

**NOTE:** \
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. \

Below is the additonal wrapper you should use to setup **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`

## Contribute

[{{back to navigation}}](#table-of-contents)

This repository **does not accept contributions** unfortunately as content has been developed with specific gliff.ai team practises and preferences in mind. _However_, an issue can still be raised if you recognise a problem you wish to bring to the gliff.ai teams attention.

We do have several repositories within the gliff.ai github space that  welcome all contributions and contributors on. These will be marked with the topic tag **contributions-welcome** meaning we welcome contributions on this repository! Search for them [here](https://github.com/search?q=topic%3Acontributors-welcome+org%3Agliff-ai&type=Repositories)!

Check out the [gliff.ai Contribution Guide](https://github.com/gliff-ai/.github/blob/main/CONTRIBUTING.md) 👋 to learn more!

## Contact

[{{back to navigation}}](#table-of-contents)

Need some help? 🤔 Have a question? 🧠 \
Reach out to the gliff.ai team at [community@gliff.ai](mailto:community@gliff.ai?subject=[GitHub]) or on our [GitHub discussions](https://github.com/gliff-ai/roadmap/discussions/landing).

## License

[{{back to navigation}}](#table-of-contents)

This code is licensed under a [GNU AGPLv3 license](https://github.com/gliff-ai/jest-browserstack-automate/blob/main/LICENSE) 📝 \
Curious about our reasoning for this? Read about them [here](https://gliff.ai/articles/open-source-license-gnu-agplv3/)!

---
_Source: https://npm.io/package/@gliff-ai/jest-browserstack-automate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
