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

Add selenium with chrome to the travis test suite

This commit is contained in:
Thomas Walpole 2013-02-25 11:13:03 -08:00
parent 660a281462
commit d1ec92ff16
4 changed files with 33 additions and 2 deletions

View file

@ -20,6 +20,11 @@ matrix:
rvm: rbx-2.0.0 rvm: rbx-2.0.0
- gemfile: gemfiles/Gemfile.base-versions - gemfile: gemfiles/Gemfile.base-versions
rvm: jruby-19mode rvm: jruby-19mode
before_install:
- URL='https://chromedriver.googlecode.com/files/chromedriver_linux32_26.0.1383.0.zip'; FILE=`mktemp`; wget "$URL" -qO $FILE && sudo unzip $FILE chromedriver -d /usr/local/bin; rm $FILE
- URL='https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb'; FILE=`mktemp`; wget "$URL" -qO $FILE && sudo dpkg -i $FILE; rm $FILE
before_script: before_script:
- sh -e /etc/init.d/xvfb start - sh -e /etc/init.d/xvfb start
- export DISPLAY=:99.0 - export DISPLAY=:99.0
script: "bundle exec rake travis"

View file

@ -5,10 +5,14 @@ require 'yard'
desc "Run all examples" desc "Run all examples"
RSpec::Core::RakeTask.new(:spec) do |t| RSpec::Core::RakeTask.new(:spec) do |t|
#t.rspec_path = 'bin/rspec'
t.rspec_opts = %w[--color] t.rspec_opts = %w[--color]
end end
RSpec::Core::RakeTask.new(:spec_with_chrome) do |t|
t.rspec_opts = %w[--color]
t.pattern = './spec{,/*/**}/*{_spec.rb,_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 = ['--any', '--extra', '--opts'] # optional #t.options = ['--any', '--extra', '--opts'] # optional
@ -18,4 +22,6 @@ 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 :default => [:spec, :cucumber] task :default => [:spec, :cucumber]

View file

@ -64,7 +64,7 @@ Capybara::SpecHelper.spec "#attach_file" do
end end
it "should not break when using HTML5 multiple file input uploading multiple files" do it "should not break when using HTML5 multiple file input uploading multiple files" do
pending "Selenium is buggy on this, see http://code.google.com/p/selenium/issues/detail?id=2239" if @session.respond_to?(:mode) && [:selenium, :selenium_focus].include?(@session.mode) pending "Selenium is buggy on this, see http://code.google.com/p/selenium/issues/detail?id=2239" if @session.respond_to?(:mode) && @session.mode.to_s =~ /^selenium/
@session.attach_file "Multiple Documents", [@test_file_path, @another_test_file_path] @session.attach_file "Multiple Documents", [@test_file_path, @another_test_file_path]
@session.click_button('Upload Multiple') @session.click_button('Upload Multiple')
@session.body.should include("2 | ")#number of files @session.body.should include("2 | ")#number of files

View file

@ -0,0 +1,20 @@
require 'spec_helper'
Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
class ChromeTestApp < TestApp
# Object.id is different from the TestApp used in firefox session so
# a new Capybar::Server instance will get launched for chrome testing
end
module TestSessions
Chrome = Capybara::Session.new(:selenium_chrome, ChromeTestApp)
end
Capybara::SpecHelper.run_specs TestSessions::Chrome, "selenium_chrome", :skip => [
:response_headers,
:status_code,
:trigger
]