Run Selenium WebDriver UI tests against a Jekyll site on Travis CI

consider there is a Jekyll website online repository which has a few Selenium WebDriver UI assessments written with BDD framework Cucumber inside. After each commit, one may additionally discover it useful to run the ones tests on Travis CI against this Jekyll site in that unique devote, as part of the continuous integration process.

In place of strolling those exams towards the live production web site each time1, a higher manner might be to construct the website online on Travis CI itself, and run the assessments against localhost without delay.

put into effect tests
installation gem stones
start Jekyll internet server
Run UI tests
put in force assessments

initially, there need to be a few UI tests within the repository, which may be written the use of Selenium WebDriver, Watir, or any other suitable automation frameworks, without or with BDD/ATDD frameworks like Cucumber, Capybara, and so forth. To setup a easy Selenium WebDriver
Ruby Training
task on Travis CI, a preceding weblog article could be useful.

for the reason that site can be built on Travis CI locally, so the URL might be localhost:4000 instead of the actual live web page URL. bear in thoughts that port quantity 4000 may be made configurable if preferred.

set up gems

before building Jekyll and going for walks Selenium UI exams on Travis CI, some essential gems need to be mounted. To accomplish that, inside the before_install section of .travis.yml file, upload inside the following commands to put in gemstones, in this example jekyll, cucumber and selenium-webdriver.


different before_install steps

installation gemstones

  • gem set up jekyll cucumber selenium-webdriver
    alternatively, including a Gemfile within the repository could additionally do the activity, which should be picked up via Travis Ci routinely.

supply ‘

gem ‘jekyll’
gem ‘cucumber’
gem ‘selenium-webdriver’
begin Jekyll web server

To build the Jekyll web page domestically on Travis CI, upload a command to serve Jekyll website with --detach alternative in .travis.yml’s before_script section, that is available when you consider that Jekyll 1.2.0 or later. With this --detach alternative, web server will be running in history, so that any next instructions can be continued and entire Travis CI construct may not be putting.


  • jekyll serve --detach
  • sleep 3 # provide internet server a while to bind to sockets, and many others
    Run UI exams

In .travis.yml’s script phase, specify the commands to run those cucumber tests.


  • cucumber ./_rake/features/
    strolling checks towards production for branches that don’t alternate production is fairly redundant.