Sha256: 4705a2fe63ea5e609e567623018e27618ce29c333f3caf43098d4b9fce9bff58

Contents?: true

Size: 1.24 KB

Versions: 57

Compression:

Stored size: 1.24 KB

Contents

module HtmlSelectorsHelpers
  # Maps a name to a selector. Used primarily by the
  #
  #   When /^(.+) within (.+)$/ do |step, scope|
  #
  # step definitions in web_steps.rb
  #
  def selector_for(locator)
    case locator

    when /^a panel?$/
      '.panel'

    when /^a panels nested contents?$/
      '.panel--nested-contents'

    when /^the timeline?$/
      '.timeline'

    when /^the table row containing "(.+?)"$/
      all('tr').detect { |tr| tr.text.include? $1 } || raise("Could not find tr containing #{$1.inspect}")

    when /^a table$/
      '.table'

      # Add more mappings here.
      # Here is an example that pulls values out of the Regexp:
      #
      #  when /^the (notice|error|info) flash$/
      #    ".flash.#{$1}"

      # You can also return an array to use a different selector
      # type, like:
      #
      #  when /the header/
      #    [:xpath, "//header"]

      # This allows you to provide a quoted selector as the scope
      # for "within" steps as was previously the default for the
      # web steps:
    when /^"(.+)"$/
      $1

    else
      raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
              "Now, go and add a mapping in #{__FILE__}"
    end
  end

end

World(HtmlSelectorsHelpers)

Version data entries

57 entries across 49 versions & 1 rubygems

Version Path
spreewald-4.6.3 tests/shared/features/support/selectors.rb
spreewald-4.6.2 tests/shared/features/support/selectors.rb
spreewald-4.6.1 tests/shared/features/support/selectors.rb
spreewald-4.6.0 tests/shared/features/support/selectors.rb
spreewald-4.5.1 tests/shared/features/support/selectors.rb
spreewald-4.5.0 tests/shared/features/support/selectors.rb
spreewald-4.4.4 tests/shared/features/support/selectors.rb
spreewald-4.4.3 tests/shared/features/support/selectors.rb
spreewald-4.4.2 tests/shared/features/support/selectors.rb
spreewald-4.4.1 tests/shared/features/support/selectors.rb
spreewald-4.4.0 tests/shared/features/support/selectors.rb
spreewald-4.3.6 tests/shared/features/support/selectors.rb
spreewald-4.3.5 tests/shared/features/support/selectors.rb
spreewald-4.3.4 tests/shared/features/support/selectors.rb
spreewald-4.3.3 tests/shared/features/support/selectors.rb
spreewald-4.3.2 tests/shared/features/support/selectors.rb
spreewald-4.2.3 tests/shared/features/support/selectors.rb
spreewald-4.2.2 tests/shared/features/support/selectors.rb
spreewald-4.1.2 tests/shared/features/support/selectors.rb
spreewald-4.1.1 tests/shared/features/support/selectors.rb