Sha256: 94cffeb351da0e2fd9de168761b051be53b61e8a34c4a72e837db7fb32a6eb58

Contents?: true

Size: 852 Bytes

Versions: 3

Compression:

Stored size: 852 Bytes

Contents

# :nocov:
begin
  require "capybara-webkit"
rescue LoadError
  Teaspoon.abort("Could not find Capybara Webkit. Install the capybara-webkit gem.")
end
# :nocov:

require "teaspoon/driver/base"

module Teaspoon
  module Driver
    class CapybaraWebkit < Base
      def initialize(_options = nil)
      end

      def run_specs(runner, url)
        session.visit(url)

        session.document.synchronize(Teaspoon.configuration.driver_timeout.to_i) do
          done = session.evaluate_script("window.Teaspoon && window.Teaspoon.finished")
          (session.evaluate_script("window.Teaspoon && window.Teaspoon.getMessages()") || []).each do |line|
            runner.process("#{line}\n")
          end
          done
        end
      end

      private

      def session
        @session ||= Capybara::Session.new(:webkit)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teaspoon-1.0.2 lib/teaspoon/driver/capybara_webkit.rb
teaspoon-1.0.1 lib/teaspoon/driver/capybara_webkit.rb
teaspoon-1.0.0 lib/teaspoon/driver/capybara_webkit.rb