explicit wait for menu to fix a failing scenario.

this scenario does not fail locally, only on travis, grrr...
This commit is contained in:
Reinier Balt 2013-04-29 09:31:15 +02:00
parent 8db5793bf6
commit 5eae11e3b3
3 changed files with 13 additions and 13 deletions

View file

@ -5,8 +5,7 @@ end
####### DELETE #######
When /^I delete the action "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
todo.should_not be_nil
todo = find_todo(action_description)
handle_js_confirm do
open_submenu_for(todo) do

View file

@ -74,14 +74,14 @@ module TracksStepHelper
end
def context_list_find_index(context_name)
div_id = "context_#{@current_user.contexts.where(:name => context_name).first.id}"
div_id = "context_#{find_context(context_name).id}"
contexts = page.all("div.context").map { |x| x[:id] }
return contexts.find_index(div_id)
end
def project_list_find_index(project_name)
# TODO: refactor with context_list_find_index
div_id = "project_#{@current_user.projects.where(:name => project_name).first.id}"
div_id = "project_#{find_project(project_name).id}"
project = page.all("div.project").map { |x| x[:id] }
return project.find_index(div_id)
end
@ -91,10 +91,6 @@ module TracksStepHelper
return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : ''
end
def execute_javascript(js)
page.execute_script(js)
end
def context_drag_and_drop(drag_id, delta)
sortable_css = "div.ui-sortable div#container_context_#{drag_id}"
execute_javascript("$('#{sortable_css}').simulateDragSortable({move: #{delta}, handle: '.grip'});")
@ -103,12 +99,13 @@ module TracksStepHelper
def open_submenu_for(todo)
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
page.should have_css(submenu_arrow, :visible=>true)
page.find(submenu_arrow, :match => :first).click
page.should have_css("div#line_todo_#{todo.id} ul#ultodo_#{todo.id}", :visible => true)
within all("div#line_todo_#{todo.id} ul#ultodo_#{todo.id}")[0] do
submenu_css = "div#line_todo_#{todo.id} ul#ultodo_#{todo.id}"
submenu = page.find(submenu_css)
wait_until { submenu.visible? }
within submenu do
yield
end
end
@ -125,5 +122,9 @@ module TracksStepHelper
def get_confirm_text
page.evaluate_script "window.confirmMsg"
end
def execute_javascript(js)
page.execute_script(js)
end
end

View file

@ -157,7 +157,7 @@ Feature: Show done
Scenario: Activating the last todo will show empty message
Given the date is "2013-03-11"
And I have a completed todo with description "todo 2" in context "@pc" completed 1 days ago
And I have a completed todo with description "todo 3" in context "@pc" completed 8 days ago
And I have a completed todo with description "todo 3" in context "@pc" completed 7 days ago
When I go to the done actions page
Then I should see "todo 1" in the done today container
And I should see "todo 2" in the done this week container