mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-02 15:28:50 +01:00
add drag and drop feature for dependencies
This commit is contained in:
parent
32d18857df
commit
8191268821
3 changed files with 43 additions and 0 deletions
20
features/dependencies.feature
Normal file
20
features/dependencies.feature
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Feature: dependencies
|
||||
|
||||
As a Tracks user
|
||||
In order to keep track of complex todos
|
||||
I want to assign and manage todo dependencies
|
||||
|
||||
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: Adding dependency to dependency
|
||||
Given I have 3 todos
|
||||
And "todo 2" depends on "todo 1"
|
||||
When I go to the home page
|
||||
And I drag "todo 3" to "todo 1"
|
||||
Then the dependencies of "todo 1" should include "todo 2"
|
||||
And the dependencies of "todo 1" should include "todo 3"
|
||||
|
|
@ -24,8 +24,30 @@ Given /^I have ([0-9]+) completed todos$/ do |count|
|
|||
end
|
||||
end
|
||||
|
||||
Given /^"(.*)" depends on "(.*)"$/ do |successor_name, predecessor_name|
|
||||
successor = Todo.find_by_description(successor_name)
|
||||
predecessor = Todo.find_by_description(predecessor_name)
|
||||
|
||||
successor.add_predecessor(predecessor)
|
||||
successor.state = "pending"
|
||||
successor.save!
|
||||
end
|
||||
|
||||
When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
|
||||
drag_id = Todo.find_by_description(dragged).id
|
||||
drop_id = Todo.find_by_description(target).id
|
||||
drag_name = "xpath=//div[@id='line_todo_#{drag_id}']//img[@class='grip']"
|
||||
drop_name = "xpath=//div[@id='line_todo_#{drop_id}']//div[@class='description']"
|
||||
selenium.drag_and_drop_to_object(drag_name, drop_name)
|
||||
end
|
||||
|
||||
Then /^I should see ([0-9]+) todos$/ do |count|
|
||||
count.to_i.downto 1 do |i|
|
||||
match_xpath "div["
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the dependencies of "(.*)" should include "(.*)"$/ do |parent_name, child_name|
|
||||
parent_id = Todo.find_by_description(parent_name).id
|
||||
assert_contain(parent_name)
|
||||
end
|
||||
|
|
@ -2,6 +2,7 @@ Webrat.configure do |config|
|
|||
config.mode = :selenium
|
||||
config.application_environment = :selenium
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
#config.selenium_server_address = "localhost"
|
||||
end
|
||||
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue