Project Setup for Selenium

Learn how to set up Selenium in a React project, and understand the additional libraries that you will need.

As mentioned before, integration tests require more setup. To implement them, we will use the Selenium framework. This is a tool to control the browser programmatically. We will still use Jest as a test runner and reporter but with a custom config. Firstly, you need to install the dependencies:

$ npm i -D selenium-webdriver chromedriver

selenium-webdriver are the JS bindings for Selenium, and chromedriver is the JS binding and a distribution of the Google Chrome browser driver. Once you have it installed, you need to create config files for jest and babel. Both are needed to enable ES6 Modules (import/export statements) and Generator Runtime (async/await statements). Create a file jest.config.js in the project root:

Get hands-on with 1200+ tech skills courses.