Sha256: b3bca476d9896023afedc2478fbf1216cc75cf6028759ad5258f48afcfc6a7a0

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

require 'webdrivers/chromedriver'

# Allow to override the initial windows size
CAPYBARA_WINDOW_SIZE = ENV.fetch('CAPYBARA_WINDOW_SIZE', '1920x1080').split('x', 2).map(&:to_i)
CAPYBARA_WINDOW_WIDTH = CAPYBARA_WINDOW_SIZE[0]
CAPYBARA_WINDOW_HEIGHT = CAPYBARA_WINDOW_SIZE[1]

Capybara.javascript_driver = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER', "solidus_chrome_headless").to_sym
Capybara.default_max_wait_time = 10
Capybara.server = :puma, { Silent: true } # A fix for rspec/rspec-rails#1897

Capybara.drivers[:selenium_chrome_headless].tap do |original_driver|
  Capybara.register_driver :solidus_chrome_headless do |app|
    original_driver.call(app).tap do |driver|
      driver.resize_window_to(
        driver.current_window_handle, CAPYBARA_WINDOW_WIDTH, CAPYBARA_WINDOW_HEIGHT
      )
    end
  end
end

require 'spree/testing_support/capybara_ext'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_dev_support-2.5.4 lib/solidus_dev_support/rspec/capybara.rb
solidus_dev_support-2.5.3 lib/solidus_dev_support/rspec/capybara.rb