capybara-2.10.2/0000755000175000017500000000000013017655444012413 5ustar lunarlunarcapybara-2.10.2/History.md0000644000175000017500000011357713017655442014412 0ustar lunarlunar#2.10.2 Release date: 2016-11-30 ### Fixed * App exceptions with multiple parameter initializers now re-raised correctly - Issue #1785 [Michael Lutsiuk] * Use Addressable::URI when parsing current_path since it's more lenient of technically invalid URLs - Issue #1801 [Marcos Duque, Thomas Walpole] #2.10.1 Release date: 2016-10-08 ### Fixed * App errors are now correctly raised with the explanatory cause in JRuby [Thomas Walpole] * Capybara::Result optimization disabled in JRuby due to issue with lazy enumerator evaluation [Thomas Walpole] See: https://github.com/jruby/jruby/issues/4212 #2.10.0 Release date: 2016-10-05 ### Added * Select `' } it "gives proper description" do expect(have_button('A button').description).to eq("have button \"A button\"") end it "passes if there is such a button" do expect(html).to have_button('A button') end it "fails if there is no such button" do expect do expect(html).to have_button('No such Button') end.to raise_error(/expected to find button "No such Button"/) end it "supports compounding" do expect(html).to have_button('Not this button').or have_button('A button') end if RSpec::Version::STRING.to_f >= 3.0 end describe "have_field matcher" do let(:html) { '

' } it "gives proper description" do expect(have_field('Text field').description).to eq("have field \"Text field\"") end it "gives proper description for a given value" do expect(have_field('Text field', with: 'some value').description).to eq("have field \"Text field\" with value \"some value\"") end it "passes if there is such a field" do expect(html).to have_field('Text field') end it "passes if there is such a field with value" do expect(html).to have_field('Text field', with: 'some value') end it "fails if there is no such field" do expect do expect(html).to have_field('No such Field') end.to raise_error(/expected to find field "No such Field"/) end it "fails if there is such field but with false value" do expect do expect(html).to have_field('Text field', with: 'false value') end.to raise_error(/expected to find field "Text field"/) end it "treats a given value as a string" do class Foo def to_s "some value" end end expect(html).to have_field('Text field', with: Foo.new) end it "supports compounding" do expect(html).to have_field('Not this one').or have_field('Text field') end if RSpec::Version::STRING.to_f >= 3.0 end describe "have_checked_field matcher" do let(:html) do ' ' end it "gives proper description" do expect(have_checked_field('it is checked').description).to eq("have field \"it is checked\" that is checked") end context "with should" do it "passes if there is such a field and it is checked" do expect(html).to have_checked_field('it is checked') end it "fails if there is such a field but it is not checked" do expect do expect(html).to have_checked_field('unchecked field') end.to raise_error(/expected to find field "unchecked field"/) end it "fails if there is no such field" do expect do expect(html).to have_checked_field('no such field') end.to raise_error(/expected to find field "no such field"/) end end context "with should not" do it "fails if there is such a field and it is checked" do expect do expect(html).not_to have_checked_field('it is checked') end.to raise_error(/expected not to find field "it is checked"/) end it "passes if there is such a field but it is not checked" do expect(html).not_to have_checked_field('unchecked field') end it "passes if there is no such field" do expect(html).not_to have_checked_field('no such field') end end it "supports compounding" do expect(html).to have_checked_field('not this one').or have_checked_field('it is checked') end if RSpec::Version::STRING.to_f >= 3.0 end describe "have_unchecked_field matcher" do let(:html) do ' ' end it "gives proper description" do expect(have_unchecked_field('unchecked field').description).to eq("have field \"unchecked field\" that is not checked") end context "with should" do it "passes if there is such a field and it is not checked" do expect(html).to have_unchecked_field('unchecked field') end it "fails if there is such a field but it is checked" do expect do expect(html).to have_unchecked_field('it is checked') end.to raise_error(/expected to find field "it is checked"/) end it "fails if there is no such field" do expect do expect(html).to have_unchecked_field('no such field') end.to raise_error(/expected to find field "no such field"/) end end context "with should not" do it "fails if there is such a field and it is not checked" do expect do expect(html).not_to have_unchecked_field('unchecked field') end.to raise_error(/expected not to find field "unchecked field"/) end it "passes if there is such a field but it is checked" do expect(html).not_to have_unchecked_field('it is checked') end it "passes if there is no such field" do expect(html).not_to have_unchecked_field('no such field') end end it "supports compounding" do expect(html).to have_unchecked_field('it is checked').or have_unchecked_field('unchecked field') end if RSpec::Version::STRING.to_f >= 3.0 end describe "have_select matcher" do let(:html) { '' } it "gives proper description" do expect(have_select('Select Box').description).to eq("have select box \"Select Box\"") end it "gives proper description for a given selected value" do expect(have_select('Select Box', selected: 'some value').description).to eq("have select box \"Select Box\" with \"some value\" selected") end it "passes if there is such a select" do expect(html).to have_select('Select Box') end it "fails if there is no such select" do expect do expect(html).to have_select('No such Select box') end.to raise_error(/expected to find select box "No such Select box"/) end it "supports compounding" do expect(html).to have_select('Not this one').or have_select('Select Box') end if RSpec::Version::STRING.to_f >= 3.0 end describe "have_table matcher" do let(:html) { '
Lovely table
' } it "gives proper description" do expect(have_table('Lovely table').description).to eq("have table \"Lovely table\"") end it "passes if there is such a select" do expect(html).to have_table('Lovely table') end it "fails if there is no such select" do expect do expect(html).to have_table('No such Table') end.to raise_error(/expected to find table "No such Table"/) end it "supports compounding" do expect(html).to have_table('nope').or have_table('Lovely table') end if RSpec::Version::STRING.to_f >= 3.0 end end capybara-2.10.2/spec/rspec/features_spec.rb0000644000175000017500000000510113017655442017631 0ustar lunarlunar# frozen_string_literal: true require 'spec_helper' require 'capybara/rspec' RSpec.configuration.before(:each, { file_path: "./spec/rspec/features_spec.rb" } ) do @in_filtered_hook = true end feature "Capybara's feature DSL" do background do @in_background = true end def current_example(context) RSpec.respond_to?(:current_example) ? RSpec.current_example : context.example end scenario "includes Capybara" do visit('/') expect(page).to have_content('Hello world!') end scenario "preserves description" do expect(current_example(self).metadata[:full_description]) .to eq("Capybara's feature DSL preserves description") end scenario "allows driver switching", :driver => :selenium do expect(Capybara.current_driver).to eq(:selenium) end scenario "runs background" do expect(@in_background).to be_truthy end scenario "runs hooks filtered by file path" do expect(@in_filtered_hook).to be_truthy end scenario "doesn't pollute the Object namespace" do expect(Object.new.respond_to?(:feature, true)).to be_falsey end feature 'nested features' do scenario 'work as expected' do visit '/' expect(page).to have_content 'Hello world!' end scenario 'are marked in the metadata as capybara_feature' do expect(current_example(self).metadata[:capybara_feature]).to be_truthy end scenario 'have a type of :feature' do expect(current_example(self).metadata[:type]).to eq :feature end end end feature "given and given! aliases to let and let!" do given(:value) { :available } given!(:value_in_background) { :available } background do expect(value_in_background).to be(:available) end scenario "given and given! work as intended" do expect(value).to be(:available) expect(value_in_background).to be(:available) end end feature "Capybara's feature DSL with driver", :driver => :culerity do scenario "switches driver" do expect(Capybara.current_driver).to eq(:culerity) end end if RSpec::Core::Version::STRING.to_f >= 3.0 xfeature "if xfeature aliases to pending then" do scenario "this should be 'temporarily disabled with xfeature'" do; end scenario "this also should be 'temporarily disabled with xfeature'" do; end end ffeature "if ffeature aliases focused tag then" do scenario "scenario inside this feature has metatag focus tag" do |example| expect(example.metadata[:focus]).to eq true end scenario "other scenarios also has metatag focus tag " do |example| expect(example.metadata[:focus]).to eq true end end end capybara-2.10.2/spec/rspec/scenarios_spec.rb0000644000175000017500000000106613017655442020007 0ustar lunarlunar# frozen_string_literal: true require 'spec_helper' require 'capybara/rspec' RSpec.configuration.before(:each, { file_path: "./spec/rspec/scenarios_spec.rb" } ) do @in_filtered_hook = true end if RSpec::Core::Version::STRING.to_f >= 3.0 feature "if fscenario aliases focused tag then" do fscenario "scenario should have focused meta tag" do |example| expect(example.metadata[:focus]).to eq true end end end feature "if xscenario aliases to pending then" do xscenario "this test should be 'temporarily disabled with xscenario'" do end end capybara-2.10.2/lib/0000755000175000017500000000000013017655442013157 5ustar lunarlunarcapybara-2.10.2/lib/capybara.rb0000644000175000017500000004202113017655442015265 0ustar lunarlunar# frozen_string_literal: true require 'timeout' require 'nokogiri' require 'xpath' 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 attr_reader :app_host, :default_host attr_accessor :asset_host, :run_server, :always_include_port attr_accessor :server_port, :exact, :match, :exact_options, :visible_text_only, :enable_aria_label attr_accessor :default_selector, :default_max_wait_time, :ignore_hidden_elements attr_accessor :save_path, :wait_on_first_by_default, :automatic_label_click, :automatic_reload attr_accessor :reuse_server, :raise_server_errors, :server_errors attr_writer :default_driver, :current_driver, :javascript_driver, :session_name, :server_host attr_reader :save_and_open_page_path attr_accessor :app ## # # Configure Capybara to suit your needs. # # Capybara.configure do |config| # config.run_server = false # config.app_host = 'http://www.google.com' # end # # === Configurable options # # [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 # [always_include_port = Boolean] Whether the Rack server's port should automatically be inserted into every visited URL (Default: false) # [asset_host = String] Where dynamic assets are hosted - will be prepended to relative asset locations if present (Default: nil) # [run_server = Boolean] Whether to start a Rack server for the given Rack app (Default: true) # [raise_server_errors = Boolean] Should errors raised in the server be raised in the tests? (Default: true) # [server_errors = Array\] Error classes that should be raised in the tests if they are raised in the server and Capybara.raise_server_errors is true (Default: [StandardError]) # [default_selector = :css/:xpath] Methods which take a selector use the given type by default (Default: :css) # [default_max_wait_time = Numeric] The maximum number of seconds to wait for asynchronous processes to finish (Default: 2) # [ignore_hidden_elements = Boolean] Whether to ignore hidden elements on the page (Default: true) # [automatic_reload = Boolean] Whether to automatically reload elements as Capybara is waiting (Default: true) # [save_path = String] Where to put pages saved through save_(page|screenshot), save_and_open_(page|screenshot) (Default: Dir.pwd) # [wait_on_first_by_default = Boolean] Whether Node#first defaults to Capybara waiting behavior for at least 1 element to match (Default: false) # [automatic_label_click = Boolean] Whether Node#choose, Node#check, Node#uncheck will attempt to click the associated label element if the checkbox/radio button are non-visible (Default: false) # [enable_aria_label = Boolean] Whether fields, links, and buttons will match against aria-label attribute (Default: false) # [reuse_server = Boolean] Reuse the server thread between multiple sessions using the same app object (Default: true) # === DSL Options # # when using capybara/dsl, the following options are also available: # # [default_driver = Symbol] The name of the driver to use by default. (Default: :rack_test) # [javascript_driver = Symbol] The name of a driver to use for JavaScript enabled tests. (Default: :selenium) # def configure yield self end ## # # Register a new driver for Capybara. # # Capybara.register_driver :rack_test do |app| # Capybara::RackTest::Driver.new(app) # end # # @param [Symbol] name The name of the new driver # @yield [app] This block takes a rack app and returns a Capybara driver # @yieldparam [] app The rack application that this driver runs against. May be nil. # @yieldreturn [Capybara::Driver::Base] A Capybara driver instance # def register_driver(name, &block) drivers[name] = block end ## # # Register a new server for Capybara. # # Capybara.register_server :webrick do |app, port, host| # require 'rack/handler/webrick' # Rack::Handler::WEBrick.run(app, ...) # end # # @param [Symbol] name The name of the new driver # @yield [app, port, host] This block takes a rack app and a port and returns a rack server listening on that port # @yieldparam [] app The rack application that this server will contain. # @yieldparam port The port number the server should listen on # @yieldparam host The host/ip to bind to # @yieldreturn [Capybara::Driver::Base] A Capybara driver instance # def register_server(name, &block) servers[name.to_sym] = block end ## # # Add a new selector to Capybara. Selectors can be used by various methods in Capybara # to find certain elements on the page in a more convenient way. For example adding a # selector to find certain table rows might look like this: # # Capybara.add_selector(:row) do # xpath { |num| ".//tbody/tr[#{num}]" } # end # # This makes it possible to use this selector in a variety of ways: # # find(:row, 3) # page.find('table#myTable').find(:row, 3).text # page.find('table#myTable').has_selector?(:row, 3) # within(:row, 3) { expect(page).to have_content('$100.000') } # # Here is another example: # # Capybara.add_selector(:id) do # xpath { |id| XPath.descendant[XPath.attr(:id) == id.to_s] } # end # # Note that this particular selector already ships with Capybara. # # @param [Symbol] name The name of the selector to add # @yield A block executed in the context of the new {Capybara::Selector} # def add_selector(name, &block) Capybara::Selector.add(name, &block) end ## # # Modify a selector previously created by {Capybara.add_selector}. # For example modifying the :button selector to also find divs styled # to look like buttons might look like this # # Capybara.modify_selector(:button) do # xpath { |locator| XPath::HTML.button(locator).or(XPath::css('div.btn')[XPath::string.n.is(locator)]) } # end # # @param [Symbol] name The name of the selector to modify # @yield A block executed in the context of the existing {Capybara::Selector} # def modify_selector(name, &block) Capybara::Selector.update(name, &block) end def drivers @drivers ||= {} end def servers @servers ||= {} end ## # # Register a proc that Capybara will call to run the Rack application. # # Capybara.server do |app, port, host| # require 'rack/handler/mongrel' # Rack::Handler::Mongrel.run(app, :Port => port) # end # # By default, Capybara will try to run webrick. # # @yield [app, port, host] This block receives a rack app, port, and host/ip and should run a Rack handler # def server(&block) if block_given? warn "DEPRECATED: Passing a block to Capybara::server is deprecated, please use Capybara::register_server instead" @server = block else @server end end ## # # Set the server to use. # # Capybara.server = :webrick # # @param [Symbol] name Name of the server type to use # @see register_server # def server=(name) @server = if name.respond_to? :call name else servers[name.to_sym] end end ## # # Wraps the given string, which should contain an HTML document or fragment # in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers}, # {Capybara::Node::Finders} and {Capybara::Node::DocumentMatchers}. This allows you to query # any string containing HTML in the exact same way you would query the current document in a Capybara # session. # # Example: A single element # # node = Capybara.string('bar') # anchor = node.first('a') # anchor[:href] #=> 'foo' # anchor.text #=> 'bar' # # Example: Multiple elements # # node = Capybara.string <<-HTML #
    #
  • Home
  • #
  • Projects
  • #
# HTML # # node.find('#projects').text # => 'Projects' # node.has_selector?('li#home', text: 'Home') # node.has_selector?('#projects') # node.find('ul').find('li:first-child').text # => 'Home' # # @param [String] html An html fragment or document # @return [Capybara::Node::Simple] A node which has Capybara's finders and matchers # def string(html) Capybara::Node::Simple.new(html) end ## # # Runs Capybara's default server for the given application and port # under most circumstances you should not have to call this method # manually. # # @param [Rack Application] app The rack application to run # @param [Fixnum] port The port to run the application on # def run_default_server(app, port) servers[:webrick].call(app, port, server_host) end ## # # @return [Symbol] The name of the driver to use by default # def default_driver @default_driver || :rack_test end ## # # @return [Symbol] The name of the driver currently in use # def current_driver @current_driver || default_driver end alias_method :mode, :current_driver ## # # @return [Symbol] The name of the driver used when JavaScript is needed # def javascript_driver @javascript_driver || :selenium end ## # # Use the default driver as the current driver # def use_default_driver @current_driver = nil end ## # # Yield a block using a specific driver # def using_driver(driver) previous_driver = Capybara.current_driver Capybara.current_driver = driver yield ensure @current_driver = previous_driver end ## # # @return [String] The IP address bound by default server # def server_host @server_host || '127.0.0.1' end ## # # Yield a block using a specific wait time # def using_wait_time(seconds) previous_wait_time = Capybara.default_max_wait_time Capybara.default_max_wait_time = seconds yield ensure Capybara.default_max_wait_time = previous_wait_time end ## # # The current Capybara::Session based on what is set as Capybara.app and Capybara.current_driver # # @return [Capybara::Session] The currently used session # def current_session session_pool["#{current_driver}:#{session_name}:#{app.object_id}"] ||= Capybara::Session.new(current_driver, app) end ## # # Reset sessions, cleaning out the pool of sessions. This will remove any session information such # as cookies. # def reset_sessions! #reset in reverse so sessions that started servers are reset last session_pool.reverse_each { |mode, session| session.reset! } end alias_method :reset!, :reset_sessions! ## # # The current session name. # # @return [Symbol] The name of the currently used session. # def session_name @session_name ||= :default end ## # # Yield a block using a specific session name. # def using_session(name) previous_session_name = self.session_name self.session_name = name yield ensure self.session_name = previous_session_name end ## # # Parse raw html into a document using Nokogiri, and adjust textarea contents as defined by the spec. # # @param [String] html The raw html # @return [Nokogiri::HTML::Document] HTML document # def HTML(html) Nokogiri::HTML(html).tap do |document| document.xpath('//textarea').each do |textarea| textarea.content=textarea.content.sub(/\A\n/,'') end end end # @deprecated Use default_max_wait_time instead def default_wait_time deprecate('default_wait_time', 'default_max_wait_time', true) default_max_wait_time end # @deprecated Use default_max_wait_time= instead def default_wait_time=(t) deprecate('default_wait_time=', 'default_max_wait_time=') self.default_max_wait_time = t end def save_and_open_page_path=(path) warn "DEPRECATED: #save_and_open_page_path is deprecated, please use #save_path instead. \n"\ "Note: Behavior is slightly different with relative paths - see documentation" unless path.nil? @save_and_open_page_path = path end def app_host=(url) raise ArgumentError.new("Capybara.app_host should be set to a url (http://www.example.com)") unless url.nil? || (url =~ URI::regexp) @app_host = url end def default_host=(url) raise ArgumentError.new("Capybara.default_host should be set to a url (http://www.example.com)") unless url.nil? || (url =~ URI::regexp) @default_host = url end def included(base) base.send(:include, Capybara::DSL) warn "`include Capybara` is deprecated. Please use `include Capybara::DSL` instead." end def reuse_server=(bool) warn "Capybara.reuse_server == false is a BETA feature and may change in a future version" unless bool @reuse_server = bool end def deprecate(method, alternate_method, once=false) @deprecation_notified ||= {} warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead" unless once and @deprecation_notified[method] @deprecation_notified[method]=true end private def session_pool @session_pool ||= {} end end self.default_driver = nil self.current_driver = nil self.server_host = nil module Driver; end module RackTest; end module Selenium; end require 'capybara/helpers' require 'capybara/session' require 'capybara/window' require 'capybara/server' require 'capybara/selector' require 'capybara/result' require 'capybara/version' require 'capybara/queries/base_query' require 'capybara/queries/selector_query' require 'capybara/queries/text_query' require 'capybara/queries/title_query' require 'capybara/queries/current_path_query' require 'capybara/queries/match_query' require 'capybara/query' require 'capybara/node/finders' require 'capybara/node/matchers' require 'capybara/node/actions' require 'capybara/node/document_matchers' require 'capybara/node/simple' require 'capybara/node/base' require 'capybara/node/element' require 'capybara/node/document' require 'capybara/driver/base' require 'capybara/driver/node' require 'capybara/rack_test/driver' require 'capybara/rack_test/node' require 'capybara/rack_test/form' require 'capybara/rack_test/browser' require 'capybara/rack_test/css_handlers.rb' require 'capybara/selenium/node' require 'capybara/selenium/driver' end Capybara.register_server :default do |app, port, host| Capybara.run_default_server(app, port) end Capybara.register_server :webrick do |app, port, host| require 'rack/handler/webrick' Rack::Handler::WEBrick.run(app, Host: host, Port: port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0)) end Capybara.register_server :puma do |app, port, host| require 'puma' Puma::Server.new(app).tap do |s| s.add_tcp_listener host, port end.run.join end Capybara.configure do |config| config.always_include_port = false config.run_server = true config.server = :default config.default_selector = :css config.default_max_wait_time = 2 config.ignore_hidden_elements = true config.default_host = "http://www.example.com" config.automatic_reload = true config.match = :smart config.exact = false config.raise_server_errors = true config.server_errors = [StandardError] config.visible_text_only = false config.wait_on_first_by_default = false config.automatic_label_click = false config.enable_aria_label = false config.reuse_server = true end Capybara.register_driver :rack_test do |app| Capybara::RackTest::Driver.new(app) end Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new(app) end capybara-2.10.2/lib/capybara/0000755000175000017500000000000013017655442014741 5ustar lunarlunarcapybara-2.10.2/lib/capybara/server.rb0000644000175000017500000000537313017655442016604 0ustar lunarlunar# frozen_string_literal: true require 'uri' require 'net/http' require 'rack' module Capybara class Server class Middleware class Counter attr_reader :value def initialize @value = 0 @mutex = Mutex.new end def increment @mutex.synchronize { @value += 1 } end def decrement @mutex.synchronize { @value -= 1 } end end attr_accessor :error def initialize(app) @app = app @counter = Counter.new end def pending_requests? @counter.value > 0 end def call(env) if env["PATH_INFO"] == "/__identify__" [200, {}, [@app.object_id.to_s]] else @counter.increment begin @app.call(env) rescue *Capybara.server_errors => e @error = e unless @error raise e ensure @counter.decrement end end end end class << self def ports @ports ||= {} end end attr_reader :app, :port, :host def initialize(app, port=Capybara.server_port, host=Capybara.server_host) @app = app @server_thread = nil # suppress warnings @host, @port = host, port @port ||= Capybara::Server.ports[port_key] @port ||= find_available_port(host) end def reset_error! middleware.error = nil end def error middleware.error end def responsive? return false if @server_thread && @server_thread.join(0) res = Net::HTTP.start(host, port) { |http| http.get('/__identify__') } if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection) return res.body == app.object_id.to_s end rescue SystemCallError return false end def wait_for_pending_requests Timeout.timeout(60) { sleep(0.01) while pending_requests? } rescue Timeout::Error raise "Requests did not finish in 60 seconds" end def boot unless responsive? Capybara::Server.ports[port_key] = port @server_thread = Thread.new do Capybara.server.call(middleware, port, host) end Timeout.timeout(60) { @server_thread.join(0.1) until responsive? } end rescue Timeout::Error raise "Rack application timed out during boot" else self end private def middleware @middleware ||= Middleware.new(app) end def port_key Capybara.reuse_server ? app.object_id : middleware.object_id end def pending_requests? middleware.pending_requests? end def find_available_port(host) server = TCPServer.new(host, 0) server.addr[1] ensure server.close if server end end end capybara-2.10.2/lib/capybara/query.rb0000644000175000017500000000043713017655442016437 0ustar lunarlunar# frozen_string_literal: true require 'capybara/queries/selector_query' module Capybara # @deprecated This class and its methods are not supposed to be used by users of Capybara's public API. # It may be removed in future versions of Capybara. Query = Queries::SelectorQuery end capybara-2.10.2/lib/capybara/selector.rb0000644000175000017500000004206313017655442017113 0ustar lunarlunar# frozen_string_literal: true require 'capybara/selector/selector' Capybara::Selector::FilterSet.add(:_field) do filter(:checked, :boolean) { |node, value| not(value ^ node.checked?) } filter(:unchecked, :boolean) { |node, value| (value ^ node.checked?) } filter(:disabled, :boolean, default: false, skip_if: :all) { |node, value| not(value ^ node.disabled?) } filter(:multiple, :boolean) { |node, value| !(value ^ node.multiple?) } describe do |options| desc, states = String.new, [] states << 'checked' if options[:checked] || (options[:unchecked] === false) states << 'not checked' if options[:unchecked] || (options[:checked] === false) states << 'disabled' if options[:disabled] == true desc << " that is #{states.join(' and ')}" unless states.empty? desc << " with the multiple attribute" if options[:multiple] == true desc << " without the multiple attribute" if options[:multiple] === false desc end end ## # # Select elements by XPath expression # # @locator An XPath expression # Capybara.add_selector(:xpath) do xpath { |xpath| xpath } end ## # # Select elements by CSS selector # # @locator A CSS selector # Capybara.add_selector(:css) do css { |css| css } end ## # # Select element by id # # @locator The id of the element to match # Capybara.add_selector(:id) do xpath { |id| XPath.descendant[XPath.attr(:id) == id.to_s] } end ## # # Select field elements (input [not of type submit, image, or hidden], textarea, select) # # @locator Matches against the id, name, or placeholder # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String] :placeholder Matches the placeholder attribute # @filter [String] :type Matches the type attribute of the field or element type for 'textarea' and 'select' # @filter [Boolean] :readonly # @filter [String] :with Matches the current value of the field # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :checked Match checked fields? # @filter [Boolean] :unchecked Match unchecked fields? # @filter [Boolean] :disabled Match disabled field? # @filter [Boolean] :multiple Match fields that accept multiple values Capybara.add_selector(:field) do xpath(:name, :placeholder, :type) do |locator, options| xpath = XPath.descendant(:input, :textarea, :select)[~XPath.attr(:type).one_of('submit', 'image', 'hidden')] if options[:type] type=options[:type].to_s if ['textarea', 'select'].include?(type) xpath = XPath.descendant(type.to_sym) else xpath = xpath[XPath.attr(:type).equals(type)] end end xpath=locate_field(xpath, locator, options) xpath end filter_set(:_field) # checked/unchecked/disabled/multiple filter(:readonly, :boolean) { |node, value| not(value ^ node.readonly?) } filter(:with) do |node, with| with.is_a?(Regexp) ? node.value =~ with : node.value == with.to_s end describe do |options| desc = String.new (expression_filters - [:type]).each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc << " of type #{options[:type].inspect}" if options[:type] desc << " with value #{options[:with].to_s.inspect}" if options.has_key?(:with) desc end end ## # # Select fieldset elements # # @locator Matches id or contents of wrapped legend # # @filter [String] :id Matches id attribute # @filter [String] :legend Matches contents of wrapped legend # @filter [String, Array] :class Matches the class(es) provided # Capybara.add_selector(:fieldset) do xpath(:legend) do |locator, options| xpath = XPath.descendant(:fieldset) xpath = xpath[XPath.attr(:id).equals(locator.to_s) | XPath.child(:legend)[XPath.string.n.is(locator.to_s)]] unless locator.nil? xpath = xpath[XPath.child(:legend)[XPath.string.n.is(options[:legend])]] if options[:legend] xpath end end ## # # Find links ( elements with an href attribute ) # # @locator Matches the id or title attributes, or the string content of the link, or the alt attribute of a contained img element # # @filter [String] :id Matches the id attribute # @filter [String] :title Matches the title attribute # @filter [String] :alt Matches the alt attribute of a contained img element # @filter [String] :class Matches the class(es) provided # @filter [String, Regexp] :href Matches the normalized href of the link # Capybara.add_selector(:link) do xpath(:title, :alt) do |locator, options={}| xpath = XPath.descendant(:a)[XPath.attr(:href)] unless locator.nil? locator = locator.to_s matchers = XPath.attr(:id).equals(locator) | XPath.string.n.is(locator) | XPath.attr(:title).is(locator) | XPath.descendant(:img)[XPath.attr(:alt).is(locator)] matchers |= XPath.attr(:'aria-label').is(locator) if Capybara.enable_aria_label xpath = xpath[matchers] end xpath = [:title].inject(xpath) { |memo, ef| memo[find_by_attr(ef, options[ef])] } xpath = xpath[XPath.descendant(:img)[XPath.attr(:alt).equals(options[:alt])]] if options[:alt] xpath end filter(:href) do |node, href| if href.is_a? Regexp node[:href].match href else node.first(:xpath, XPath.axis(:self)[XPath.attr(:href).equals(href.to_s)], minimum: 0) end end describe { |options| " with href #{options[:href].inspect}" if options[:href] } end ## # # Find buttons ( input [of type submit, reset, image, button] or button elements ) # # @locator Matches the id, value, or title attributes, string content of a button, or the alt attribute of an image type button or of a descendant image of a button # # @filter [String] :id Matches the id attribute # @filter [String] :title Matches the title attribute # @filter [String] :class Matches the class(es) provided # @filter [String] :value Matches the value of an input button # Capybara.add_selector(:button) do xpath(:value, :title) do |locator, options={}| input_btn_xpath = XPath.descendant(:input)[XPath.attr(:type).one_of('submit', 'reset', 'image', 'button')] btn_xpath = XPath.descendant(:button) image_btn_xpath = XPath.descendant(:input)[XPath.attr(:type).equals('image')] unless locator.nil? locator = locator.to_s locator_matches = XPath.attr(:id).equals(locator) | XPath.attr(:value).is(locator) | XPath.attr(:title).is(locator) locator_matches |= XPath.attr(:'aria-label').is(locator) if Capybara.enable_aria_label input_btn_xpath = input_btn_xpath[locator_matches] btn_xpath = btn_xpath[locator_matches | XPath.string.n.is(locator) | XPath.descendant(:img)[XPath.attr(:alt).is(locator)]] alt_matches = XPath.attr(:alt).is(locator) alt_matches |= XPath.attr(:'aria-label').is(locator) if Capybara.enable_aria_label image_btn_xpath = image_btn_xpath[alt_matches] end res_xpath = input_btn_xpath + btn_xpath + image_btn_xpath res_xpath = expression_filters.inject(res_xpath) { |memo, ef| memo[find_by_attr(ef, options[ef])] } res_xpath end filter(:disabled, :boolean, default: false, skip_if: :all) { |node, value| not(value ^ node.disabled?) } describe do |options| desc = String.new desc << " that is disabled" if options[:disabled] == true expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc end end ## # # Find links or buttons # Capybara.add_selector(:link_or_button) do label "link or button" xpath do |locator, options| self.class.all.values_at(:link, :button).map {|selector| selector.xpath.call(locator, options)}.reduce(:+) end filter(:disabled, :boolean, default: false, skip_if: :all) { |node, value| node.tag_name == "a" or not(value ^ node.disabled?) } describe { |options| " that is disabled" if options[:disabled] } end ## # # Find text fillable fields ( textarea, input [not of type submit, image, radio, checkbox, hidden, file] ) # # @locator Matches against the id, name, or placeholder # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String] :placeholder Matches the placeholder attribute # @filter [String] :with Matches the current value of the field # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :disabled Match disabled field? # @filter [Boolean] :multiple Match fields that accept multiple values # Capybara.add_selector(:fillable_field) do label "field" xpath(:name, :placeholder) do |locator, options| xpath = XPath.descendant(:input, :textarea)[~XPath.attr(:type).one_of('submit', 'image', 'radio', 'checkbox', 'hidden', 'file')] locate_field(xpath, locator, options) end filter_set(:_field, [:disabled, :multiple]) filter(:with) do |node, with| with.is_a?(Regexp) ? node.value =~ with : node.value == with.to_s end describe do |options| desc = String.new expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc << " with value #{options[:with].to_s.inspect}" if options.has_key?(:with) desc end end ## # # Find radio buttons # # @locator Match id, name, or associated label text # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :checked Match checked fields? # @filter [Boolean] :unchecked Match unchecked fields? # @filter [Boolean] :disabled Match disabled field? # @filter [String] :option Match the value # Capybara.add_selector(:radio_button) do label "radio button" xpath(:name) do |locator, options| xpath = XPath.descendant(:input)[XPath.attr(:type).equals('radio')] locate_field(xpath, locator, options) end filter_set(:_field, [:checked, :unchecked, :disabled]) filter(:option) { |node, value| node.value == value.to_s } describe do |options| desc = String.new desc << " with value #{options[:option].inspect}" if options[:option] expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc end end ## # # Find checkboxes # # @locator Match id, name, or associated label text # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :checked Match checked fields? # @filter [Boolean] :unchecked Match unchecked fields? # @filter [Boolean] :disabled Match disabled field? # @filter [String] :option Match the value # Capybara.add_selector(:checkbox) do xpath(:name) do |locator, options| xpath = XPath.descendant(:input)[XPath.attr(:type).equals('checkbox')] locate_field(xpath, locator, options) end filter_set(:_field, [:checked, :unchecked, :disabled]) filter(:option) { |node, value| node.value == value.to_s } describe do |options| desc = String.new desc << " with value #{options[:option].inspect}" if options[:option] expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc end end ## # # Find select elements # # @locator Match id, name, placeholder, or associated label text # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String] :placeholder Matches the placeholder attribute # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :disabled Match disabled field? # @filter [Boolean] :multiple Match fields that accept multiple values # @filter [Array] :options Exact match options # @filter [Array] :with_options Partial match options # @filter [String, Array] :selected Match the selection(s) # Capybara.add_selector(:select) do label "select box" xpath(:name, :placeholder) do |locator, options| xpath = XPath.descendant(:select) locate_field(xpath, locator, options) end filter_set(:_field, [:disabled, :multiple]) filter(:options) do |node, options| if node.visible? actual = node.all(:xpath, './/option').map { |option| option.text } else actual = node.all(:xpath, './/option', visible: false).map { |option| option.text(:all) } end options.sort == actual.sort end filter(:with_options) do |node, options| finder_settings = { minimum: 0 } if !node.visible? finder_settings[:visible] = false end options.all? { |option| node.first(:option, option, finder_settings) } end filter(:selected) do |node, selected| actual = node.all(:xpath, './/option', visible: false).select { |option| option.selected? }.map { |option| option.text(:all) } [selected].flatten.sort == actual.sort end describe do |options| desc = String.new desc << " with options #{options[:options].inspect}" if options[:options] desc << " with at least options #{options[:with_options].inspect}" if options[:with_options] desc << " with #{options[:selected].inspect} selected" if options[:selected] expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc end end ## # # Find option elements # # @locator Match text of option # @filter [Boolean] :disabled Match disabled option # @filter [Boolean] :selected Match selected option # Capybara.add_selector(:option) do xpath do |locator| xpath = XPath.descendant(:option) xpath = xpath[XPath.string.n.is(locator.to_s)] unless locator.nil? xpath end filter(:disabled, :boolean) { |node, value| not(value ^ node.disabled?) } filter(:selected, :boolean) { |node, value| not(value ^ node.selected?) } describe do |options| desc = String.new desc << " that is#{' not' unless options[:disabled]} disabled" if options.has_key?(:disabled) desc << " that is#{' not' unless options[:selected]} selected" if options.has_key?(:selected) desc end end ## # # Find file input elements # # @locator Match id, name, or associated label text # @filter [String] :id Matches the id attribute # @filter [String] :name Matches the name attribute # @filter [String, Array] :class Matches the class(es) provided # @filter [Boolean] :disabled Match disabled field? # @filter [Boolean] :multiple Match field that accepts multiple values # Capybara.add_selector(:file_field) do label "file field" xpath(:name) do |locator, options| xpath = XPath.descendant(:input)[XPath.attr(:type).equals('file')] locate_field(xpath, locator, options) end filter_set(:_field, [:disabled, :multiple]) describe do |options| desc = String.new expression_filters.each { |ef| desc << " with #{ef.to_s} #{options[ef]}" if options.has_key?(ef) } desc end end ## # # Find label elements # # @locator Match id or text contents # @filter [Element, String] :for The element or id of the element associated with the label # Capybara.add_selector(:label) do label "label" xpath(:for) do |locator, options| xpath = XPath.descendant(:label) xpath = xpath[XPath.string.n.is(locator.to_s) | XPath.attr(:id).equals(locator.to_s)] unless locator.nil? if options.has_key?(:for) && !options[:for].is_a?(Capybara::Node::Element) xpath = xpath[XPath.attr(:for).equals(options[:for].to_s).or((~XPath.attr(:for)).and(XPath.descendant()[XPath.attr(:id).equals(options[:for].to_s)]))] end xpath end filter(:for) do |node, field_or_value| if field_or_value.is_a? Capybara::Node::Element if node[:for] field_or_value[:id] == node[:for] else field_or_value.find_xpath('./ancestor::label[1]').include? node.base end else #Non element values were handled through the expression filter true end end describe do |options| desc = String.new desc << " for #{options[:for]}" if options[:for] desc end end ## # # Find table elements # # @locator id or caption text of table # @filter [String] :id Match id attribute of table # @filter [String] :caption Match text of associated caption # @filter [String, Array] :class Matches the class(es) provided # Capybara.add_selector(:table) do xpath(:caption) do |locator, options| xpath = XPath.descendant(:table) xpath = xpath[XPath.attr(:id).equals(locator.to_s) | XPath.descendant(:caption).is(locator.to_s)] unless locator.nil? xpath = xpath[XPath.descendant(:caption).equals(options[:caption])] if options[:caption] xpath end describe do |options| desc = String.new desc << " with caption #{options[:caption]}" if options[:caption] desc end end ## # # Find frame/iframe elements # # @locator Match id or name # @filter [String] :id Match id attribute # @filter [String] :name Match name attribute # @filter [String, Array] :class Matches the class(es) provided # Capybara.add_selector(:frame) do xpath(:name) do |locator, options| xpath = XPath.descendant(:iframe) + XPath.descendant(:frame) xpath = xpath[XPath.attr(:id).equals(locator.to_s) | XPath.attr(:name).equals(locator)] unless locator.nil? xpath = expression_filters.inject(xpath) { |memo, ef| memo[find_by_attr(ef, options[ef])] } xpath end describe do |options| desc = String.new desc << " with name #{options[:name]}" if options[:name] desc end end capybara-2.10.2/lib/capybara/node/0000755000175000017500000000000013017655442015666 5ustar lunarlunarcapybara-2.10.2/lib/capybara/node/simple.rb0000644000175000017500000001135613017655442017512 0ustar lunarlunar# frozen_string_literal: true module Capybara module Node ## # # A {Capybara::Node::Simple} is a simpler version of {Capybara::Node::Base} which # includes only {Capybara::Node::Finders} and {Capybara::Node::Matchers} and does # not include {Capybara::Node::Actions}. This type of node is returned when # using {Capybara.string}. # # It is useful in that it does not require a session, an application or a driver, # but can still use Capybara's finders and matchers on any string that contains HTML. # class Simple include Capybara::Node::Finders include Capybara::Node::Matchers include Capybara::Node::DocumentMatchers attr_reader :native def initialize(native) native = Capybara::HTML(native) if native.is_a?(String) @native = native end ## # # @return [String] The text of the element # def text(type=nil) native.text end ## # # Retrieve the given attribute # # element[:title] # => HTML title attribute # # @param [Symbol] name The attribute name to retrieve # @return [String] The value of the attribute # def [](name) attr_name = name.to_s if attr_name == 'value' value elsif 'input' == tag_name and 'checkbox' == native[:type] and 'checked' == attr_name native['checked'] == 'checked' else native[attr_name] end end ## # # @return [String] The tag name of the element # def tag_name native.node_name end ## # # An XPath expression describing where on the page the element can be found # # @return [String] An XPath expression # def path native.path end ## # # @return [String] The value of the form element # def value if tag_name == 'textarea' native.content elsif tag_name == 'select' if native['multiple'] == 'multiple' native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content } else option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first option[:value] || option.content if option end elsif tag_name == 'input' && %w(radio checkbox).include?(native[:type]) native[:value] || 'on' else native[:value] end end ## # # Whether or not the element is visible. Does not support CSS, so # the result may be inaccurate. # # @param [Boolean] check_ancestors Whether to inherit visibility from ancestors # @return [Boolean] Whether the element is visible # def visible?(check_ancestors = true) return false if (tag_name == 'input') && (native[:type]=="hidden") if check_ancestors #check size because oldest supported nokogiri doesnt support xpath boolean() function native.xpath("./ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or @hidden or name()='script' or name()='head']").size() == 0 else #no need for an xpath if only checking the current element !(native.has_attribute?('hidden') || (native[:style] =~ /display:\s?none/) || %w(script head).include?(tag_name)) end end ## # # Whether or not the element is checked. # # @return [Boolean] Whether the element is checked # def checked? native.has_attribute?('checked') end ## # # Whether or not the element is disabled. # # @return [Boolean] Whether the element is disabled def disabled? native.has_attribute?('disabled') end ## # # Whether or not the element is selected. # # @return [Boolean] Whether the element is selected # def selected? native.has_attribute?('selected') end def synchronize(seconds=nil) yield # simple nodes don't need to wait end def allow_reload! # no op end def title if native.respond_to? :title native.title else #old versions of nokogiri don't have #title - remove in 3.0 native.xpath('/html/head/title | /html/title').first.text end end def inspect %(#) end # @api private def find_css(css) native.css(css) end # @api private def find_xpath(xpath) native.xpath(xpath) end end end end capybara-2.10.2/lib/capybara/node/actions.rb0000644000175000017500000002646613017655442017671 0ustar lunarlunar# frozen_string_literal: true module Capybara module Node module Actions ## # # Finds a button or link by id, text or value and clicks it. Also looks at image # alt text inside the link. # @!macro waiting_behavior # If the driver is capable of executing JavaScript, +$0+ will wait for a set amount of time # and continuously retry finding the element until either the element is found or the time # expires. The length of time +find+ will wait is controlled through {Capybara.default_max_wait_time} # # @option options [false, Numeric] wait (Capybara.default_max_wait_time) Maximum time to wait for matching element to appear. # # @overload click_link_or_button([locator], options) # # @param [String] locator Text, id or value of link or button # def click_link_or_button(locator=nil, options={}) locator, options = nil, locator if locator.is_a? Hash find(:link_or_button, locator, options).click end alias_method :click_on, :click_link_or_button ## # # Finds a link by id, text or title and clicks it. Also looks at image # alt text inside the link. # # @macro waiting_behavior # # @overload click_link([locator], options) # @param [String] locator text, id, title or nested image's alt attribute # @param options See {Capybara::Node::Finders#find_link} # def click_link(locator=nil, options={}) locator, options = nil, locator if locator.is_a? Hash find(:link, locator, options).click end ## # # Finds a button on the page and clicks it. # This can be any \ element of type submit, reset, image, button or it can be a # \ capybara-2.10.2/lib/capybara/spec/views/header_links.erb0000644000175000017500000000025413017655442022153 0ustar lunarlunar<%# frozen_string_literal: true %>

Link

capybara-2.10.2/lib/capybara/spec/views/frame_parent.erb0000644000175000017500000000034113017655442022163 0ustar lunarlunar<%# frozen_string_literal: true %> This is the parent frame title capybara-2.10.2/lib/capybara/spec/views/with_base_tag.erb0000644000175000017500000000050013017655442022315 0ustar lunarlunar<%# frozen_string_literal: true %> with_external_source

FooBar

This is the title of frame two
This is the text of divInFrameTwo
capybara-2.10.2/lib/capybara/spec/views/frame_child.erb0000644000175000017500000000106113017655442021755 0ustar lunarlunar<%# frozen_string_literal: true %> This is the child frame title Close Window capybara-2.10.2/lib/capybara/spec/views/with_html.erb0000644000175000017500000001033413017655442021522 0ustar lunarlunar<%# frozen_string_literal: true %>
<%= referrer %>

This is a test

Header Class Test One

Header Class Test Two

Header Class Test Three

Header Class Test Four

Header Class Test Five

42 Other span

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. awesome image

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat Redirect pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia text with   whitespace id est laborum.

BackToMyself A link came first A link A link with data-method A link with capitalized data-method No Href Blank Href Blank Anchor Blank JS Anchor Normal Anchor Anchor on different page Anchor on same page Relative Protocol very fine image fine image Disabled link Naked Query String <% if params[:query_string] %> Query String sent <% end %>

Some of this text is hidden!
Some of this text is not hidden and some is hidden
Number 42
  • John
  • Paul
  • George
  • Ringo
singular
multiple one
multiple two
almost singular but not quite
almost singular
capybara-2.10.2/lib/capybara/spec/views/with_slow_unload.erb0000644000175000017500000000053513017655442023106 0ustar lunarlunar
This delays unload by 2 seconds
capybara-2.10.2/lib/capybara/spec/views/postback.erb0000644000175000017500000000037013017655442021330 0ustar lunarlunar<%# frozen_string_literal: true %>

Postback

capybara-2.10.2/lib/capybara/spec/views/buttons.erb0000644000175000017500000000026713017655442021225 0ustar lunarlunar<%# frozen_string_literal: true %>

Buttons

capybara-2.10.2/lib/capybara/spec/views/with_simple_html.erb0000644000175000017500000000004713017655442023073 0ustar lunarlunar<%# frozen_string_literal: true %> Bar capybara-2.10.2/lib/capybara/spec/views/popup_one.erb0000644000175000017500000000033013017655442021522 0ustar lunarlunar<%# frozen_string_literal: true %> Title of the first popup
This is the text of divInPopupOne
capybara-2.10.2/lib/capybara/spec/views/popup_two.erb0000644000175000017500000000032213017655442021553 0ustar lunarlunar<%# frozen_string_literal: true %> Title of popup two
This is the text of divInPopupTwo
capybara-2.10.2/lib/capybara/spec/views/fieldsets.erb0000644000175000017500000000131613017655442021505 0ustar lunarlunar<%# frozen_string_literal: true %>
Agent

Villain

capybara-2.10.2/lib/capybara/spec/views/within_frames.erb0000644000175000017500000000056513017655442022367 0ustar lunarlunar<%# frozen_string_literal: true %> With Frames
This is the text for divInMainWindow
capybara-2.10.2/lib/capybara/spec/views/tables.erb0000644000175000017500000000241313017655442020774 0ustar lunarlunar<%# frozen_string_literal: true %>
Agent
Girl
Villain
capybara-2.10.2/lib/capybara/spec/views/with_count.erb0000644000175000017500000000024213017655442021703 0ustar lunarlunar<%# frozen_string_literal: true %>

This page is used for testing number options of has_text?

count1

2 count

Count

capybara-2.10.2/lib/capybara/spec/views/with_html_entities.erb0000644000175000017500000000011713017655442023424 0ustar lunarlunar<%# frozen_string_literal: true %> Encoding with — html entities » capybara-2.10.2/lib/capybara/spec/views/with_title.erb0000644000175000017500000000016013017655442021673 0ustar lunarlunar<%# frozen_string_literal: true %> Test Title abcdefg capybara-2.10.2/lib/capybara/spec/views/with_unload_alert.erb0000644000175000017500000000033413017655442023226 0ustar lunarlunar
This triggers an alert on unload
Go away capybara-2.10.2/lib/capybara/spec/views/host_links.erb0000644000175000017500000000053013017655442021675 0ustar lunarlunar<%# frozen_string_literal: true %>

Relative Host Absolute Host

capybara-2.10.2/lib/capybara/spec/views/with_js.erb0000644000175000017500000000570513017655442021200 0ustar lunarlunar<%# frozen_string_literal: true %> with_js

FooBar

This is text

This is a draggable element.

It should be dropped here.

Click me

Slowly

Editable content
Content

Reload! this won't change

waiting to be reloaded

Fetch new list!

  • Item 1
  • Item 2

Change title

Click me

Open alert

Open delayed alert Open slow alert

Open confirm

Open check twice

Open prompt

Change page Non-escaped query options Escaped query options

capybara-2.10.2/lib/capybara/spec/views/with_scope.erb0000644000175000017500000000254613017655442021675 0ustar lunarlunar<%# frozen_string_literal: true %>

This page is used for testing various scopes

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim venia. Go

  • With Simple HTML: Go

  • Bar: Go

  • With Simple HTML: Go
capybara-2.10.2/lib/capybara/spec/views/form.erb0000644000175000017500000004360013017655442020470 0ustar lunarlunar<%# frozen_string_literal: true %>

Form



First address

Second address

Emergency Number