From dfd985fdf2a82690217edd94110615d6ebe17821 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Tue, 21 Jul 2015 17:43:11 -0700 Subject: [PATCH] use travis container mode --- .travis.yml | 21 +++++++++++-------- .../spec/session/accept_confirm_spec.rb | 2 +- spec/selenium_spec_chrome.rb | 2 ++ spec/server_spec.rb | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index aab96949..dba3d8b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: ruby +sudo: false rvm: - 1.9.3 - 2.0.0 - 2.1 - 2.2 - jruby-19mode - - jruby-9.0.0.0 + - jruby-9.0.3.0 - rbx-2 gemfile: - Gemfile @@ -20,23 +21,25 @@ matrix: env: CAPYBARA_CHROME=true allow_failures: - gemfile: gemfiles/Gemfile.beta-versions - - rvm: jruby-9.0.0.0 + - rvm: jruby-9.0.3.0 env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true +addons: + apt: + sources: + - google-chrome + packages: + - google-chrome-stable + - awesome + before_install: - if [ $CAPYBARA_CHROME ]; then CHROMEDRIVER_VERSION=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE); CHROMEDRIVER_URL="http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"; - FILE=`mktemp`; wget "$CHROMEDRIVER_URL" -qO $FILE && sudo unzip $FILE chromedriver -d /usr/local/bin; rm $FILE; sudo chmod 777 /usr/local/bin/chromedriver; - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -; - sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'; - sudo apt-get update; - sudo apt-get install google-chrome-stable --force-yes; + FILE=`mktemp`; wget "$CHROMEDRIVER_URL" -qO $FILE && unzip $FILE chromedriver -d ~; rm $FILE; chmod 777 ~/chromedriver; fi - - sudo chmod 1777 /dev/shm - - sudo apt-get install awesome -y before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start diff --git a/lib/capybara/spec/session/accept_confirm_spec.rb b/lib/capybara/spec/session/accept_confirm_spec.rb index 85aa10a5..4386098a 100644 --- a/lib/capybara/spec/session/accept_confirm_spec.rb +++ b/lib/capybara/spec/session/accept_confirm_spec.rb @@ -17,7 +17,7 @@ Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do expect(message).to eq('Confirm opened') end - it "should work with nested modals", focus: true do + it "should work with nested modals" do expect { @session.dismiss_confirm 'Are you really sure?' do @session.accept_confirm 'Are you sure?' do diff --git a/spec/selenium_spec_chrome.rb b/spec/selenium_spec_chrome.rb index 4ca0163b..743c3e8b 100644 --- a/spec/selenium_spec_chrome.rb +++ b/spec/selenium_spec_chrome.rb @@ -1,6 +1,8 @@ require 'spec_helper' require 'selenium-webdriver' +Selenium::WebDriver::Chrome.driver_path = '/home/travis/chromedriver' if ENV['TRAVIS'] + Capybara.register_driver :selenium_chrome do |app| args = ENV['TRAVIS'] ? ['no-sandbox' ] : [] Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args) diff --git a/spec/server_spec.rb b/spec/server_spec.rb index 4ed18a7c..711e09f6 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Capybara::Server do ensure Capybara.server_host = nil end - end + end unless ENV['TRAVIS'] and (RUBY_ENGINE == 'jruby') #TODO travis with jruby in container mode has an issue with this test it "should use specified port" do Capybara.server_port = 22789