6.1.1 • Published 2 years ago

jest-environment-selenium-webdriver v6.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Jest Selenium Environment

Automated testing in Chrome, Edge, Firefox using Jest, Selenium and Docker.

Install

npm i jest-environment-selenium-webdriver

Config single env in Package.json

testEnvironmentOptions: {
  browserName: 'chrome',
  browserArgs: [
    'no-sandbox',
    'headless',
    'disable-gpu',
    '--window-size=1920,1080',
    '--ignore-ssl-errors=yes',
    '--ignore-certificate-errors'
  ],
}

Config multiple envs

jest.chrome.js

module.exports = {
  testEnvironmentOptions: {
    browserName: 'chrome',
    browserArgs: [
      'no-sandbox',
      'headless',
      'disable-gpu',
      '--window-size=1920,1080',
      '--ignore-ssl-errors=yes',
      '--ignore-certificate-errors'
    ],
  }
}

jest.edge.js

module.exports = {
  testEnvironmentOptions: {
    browserName: 'edge',
    browserArgs: [
      'no-sandbox',
      'headless',
      'disable-gpu',
      '--window-size=1920,1080',
      '--ignore-ssl-errors=yes',
      '--ignore-certificate-errors'
    ],
  }
}

jest.firefox.js

module.exports = {
  testEnvironmentOptions: {
    browserName: 'firefox',
    browserArgs: [
      'no-sandbox',
      'headless',
      'disable-gpu',
      '--window-size=1920,1080',
      '--ignore-ssl-errors=yes',
      '--ignore-certificate-errors'
    ],
  }
}

testEnvironmentOptions

optionsdescriptionvalues
browserNametargeted browserchrome, edge or firefox
browserArgsarguments to configure the browser(optional) array of strings
browserBinary(optional) absolute path to browser exe in case you need to run a specific versionstring
remoteServer(optional) path to reach selenium grid serverstring e.g. http://localhost:4444

Run using scripts in Package.json

scripts: {
  "test:chrome": "jest --config=./jest.chrome.js",
  "test:edge": "jest --config=./jest.edge.js",
  "test:firefox": "jest --config=./jest.firefox.js",
}
  • Invoke npm run test:chrome
5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

6.0.1

2 years ago

6.1.1

2 years ago

3.0.0

2 years ago

4.1.0

2 years ago

4.0.0

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago