tracks/features/support/world.rb
Reinier Balt 8cbe077784 get some further scenarios for adding todos to several pages
one is still failing, will get to that
2011-02-03 18:19:19 +01:00

37 lines
No EOL
1.4 KiB
Ruby

module TracksStepHelper
def submit_multiple_next_action_form
selenium.click("xpath=//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def submit_next_action_form
selenium.click("xpath=//form[@id='todo-form-new-action']//button[@id='todo_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def submit_new_context_form
selenium.click("xpath=//form[@id='context-form']//button[@id='context_new_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def submit_new_project_form
selenium.click("xpath=//form[@id='project_form']//button[@id='project_new_project_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def format_date(date)
# copy-and-past from ApplicationController::format_date
return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : ''
end
def execute_javascript(js)
selenium.get_eval "(function() {with(this) {#{js}}}).call(selenium.browserbot.getCurrentWindow());"
end
def clear_context_name_from_next_action_form
execute_javascript("$('#todo_context_name').val('');")
end
def clear_project_name_from_next_action_form
execute_javascript("$('#todo_project_name').val('');")
end
end
World(TracksStepHelper)