Sha256: edd5fa8433a48353570f8a39959222d86a9af90fe13bf1acbd2821ce4933e229
Contents?: true
Size: 981 Bytes
Versions: 4
Compression:
Stored size: 981 Bytes
Contents
module AcceptanceHelpers def saop save_and_open_page end def handle_js_confirm(message = nil, accept = true) page.execute_script('window.original_confirm_function = window.confirm') page.execute_script("window.confirm = function(msg) { $.cookie('confirm_message', msg); return #{!!accept}; }") yield page.evaluate_script("$.cookie('confirm_message')").should == message unless message.nil? ensure page.evaluate_script 'window.confirm = window.original_confirm_function' end def fill_in_autocomplete(capybara_selector, jquery_selector, value) fill_in capybara_selector, with: value page.execute_script "$('#{jquery_selector}').keydown()" end def choose_autocomplete(text) find('ul.ui-autocomplete').should have_content(text) page.execute_script("$('.ui-menu-item:contains(\"#{text}\")').find('a').trigger('mouseenter').click()") end end RSpec.configure do |config| config.include AcceptanceHelpers, type: :request end
Version data entries
4 entries across 4 versions & 1 rubygems