diff --git a/features/notes_manage.feature b/features/notes_manage.feature index 410d61d3..f742b6bf 100644 --- a/features/notes_manage.feature +++ b/features/notes_manage.feature @@ -42,3 +42,26 @@ Feature: View, add, remove notes When I go to the notes page And I edit the first note to "edited note" Then I should see "edited note" + + @selenium + Scenario: Toggle all notes + Given I have a context called "@pc" + And I have a project "take notes" that has the following todos + | description | context | notes | + | test 1 | @pc | note A | + | test 2 | @pc | note B | + | test 3 | @pc | note C | + When I go to the home page + Then I should not see "note A" + And I should not see "note B" + And I should not see "note C" + When I toggle the note of "test 1" + Then I should see "note A" + And I should not see "note B" + And I should not see "note C" + When I toggle the note of "test 1" + Then I should not see "note A" + When I toggle all notes + Then I should see "note A" + And I should see "note B" + And I should see "note C" diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb index ba2e9599..2dc0e8f4 100644 --- a/features/step_definitions/container_steps.rb +++ b/features/step_definitions/container_steps.rb @@ -1,3 +1,17 @@ +When /^I collapse the context container of "([^"]*)"$/ do |context_name| + context = @current_user.contexts.find_by_name(context_name) + context.should_not be_nil + + xpath = "//a[@id='toggle_c#{context.id}']" + selenium.is_visible(xpath).should be_true + + selenium.click(xpath) +end + +When /^I toggle all collapsed context containers$/ do + click_link 'Toggle collapsed contexts' +end + ####### Context ####### Then /^I should not see the context "([^"]*)"$/ do |context_name| @@ -17,6 +31,10 @@ Then /^I should not see the container for context "([^"]*)"$/ do |context_name| Then "I should not see the context \"#{context_name}\"" end +Then /^I should not see the context container for "([^"]*)"$/ do |context_name| + Then "I should not see the context \"#{context_name}\"" +end + Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name| Then "I should not see the context \"#{context_name}\"" end diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb index 66b1602d..195d6f39 100644 --- a/features/step_definitions/note_steps.rb +++ b/features/step_definitions/note_steps.rb @@ -16,10 +16,6 @@ Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num| end end -When /^I click Toggle Notes$/ do - click_link 'Toggle notes' -end - When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project| project = Project.find_by_name(project) project.notes.create!(:user_id => @current_user.id, :body => note) @@ -44,6 +40,23 @@ When /^I edit the first note to "([^"]*)"$/ do |note_body| click_button "submit_note_#{id}" end +When /^I toggle the note of "([^"]*)"$/ do |todo_description| + todo = @current_user.todos.find_by_description(todo_description) + todo.should_not be_nil + + xpath = "//div[@id='line_todo_#{todo.id}']/div/a/img" + + selenium.click(xpath) +end + +When /^I click Toggle Notes$/ do + click_link 'Toggle notes' +end + +When /^I toggle all notes$/ do + When "I click Toggle Notes" +end + Then /^(.*) notes should be visible$/ do |number| # count number of project_notes count = 0 diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb index 083c5be5..5025f523 100644 --- a/features/step_definitions/todo_create_steps.rb +++ b/features/step_definitions/todo_create_steps.rb @@ -163,7 +163,8 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na new_todo = @current_user.todos.create!( :description => todo[:description], :context_id => context.id, - :project_id=>@project.id) + :project_id=>@project.id, + :notes => todo[:notes]) unless todo[:tags].nil? new_todo.tag_with(todo[:tags]) end diff --git a/features/toggle_context_containers.feature b/features/toggle_context_containers.feature new file mode 100644 index 00000000..fc73bb41 --- /dev/null +++ b/features/toggle_context_containers.feature @@ -0,0 +1,67 @@ +Feature: Toggle the context containers + In order to only see the todos relevant on this moment + As a Tracks user + I want to toggle the contexts so the todos in that context are not shown + + Background: + Given the following user record + | login | password | is_admin | + | testuser | secret | false | + And I have logged in as "testuser" with password "secret" + + @selenium + Scenario: I can toggle a context container + Given I have the following contexts + | name | hide | + | @ipad | false | + | @home | false | + | @boss | false | + And I have a project "collapse those contexts" that has the following todos + | description | context | + | test 1 | @ipad | + | test 2 | @home | + | test 3 | @boss | + When I go to the home page + Then I should see "test 1" in the context container for "@ipad" + And I should see "test 2" in the context container for "@home" + And I should see "test 3" in the context container for "@boss" + When I collapse the context container of "@ipad" + Then I should not see "test 1" + And I should see "test 2" in the context container for "@home" + And I should see "test 3" in the context container for "@boss" + When I collapse the context container of "@home" + Then I should not see "test 1" + And I should not see "test 2" + And I should see "test 3" in the context container for "@boss" + When I collapse the context container of "@boss" + Then I should not see "test 1" + And I should not see "test 2" + And I should not see "test 3" + + @selenium + Scenario: I can hide all collapsed containers + Given I have the following contexts + | name | hide | + | @ipad | false | + | @home | false | + | @boss | false | + And I have a project "collapse those contexts" that has the following todos + | description | context | + | test 1 | @ipad | + | test 2 | @home | + | test 3 | @boss | + When I go to the home page + Then I should see "test 1" in the context container for "@ipad" + And I should see "test 2" in the context container for "@home" + And I should see "test 3" in the context container for "@boss" + When I collapse the context container of "@home" + And I collapse the context container of "@boss" + And I collapse the context container of "@ipad" + Then I should not see "test 1" + And I should not see "test 2" + And I should not see "test 3" + When I toggle all collapsed context containers + Then I should not see the context container for "@home" + And I should not see the context container for "@boss" + And I should not see the context container for "@ipad" +