diff --git a/features/step_definitions/dependencies_steps.rb b/features/step_definitions/dependencies_steps.rb index 4c877837..88e782ab 100644 --- a/features/step_definitions/dependencies_steps.rb +++ b/features/step_definitions/dependencies_steps.rb @@ -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 @@ -42,11 +42,8 @@ When /^I edit the dependency of "([^"]*)" to add "([^"]*)" as predecessor$/ do | # in webkit, the autocompleter is not fired after fill_in page.execute_script %Q{$("#{form_css}").find('input[id$="predecessor_input"]').autocomplete('search')} if Capybara.javascript_driver == :webkit - # wait for auto complete - expect(page).to have_css("a.ui-state-focus") - # click first line - page.find(:css, "ul li a.ui-state-focus").click + page.find('ul.ui-autocomplete li.ui-state-focus').click # wait for the new dependency to be added to the list expect(page).to have_css("li#pred_#{predecessor.id}") diff --git a/features/step_definitions/todo_edit_steps.rb b/features/step_definitions/todo_edit_steps.rb index 347f0dea..1c459a2f 100644 --- a/features/step_definitions/todo_edit_steps.rb +++ b/features/step_definitions/todo_edit_steps.rb @@ -116,6 +116,7 @@ When /^I edit the due date of "([^"]*)" to "([^"]*)"$/ do |action_description, d open_edit_form_for(todo) fill_in "due_todo_#{todo.id}", :with => date + close_datepicker submit_edit_todo_form(todo) end diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index a0100249..f9dd2c4d 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -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| diff --git a/features/support/tracks_form_helper.rb b/features/support/tracks_form_helper.rb index d7805ffb..d88e5f12 100644 --- a/features/support/tracks_form_helper.rb +++ b/features/support/tracks_form_helper.rb @@ -109,4 +109,9 @@ module TracksFormHelper execute_javascript("$('#todo_project_name').val('');") end + def close_datepicker + within '.ui-datepicker' do + click_button 'Done' + end + end end diff --git a/features/support/tracks_step_helper.rb b/features/support/tracks_step_helper.rb index 6e4a8b61..dd90e085 100644 --- a/features/support/tracks_step_helper.rb +++ b/features/support/tracks_step_helper.rb @@ -19,11 +19,11 @@ module TracksStepHelper end def wait_for_auto_complete - expect(page).to have_css("a.ui-state-focus", :visible => true) + expect(page).to have_css("ul.ui-autocomplete li.ui-state-focus", :visible => true) end def click_first_line_of_auto_complete - page.find(:css, "ul li a.ui-state-focus").click + page.find(:css, "ul.ui-autocomplete li.ui-state-focus").click end def check_xpath_visibility(visible, xpath)