Permalink
Browse files

PhantomJS is abandoned, replace it with Selenium/Chrome headless

  • Loading branch information...
guilleiguaran committed Oct 19, 2017
1 parent b7bf709 commit 4dcf12a340f82fb01453ef3b7aca6df756bdaa65
Showing with 31 additions and 151 deletions.
  1. +1 −1 .travis.yml
  2. +5 −0 Gemfile
  3. +11 −0 Gemfile.lock
  4. +1 −1 actionview/Rakefile
  5. +0 −149 ci/phantomjs.js
  6. +13 −0 ci/qunit-selenium-runner.rb
View
@@ -14,6 +14,7 @@ services:
addons:
postgresql: "9.6"
chrome: stable
apt:
sources:
- sourceline: "ppa:mc3man/trusty-media"
@@ -34,7 +35,6 @@ before_install:
- "[[ $GEM != 'av:ujs' ]] || nvm install node"
- "[[ $GEM != 'av:ujs' ]] || node --version"
- "[[ $GEM != 'av:ujs' ]] || (cd actionview && npm install)"
- "[[ $GEM != 'av:ujs' ]] || [[ $(phantomjs --version) > '2' ]] || npm install -g phantomjs-prebuilt"
before_script:
# Set Sauce Labs username and access key. Obfuscated, purposefully not encrypted.
View
@@ -102,6 +102,11 @@ group :storage do
gem "mini_magick"
end
group :ujs do
gem "qunit-selenium"
gem "chromedriver-helper"
end
# Add your own local bundler stuff.
local_gemfile = File.expand_path(".Gemfile", __dir__)
instance_eval File.read local_gemfile if File.exist? local_gemfile
View
@@ -136,6 +136,8 @@ GEM
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
amq-protocol (2.2.0)
archive-zip (0.7.0)
io-like (~> 0.3.0)
ast (2.3.0)
aws-partitions (1.20.0)
aws-sdk-core (3.3.0)
@@ -199,6 +201,9 @@ GEM
xpath (~> 2.0)
childprocess (0.7.1)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.1.0)
archive-zip (~> 0.7.0)
nokogiri (~> 1.6)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
@@ -289,6 +294,7 @@ GEM
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (0.8.6)
io-like (0.3.0)
jmespath (1.3.1)
json (2.1.0)
jwt (1.5.6)
@@ -356,6 +362,9 @@ GEM
public_suffix (2.0.5)
puma (3.9.1)
que (0.14.0)
qunit-selenium (0.0.4)
selenium-webdriver
thor
racc (1.4.14)
rack (2.0.3)
rack-cache (1.7.0)
@@ -498,6 +507,7 @@ DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
capybara (~> 2.15)
chromedriver-helper
coffee-rails
dalli (>= 2.2.1)
delayed_job
@@ -520,6 +530,7 @@ DEPENDENCIES
puma
que
queue_classic!
qunit-selenium
racc (>= 1.4.6)
rack-cache (~> 1.2)
rails!
View
@@ -45,7 +45,7 @@ namespace :test do
end
end
system("npm run lint && phantomjs ../ci/phantomjs.js http://localhost:4567/")
system("npm run lint && bundle exec ruby ../ci/qunit-selenium-runner.rb http://localhost:4567/")
status = $?.to_i
ensure
Process.kill("KILL", pid) if pid
View

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,13 @@
require 'qunit/selenium/test_runner'
require 'chromedriver/helper'
driver_options = Selenium::WebDriver::Chrome::Options.new
driver_options.add_argument('--headless')
driver_options.add_argument('--disable-gpu')
driver = ::Selenium::WebDriver.for(:chrome, options: driver_options)
result = QUnit::Selenium::TestRunner.new(driver).open(ARGV[0], timeout: 60)
driver.quit
puts "Time: #{result.duration} seconds, Total: #{result.tests[:total]}, Passed: #{result.tests[:passed]}, Failed: #{result.tests[:failed]}"
exit(result.tests[:failed] > 0 ? 1 : 0)

0 comments on commit 4dcf12a

Please sign in to comment.