# frozen_string_literal: true require 'timeout' require 'nokogiri' require 'xpath' require 'forwardable' require 'capybara/config' module Capybara class CapybaraError < StandardError; end class DriverNotFoundError < CapybaraError; end class FrozenInTime < CapybaraError; end class ElementNotFound < CapybaraError; end class ModalNotFound < CapybaraError; end class Ambiguous < ElementNotFound; end class ExpectationNotMet < ElementNotFound; end class FileNotFound < CapybaraError; end class UnselectNotAllowed < CapybaraError; end class NotSupportedByDriverError < CapybaraError; end class InfiniteRedirectError < CapybaraError; end class ScopeError < CapybaraError; end class WindowError < CapybaraError; end class ReadOnlyElementError < CapybaraError; end class << self extend Forwardable # DelegateCapybara global configurations # @!method app # See {Capybara.configure} # @!method reuse_server # See {Capybara.configure} # @!method threadsafe # See {Capybara.configure} # @!method server # See {Capybara.configure} # @!method default_driver # See {Capybara.configure} # @!method javascript_driver # See {Capybara.configure} # @!method allow_gumbo # See {Capybara.configure} Config::OPTIONS.each do |method| def_delegators :config, method, "#{method}=" end # Delegate Capybara global configurations # @!method default_selector # See {Capybara.configure} # @!method default_max_wait_time # See {Capybara.configure} # @!method app_host # See {Capybara.configure} # @!method always_include_port # See {Capybara.configure} SessionConfig::OPTIONS.each do |method| def_delegators :config, method, "#{method}=" end ## # # Configure Capybara to suit your needs. # # Capybara.configure do |config| # config.run_server = false # config.app_host = 'http://www.google.com' # end # # #### Configurable options # # - **allow_gumbo** (Boolean = `false`) - When `nokogumbo` is available, whether it will be used to parse HTML strings. # - **always_include_port** (Boolean = `false`) - Whether the Rack server's port should automatically be inserted into every visited URL # unless another port is explicitly specified. # - **app_host** (String, `nil`) - The default host to use when giving a relative URL to visit, must be a valid URL e.g. `http://www.example.com`. # - **asset_host** (String = `nil`) - Where dynamic assets are hosted - will be prepended to relative asset locations if present. # - **automatic_label_click** (Boolean = `false`) - Whether {Capybara::Node::Element#choose Element#choose}, {Capybara::Node::Element#check Element#check}, # {Capybara::Node::Element#uncheck Element#uncheck} will attempt to click the associated `