Browse files

Update and add scenario's for testing interaction with new deferred c…

…ontainer on context page and fix regressions
  • Loading branch information...
1 parent dd957f0 commit 7435b1ba9305783dfe283dfff3654602e314e053 @lrbalt lrbalt committed Mar 23, 2012
View
2 app/controllers/contexts_controller.rb
@@ -286,7 +286,7 @@ def init_todos
@projects = current_user.projects
- @count = @not_done_todos.size
+ @count = @not_done_todos.count + @deferred.count + @pending.count
end
end
View
1 app/controllers/todos_controller.rb
@@ -1371,6 +1371,7 @@ def cache_attributes_from_before_update
@original_item_due = @todo.due
@original_item_due_id = get_due_id_for_calendar(@todo.due)
@original_item_predecessor_list = @todo.predecessors.map{|t| t.specification}.join(', ')
+ @todo_was_deferred_or_blocked = @todo.deferred? || @todo.pending?
end
def update_project
View
20 features/calendar.feature
@@ -15,12 +15,12 @@ Feature: Show all due actions in a calendar view
When I submit a new action with description "something new" in the context "@calendar"
And I go to the calendar page
Then the badge should show 0
- And I should not see "something new"
+ And I should not see the todo "something new"
When I go to the home page
- Then I should see "something new"
+ Then I should see the todo "something new"
When I edit the due date of "something new" to tomorrow
And I go to the calendar page
- Then I should see "something new"
+ Then I should see the todo "something new"
And the badge should show 1
@javascript
@@ -29,30 +29,30 @@ Feature: Show all due actions in a calendar view
And I submit a new action with description "something new" in the context "@calendar"
And I edit the due date of "something new" to tomorrow
And I go to the calendar page
- Then I should see "something new"
+ Then I should see the todo "something new"
When I clear the due date of "something new"
- Then I should not see "something new"
+ Then I should not see the todo "something new"
@javascript
Scenario: Marking a todo complete will remove it from the calendar
Given I have a todo "something new" in the context "@calendar" which is due tomorrow
When I go to the calendar page
- Then I should see "something new"
+ Then I should see the todo "something new"
When I clear the due date of "something new"
- Then I should not see "something new"
+ Then I should not see the todo "something new"
@javascript
Scenario: Deleting a todo will remove it from the calendar
Given I have a todo "something new" in the context "@calendar" which is due tomorrow
When I go to the calendar page
- Then I should see "something new"
+ Then I should see the todo "something new"
When I delete the action "something new"
- Then I should not see "something new"
+ Then I should not see the todo "something new"
@javascript
Scenario: Changing due date of a todo will move it in the calendar
Given I have a todo "something new" in the context "@calendar" which is due tomorrow
When I go to the calendar page
- Then I should see "something new"
+ Then I should see the todo "something new"
When I edit the due date of "something new" to next month
Then I should see "something new" in the due next month container
View
71 features/context_edit.feature
@@ -10,7 +10,7 @@ Feature: Edit a context
And I have logged in as "testuser" with password "secret"
And I have a context called "@pc"
And I have a project called "test project"
- And I have 2 todos in project "test project" in context "@pc" with tags "starred"
+ And I have 2 todos in project "test project" in context "@pc" with tags "starred" prefixed by "test_project "
@javascript
Scenario: In place edit of context name
@@ -26,48 +26,81 @@ Feature: Edit a context
Scenario: Editing the context of a todo will remove the todo
When I go to the the context page for "@pc"
Then the badge should show 2
- When I edit the context of "todo 1" to "@laptop"
- Then I should not see "todo 1"
+ When I edit the context of "test_project todo 1" to "@laptop"
+ Then I should not see the todo "todo 1"
And the badge should show 1
@javascript
Scenario: Editing the description of a a todo will update that todo
When I go to the the context page for "@pc"
- And I edit the description of "todo 1" to "changed"
- Then I should not see "todo 1"
+ And I edit the description of "test_project todo 1" to "changed"
+ Then I should not see "test_project todo 1"
And I should see "changed"
@javascript
Scenario: Editing the context of the last todo will remove the todo and show empty message
When I go to the the context page for "@pc"
- And I edit the context of "todo 1" to "@laptop"
- Then I should not see "todo 1"
+ And I edit the context of "test_project todo 1" to "@laptop"
+ Then I should not see the todo "test_project todo 1"
And the badge should show 1
- When I edit the context of "todo 2" to "@laptop"
- Then I should not see "todo 2"
+ When I edit the context of "test_project todo 2" to "@laptop"
+ Then I should not see the todo "test_project todo 2"
And the badge should show 0
- And I should see "Currently there are no incomplete actions in this context"
+ And I should see empty message for todos of context
@javascript
Scenario: Adding a todo to a hidden project will not show the todo
Given I have a hidden project called "hidden project"
When I go to the the context page for "@pc"
- And I edit the project of "todo 1" to "hidden project"
- Then I should not see "todo 1"
+ And I edit the project of "test_project todo 1" to "hidden project"
+ Then I should not see the todo "test_project todo 1"
When I submit a new action with description "todo X" to project "hidden project" in the context "@pc"
- Then I should not see "todo X"
+ Then I should not see the todo "todo X"
When I go to the "hidden project" project
- Then I should see "todo 1"
- And I should see "todo X"
+ Then I should see the todo "test_project todo 1"
+ And I should see the todo "todo X"
And the badge should show 2
@javascript
Scenario: Adding a todo to a hidden context will show that todo
Given I have a hidden context called "@personal"
When I go to the the context page for "@pc"
- And I edit the context of "todo 1" to "@personal"
- Then I should not see "todo 1"
+ And I edit the context of "test_project todo 1" to "@personal"
+ Then I should not see the todo "test_project todo 1"
When I go to the context page for "@personal"
- Then I should see "todo 1"
+ Then I should see the todo "test_project todo 1"
When I submit a new action with description "todo X" to project "test project" in the context "@personal"
- Then I should see "todo X"
+ Then I should see the todo "todo X"
+
+ @javascript
+ Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages
+ Given I have a context "test" with 1 todos
+ When I go to the "test" context
+ Then I should see "todo 1" in the action container
+ And I should see empty message for deferred todos of context
+ And I should see empty message for completed todos of context
+ When I defer "todo 1" for 1 day
+ Then I should see "todo 1" in the deferred container
+ And I should not see empty message for deferred todos of context
+ And I should see empty message for completed todos of context
+ And I should see empty message for todos of context
+
+ @javascript
+ Scenario: Moving the todo out of the tickler will move todo to active container and update empty messages
+ Given I have a context "test" with 1 deferred todos
+ When I go to the "test" context
+ Then I should see "deferred todo 1" in the deferred container
+ And I should see empty message for todos of context
+ And I should not see empty message for deferred todos of context
+ When I clear the show from date of "deferred todo 1"
+ Then I should see "deferred todo 1" in the action container
+ And I should see empty message for deferred todos of context
+ And I should not see empty message for todos of context
+
+ @javascript
+ Scenario: Making all deferred todos inactive will show empty message
+ Given I have a context "test" with 1 deferred todos
+ When I go to the "test" context
+ And I mark "deferred todo 1" as complete
+ Then I should see empty message for todos of context
+ And I should see empty message for deferred todos of context
View
37 features/edit_a_todo.feature
@@ -19,18 +19,18 @@ Feature: Edit a next action from every page
When I go to the tag page for "starred"
Then I should see "star me"
- @javascript @selenium_only
+ @javascript
Scenario: I can delete a todo
Given I have a todo "delete me" in the context "@home"
When I go to the home page
Then I should see "delete me"
When I delete the action "delete me"
Then I should not see "delete me"
- @javascript @selenium_only
+ @javascript @wip
Scenario: Removing the last todo in context will hide context
- # the go to home page before the last delete was necessary because webkit was not able to
- # hit the submenu arrow
+ # this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14.
+ # and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This will work on webkit though
Given I have a todo "delete me" in the context "@home"
When I go to the home page
Then I should see the container for context "@home"
@@ -44,13 +44,12 @@ Feature: Edit a next action from every page
Then I should not see the container for context "@home"
And I should see the container for context "@pc"
And I should see "delete me" in the context container for "@pc"
- When I go to the home page
And I delete the todo "delete me"
- Then I should not see "delete me"
+ Then I should not see the todo "delete me"
And I should not see the container for context "@home"
And I should not see the container for context "@pc"
- @javascript @selenium_only
+ @javascript
Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo
Given I have a context called "@home"
And I have a project "my project" that has the following todos
@@ -105,9 +104,10 @@ Feature: Edit a next action from every page
And I should see "visible todo" in the completed container
Scenarios:
- | page | page type |
- | tag page for "starred" | tag |
- | "visible project" project | project |
+ | page | page type |
+ | tag page for "starred" | tag |
+ | "visible project" project | project |
+ | context page for "visible context" | context |
@javascript
Scenario Outline: I can mark a completed todo active and it will update empty messages and context containers
@@ -144,12 +144,11 @@ Feature: Edit a next action from every page
@javascript
Scenario Outline: I can edit a todo to change its description
- # do for more pages, see #1094
Given I have a todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context" that is due next week
When I go to the <page>
And I edit the description of "visible todo" to "changed todo"
- Then I should not see "visible todo"
- And I should see "changed todo"
+ Then I should not see the todo "visible todo"
+ And I should see the todo "changed todo"
Scenarios:
| page |
@@ -196,18 +195,18 @@ Feature: Edit a next action from every page
And I have a project "project two" with 1 todos
When I go to the "project two" project
And I edit the project of "todo 1" to "project one"
- Then I should not see "todo 1"
+ Then I should not see the todo "todo 1"
When I go to the "project one" project
- Then I should see "todo 1"
+ Then I should see the todo "todo 1"
@javascript
Scenario: I can edit a todo to move it to the tickler
When I go to the home page
And I submit a new action with description "start later" in the context "@pc"
And I edit the show from date of "start later" to next month
- Then I should not see "start later"
+ Then I should not see the todo "start later"
When I go to the tickler page
- Then I should see "start later"
+ Then I should see the todo "start later"
@javascript @wip
Scenario: I can defer a todo
@@ -246,8 +245,8 @@ Feature: Edit a next action from every page
Given I have a todo "tag me"
When I go to the home page
And I edit the tags of "tag me" to "bla, bli"
- Then I should see "bla"
- And I should see "bli"
+ Then I should see the todo "bla"
+ And I should see the todo "bli"
Scenario: Clicking a tag of a todo will go to that tag page
Given I have a todo "tag you are it" in context "@tags" with tags "taga, tagb"
View
5 features/project_edit.feature
@@ -157,6 +157,7 @@ Feature: Edit a project
When I go to the "test" project
And I mark "deferred todo 1" as complete
Then I should see empty message for todos of project
+ And I should see empty message for deferred todos of project
# Ticket #1043
@javascript
@@ -165,5 +166,5 @@ Feature: Edit a project
And I have a project called "bar"
When I go to the "foo" project
And I change the project_name field of "todo 1" to "bar"
- Then I should not see "todo 1"
- And I should see "todo 2"
+ Then I should not see the todo "todo 1"
+ And I should see the todo "todo 2"
View
10 features/search.feature
@@ -32,16 +32,16 @@ Feature: Show all due actions in a calendar view
| testing search | @work |
When I go to the search page
And I search for "test"
- Then I should see "tester of stuff"
+ Then I should see the todo "tester of stuff"
When I star the action "tester of stuff"
Then I should see a starred "tester of stuff"
When I edit the description of "tester of stuff" to "test 1-2-3"
- Then I should not see "tester of stuff"
- And I should see "test 1-2-3"
+ Then I should not see the todo "tester of stuff"
+ And I should see the todo "test 1-2-3"
When I go to the search page
And I search for "test"
- Then I should not see "tester of stuff"
- And I should see "test 1-2-3"
+ Then I should not see the todo "tester of stuff"
+ And I should see the todo "test 1-2-3"
@javascript
Scenario: I can delete found todos
View
32 features/shared_add_new_todo.feature
@@ -9,7 +9,7 @@ Feature: Add new next action from every page
| testuser | secret | false |
And I have logged in as "testuser" with password "secret"
And I have a context called "test context"
- And I have a project "test project" with 1 todos
+ And I have a project "test project"
@javascript
Scenario Outline: I can hide the input form for single next action on a page
@@ -99,6 +99,7 @@ Feature: Add new next action from every page
@javascript
Scenario Outline: I can add multiple todos from several pages
+ Given I have a project "testing" with 1 todos
When I go to the <page>
And I follow "Add multiple next actions"
And I submit multiple actions with using
@@ -115,7 +116,7 @@ Feature: Add new next action from every page
| page | see | badge | count |
| home page | see | 3 | 3 |
| tickler page | not see | 0 | 3 |
- | "test project" project | see | 3 | 3 |
+ | "testing" project | see | 3 | 3 |
| context page for "test context" | see | 2 | 3 |
| tag page for "starred" | not see | 0 | 3 |
@@ -148,9 +149,9 @@ Feature: Add new next action from every page
Scenarios:
| page | todo | badge | visible |
- | home page | action | 2 | be visible |
+ | home page | action | 1 | be visible |
| tickler page | deferred action | 1 | be visible |
- | "test project" project | action | 2 | not be visible |
+ | "test project" project | action | 1 | not be visible |
| context page for "test context" | action | 1 | not be visible |
| tag page for "starred" | action | 1 | be visible |
@@ -188,7 +189,7 @@ Feature: Add new next action from every page
Then I should not see "another new todo"
@javascript
- Scenario: Adding a todo to a context show the todo in that context page
+ Scenario: Adding a todo to a context shows the todo in that context page
Given I have a context called "visible context"
And I have a hidden context called "hidden context"
When I go to the context page for "visible context"
@@ -202,24 +203,31 @@ Feature: Add new next action from every page
Scenario: Adding a todo to an empty container hides the empty message # TODO: make outline
Given I have a context called "visible context"
When I go to the tag page for "test"
- Then I should see "Currently there are no incomplete actions with the tag 'test'"
+ Then I should see empty message for todos of tag
When I submit a new action with description "a new todo" and the tags "test" in the context "visible context"
Then I should see "a new todo"
- And I should not see "Currently there are no incomplete actions with the tag 'bla'"
+ And I should not see empty message for todos of tag
@javascript
- Scenario: Adding a dependency to a todo updated the successor
- When I go to the "test project" project
+ Scenario Outline: Adding a dependency to a todo updates the successor
+ Given I have a <list_type> "test" with 1 todos
+ When I go to the "test" <list_type>
Then I should see "todo 1"
When I submit a new action with description "a new todo" with a dependency on "todo 1"
- Then I should not see "a new todo" in the project container of "test project"
+ Then I should not see "a new todo" in the <list_type> container of "test"
When I expand the dependencies of "todo 1"
Then I should see "a new todo" within the dependencies of "todo 1"
- And I should not see empty message for deferred todos of project
+ And I should not see empty message for deferred todos of <list_type>
+
+ Examples:
+ | list_type |
+ | project |
+ | context |
@javascript
Scenario: Adding a dependency to a todo in another project
- Given I have a project "another project"
+ Given I have a project "testing" with 1 todos
+ And I have a project "another project"
When I go to the "another project" project
And I submit a new action with description "a new todo" with a dependency on "todo 1"
Then I should not see "a new todo" in the project container of "another project"
View
16 features/step_definitions/container_steps.rb
@@ -82,16 +82,22 @@
page.should_not have_xpath("//div[@id='tickler']//div[@id='line_todo_#{todo.id}']")
end
-####### Project #######
-
-Then /^I should see "([^"]*)" in the action container$/ do |todo_description|
+Then /^I should (not see|see) "([^"]*)" in the action container$/ do |visible, todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
- xpath = "//div[@id='p#{todo.project.id}items']//div[@id='line_todo_#{todo.id}']"
- page.should have_xpath(xpath)
+ id = @source_view=="project" ? "p#{todo.project_id}items" : "c#{todo.context_id}items"
+
+ xpath = "//div[@id='#{id}']//div[@id='line_todo_#{todo.id}']"
+ page.send(visible=="see" ? :should : :should_not, have_xpath(xpath))
end
+Then /^I should not see "([^"]*)" in the context container of "([^"]*)"$/ do |todo_description, context_name|
+ step "I should not see \"#{todo_description}\" in the action container"
+end
+
+####### Project #######
+
Then /^I should not see "([^"]*)" in the project container of "([^"]*)"$/ do |todo_description, project_name|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
View
41 features/step_definitions/context_steps.rb
@@ -46,13 +46,19 @@
step("I have the following contexts:", table)
end
-Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
+Given /^I have a context "([^\"]*)" with (\d+) (?:actions|todos)$/ do |context_name, number_of_actions|
context = @current_user.contexts.create!(:name => context_name)
+ @todos=[]
1.upto number_of_actions.to_i do |i|
- @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
+ @todos << @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
end
end
+Given /^I have a context "([^\"]*)" with (\d+) deferred (?:actions|todos)$/ do |context_name, number_of_actions|
+ step "I have a context \"#{context_name}\" with #{number_of_actions} actions"
+ @todos.each {|todo| todo.description = "deferred "+todo.description; todo.show_from = Time.zone.now + 1.week; todo.save!}
+end
+
When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
page.find("span#context_name").click
fill_in "value", :with => new_context_name
@@ -63,26 +69,15 @@
step "I should see \"#{context_name}\""
end
-Then /^he should see that a context named "([^\"]*)" is present$/ do |context_name|
- step "I should see \"#{context_name}\""
-end
-
-Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
- step "I should not see \"#{context_name} (\""
-end
-
-Then /^I should not see empty message for todos of context/ do
- page.should_not have_css("div#c#{@context.id}empty-nd", :visible=>true)
-end
-
-Then /^I should see empty message for todos of context/ do
- page.should have_css("div#c#{@context.id}empty-nd", :visible => true)
+Then /^he should see that a context named "([^\"]*)" (is|is not) present$/ do |context_name, visible|
+ step "I should #{visible} \"#{context_name}\""
end
-Then /^I should not see empty message for completed todos of context$/ do
- page.should_not have_css("div#empty-d", :visible=>true)
-end
-
-When /^I should see empty message for completed todos of context$/ do
- page.should have_css("div#empty-d", :visible=>true)
-end
+Then /^I should (see|not see) empty message for (todo|completed todo|deferred todo)s of context/ do |visible, state|
+ css = "error"
+ css = "div#c#{@context.id}empty-nd" if state == "todo"
+ css = "div#empty-d" if state == "completed todo"
+ css = "div#tickler-empty-nd" if state == "deferred todo"
+
+ page.send(visible=="see" ? :should : :should_not, have_css(css, :visible=>true))
+end
View
22 features/step_definitions/project_steps.rb
@@ -18,7 +18,7 @@
step "I have a project \"#{name}\" with #{deferred_count} deferred todos"
end
-Given /^I have a project "([^\"]*)" with ([0-9]+) (todo|active todo|deferred todo)s$/ do |project_name, num_todos, state|
+Given /^I have a project "([^"]*)" with (\d+) (todo|active todo|deferred todo)s prefixed by "([^\"]*)"$/ do |project_name, num_todos, state, prefix|
@context = @current_user.contexts.find_or_create_by_name("Context A")
@project = @current_user.projects.find_or_create_by_name(project_name)
# acts_as_list adds at top by default, but that is counter-intuitive when reading scenario's, so reverse this
@@ -29,13 +29,17 @@
todo = @current_user.todos.create!(
:project_id => @project.id,
:context_id => @context.id,
- :description => "#{state} #{i}")
+ :description => "#{prefix}#{state} #{i}")
todo.show_from = Time.zone.now + 1.week if state=="deferred todo"
todo.save!
@todos << todo
end
end
+Given /^I have a project "([^"]*)" with (\d+) (todos|active todos|deferred todos)$/ do |project_name, num_todos, state|
+ step "I have a project \"#{project_name}\" with #{num_todos} #{state} prefixed by \"\""
+end
+
Given /^there exists a project (?:|called )"([^"]*)" for user "([^"]*)"$/ do |project_name, user_name|
user = User.find_by_login(user_name)
user.should_not be_nil
@@ -198,16 +202,10 @@
end
Then /^I should (see|not see) empty message for (todos|deferred todos|completed todos) of project/ do |visible, state|
- case state
- when "todos"
- css = "div#p#{@project.id}empty-nd"
- when "deferred todos"
- css = "div#tickler-empty-nd"
- when "completed todos"
- css = "div#empty-d"
- else
- css = "wrong state"
- end
+ css = "wrong state"
+ css = "div#p#{@project.id}empty-nd" if state == "todos"
+ css = "div#tickler-empty-nd" if state == "deferred todos"
+ css = "div#empty-d" if state == "completed todos"
elem = find(css)
elem.should_not be_nil
View
8 features/step_definitions/todo_create_steps.rb
@@ -20,7 +20,7 @@
@todo.save!
end
-Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names|
+Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)" prefixed by "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names, prefix|
@context = @current_user.contexts.find_by_name(context_name)
@context.should_not be_nil
@@ -29,13 +29,17 @@
@todos = []
number_of_todos.to_i.downto 1 do |i|
- todo = @current_user.todos.create!(:context_id => @context.id, :description => "todo #{i}", :project_id => @project.id)
+ todo = @current_user.todos.create!(:context_id => @context.id, :description => "#{prefix}todo #{i}", :project_id => @project.id)
todo.tag_with(tag_names)
todo.save!
@todos << todo
end
end
+Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names|
+ step "I have #{number_of_todos} todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tag_names}\" prefixed by \"\""
+end
+
Given /^I have a todo "([^"]*)"$/ do |description|
step "I have a todo \"#{description}\" in the context \"Context A\""
end
View
4 features/support/paths.rb
@@ -99,6 +99,10 @@ def path_to(page_name)
@source_view = "context"
@context = @current_user.contexts.find_by_name($1)
context_path(@context, options)
+ when /the "([^\"]*)" context/i
+ @source_view = "context"
+ @context = @current_user.contexts.find_by_name($1)
+ context_path(@context, options)
when /the "([^\"]*)" project for user "([^\"]*)"/i
@source_view = "project"
@project = User.find_by_login($2).projects.find_by_name($1)
View
4 features/tagging_todos.feature
@@ -19,9 +19,9 @@ Feature: Tagging todos
Scenario: I can remove a tag from a todo from the tag view and the todo will be removed
Given I have a todo "fix tests" in context "@pc" with tags "now"
When I go to the tag page for "now"
- Then I should see "fix tests"
+ Then I should see the todo "fix tests"
When I edit the tags of "fix tests" to "later"
- Then I should not see "fix tests"
+ Then I should not see the todo "fix tests"
@javascript
Scenario: I can add a new todo from tag view with that tag and it will be added to the page

0 comments on commit 7435b1b

Please sign in to comment.