Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

have_xpath instead of have_selector to avoid problems with forms within

tables
  • Loading branch information...
commit f0be0f38f6ab3b20bfbeab56793bd894ddc6666d 1 parent fa97be0
@nando authored
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/mundo_pepino/es_ES/definitions.rb
View
13 lib/mundo_pepino/es_ES/definitions.rb
@@ -275,14 +275,13 @@
end
Entonces /^(#{_veo_o_no_}) (?:una|la) tabla (?:(["'].+?['"]|[^ ]+) )?con (?:el|los) (?:siguientes? )?(?:valore?s?|contenidos?):$/ do |should, table_id, valores|
- table_id = "##{table_id.to_unquoted}" if table_id
+ table_id = "[@id = '#{table_id.to_unquoted}']" if table_id
shouldified = shouldify(should)
- #TODO For capybara page instead response and have_css instead have_selector
- response.send shouldified, have_selector("table#{table_id}")
+ response.send shouldified, have_xpath("//table#{table_id}")
- if have_selector("table#{table_id} tbody").matches?(response)
+ if have_xpath("//table#{table_id}/tbody").matches?(response)
start_row = 1
- tbody = "tbody"
+ tbody = "/tbody"
else
start_row = 2
tbody = ""
@@ -290,8 +289,8 @@
valores.raw[1..-1].each_with_index do |row, i|
row.each_with_index do |cell, j|
- response.send shouldified,
- have_selector("table#{table_id} #{tbody} tr:nth-child(#{i+start_row})>td:nth-child(#{j+1})") { |td|
+ response.send shouldified,
+ have_xpath("//table#{table_id}#{tbody}/tr[position() = #{i+start_row} ]/td[position() = #{j+1}]") { |td|
td.inner_text.should =~ /#{cell == '.*' ? cell : Regexp.escape((cell||"").to_translated)}/
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.