Skip to content

jmarceli/jest-selenium-browserstack-example

Repository files navigation

Jest Selenium BrowserStack Example

  1. Clone it git clone git@github.com:jmarceli/jest-selenium-browserstack-example.git
  2. cd jest-selenium-browserstack-example
  3. Replace YOUR_BROWSERSTACK_USERNAME with BrowserStack username and YOUR_BROWSERSTACK_KEY with BrowserStack key in files inside test/ directory
  4. Run selected tests (see scripts section below) and/or modify source

For more information head to https://www.grzegorowski.com/integration-tests-with-jest-selenium-and-browserstack/

Scripts

Local tests

Run Jest Selenium tests locally with:

yarn test:local

Manual tests

Connect with BrowserStack manually:

~/.browserstack/BrowserStackLocal --key [YOUR_BROWSERSTACK_KEY] --folder $(pwd)

and then run tests with:

yarn test:manual

Automate tests

Just execute:

yarn test:automate

And see tests automatically connecting and running on BrowserStack.

Parametrized tests

To run tests against browser and OS specified as command execution arguments use:

BROWSER=chrome OS=Windows yarn test:parametrized

Sequential tests

Here is how you may run tests for multiple browsers in one call, adjust configuration in ./test/config.json and run:

yarn test:sequential

Other scripts available

yarn build

For building tested code from src/ directory.

yarn clean

To remove lib/ directory generated with build script.

yarn lint

Runs Eslint on files inside src/ directory.


author: Jan Grzegorowski