/headless_browser_tests

Get started with headless chrome/firefox within 5 minutes

Primary LanguageRuby

headless browser tests

lets sit and try headless browsers for chrome and firefox in 10 minutes

Build Status

SetUp

  1. Installing Browser in your system

A.On mac

  • Install chrome 59+
  • Install firefox 56+

B.On Ubuntu server

  • Install firefox
$ sudo apt-get update
$ wget https://ftp.mozilla.org/pub/firefox/releases/56.0/linux-x86_64/en-US/firefox-56.0.tar.bz2
$ tar -xjf firefox-56.0.tar.bz2
$ sudo mv firefox /opt/firefox56
$ sudo ln -s /opt/firefox56/firefox-bin /usr/bin/firefox
  • Install chrome
$ export CHROME_BIN=/usr/bin/google-chrome
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
$ sudo apt-get install google-chrome-stable
  1. Install ruby 2.3.0 or above with rvm RVM is ruby version manager. We can install it
$curl -sSL https://get.rvm.io | bash -s stable --ruby
$rvm install 2.3.0
$rvm use 2.3.0 --default

On ubuntu

$sudo apt-get install ruby
  1. Install bundler
$gem install bundler

clone the repo and run bundle install ,all dependencies will be added

$bundle install

4)Install geckodriver

$wget https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.19.0-linux64.tar.gz
$tar -xvzf geckodriver*
$chmod +x geckodriver
$sudo mv geckodriver /usr/local/bin/

Run Test

To run tests on headless chrome

$bundle exec cucumber DRIVER=headless_chrome

To run tests on headless firefox

$bundle exec cucumber DRIVER=headless_firefox

To run tests on headless firefox with verbose logging

$bundle exec cucumber DRIVER=headless_firefox DEBUG=true