1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

run chrome test separately once

This commit is contained in:
Thomas Walpole 2015-05-21 11:00:36 -07:00
parent d4f416e758
commit 6b89b9be30
4 changed files with 34 additions and 16 deletions

View file

@ -16,6 +16,9 @@ matrix:
rvm: 2.2
- gemfile: gemfiles/Gemfile.beta-versions
rvm: jruby-9.0.0.0.pre1
- gemfile: Gemfile
rvm: 2.2
env: CAPYBARA_CHROME=true
allow_failures:
- gemfile: gemfiles/Gemfile.beta-versions
rvm: 2.2
@ -26,13 +29,15 @@ env:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
before_install:
- 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
- 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;
fi
- sudo chmod 1777 /dev/shm
- sudo apt-get install awesome -y
before_script:

View file

@ -15,6 +15,13 @@ RSpec::Core::RakeTask.new(:spec_with_chrome) do |t|
t.pattern = './spec{,/*/**}/*{_spec.rb,_spec_chrome.rb}'
end
RSpec::Core::RakeTask.new(:spec_chrome) do |t|
t.rspec_opts = %w[--color]
# jruby buffers the progress formatter so travis doesn't see output often enough
t.rspec_opts << '--format documentation' if RUBY_PLATFORM=='java'
t.pattern = './spec/*{_spec_chrome.rb}'
end
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
t.options = %w(--markup=markdown)
@ -24,6 +31,13 @@ Cucumber::Rake::Task.new(:cucumber) do |task|
task.cucumber_opts = ['--format=progress', 'features']
end
task :travis => [:spec_with_chrome, :cucumber]
task :travis do |t|
if ENV['CAPYBARA_CHROME']
Rake::Task[:spec_chrome].invoke
else
Rake::Task[:spec].invoke
Rake::Task[:cucumber].invoke
end
end
task :default => [:spec, :cucumber]

View file

@ -237,7 +237,10 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
end
def invalid_element_errors
[Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::ElementNotVisibleError]
[Selenium::WebDriver::Error::StaleElementReferenceError,
Selenium::WebDriver::Error::UnhandledError,
Selenium::WebDriver::Error::ElementNotVisibleError,
Selenium::WebDriver::Error::InvalidSelectorError] # Work around a race condition that can occur with chromedriver and #go_back/#go_forward
end
def no_such_window_error

View file

@ -1,17 +1,13 @@
require 'spec_helper'
require 'selenium-webdriver'
Capybara.register_driver :selenium_chrome do |app|
args = ENV['TRAVIS'] ? ['no-sandbox' ] : []
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
end
class ChromeTestApp < TestApp
# Object.id is different from the TestApp used in firefox session so
# a new Capybara::Server instance will get launched for chrome testing
end
module TestSessions
Chrome = Capybara::Session.new(:selenium_chrome, ChromeTestApp)
Chrome = Capybara::Session.new(:selenium_chrome, TestApp)
end
Capybara::SpecHelper.run_specs TestSessions::Chrome, "selenium_chrome", :capybara_skip => [