fix #922. You can now mark a todo complete from the tickler. Also fixed some small aasm corner cases found by this change

This commit is contained in:
Reinier Balt 2011-08-18 17:15:00 +02:00
parent 367907eab2
commit 07b05d01f7
16 changed files with 276 additions and 147 deletions

View file

@ -1,3 +1,5 @@
####### Context #######
Then /^I should not see the context "([^"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
@ -23,10 +25,11 @@ Then /^I should see the container for context "([^"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
xpath = "xpath=//div[@id='c#{context.id}']"
xpath = "//div[@id='c#{context.id}']"
selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
wait_for :timeout => 5 do
selenium.is_visible(xpath)
end
end
Then /^the container for the context "([^"]*)" should be visible$/ do |context_name|
@ -60,6 +63,8 @@ Then /^I should not see "([^"]*)" in the context container for "([^"]*)"$/ do |t
end
end
####### Deferred #######
Then /^I should see "([^"]*)" in the deferred container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
@ -71,6 +76,19 @@ Then /^I should see "([^"]*)" in the deferred container$/ do |todo_description|
end
end
Then /^I should not see "([^"]*)" in the deferred container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='tickler']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
!selenium.is_element_present(xpath)
end
end
####### Project #######
Then /^I should see "([^"]*)" in the action container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
@ -98,51 +116,6 @@ Then /^I should not see "([^"]*)" in the project container of "([^"]*)"$/ do |to
end
end
Then /^I should see "([^"]*)" in the completed container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='completed_container']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
Then /^I should not see "([^"]*)" in the deferred container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='tickler']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
!selenium.is_element_present(xpath)
end
end
Then /^I should see "([^"]*)" in the hidden container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='hidden']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
Then /^I should see "([^"]*)" in the due next month container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='due_after_this_month']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_description, project_name|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
@ -156,6 +129,60 @@ Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_desc
selenium.is_visible(xpath).should be_true
end
####### Completed #######
Then /^I should see "([^"]*)" in the completed container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='completed_container']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
Then /^I should not see "([^"]*)" in the completed container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='completed_container']//div[@id='line_todo_#{todo.id}']"
if selenium.is_element_present(xpath)
wait_for :timeout => 5 do
!selenium.is_element_present(xpath)
end
end
end
####### Hidden #######
Then /^I should see "([^"]*)" in the hidden container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='hidden']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
####### Calendar #######
Then /^I should see "([^"]*)" in the due next month container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='due_after_this_month']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
####### Repeat patterns #######
Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repeat_pattern|
repeat = @current_user.recurring_todos.find_by_description(repeat_pattern)