diff --git a/features/contexts_manage.feature b/features/contexts_manage.feature new file mode 100644 index 00000000..00ce49fa --- /dev/null +++ b/features/contexts_manage.feature @@ -0,0 +1,21 @@ +Feature: Manage contexts + + In order to manage my contexts + As a Tracks user + I want to view, edit, add, or remove contexts + + 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: In place edit of context name + Given I have a context called "Errands" + When I visits the context page for "Errands" + And I edit the context name in place to be "OutAndAbout" + Then I should see the context name is "OutAndAbout" + When I go to the contexts page + Then he should see that a context named "Errands" is not present + And he should see that a context named "OutAndAbout" is present diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb new file mode 100644 index 00000000..e8a49491 --- /dev/null +++ b/features/step_definitions/context_steps.rb @@ -0,0 +1,27 @@ +Given /^I have a context called "([^\"]*)"$/ do |context_name| + @current_user.contexts.create!(:name => context_name) +end + +When /^I visits the context page for "([^\"]*)"$/ do |context_name| + context = @current_user.contexts.find_by_name(context_name) + context.should_not be_nil + visit "/contexts/#{context.id}" +end + +When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name| + selenium.click "context_name" + fill_in "value", :with => "OutAndAbout" + click_button "OK" +end + +Then /^I should see the context name is "([^\"]*)"$/ do |context_name| + Then "I should see \"#{context_name}\"" +end + +Then /^he should see that a context named "([^\"]*)" is present$/ do |context_name| + Then "I should see \"#{context_name}\"" +end + +Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name| + Then "I should not see \"#{context_name}\"" +end \ No newline at end of file diff --git a/features/support/paths.rb b/features/support/paths.rb index b4ecce8e..91222396 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -14,6 +14,8 @@ module NavigationHelpers login_path when /the notes page/ notes_path + when /the contexts page/ + contexts_path # Add more page name => path mappings here diff --git a/features/support/selenium.rb b/features/support/selenium.rb index a1e23d4e..72a44a7c 100644 --- a/features/support/selenium.rb +++ b/features/support/selenium.rb @@ -1,6 +1,7 @@ Webrat.configure do |config| config.mode = :selenium config.application_environment = :selenium + config.selenium_browser_startup_timeout = 30 end Cucumber::Rails::World.use_transactional_fixtures = false diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fcae81a9..c0c47aaf 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -394,7 +394,7 @@ $(document).ready(function() { }; $.post('/contexts/update/'+context_id, {'context[name]': value}, highlight); return(value); - }, {style: 'padding:0px', submit: "OK"}); + }, {style: 'padding:0px', submit: "OK", cancel: "CANCEL"}); /* Projects behavior */ diff --git a/stories/all.rb b/stories/all.rb deleted file mode 100644 index 2e8f46a4..00000000 --- a/stories/all.rb +++ /dev/null @@ -1,4 +0,0 @@ -dir = File.dirname(__FILE__) -Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file| - require file -end \ No newline at end of file diff --git a/stories/context_detail/change_context_name.story b/stories/context_detail/change_context_name.story deleted file mode 100644 index 0dffeebe..00000000 --- a/stories/context_detail/change_context_name.story +++ /dev/null @@ -1,15 +0,0 @@ -Story: Change context name - - As a Tracks user - I want to change the name of a context - So that it can best reflect my daily life - - Scenario: In place edit of context name - Given a logged in user Luis - And Luis has a context Errands - When Luis visits the Errands context page - And he edits the Errands context name in place to be OutAndAbout - Then he should see the context name is OutAndAbout - When Luis visits the context listing page - Then he should see that a context named Errands is not present - And he should see that a context named OutAndAbout is present diff --git a/stories/helper.rb b/stories/helper.rb deleted file mode 100644 index da7a13a6..00000000 --- a/stories/helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -require 'spec/rails/story_adapter' \ No newline at end of file diff --git a/stories/notes/view_add_remove.story b/stories/notes/view_add_remove.story deleted file mode 100644 index 34e519fe..00000000 --- a/stories/notes/view_add_remove.story +++ /dev/null @@ -1,41 +0,0 @@ -Story: View, add, remove notes - - As a Tracks user - I want to view, add, and remove notes - So that I can keep important information easily accessible - - Scenario: View and toggle notes - - Given a logged in user Luis - And Luis has two projects with one note each - When Luis visits the notes page - Then two notes should be visible - And the badge should show 2 - When Luis clicks Toggle Notes - Then the body of the notes should be shown - - Scenario: Add a new note - - Given a logged in user Luis - And Luis has one project Pass Final Exam with no notes - When Luis adds a note from the Pass Final Exam project page - Then Luis should see the note on the Pass Final Exam project page - And Luis should see the note on the notes page - And the badge on the notes page should show 1 - - Scenario: Delete note from notes page - - Given a logged in user Luis - And Luis has one project Pass Final Exam with 2 notes - When Luis visits the notes page - And Luis deletes the first note - Then the first note should disappear - Then the badge should show 1 - - Scenario: Link to note - Given a logged in user Luis - And Luis has one project Pass Final Exam with 1 note - When Luis visits the Pass Final Exam project page - And clicks the icon next to the note - Then he should see the note text - \ No newline at end of file diff --git a/stories/steps/context_detail.rb b/stories/steps/context_detail.rb deleted file mode 100644 index f02ae1aa..00000000 --- a/stories/steps/context_detail.rb +++ /dev/null @@ -1,34 +0,0 @@ -steps_for :context_detail do - include_steps_for :users - - Given "Luis has a context Errands" do - @errands = @luis.contexts.create!(:name => 'Errands') - end - - When "Luis visits the Errands context page" do - visits "/contexts/#{@errands.to_param}" - end - - When "he edits the Errands context name in place to be OutAndAbout" do - selenium.click 'context_name_in_place_editor' - wait_for_ajax_and_effects - selenium.type "css=#context_name_in_place_editor-inplaceeditor input.editor_field", "OutAndAbout" - clicks_button "ok", :wait => :ajax - end - - When "Luis visits the context listing page" do - visits "/contexts" - end - - Then "he should see the context name is OutAndAbout" do - should_see 'OutAndAbout' - end - - Then "he should see that a context named Errands is not present" do - should_not_see 'Errands' - end - - Then "he should see that a context named OutAndAbout is present" do - should_see 'OutAndAbout' - end -end diff --git a/stories/steps/notes.rb b/stories/steps/notes.rb deleted file mode 100644 index aa17722a..00000000 --- a/stories/steps/notes.rb +++ /dev/null @@ -1,94 +0,0 @@ -steps_for :notes do - include_steps_for :users - - Given "Luis has two projects with one note each" do - project_a = @luis.projects.create!(:name => 'project A') - project_a.notes.create!(:user_id => @luis.id, :body => 'note for project A') - project_b = @luis.projects.create!(:name => 'project B') - project_b.notes.create!(:user_id => @luis.id, :body => 'note for project B') - end - - Given "Luis has one project Pass Final Exam with no notes" do - @exam_project = @luis.projects.create!(:name => 'Pass Final Exam') - end - - Given "Luis has one project Pass Final Exam with 1 note" do - Given "Luis has one project Pass Final Exam with no notes" - @exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 1') - end - - Given "Luis has one project Pass Final Exam with 2 notes" do - Given "Luis has one project Pass Final Exam with 1 note" - @exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 2') - end - - When "Luis visits the notes page" do - visits '/notes' - end - - When "Luis adds a note from the Pass Final Exam project page" do - When "Luis visits the Pass Final Exam project page" - clicks_link 'Add a note', :wait => :ajax - fills_in 'new_note_body', :with => 'new exam note' - clicks_button 'Add note', :wait => :ajax - end - - When "Luis visits the Pass Final Exam project page" do - visits "/projects/#{@exam_project.to_param}" - end - - When "Luis deletes the first note" do - selenium.click "css=a.delete_note" - selenium.get_confirmation.should =~ /delete/ - end - - When "clicks the icon next to the note" do - selenium.click "css=a.link_to_notes" - wait_for_page_to_load - end - - When "Luis clicks Toggle Notes" do - clicks_link 'Toggle notes', :wait => :effects - end - - Then "the body of the notes should be shown" do - wait_for_effects - selenium.is_visible("css=body.notes").should be_true - end - - Then "Luis should see the note on the Pass Final Exam project page" do - should_see "new exam note" - end - - Then "Luis should see the note on the notes page" do - visits '/notes' - should_see "new exam note" - end - - Then "the badge on the notes page should show 1" do - badge_count_should_show(1) - end - - Then "the first note should disappear" do - wait_for_ajax_and_effects - should_not_see 'exam note 1' - end - - Then "the badge should show 1" do - wait_for_ajax_and_effects - badge_count_should_show(1) - end - - Then "the badge should show 2" do - badge_count_should_show(2) - end - - Then "two notes should be visible" do - should_see 'note for project A' - should_see 'note for project B' - end - - Then "he should see the note text" do - should_see 'exam note 1' - end -end \ No newline at end of file diff --git a/test/selenium/context_detail/in_place_edit_name.rsel b/test/selenium/context_detail/in_place_edit_name.rsel deleted file mode 100644 index d899d9cc..00000000 --- a/test/selenium/context_detail/in_place_edit_name.rsel +++ /dev/null @@ -1,10 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/contexts/1" -click "context_name" -wait_for_element_present "css=#context_name form input" -type "css=#context_name form input", "Test Foo" -click "css=#context_name form button" -wait_for_text "context_name", "Test Foo" -open "/contexts/1" -wait_for_text "context_name", "Test Foo"