# frozen_string_literal: true require 'timeout' require 'nokogiri' require 'xpath' require 'forwardable' require 'capybara/config' require 'capybara/registration_container' 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 use_html5_parsing # 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 # # - **use_html5_parsing** (Boolean = `false`) - When Nokogiri >= 1.12.0 or `nokogumbo` is installed, whether HTML5 parsing will be used for 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 `