diff --git a/features/manage_project.feature b/features/manage_project.feature index 74eaaeec..88893ed5 100644 --- a/features/manage_project.feature +++ b/features/manage_project.feature @@ -16,4 +16,13 @@ Feature: Manage a project When I visit the "manage me" project And I edit the project description to "_successfull outcome_: project is *done*" Then I should see the italic text "successfull outcome" in the project description - And I should see the bold text "done" in the project description \ No newline at end of file + And I should see the bold text "done" in the project description + + # Ticket #1043 + @selenium + 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 + And I change the project_name field of "Todo 1" to "bar" + Then I should not see the todo "Todo 1" + And I should see the todo "Todo 2" diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index 54fec93c..98831bca 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -59,6 +59,13 @@ Then /^I should see ([0-9]+) todos$/ do |count| end end +When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field, todo_name, new_value| + selenium.click("//span[@class=\"todo.descr\"][.=\"#{todo_name}\"]/../../a[@class=\"icon edit_item\"]", :wait_for => :ajax, :javascript_framework => :jquery) + selenium.type("css=form.edit_todo_form input[name=#{field}]", new_value) + selenium.click("css=button.positive", :wait_for => :ajax, :javascript_framework => :jquery) + sleep(5) +end + Then /^the dependencies of "(.*)" should include "(.*)"$/ do |child_name, parent_name| parent = @current_user.todos.find_by_description(parent_name) parent.should_not be_nil @@ -81,3 +88,11 @@ Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |succe xpath = "xpath=//div[@id='line_todo_#{todo.id}']//div[@id='successor_line_todo_#{successor.id}']//span" selenium.wait_for_element(xpath, :timeout_in_seconds => 5) end + +Then /^I should see the todo "([^\"]*)"$/ do |todo_description| + selenium.is_element_present("//span[.=\"#{todo_description}\"]").should be_true +end + +Then /^I should not see the todo "([^\"]*)"$/ do |todo_description| + selenium.is_element_present("//span[.=\"#{todo_description}\"]").should be_false +end