2017-10-28 08:14:06 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-06-16 14:46:42 -04:00
|
|
|
require "webdrivers"
|
2021-06-24 19:26:00 -04:00
|
|
|
require_relative "test_run"
|
2021-06-16 14:46:42 -04:00
|
|
|
|
|
|
|
driver = if ARGV[1]
|
|
|
|
::Selenium::WebDriver.for(:remote, url: ARGV[1], desired_capabilities: :chrome)
|
|
|
|
else
|
2019-02-05 09:50:06 -05:00
|
|
|
driver_options = Selenium::WebDriver::Chrome::Options.new
|
|
|
|
driver_options.add_argument("--headless")
|
|
|
|
driver_options.add_argument("--disable-gpu")
|
|
|
|
driver_options.add_argument("--no-sandbox")
|
|
|
|
|
2021-06-16 14:46:42 -04:00
|
|
|
::Selenium::WebDriver.for(:chrome, options: driver_options)
|
2019-02-05 09:50:06 -05:00
|
|
|
end
|
2017-10-19 12:01:52 -04:00
|
|
|
|
2021-06-16 14:46:42 -04:00
|
|
|
driver.get(ARGV[0])
|
|
|
|
|
|
|
|
result = TestRun.new(driver).tap do |run|
|
|
|
|
::Selenium::WebDriver::Wait.new(timeout: 60).until do
|
|
|
|
run.completed?
|
|
|
|
end
|
|
|
|
end.result
|
|
|
|
|
2017-10-19 12:01:52 -04:00
|
|
|
driver.quit
|
|
|
|
|
2017-10-19 12:11:20 -04:00
|
|
|
puts "Time: #{result.duration} seconds, Total: #{result.assertions[:total]}, Passed: #{result.assertions[:passed]}, Failed: #{result.assertions[:failed]}"
|
2021-06-16 14:46:42 -04:00
|
|
|
if result.tests[:failed] > 0
|
2021-07-20 20:15:10 -04:00
|
|
|
puts "Qunit output follows. Look for lines that have failures, e.g. (1, n, n) - those are your failing lines\r\n\r\n#{result.raw_output}"
|
2021-06-16 14:46:42 -04:00
|
|
|
end
|
2017-10-19 12:01:52 -04:00
|
|
|
exit(result.tests[:failed] > 0 ? 1 : 0)
|