Module: Helper

Defined in:
lib/SkeletonWeb/features/support/helper.rb,
lib/SkeletonMobile/features/support/helper.rb

Overview

!/usr/bin/env ruby metodo para tira screenshot e imbutir no relatorio html

Instance Method Summary collapse

Instance Method Details

#finished_all_ajax_requests?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/SkeletonWeb/features/support/helper.rb', line 19

def finished_all_ajax_requests?
  page.evaluate_script('jQuery.active').zero?
end

#take_screenshot(file_name, result) ⇒ Object



6
7
8
9
10
11
# File 'lib/SkeletonWeb/features/support/helper.rb', line 6

def take_screenshot(file_name, result)
  file_path = "results/screenshots/test_#{result}"
  screenshot = "#{file_path}/#{file_name}.png"
  page.save_screenshot(screenshot)
  embed(screenshot, 'image/png', 'Click here')
end

#wait_for_ajaxObject



13
14
15
16
17
# File 'lib/SkeletonWeb/features/support/helper.rb', line 13

def wait_for_ajax
  Timeout.timeout(Capybara.default_max_wait_time) do
    loop until finished_all_ajax_requests?
  end
end