All Projects → applitools → jest-environment-selenium

applitools / jest-environment-selenium

Licence: Apache-2.0 license
Jest environment for running Selenium WebDriver tests

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jest-environment-selenium

Rails Env Favicon
Gem to display the rails environment on the favicon
Stars: ✭ 212 (+657.14%)
Mutual labels:  environment
ai-learning-environments
List of environments and competitions for RL and AI training
Stars: ✭ 14 (-50%)
Mutual labels:  environment
protractor-element-extend
Module, that helps you to extend ElementFinder in your own custom fragments
Stars: ✭ 22 (-21.43%)
Mutual labels:  webdriver
Ma Gym
A collection of multi agent environments based on OpenAI gym.
Stars: ✭ 226 (+707.14%)
Mutual labels:  environment
bandmaster
Simple and easily extendable Go library for managing runtime services & dependencies (datastores, APIs, MQs, custom...).
Stars: ✭ 43 (+53.57%)
Mutual labels:  environment
elemental
Elemental makes Selenium automation faster and easier.
Stars: ✭ 36 (+28.57%)
Mutual labels:  webdriver
Terraform Aws Elastic Beanstalk Environment
Terraform module to provision an AWS Elastic Beanstalk Environment
Stars: ✭ 211 (+653.57%)
Mutual labels:  environment
kapten
Simple containerized development environments directly from the command line
Stars: ✭ 53 (+89.29%)
Mutual labels:  environment
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (+10.71%)
Mutual labels:  environment
violent-webdriver
UI自动化测试暴力插件
Stars: ✭ 41 (+46.43%)
Mutual labels:  webdriver
Loft
Namespace & Virtual Cluster Manager for Kubernetes - Lightweight Virtual Clusters, Self-Service Provisioning for Engineers and 70% Cost Savings with Sleep Mode
Stars: ✭ 239 (+753.57%)
Mutual labels:  environment
adopt-a-drain
A web application that allows citizens to "adopt" a storm drain in San Francisco. In use, and in development at other brigades. Looking for a maintainer or someone interested in developing further in collaboration with others across the country.
Stars: ✭ 43 (+53.57%)
Mutual labels:  environment
wd.java
Java Client binding for Macaca
Stars: ✭ 30 (+7.14%)
Mutual labels:  webdriver
Setup Miniconda
Set up your GitHub Actions workflow with conda via miniconda
Stars: ✭ 222 (+692.86%)
Mutual labels:  environment
coffee-boots
Support property-based configuring of multiple Caffeine caches for Spring Cache abstraction.
Stars: ✭ 22 (-21.43%)
Mutual labels:  environment
Environ Config
Python Application Configuration With Environment Variables
Stars: ✭ 210 (+650%)
Mutual labels:  environment
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+157.14%)
Mutual labels:  environment
Fruit-API
A Universal Deep Reinforcement Learning Framework
Stars: ✭ 61 (+117.86%)
Mutual labels:  environment
selenium-auto-wait
Utility to automatically manage all web element waits and enables to write wait-free selenium tests.
Stars: ✭ 31 (+10.71%)
Mutual labels:  webdriver
wdio-intercept-service
🕸 Capture and assert HTTP ajax calls in webdriver.io
Stars: ✭ 101 (+260.71%)
Mutual labels:  webdriver

jest-environment-selenium · npm version Build Status License

Jest environment for running Selenium WebDriver tests

Installation

I like using yarn for installations.

yarn add -D jest-environment-selenium

But npm works too!

npm install --save-dev jest-environment-selenium

Setup

Add this to the package.json:

"jest": {
    "testEnvironment": "jest-environment-selenium",
    "setupTestFrameworkScriptFile": "jest-environment-selenium/dist/setup.js"
}

By default tests will run against a local chromedriver, but you can easily specify something else.

"jest": {
    "testEnvironmentOptions": {
      "capabilities": {
        "browserName": "firefox"
      },
      "server": "http://localhost:4444/wd/hub",
      "proxyType": "manual",
      "proxyOptions": {
        "https": "http://127.0.0.1:3218"
      }
    }
}

Jest Environment Selenium

Tests will be initialized with a driver according to the options (or a default chrome one)

test('load wikipedia', () => {
  driver.get('https://en.wikipedia.org/wiki/Base64');
});

cleanup

Kills the used session and starts a new one.

afterEach(async () => (cleanup()));

Failing to call cleanup will result in non "idempotent" tests, which reuse the same WebDriver session (which can lead to difficult to debug errors in your tests).

Caveats

Since the tests are async make sure you return a Promise so that jest won't bail early

test('load wikipedia', () => {
  driver.get('https://en.wikipedia.org/wiki/Base64');
  return driver.getTitle().then(title => {expect(title).toBeDefined();});
});

Matchers

Custom WebDriver matchers designed for ease of use with jest

expect.resolves[.not].toBePresent()

toBePresent checks that an element appears on a page, it expects to receive a WebElementPromise

test('link appears in the page', () => {
  driver.get('https://en.wikipedia.org/wiki/Base64');
  return expect(driver.findElements(By.linkText("binary-to-text encoding"))).resolves.toBePresent();
});

expect.resolves[.not].toBeChecked()

toBeChecked checks that a checkbox is checked (many checks wow! 😱), it expects to receive a WebElementPromise

test('a checkbox is checked', () => {
  driver.get('somewhere');
  return expect(driver.findElements(By.css('input[type="checkbox"]'))).resolves.toBeChecked();
});

expect.resolves[.not].toBeEditable()

toBeEditable checks that an input is editable (enabled and not readonly), it expects to receive a WebElementPromise

test('an input is editable', () => {
  driver.get('somewhere');
  return expect(driver.findElements(By.css('input'))).resolves.toBeEditable();
});

expect.resolves[.not].toHaveValue(value)

toHaveValue checks that an input value is what you expect, it expects to receive a WebElementPromise

test('an input has the value', () => {
  driver.get('somewhere');
  return expect(driver.findElements(By.css('input'))).resolves.toHaveValue('test');
});

expect.resolves[.not].toHaveSelectedValue(value)

toHaveValue checks that a select value is what you expect (will fail on other inputs), it expects to receive a WebElementPromise

test('a select has the right value', () => {
  driver.get('somewhere');
  return expect(driver.findElements(By.css('select'))).resolves.toHaveSelectedValue('test');
});

expect.resolves[.not].toHaveText(value)

toHaveValue checks that an element innetText is what you expect, it expects to receive a WebElementPromise

test('the paragraph has the correct text', () => {
  driver.get('somewhere');
  return expect(driver.findElements(By.css('p'))).resolves.toHaveText('some nice text, maybe lorem ipsum');
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].