class QUnit::Selenium::Cli

Public Instance Methods

open(url) click to toggle source
# File lib/qunit/selenium/cli.rb, line 12
def open(url)
  profile = ::Selenium::WebDriver::Firefox::Profile.new
  driver = ::Selenium::WebDriver.for :firefox, profile: profile

  begin
    test_result = TestRunner.new(driver).open(url, timeout: options[:timeout])
    driver.save_screenshot options[:screenshot] if options[:screenshot]

    print_report(test_result)

    error = test_result.assertions[:failed] > 0
  rescue => e
    puts "Error: #{e}"
    driver.save_screenshot('qunit-selenium-error.png')
    error = true
  ensure
    driver.quit
  end
  exit(1) if error
end

Private Instance Methods

print_report(result) click to toggle source