Sha256: 15882c085468922529c0d5c4e09909677922d676d62f1ddc2214bc67aa92584a

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

require "selenium-webdriver"
require "teabag/runner"

module Teabag
  module Drivers
    class SeleniumDriver < BaseDriver

      def run_specs(suite, url)
        runner = Teabag::Runner.new(suite)

        driver = Selenium::WebDriver.for(:firefox)
        driver.navigate.to("#{url}&reporter=Console")

        Selenium::WebDriver::Wait.new(timeout: 180, interval: 0.01, message: "Timed out").until do
          done = driver.execute_script("return window.Teabag && window.Teabag.finished")
          driver.execute_script("return window.Teabag && window.Teabag.getMessages() || []").each do |line|
            runner.process("#{line}\n")
          end
          done
        end

        runner.failure_count
      ensure
        driver.quit
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
teabag-0.5.4 lib/teabag/drivers/selenium_driver.rb
teabag-0.5.3 lib/teabag/drivers/selenium_driver.rb
teabag-0.5.2 lib/teabag/drivers/selenium_driver.rb
teabag-0.5.1 lib/teabag/drivers/selenium_driver.rb
teabag-0.5.0 lib/teabag/drivers/selenium_driver.rb