test with phantomjs 2.1 - and fixes for 2.1

This commit is contained in:
Thomas Walpole 2016-01-08 10:48:18 -08:00
parent 6ad3cbf791
commit 9ecd82f6c1
6 changed files with 19 additions and 10 deletions

View File

@ -1,10 +1,13 @@
sudo: false
script: bundle exec rake
before_script: phantomjs --version
before_script: ${PHANTOMJS:-phantomjs} --version
before_install:
- mkdir travis-phantomjs2
- mkdir travis-phantomjs2 travis-phantomjs21
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs2/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xvf $PWD/travis-phantomjs2/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs2
- wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/phantomjs-2.1-linux-x86_64.tar.bz2
- tar -xvf $PWD/phantomjs-2.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs21 --strip-components 2 phantomjs-2.1.1-linux-x86_64/bin/phantomjs
- chmod +x $PWD/travis-phantomjs21/phantomjs
rvm:
- 2.2.2
- 2.1.6
@ -15,6 +18,7 @@ gemfile:
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
matrix:
include:
- rvm: 1.9.3
@ -23,11 +27,15 @@ matrix:
gemfile: gemfiles/Gemfile.1_9_3
- rvm: 2.2.2
gemfile: Gemfile
env: USE_PHANTOMJS2=true
env: PHANTOMJS=$PWD/travis-phantomjs2/phantomjs
- rvm: 2.2.2
gemfile: Gemfile
env: PHANTOMJS=$PWD/travis-phantomjs21/phantomjs
- rvm: 2.2.2
gemfile: gemfiles/Gemfile.capybara_master
env: PHANTOMJS=$PWD/travis-phantomjs2/phantomjs
- rvm: 2.2.2
gemfile: gemfiles/Gemfile.capybara_master
env: USE_PHANTOMJS2=true
env: PHANTOMJS=$PWD/travis-phantomjs21/phantomjs
allow_failures:
- gemfile: gemfiles/Gemfile.capybara_master

View File

@ -169,8 +169,8 @@ class Poltergeist.Browser
@currentPage.beforeUpload(node.id)
@currentPage.uploadFile('[_poltergeist_selected]', value)
@currentPage.afterUpload(node.id)
if phantom.version.major == 2
# In phantomjs 2 - uploadFile only fully works if executed within a user action
if phantom.version.major == 2 && phantom.version.minor == 0
# In phantomjs 2.0.x - uploadFile only fully works if executed within a user action
# It does however setup the filenames to be uploaded, so if we then click on the
# file input element the filenames will get set
@click(page_id, id)

View File

@ -211,7 +211,7 @@ Poltergeist.Browser = (function() {
this.currentPage.beforeUpload(node.id);
this.currentPage.uploadFile('[_poltergeist_selected]', value);
this.currentPage.afterUpload(node.id);
if (phantom.version.major === 2) {
if (phantom.version.major === 2 && phantom.version.minor === 0) {
return this.click(page_id, id);
} else {
return this.current_command.sendResponse(true);

View File

@ -415,7 +415,8 @@ module Capybara::Poltergeist
@driver.browser.command 'browser_error'
}.to raise_error(BrowserError) { |e|
expect(e.message).to include('Error: zomg')
expect(e.message).to include('compiled/browser.js')
# PhantomJS 2.1 refers to files as being in code subdirectory
expect(e.message).to include('compiled/browser.js').or include('code/browser.js')
}
end

View File

@ -440,7 +440,7 @@ describe Capybara::Session do
end
end
context "with image maps", focus: true do
context "with image maps" do
before do
@session.visit('/poltergeist/image_map')
end

View File

@ -18,7 +18,7 @@ Capybara.register_driver :poltergeist do |app|
debug: debug
}
options[:phantomjs] = ENV['TRAVIS_BUILD_DIR'] + '/travis-phantomjs2/phantomjs' if ENV['TRAVIS'] && ENV['USE_PHANTOMJS2']
options[:phantomjs] = ENV['PHANTOMJS'] if ENV['TRAVIS'] && ENV['PHANTOMJS']
Capybara::Poltergeist::Driver.new(
app, options