Add option to run qunit tests in headless chrome (#5054)

This commit is contained in:
David Taylor
2017-08-16 14:42:42 +03:00
committed by Sam
parent 6e59149a77
commit c981edfa20
2 changed files with 172 additions and 3 deletions

View File

@ -1,11 +1,11 @@
desc "Runs the qunit test suite"
task "qunit:test", [:timeout, :qunit_path] => :environment do |_, args|
task "qunit:test", [:timeout, :qunit_path, :use_chrome] => :environment do |_, args|
require "rack"
require "socket"
unless %x{which phantomjs > /dev/null 2>&1}
unless %x{which phantomjs > /dev/null 2>&1} || args[:use_chrome]
abort "PhantomJS is not installed. Download from http://phantomjs.org"
end
@ -36,7 +36,12 @@ task "qunit:test", [:timeout, :qunit_path] => :environment do |_, args|
success = true
test_path = "#{Rails.root}/vendor/assets/javascripts"
qunit_path = args[:qunit_path] || "/qunit"
cmd = "phantomjs #{test_path}/run-qunit.js http://localhost:#{port}#{qunit_path}"
if args[:use_chrome]
cmd = "node #{test_path}/run-qunit-chrome.js http://localhost:#{port}#{qunit_path}"
else
cmd = "phantomjs #{test_path}/run-qunit.js http://localhost:#{port}#{qunit_path}"
end
options = {}