start adding scenarios for calendar

This commit is contained in:
Reinier Balt 2011-02-27 00:35:19 +01:00
parent b8484e48fe
commit 75cf51927e
3 changed files with 42 additions and 7 deletions

View file

@ -1,4 +1,4 @@
Feature: dependencies
Feature: Show all due actions in a calendar view
As a Tracks user
In order to keep overview of my due todos
I want to manage due todos in a calendar view
@ -8,12 +8,28 @@ Feature: dependencies
| login | password | is_admin |
| testuser | secret | false |
And I have logged in as "testuser" with password "secret"
And I have a context called "@calendar"
@selenium
Scenario: Setting due date of a todo will show it in the calendar
Given this is a pending scenario
When I submit a new action with description "a new next action" in the context "@calendar"
And I go to the calendar page
Then the badge should show 0
And I should not see "a new next action"
When I go to the home page
And I edit the due date of "a new next action" to tomorrow
And I go to the calendar page
Then the badge should show 1
And I should see "a new next action"
@selenium @wip
Scenario: Clearing the due date of a todo will remove it from the calendar
Given this is a pending scenario
When I submit a new action with description "a new next action" in the context "@calendar"
And I edit the due date of "a new next action" to tomorrow
And I go to the calendar page
Then I should see "a new next action"
When I clear the due date of "a new next action"
Then I should not see "a new next action"
Scenario: Changing due date of a todo will move it in the calendar
Given this is a pending scenario

View file

@ -174,12 +174,26 @@ end
When /^I edit the dependency of "([^"]*)" to "([^"]*)"$/ do |todo_name, deps|
todo = @dep_todo = @current_user.todos.find_by_description(todo_name)
todo.should_not be_nil
# click edit
selenium.click("//div[@id='line_todo_#{todo.id}']//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
open_edit_form_for(todo)
fill_in "predecessor_list_todo_#{todo.id}", :with => deps
submit_edit_todo_form(todo)
sleep(1) # TODO: replace with some wait_for
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
open_edit_form_for(todo)
fill_in "due_todo_#{todo.id}", :with => format_date(todo.created_at + 1.day)
submit_edit_todo_form(todo)
end
When /^I clear the due date of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
open_edit_form_for(todo)
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo_id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
submit_edit_todo_form(todo)
end
Then /^I should see ([0-9]+) todos$/ do |count|

View file

@ -36,6 +36,11 @@ module TracksStepHelper
execute_javascript("$('#todo_project_name').val('');")
end
def open_edit_form_for(todo)
# click edit
selenium.click("//div[@id='line_todo_#{todo.id}']//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
end
end
World(TracksStepHelper)