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:
parent
d4f416e758
commit
6b89b9be30
4 changed files with 34 additions and 16 deletions
19
.travis.yml
19
.travis.yml
|
@ -16,6 +16,9 @@ matrix:
|
||||||
rvm: 2.2
|
rvm: 2.2
|
||||||
- gemfile: gemfiles/Gemfile.beta-versions
|
- gemfile: gemfiles/Gemfile.beta-versions
|
||||||
rvm: jruby-9.0.0.0.pre1
|
rvm: jruby-9.0.0.0.pre1
|
||||||
|
- gemfile: Gemfile
|
||||||
|
rvm: 2.2
|
||||||
|
env: CAPYBARA_CHROME=true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- gemfile: gemfiles/Gemfile.beta-versions
|
- gemfile: gemfiles/Gemfile.beta-versions
|
||||||
rvm: 2.2
|
rvm: 2.2
|
||||||
|
@ -26,13 +29,15 @@ env:
|
||||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- CHROMEDRIVER_VERSION=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
- if [ $CAPYBARA_CHROME ]; then
|
||||||
- CHROMEDRIVER_URL="http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
|
CHROMEDRIVER_VERSION=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE);
|
||||||
- FILE=`mktemp`; wget "$CHROMEDRIVER_URL" -qO $FILE && sudo unzip $FILE chromedriver -d /usr/local/bin; rm $FILE; sudo chmod 777 /usr/local/bin/chromedriver
|
CHROMEDRIVER_URL="http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip";
|
||||||
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
FILE=`mktemp`; wget "$CHROMEDRIVER_URL" -qO $FILE && sudo unzip $FILE chromedriver -d /usr/local/bin; rm $FILE; sudo chmod 777 /usr/local/bin/chromedriver;
|
||||||
- sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -;
|
||||||
- sudo apt-get update
|
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list';
|
||||||
- sudo apt-get install google-chrome-stable --force-yes
|
sudo apt-get update;
|
||||||
|
sudo apt-get install google-chrome-stable --force-yes;
|
||||||
|
fi
|
||||||
- sudo chmod 1777 /dev/shm
|
- sudo chmod 1777 /dev/shm
|
||||||
- sudo apt-get install awesome -y
|
- sudo apt-get install awesome -y
|
||||||
before_script:
|
before_script:
|
||||||
|
|
16
Rakefile
16
Rakefile
|
@ -15,6 +15,13 @@ RSpec::Core::RakeTask.new(:spec_with_chrome) do |t|
|
||||||
t.pattern = './spec{,/*/**}/*{_spec.rb,_spec_chrome.rb}'
|
t.pattern = './spec{,/*/**}/*{_spec.rb,_spec_chrome.rb}'
|
||||||
end
|
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|
|
YARD::Rake::YardocTask.new do |t|
|
||||||
t.files = ['lib/**/*.rb']
|
t.files = ['lib/**/*.rb']
|
||||||
t.options = %w(--markup=markdown)
|
t.options = %w(--markup=markdown)
|
||||||
|
@ -24,6 +31,13 @@ Cucumber::Rake::Task.new(:cucumber) do |task|
|
||||||
task.cucumber_opts = ['--format=progress', 'features']
|
task.cucumber_opts = ['--format=progress', 'features']
|
||||||
end
|
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]
|
task :default => [:spec, :cucumber]
|
||||||
|
|
|
@ -237,7 +237,10 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def invalid_element_errors
|
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
|
end
|
||||||
|
|
||||||
def no_such_window_error
|
def no_such_window_error
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
require 'selenium-webdriver'
|
||||||
|
|
||||||
Capybara.register_driver :selenium_chrome do |app|
|
Capybara.register_driver :selenium_chrome do |app|
|
||||||
args = ENV['TRAVIS'] ? ['no-sandbox' ] : []
|
args = ENV['TRAVIS'] ? ['no-sandbox' ] : []
|
||||||
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
|
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
|
||||||
end
|
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
|
module TestSessions
|
||||||
Chrome = Capybara::Session.new(:selenium_chrome, ChromeTestApp)
|
Chrome = Capybara::Session.new(:selenium_chrome, TestApp)
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara::SpecHelper.run_specs TestSessions::Chrome, "selenium_chrome", :capybara_skip => [
|
Capybara::SpecHelper.run_specs TestSessions::Chrome, "selenium_chrome", :capybara_skip => [
|
||||||
|
|
Loading…
Reference in a new issue