further fixing regressions

This commit is contained in:
Reinier Balt 2013-04-19 22:55:54 +02:00
parent a8e426a2cd
commit 8b464112ad
7 changed files with 61 additions and 59 deletions

View file

@ -12,6 +12,14 @@ module TracksFormHelper
wait_for_animations_to_end
end
def open_context_edit_form(context)
# open edit form
page.find("a#link_edit_context_#{context.id}").click
# wait for the form to appear (which included a submit button)
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
end
def submit_form(form_xpath, button_name)
handle_js_confirm do
# on calendar page there can be more than 1 occurance of a todo, so we select the first here
@ -47,6 +55,17 @@ module TracksFormHelper
def wait_for_todo_form_to_go_away(todo)
page.should_not have_content("button#submit_todo_#{todo.id}")
end
def wait_for_context_form_to_appear(context)
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
end
def wait_for_context_form_to_go_away(context)
# wait for the form to go away
page.should_not have_css("button#submit_context_#{context.id}", :visible => true)
# wait for the changed context to appear
page.should have_css("a#link_edit_context_#{context.id}", :visible=> true)
end
def open_project_edit_form(project)
click_link "link_edit_project_#{project.id}"

View file

@ -95,6 +95,11 @@ module TracksStepHelper
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'});")
end
def open_submenu_for(todo)
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
page.should have_css(submenu_arrow, :visible=>true)
@ -109,12 +114,12 @@ module TracksStepHelper
end
def handle_js_confirm(accept=true)
page.execute_script "window.original_confirm_function = window.confirm"
page.execute_script "window.confirmMsg = null"
page.execute_script "window.confirm = function(msg) { window.confirmMsg = msg; return #{!!accept}; }"
execute_javascript "window.original_confirm_function = window.confirm"
execute_javascript "window.confirmMsg = null"
execute_javascript "window.confirm = function(msg) { window.confirmMsg = msg; return #{!!accept}; }"
yield
ensure
page.execute_script "window.confirm = window.original_confirm_function"
execute_javascript "window.confirm = window.original_confirm_function"
end
def get_confirm_text