module Capybara::Node::Matchers

def assert_text(*args)

Returns:
  • (true) -

Raises:
  • (Capybara::ExpectationNotMet) - if the assertion hasn't succeeded during wait time

Options Hash: (**options)
  • :normalize_ws (Boolean) -- When true replace all whitespace with standard spaces and collapse consecutive whitespace to a single space
  • :exact (Boolean) -- Whether text must be an exact match or just substring
  • :wait (Numeric) -- Maximum time that Capybara will wait for text to eq/match given string/regexp argument
  • :between (Range) -- Range of times that is expected to contain number of times text occurs
  • :maximum (Integer) -- Maximum number of times the text is expected to occur
  • :minimum (Integer) -- Minimum number of times the text is expected to occur
  • :count (Integer) -- Number of times the text is expected to occur
  • :normalize_ws (Boolean) -- When true replace all whitespace with standard spaces and collapse consecutive whitespace to a single space
  • :exact (Boolean) -- Whether text must be an exact match or just substring
  • :wait (Numeric) -- Maximum time that Capybara will wait for text to eq/match given string/regexp argument
  • :between (Range) -- Range of times that is expected to contain number of times text occurs
  • :maximum (Integer) -- Maximum number of times the text is expected to occur
  • :minimum (Integer) -- Minimum number of times the text is expected to occur
  • :count (Integer) -- Number of times the text is expected to occur

Parameters:
  • text (String, Regexp) -- The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
  • text (String, Regexp) -- The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
  • type (:all, :visible) -- Whether to check for only visible or all text. If this parameter is missing or nil then we use the value of `Capybara.ignore_hidden_elements`, which defaults to `true`, corresponding to `:visible`.

Overloads:
  • assert_text(text, **options)
  • assert_text(type, text, **options)
def assert_text(*args)
  _verify_text(args) do |count, query|
    unless query.matches_count?(count) && (count.positive? || query.expects_none?)
      raise Capybara::ExpectationNotMet, query.failure_message
    end
  end
end