Commit 1bd0b110e7481b28169722d7cb822c9d1a9bc574
1 parent
78c5e867
Exists in
send_email_to_admins
and in
5 other branches
selenium: optional support for chrome driver
Showing
3 changed files
with
39 additions
and
18 deletions
Show diff stats
.travis.yml
| ... | ... | @@ -40,21 +40,36 @@ before_script: |
| 40 | 40 | - bundle exec rake db:migrate &>/dev/null |
| 41 | 41 | |
| 42 | 42 | env: |
| 43 | - - TASK=test:api | |
| 44 | - - TASK=test:units | |
| 45 | - - TASK=test:functionals | |
| 46 | - - TASK=test:integration | |
| 47 | - - SLICE=1/2 TASK=cucumber LANG=en | |
| 48 | - - SLICE=2/2 TASK=cucumber LANG=en | |
| 49 | - - SLICE=1/4 TASK=selenium | |
| 50 | - - SLICE=2/4 TASK=selenium | |
| 51 | - - SLICE=3/4 TASK=selenium | |
| 52 | - - SLICE=4/4 TASK=selenium | |
| 53 | - - SLICE=1/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 54 | - - SLICE=2/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 55 | - - SLICE=3/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 56 | - - SLICE=4/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 57 | - - SLICE=5/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 43 | + global: | |
| 44 | + - LANG=en | |
| 45 | + matrix: | |
| 46 | + - TASK=test:api | |
| 47 | + - TASK=test:units | |
| 48 | + - TASK=test:functionals | |
| 49 | + - TASK=test:integration | |
| 50 | + - SLICE=1/2 TASK=cucumber | |
| 51 | + - SLICE=2/2 TASK=cucumber | |
| 52 | + - SLICE=1/4 TASK=selenium | |
| 53 | + - SLICE=2/4 TASK=selenium | |
| 54 | + - SLICE=3/4 TASK=selenium | |
| 55 | + - SLICE=4/4 TASK=selenium | |
| 56 | + - SLICE=1/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 57 | + - SLICE=2/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 58 | + - SLICE=3/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 59 | + - SLICE=4/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 60 | + - SLICE=5/5 TASK=test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
| 61 | + # chrome hanging on travis | |
| 62 | + #- SLICE=1/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 63 | + #- SLICE=2/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 64 | + #- SLICE=3/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 65 | + #- SLICE=4/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 66 | + | |
| 67 | +matrix: | |
| 68 | + allow_failures: | |
| 69 | + - env: SLICE=1/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 70 | + - env: SLICE=2/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 71 | + - env: SLICE=3/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 72 | + - env: SLICE=4/4 TASK=selenium SELENIUM_DRIVER=chrome | |
| 58 | 73 | |
| 59 | 74 | script: |
| 60 | 75 | - bundle exec rake $TASK | ... | ... |
Gemfile
| ... | ... | @@ -77,6 +77,7 @@ group :cucumber do |
| 77 | 77 | gem 'cucumber-rails', '~> 1.4.2', :require => false |
| 78 | 78 | gem 'database_cleaner', '~> 1.3' |
| 79 | 79 | gem 'selenium-webdriver', '>= 2.50' |
| 80 | + gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' | |
| 80 | 81 | end |
| 81 | 82 | |
| 82 | 83 | # Requires custom dependencies | ... | ... |
features/support/selenium.rb
| ... | ... | @@ -2,9 +2,14 @@ require 'selenium/webdriver' |
| 2 | 2 | |
| 3 | 3 | Capybara.default_driver = :selenium |
| 4 | 4 | Capybara.register_driver :selenium do |app| |
| 5 | - profile = Selenium::WebDriver::Firefox::Profile.new | |
| 6 | - profile.native_events = true | |
| 7 | - Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile | |
| 5 | + case ENV['SELENIUM_DRIVER'] | |
| 6 | + when 'chrome' | |
| 7 | + Capybara::Selenium::Driver.new app, browser: :chrome | |
| 8 | + else | |
| 9 | + profile = Selenium::WebDriver::Firefox::Profile.new | |
| 10 | + profile.native_events = true | |
| 11 | + Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile | |
| 12 | + end | |
| 8 | 13 | end |
| 9 | 14 | |
| 10 | 15 | Before('@ignore-hidden-elements') do | ... | ... |