fix cucumber story for drag and drop for dependencies. Was broken since last change of drop target to a hidden img that appears when dragging starts

not a trivial one to fix :-)
This commit is contained in:
Reinier Balt 2010-03-24 17:58:15 +01:00
parent 238bf97a27
commit 8dbf790810
2 changed files with 8 additions and 3 deletions

View file

@ -122,7 +122,7 @@ module TodosHelper
:title => 'Drag onto another action to make it depend on that action',
:class => 'grip') +
image_tag('blank.png', :width => 16, :height => 16, :border => 0,
:title => "Drop an action to make it depend on this action", :class => 'successor_target')
:id => "successor_target_#{@todo.id}", :title => "Drop an action to make it depend on this action", :class => 'successor_target')
end
end

View file

@ -37,8 +37,13 @@ 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']"
drop_name = "xpath=//div[@id='line_todo_#{drop_id}']//img[@id='successor_target_#{drop_id}']"
# the target img is hidden until drag starts. We need to show the img or the
# xpath will not find it
js="$('img#successor_target_#{drop_id}').show();"
selenium.get_eval "(function() {with(this) {#{js}}}).call(selenium.browserbot.getCurrentWindow());"
selenium.drag_and_drop_to_object(drag_name, drop_name)
arrow = "xpath=//div[@id='line_todo_#{drop_id}']/div/a[@class='show_successors']/img"