finish updating cucumber scenario's to the stricter capybara

This commit is contained in:
Reinier Balt 2013-01-01 17:38:59 +01:00
parent ee3f8a3f8b
commit 796685072d
11 changed files with 55 additions and 34 deletions

View file

@ -14,9 +14,11 @@ end
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
find("a#link_edit_context_#{@context.id}").click
page.should have_css("button#submit_context_#{@context.id}", :visible=>true)
fill_in "context_name", :with => new_name
click_button "submit_context_#{@context.id}"
within "div.edit-form" do
fill_in "context_name", :with => new_name
click_button "submit_context_#{@context.id}"
end
# wait for the form to go away
page.should have_css("a#link_edit_context_#{@context.id}", :visible=> true)

View file

@ -0,0 +1,4 @@
When /^I follow the tag "(.*?)"$/ do |tag_name|
# there could be more than one tag on the page, so use the first
all(:xpath, "//span[@class='tag #{tag_name}']/a")[0].click
end

View file

@ -4,7 +4,7 @@ When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, projec
end
When /^I delete the first note$/ do
title = page.find("div.container h2").text
title = page.all("div.container h2").first.text
id = title.split(' ').last
handle_js_confirm do
@ -20,12 +20,14 @@ When /^I click the icon next to the note$/ do
end
When /^I edit the first note to "([^"]*)"$/ do |note_body|
title = page.find("div.container h2").text
title = page.all("div.container h2").first.text
id = title.split(' ').last
click_link "link_edit_note_#{id}"
fill_in "note[body]", :with => note_body
click_button "submit_note_#{id}"
within "form#edit_form_note_#{id}" do
fill_in "note[body]", :with => note_body
click_button "submit_note_#{id}"
end
end
When /^I toggle the note of "([^"]*)"$/ do |todo_description|
@ -79,5 +81,5 @@ Then /^I should not see the note "([^"]*)"$/ do |note_content|
end
Then /^I should see the note "([^"]*)"$/ do |note_content|
page.find("div", :text => note_content).should be_visible
page.all("div", :text => note_content).first.should be_visible
end

View file

@ -35,15 +35,19 @@ end
When /^I sort the active list alphabetically$/ do
handle_js_confirm do
click_link "Alphabetically"
within "div#list-active-projects-container" do
click_link "Alphabetically"
end
wait_for_ajax
end
get_confirm_text.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
end
When /^I sort the list by number of tasks$/ do
When /^I sort the active list by number of tasks$/ do
handle_js_confirm do
click_link "By number of tasks"
within "div#list-active-projects-container" do
click_link "By number of tasks"
end
wait_for_ajax
end
get_confirm_text.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."

View file

@ -97,7 +97,9 @@ When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_desc
todo.should_not be_nil
open_edit_form_for(todo)
fill_in "todo_description", :with => new_description
within "form.edit_todo_form" do
fill_in "todo_description", :with => new_description
end
submit_button_xpath = "//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']"
page.find(:xpath, submit_button_xpath).click
wait_for_ajax