mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
287920ca7d
If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
22 lines
767 B
Ruby
22 lines
767 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "qunit/selenium/test_runner"
|
|
|
|
if ARGV[1]
|
|
driver = ::Selenium::WebDriver.for(:remote, url: ARGV[1], desired_capabilities: :chrome)
|
|
else
|
|
require "chromedriver-helper"
|
|
|
|
driver_options = Selenium::WebDriver::Chrome::Options.new
|
|
driver_options.add_argument("--headless")
|
|
driver_options.add_argument("--disable-gpu")
|
|
driver_options.add_argument("--no-sandbox")
|
|
|
|
driver = ::Selenium::WebDriver.for(:chrome, options: driver_options)
|
|
end
|
|
|
|
result = QUnit::Selenium::TestRunner.new(driver).open(ARGV[0], timeout: 60)
|
|
driver.quit
|
|
|
|
puts "Time: #{result.duration} seconds, Total: #{result.assertions[:total]}, Passed: #{result.assertions[:passed]}, Failed: #{result.assertions[:failed]}"
|
|
exit(result.tests[:failed] > 0 ? 1 : 0)
|