class Capybara::Queries::TextQuery

def initialize(type = nil, expected_text, session_options:, **options) # rubocop:disable Style/OptionalArguments

rubocop:disable Style/OptionalArguments
def initialize(type = nil, expected_text, session_options:, **options) # rubocop:disable Style/OptionalArguments
  @type = if type.nil?
    Capybara.ignore_hidden_elements || Capybara.visible_text_only ? :visible : :all
  else
    type
  end
  @expected_text = expected_text.is_a?(Regexp) ? expected_text : expected_text.to_s
  @options = options
  super(@options)
  self.session_options = session_options
  @search_regexp = Capybara::Helpers.to_regexp(@expected_text, exact: exact?)
  assert_valid_keys
end