Automated browser tests, in my case, are often part of continuous integration (CI). Failure = no deploy. This naturally creates some expectations towards acceptance/end to end testing framework. I haven’t found the tool which would meet all requirements although CodeceptJS is close. Nevertheless, no matter whether you use Protractor, Nightwatch.js, WebdriverIO, CodeceptJS or anything else based on Selenium you need to set it up and make it talk to the browser.
Selenium and drivers versions are important as not all drivers can run on any version of Selenium and not all browser versions are compatible with the specific driver.
All following commands should be executed from the root of your project.
Get the Selenium Standalone Server
curl -O https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.6.0.jar
Version 3.x of Selenium doesn’t include a driver for Firefox anymore. To run your tests in Firefox 48+ you need GeckoDriver. Check the CHANGELOG for more info.
This particular version requires Java to run:
java -jar selenium-server-standalone-3.4.0.jar
Get the GeckoDriver
curl -OL https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz tar -xvf geckodriver-v0.19.1-linux64.tar.gz
curl -OL https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-macos.tar.gz tar -xvf geckodriver-v0.19.1-macos.tar.gz
You can find other geckodriver releases on GitHub and download appropriate for your system.
Get the ChromeDriver
curl -O http://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip unzip chromedriver_linux64.zip
curl -O https://chromedriver.storage.googleapis.com/2.31/chromedriver_mac64.zip unzip chromedriver_mac64.zip
You can find other ChromeDriver releases on Chromium website and download appropriate for your system.
|Selenium Standalone Server||Firefox||GeckoDriver||Chrome||ChromeDriver|
Alternative - it’s a Nightmare
Nightmare is a very interesting alternative to Selenium-based testing frameworks. In contrast to those I’ve mentioned at the beginning, I don’t have much experience with it. Based on my tests it was almost 3 times faster on average than WebdriverIO. Under the hood Nightmare uses Electron.
To start using Nightmare all you need to do is install it and start writing tests. No config files required.
npm i -D nightmare
Check it out. Nightmare is definitely worth giving a try!