From 1bd0b110e7481b28169722d7cb822c9d1a9bc574 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Mon, 25 Apr 2016 16:58:46 -0300 Subject: [PATCH] selenium: optional support for chrome driver --- .travis.yml | 45 ++++++++++++++++++++++++++++++--------------- Gemfile | 1 + features/support/selenium.rb | 11 ++++++++--- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a76ad9..757ac55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,21 +40,36 @@ before_script: - bundle exec rake db:migrate &>/dev/null env: - - TASK=test:api - - TASK=test:units - - TASK=test:functionals - - TASK=test:integration - - SLICE=1/2 TASK=cucumber LANG=en - - SLICE=2/2 TASK=cucumber LANG=en - - SLICE=1/4 TASK=selenium - - SLICE=2/4 TASK=selenium - - SLICE=3/4 TASK=selenium - - SLICE=4/4 TASK=selenium - - SLICE=1/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install - - SLICE=2/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install - - SLICE=3/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install - - SLICE=4/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install - - SLICE=5/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + global: + - LANG=en + matrix: + - TASK=test:api + - TASK=test:units + - TASK=test:functionals + - TASK=test:integration + - SLICE=1/2 TASK=cucumber + - SLICE=2/2 TASK=cucumber + - SLICE=1/4 TASK=selenium + - SLICE=2/4 TASK=selenium + - SLICE=3/4 TASK=selenium + - SLICE=4/4 TASK=selenium + - SLICE=1/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + - SLICE=2/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + - SLICE=3/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + - SLICE=4/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + - SLICE=5/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install + # chrome hanging on travis + #- SLICE=1/4 TASK=selenium SELENIUM_DRIVER=chrome + #- SLICE=2/4 TASK=selenium SELENIUM_DRIVER=chrome + #- SLICE=3/4 TASK=selenium SELENIUM_DRIVER=chrome + #- SLICE=4/4 TASK=selenium SELENIUM_DRIVER=chrome + +matrix: + allow_failures: + - env: SLICE=1/4 TASK=selenium SELENIUM_DRIVER=chrome + - env: SLICE=2/4 TASK=selenium SELENIUM_DRIVER=chrome + - env: SLICE=3/4 TASK=selenium SELENIUM_DRIVER=chrome + - env: SLICE=4/4 TASK=selenium SELENIUM_DRIVER=chrome script: - bundle exec rake $TASK diff --git a/Gemfile b/Gemfile index 9b9c2f5..498d8ad 100644 --- a/Gemfile +++ b/Gemfile @@ -77,6 +77,7 @@ group :cucumber do gem 'cucumber-rails', '~> 1.4.2', :require => false gem 'database_cleaner', '~> 1.3' gem 'selenium-webdriver', '>= 2.50' + gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' end # Requires custom dependencies diff --git a/features/support/selenium.rb b/features/support/selenium.rb index 0f4711c..249da01 100644 --- a/features/support/selenium.rb +++ b/features/support/selenium.rb @@ -2,9 +2,14 @@ require 'selenium/webdriver' Capybara.default_driver = :selenium Capybara.register_driver :selenium do |app| - profile = Selenium::WebDriver::Firefox::Profile.new - profile.native_events = true - Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile + case ENV['SELENIUM_DRIVER'] + when 'chrome' + Capybara::Selenium::Driver.new app, browser: :chrome + else + profile = Selenium::WebDriver::Firefox::Profile.new + profile.native_events = true + Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile + end end Before('@ignore-hidden-elements') do -- libgit2 0.21.2