Fix cucumber drag-and-drop failures

This commit is contained in:
Dan Rice 2016-02-15 23:22:23 -05:00
parent 9419e94a53
commit 24b16ea8dd
2 changed files with 3 additions and 5 deletions

View file

@ -10,8 +10,8 @@ end
When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
drag_id = Todo.where(:description => dragged).first.id
drop_id = Todo.where(:description => target).first.id
drag_elem = page.find(:xpath, "//div[@id='line_todo_#{drag_id}']//img[@class='grip']")
drop_elem = page.find(:xpath, "//div[@id='line_todo_#{drop_id}']")
drag_elem = page.find("div#line_todo_#{drag_id} img.grip")
drop_elem = page.find("div#line_todo_#{drop_id}")
drag_elem.drag_to(drop_elem)
end

View file

@ -75,9 +75,7 @@ end
Then /^I should see an active todo "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
expect(todo).to_not be_nil
xpath = "//div[@id='line_todo_#{todo.id}']/img[@class='grip']"
expect(page).to have_xpath(xpath, :visible=>true)
expect(page).to have_css("div#line_todo_#{todo.id} img.grip", :visible=>true)
end
Then /^the number of actions should be (\d+)$/ do |count|