From 0f525436ff8d94543391684aa0362f188c00f035 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Mon, 8 Nov 2010 22:36:35 +0100 Subject: [PATCH] support rake cucumber:selenium_wip to run wip for selenium. rake cucumber:wip will only ron non-selnium wip stories. Furthermore some selenium script migration to cucumber --- config/cucumber.yml | 3 ++- features/dependencies.feature | 2 +- features/project_edit.feature | 17 +++++++++++++++-- features/project_list.feature | 14 ++++++++++++++ .../step_definitions/project_list_steps.rb | 8 ++++++++ features/step_definitions/project_steps.rb | 9 +++++++++ lib/tasks/cucumber-tracks.rake | 8 +++++++- test/selenium/project_detail/add_todo.rsel | 12 ------------ .../project_detail/in_place_edit_name.rsel | 13 ------------- test/selenium/project_listing/delete.rsel | 6 ------ .../project_listing/edit_then_delete.rsel | 15 --------------- test/selenium/project_listing/edit_twice.rsel | 19 ------------------- 12 files changed, 56 insertions(+), 70 deletions(-) delete mode 100644 test/selenium/project_detail/add_todo.rsel delete mode 100644 test/selenium/project_detail/in_place_edit_name.rsel delete mode 100644 test/selenium/project_listing/delete.rsel delete mode 100644 test/selenium/project_listing/edit_then_delete.rsel delete mode 100644 test/selenium/project_listing/edit_twice.rsel diff --git a/config/cucumber.yml b/config/cucumber.yml index 19a76f8e..038cbe30 100644 --- a/config/cucumber.yml +++ b/config/cucumber.yml @@ -5,5 +5,6 @@ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@w %> default: <%= std_opts %> features --tags ~@selenium selenium: <%= std_opts %> features --tags @selenium -wip: --tags @wip:10 --wip features +selenium_wip: features --wip --tags @wip:10 --tags @selenium +wip: --wip --tags @wip:10 --tags ~@selenium features rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip diff --git a/features/dependencies.feature b/features/dependencies.feature index 88cc32ef..7597459b 100644 --- a/features/dependencies.feature +++ b/features/dependencies.feature @@ -24,7 +24,7 @@ Feature: dependencies When I expand the dependencies of "Todo 2" Then I should see "Todo 3" within the dependencies of "Todo 2" - @selenium, @wip + @selenium @wip Scenario: Adding dependency with comma to todo # for #975 Given I have a context called "@pc" And I have a project "dependencies" that has the following todos diff --git a/features/project_edit.feature b/features/project_edit.feature index 4fd6ec2a..2b2f139e 100644 --- a/features/project_edit.feature +++ b/features/project_edit.feature @@ -19,7 +19,7 @@ Feature: Edit a project And I should see the bold text "done" in the project description # Ticket #1043 - @selenium, @wip + @selenium @wip Scenario: I can move a todo out of the current project Given I have a project "foo" with 2 todos When I visit the "foo" project @@ -27,6 +27,16 @@ Feature: Edit a project Then I should not see the todo "Todo 1" And I should see the todo "Todo 2" + @selenium + Scenario: I can edit the project name in place + Given I have a project "release tracks 1.8" with 1 todos + When I visit the project page for "release tracks 1.8" + And I edit the project name in place to be "release tracks 2.0" + Then I should see the project name is "release tracks 2.0" + When I go to the projects page + Then I should see that a project named "release tracks 1.8" is not present + And I should see that a project named "release tracks 2.0" is present + # Ticket #1041 @selenium Scenario: I can change the name of the project using the Edit Project Settings form @@ -52,4 +62,7 @@ Feature: Edit a project When I go to the projects page Then the badge should show 2 # "manage me" and "test" When I edit the project name of "manage me" to "test" - Then I should see "Name already exists" \ No newline at end of file + Then I should see "Name already exists" + + # No scenario is needed for adding a todo to the project. This is covered in + # shared_add_new_todo.feature "I can add a todo from several pages" \ No newline at end of file diff --git a/features/project_list.feature b/features/project_list.feature index 1809a3f6..48a3dc49 100644 --- a/features/project_list.feature +++ b/features/project_list.feature @@ -38,6 +38,19 @@ Feature: Manage the list of projects And the badge should show 2 And the project list badge for "active" projects should show 2 + @selenium + Scenario: Deleting a project after a edit will remove it from the list + # make sure the js is enabled after an edit and another edit + When I go to the projects page + And I edit the project name of "manage me" to "manage him" + Then I should see "manage him" + When I edit the project name of "manage him" to "manage her" + Then I should see "manage her" + When I delete project "manage her" + Then I should not see "manage her" + And the badge should show 2 + And the project list badge for "active" projects should show 2 + @selenium Scenario: Changing project state will move project to other state list When I go to the projects page @@ -94,3 +107,4 @@ Feature: Manage the list of projects Then the project "test" should be above the project "very busy" When I sort the list by number of tasks Then the project "very busy" should be above the project "test" + diff --git a/features/step_definitions/project_list_steps.rb b/features/step_definitions/project_list_steps.rb index 539df9d4..e060f501 100644 --- a/features/step_definitions/project_list_steps.rb +++ b/features/step_definitions/project_list_steps.rb @@ -48,6 +48,14 @@ When /^I sort the list by number of tasks$/ do selenium.get_confirmation.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order." end +Then /^I should see that a project named "([^"]*)" is not present$/ do |project_name| + Then "I should not see \"#{project_name}\"" +end + +Then /^I should see that a project named "([^"]*)" is present$/ do |project_name| + Then "I should see \"#{project_name}\"" +end + Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low| high_id = @current_user.projects.find_by_name(project_high).id low_id = @current_user.projects.find_by_name(project_low).id diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 9c733236..95ddfc56 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -61,6 +61,11 @@ When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_n When "I edit the project name to \"#{project_new_name}\"" end +When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name| + selenium.click "project_name" + fill_in "value", :with => new_project_name + click_button "OK" +end When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, state_name| project = @current_user.projects.find_by_name(project_name) @@ -104,4 +109,8 @@ end Then /^the project title should be "(.*)"$/ do |title| selenium.get_text("css=h2#project_name").should == title +end + +Then /^I should see the project name is "([^"]*)"$/ do |project_name| + Then "the project title should be \"#{project_name}\"" end \ No newline at end of file diff --git a/lib/tasks/cucumber-tracks.rake b/lib/tasks/cucumber-tracks.rake index f88b3795..ae5bdfad 100644 --- a/lib/tasks/cucumber-tracks.rake +++ b/lib/tasks/cucumber-tracks.rake @@ -17,12 +17,18 @@ begin t.profile = 'selenium' end + Cucumber::Rake::Task.new({:selenium_wip => :env_to_selenium}, 'Run unfinished features that require selenium') do |t| + t.binary = vendored_cucumber_bin + t.fork = true # You may get faster startup if you set this to false + t.profile = 'selenium_wip' + end + task :env_to_selenium => 'db:test:prepare' do ENV['RAILS_ENV'] = 'selenium' end desc 'Run all features' - task :all => [:ok, :wip, :selenium] + task :all => [:ok, :wip, :selenium, :selenium_wip] end rescue LoadError desc 'cucumber rake task not available (cucumber not installed)' diff --git a/test/selenium/project_detail/add_todo.rsel b/test/selenium/project_detail/add_todo.rsel deleted file mode 100644 index d3f60e88..00000000 --- a/test/selenium/project_detail/add_todo.rsel +++ /dev/null @@ -1,12 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/projects/1" - -# add new todo -type "todo_description", "a brand new todo" -click "css=#todo-form-new-action .submit_box button" -wait_for_element_present "css=div#p1items div.item-container" - -# wait for flash to mention that todo was added and verify existence of new todo -wait_for_visible "flash" -verify_text_present 'a brand new todo' diff --git a/test/selenium/project_detail/in_place_edit_name.rsel b/test/selenium/project_detail/in_place_edit_name.rsel deleted file mode 100644 index 05be914a..00000000 --- a/test/selenium/project_detail/in_place_edit_name.rsel +++ /dev/null @@ -1,13 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/projects/1" - -click "project_name" -wait_for_element_present "css=#project_name form input" -type "css=#project_name form input", "Test Foo" -click "css=#project_name form button" -wait_for_text "project_name", "Test Foo" - - -open "/projects/1" -wait_for_text "project_name", "Test Foo" diff --git a/test/selenium/project_listing/delete.rsel b/test/selenium/project_listing/delete.rsel deleted file mode 100644 index ad9eac16..00000000 --- a/test/selenium/project_listing/delete.rsel +++ /dev/null @@ -1,6 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/projects" -click "css=#project_2 .buttons img.delete_item" -assert_confirmation "Are you sure that you want to delete the project 'Make more money than Billy Gates'?" -wait_for_element_not_present "project_2" \ No newline at end of file diff --git a/test/selenium/project_listing/edit_then_delete.rsel b/test/selenium/project_listing/edit_then_delete.rsel deleted file mode 100644 index add29928..00000000 --- a/test/selenium/project_listing/edit_then_delete.rsel +++ /dev/null @@ -1,15 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/projects" -click "css=#project_2 .buttons img.edit_item" -wait_for_visible "edit_project_2" -wait_for_not_visible "project_2" -type "//div[@id='edit_project_2'] //input[@name='project[name]']", "become a billionaire" -click "//div[@id='edit_project_2'] //button" -wait_for_not_visible "edit_project_2" -wait_for_visible "project_2" -wait_for_visible "flash" -click "css=#project_2 .buttons img.delete_item" -assert_confirmation "Are you sure that you want to delete the project 'become a billionaire'?" -wait_for_text "flash", "Deleted project 'become a billionaire'" -wait_for_element_not_present "project_2" diff --git a/test/selenium/project_listing/edit_twice.rsel b/test/selenium/project_listing/edit_twice.rsel deleted file mode 100644 index 98d7c6df..00000000 --- a/test/selenium/project_listing/edit_twice.rsel +++ /dev/null @@ -1,19 +0,0 @@ -setup :fixtures => :all -login :as => 'admin' -open "/projects" -click "css=#project_2 .buttons img.edit_item" -wait_for_visible "edit_project_2" -wait_for_not_visible "project_2" -type "//div[@id='edit_project_2'] //input[@name='project[name]']", "become a billionaire" -click "//div[@id='edit_project_2'] //button" -wait_for_not_visible "edit_project_2" -wait_for_visible "project_2" -assert_text 'css=#project_2 .data a', 'become a billionaire' -click "css=#project_2 .buttons img.edit_item" -wait_for_visible "edit_project_2" -wait_for_not_visible "project_2" -type "//div[@id='edit_project_2'] //input[@name='project[name]']", "become a multi-millionaire" -click "//div[@id='edit_project_2'] //button" -wait_for_not_visible "edit_project_2" -wait_for_visible "project_2" -assert_text 'css=#project_2 .data a', 'become a multi-millionaire' \ No newline at end of file