add more cucumber scenarios

This commit is contained in:
Reinier Balt 2011-08-15 17:04:59 +02:00
parent b40998e0bc
commit ef961188ea
12 changed files with 190 additions and 71 deletions

View file

@ -23,6 +23,15 @@ When /^I edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description
submit_edit_todo_form(todo)
end
When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
open_edit_form_for(todo)
fill_in "todo_description", :with => new_description
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
# do not wait for form to disappear to be able to test failures
end
When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
@ -65,6 +74,15 @@ When /^I remove the show from date from "([^"]*)"$/ do |action_description|
submit_edit_todo_form(todo)
end
When /^I edit the tags of "([^"]*)" to "([^"]*)"$/ do |action_description, tags|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
open_edit_form_for(todo)
fill_in "tag_list", :with => tags
submit_edit_todo_form(todo)
end
When /^I defer "([^"]*)" for 1 day$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
@ -72,9 +90,7 @@ When /^I defer "([^"]*)" for 1 day$/ do |action_description|
defer_todo_1day_button = "xpath=//a[@id='defer_1_todo_#{todo.id}']/img"
selenium.click defer_todo_1day_button
wait_for :timeout => 5 do
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
end
wait_for_ajax
end
When /^I make a project of "([^"]*)"$/ do |action_description|
@ -89,3 +105,9 @@ When /^I make a project of "([^"]*)"$/ do |action_description|
end
end
Then /^I should see an error message$/ do
error_block = "xpath=//form/div[@id='edit_error_status']"
wait_for :timeout => 5 do
selenium.is_element_present(error_block)
end
end