migrate dependencies

without functional changes
This commit is contained in:
Reinier Balt 2011-02-03 16:59:59 +01:00
parent bf5e378301
commit a02f1d2584
14 changed files with 334 additions and 143 deletions

View file

@ -9,21 +9,21 @@ Feature: dependencies
| testuser | secret | false |
And I have logged in as "testuser" with password "secret"
@selenium @wip
Scenario: Adding dependency to dependency
@selenium
Scenario: Adding dependency to dependency by drag and drop
Given I have a project "dependencies" with 3 todos
And "Todo 2" depends on "Todo 1"
When I visit the "dependencies" project
And I drag "Todo 3" to "Todo 2"
Then the dependencies of "Todo 2" should include "Todo 1"
And the dependencies of "Todo 3" should include "Todo 2"
Then the successors of "Todo 1" should include "Todo 2"
And the successors of "Todo 2" should include "Todo 3"
When I expand the dependencies of "Todo 1"
Then I should see "Todo 2" within the dependencies of "Todo 1"
And I should see "Todo 3" within the dependencies of "Todo 1"
When I expand the dependencies of "Todo 2"
Then I should see "Todo 3" within the dependencies of "Todo 2"
@selenium @wip
@selenium
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
@ -32,9 +32,49 @@ Feature: dependencies
| test me | @pc |
When I visit the "dependencies" project
And I drag "test me" to "test,1, 2,3"
Then the dependencies of "test me" should include "test,1, 2,3"
When I edit the dependency of "test me" to '"test,1, 2,3" <"@pc"; "dependencies">,"test,1, 2,3" <"@pc"; "dependencies">'
Then the successors of "test,1, 2,3" should include "test me"
When I edit the dependency of "test me" to "'test,1, 2,3' <'@pc'; 'dependencies'>,'test,1, 2,3' <'@pc'; 'dependencies'>"
Then there should not be an error
Scenario: Deleting a predecessor will activate successors
Given this is a pending scenario
@selenium
Scenario: I can edit a todo to add the todo as a dependency to another
Given I have a context called "@pc"
And I have a project "dependencies" that has the following todos
| description | context |
| test 1 | @pc |
| test 2 | @pc |
| test 3 | @pc |
When I visit the "dependencies" project
When I edit the dependency of "test 1" to "'test 2' <'@pc'; 'dependencies'>"
Then I should see "test 1" within the dependencies of "test 2"
And I should see "test 1" in the deferred container
When I edit the dependency of "test 1" to "'test 2' <'@pc'; 'dependencies'>, 'test 3' <'@pc'; 'dependencies'>"
Then I should see "test 1" within the dependencies of "test 2"
Then I should see "test 1" within the dependencies of "test 3"
When I edit the dependency of "test 1" to "'test 2' <'@pc'; 'dependencies'>"
And I edit the dependency of "test 2" to "'test 3' <'@pc'; 'dependencies'>"
Then I should see "test 1" within the dependencies of "test 3"
Then I should see "test 2" within the dependencies of "test 3"
@selenium
Scenario: I can remove a dependency by editing the todo
Given I have a context called "@pc"
And I have a project "dependencies" that has the following todos
| description | context |
| test 1 | @pc |
| test 2 | @pc |
And "test 1" depends on "test 2"
When I visit the "dependencies" project
Then I should see "test 1" in the deferred container
When I edit the dependency of "test 1" to ""
Then I should not see "test 1" within the dependencies of "test 2"
And I should not see "test 1" in the deferred container
Scenario: Deleting a predecessor will activate successors
Given this is a pending scenario
Scenario: Deleting a successor will update predecessor
Given this is a pending scenario

View file

@ -162,14 +162,15 @@ When /^I submit the new multiple actions form with$/ do |multi_line_descriptions
submit_multiple_next_action_form
end
When /^I edit the dependency of "([^"]*)" to '([^'']*)'$/ do |todo_name, deps|
When /^I edit the dependency of "([^"]*)" to "([^"]*)"$/ do |todo_name, deps|
todo = @dep_todo = @current_user.todos.find_by_description(todo_name)
todo.should_not be_nil
# click edit
selenium.click("//div[@id='line_todo_#{todo.id}']//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
fill_in "predecessor_list_todo_#{todo.id}", :with => deps
# submit form
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
submit_edit_todo_form(todo)
sleep(1) # TODO: replace with some wait_for
end
Then /^I should see ([0-9]+) todos$/ do |count|
@ -179,11 +180,12 @@ Then /^I should see ([0-9]+) todos$/ do |count|
end
Then /^there should not be an error$/ do
# form should be gone and thus not errors visible
sleep(5)
# form should be gone and thus no errors visible
selenium.is_visible("edit_todo_#{@dep_todo.id}").should == false
end
Then /^the dependencies of "(.*)" should include "(.*)"$/ do |child_name, parent_name|
Then /^the successors of "(.*)" should include "(.*)"$/ do |parent_name, child_name|
parent = @current_user.todos.find_by_description(parent_name)
parent.should_not be_nil
@ -206,6 +208,17 @@ Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |succe
selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
end
Then /^I should not see "([^"]*)" within the dependencies of "([^"]*)"$/ do |successor_description, todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
successor = @current_user.todos.find_by_description(successor_description)
successor.should_not be_nil
# let selenium look for the presence of the successor
xpath = "xpath=//div[@id='line_todo_#{todo.id}']//div[@id='successor_line_todo_#{successor.id}']//span"
selenium.is_element_present(xpath).should be_false
end
Then /^I should see the todo "([^\"]*)"$/ do |todo_description|
selenium.is_element_present("//span[.=\"#{todo_description}\"]").should be_true
end
@ -236,4 +249,22 @@ end
Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name|
selenium.get_confirmation.should == "New context \"#{context_name}\" will be also created. Are you sure?"
end
end
Then /^I should see "([^"]*)" in the deferred container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='tickler']//div[@id='line_todo_#{todo.id}']"
selenium.is_element_present(xpath).should be_true
end
Then /^I should not see "([^"]*)" in the deferred container$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='tickler']//div[@id='line_todo_#{todo.id}']"
selenium.is_element_present(xpath).should be_false
end

View file

@ -15,6 +15,10 @@ module TracksStepHelper
selenium.click("xpath=//form[@id='project_form']//button[@id='project_new_project_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def submit_edit_todo_form (todo)
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def format_date(date)
# copy-and-past from ApplicationController::format_date
return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : ''