features/step_definations/table_steps.rb in druid-ts-1.1.3 vs features/step_definations/table_steps.rb in druid-ts-1.1.4
- old
+ new
@@ -5,13 +5,14 @@
When(/^I retrieve a table element by "(.*?)"$/) do |how|
@element = @page.send "table_#{how}_element".to_sym
end
Then(/^the data for row "(.*?)" should be "(.*?)" and "(.*?)"$/) do |row, col1, col2|
- row = @element[row.to_i - 1]
- expect(row[0].text).to eql col1
- expect(row[1].text).to eql col2
+ row = (row.to_i - 1) if row.to_i > 0
+ table_row = @element[row]
+ expect(table_row[0].text).to eql col1
+ expect(table_row[1].text).to eql col2
end
Then(/^the table should have "(.*?)" rows$/) do |number|
expect(@element.rows).to eql number.to_i
end
@@ -51,6 +52,22 @@
expect(@element.last_row[1].text).to eql col2
end
Then(/^I should see that the table exists$/) do
expect(@page.table_id?).to be true
+end
+
+Then(/^the data for column "([^"]*)" and row "([^"]*)" should be "([^"]*)"$/) do |column, row, value|
+ expect(@element[row.to_i - 1][column].text).to eql value
+end
+
+Then(/^the data for row "([^"]*)" and column "([^"]*)" should be "([^"]*)"$/) do |row, column, value|
+ expect(@element[row][column].text).to eql value
+end
+
+Then(/^the data for row "([^"]*)" should be nil$/) do |row|
+ expect(@element[row]).to be_nil
+end
+
+Then(/^the data for row "([^"]*)" and column "([^"]*)" should be nil$/) do |row, column|
+ expect(@element[row][column]).to be_nil
end