Sha256: 70df9cabbda4d1a3b6df4692347fea679dbb282b1324f416e963263a48b745bf

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

require_relative '../client'

module TrueAutomation
  module Driver
    class Capybara < Capybara::Selenium::Driver
      def initialize(app, **options)
        @port = options.delete(:port) || 9515

        super(app, options)

        @ta_client = TrueAutomation::Client.new

        @options.merge!(browser: :remote,
                        url: "http://localhost:#{@port}/",
                        desired_capabilities: {
                            browser: :chrome
                        })
      end

      def browser
        unless @browser
          @ta_client.start(port: @port)

          @ta_client.wait_until_start

          at_exit do
            @ta_client.stop
          end

          super
        end
        @browser
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
true_automation-0.3.6 lib/true_automation/driver/capybara.rb
true_automation-0.3.5 lib/true_automation/driver/capybara.rb