Module: Fluent::Evaluators

Included in:
Fluent
Defined in:
lib/fluent/evaluators.rb

Instance Method Summary collapse

Instance Method Details

#focusedObject Also known as: what_has_focus?



60
61
62
# File 'lib/fluent/evaluators.rb', line 60

def focused
  platform.focused
end


10
11
12
# File 'lib/fluent/evaluators.rb', line 10

def get_cookie_value(name)
  platform.get_cookie_value(name)
end

#markupObject Also known as: html

Page-Level Actions ##



44
45
46
# File 'lib/fluent/evaluators.rb', line 44

def markup
  platform.markup
end

#refreshObject Also known as: refresh_page



24
25
26
# File 'lib/fluent/evaluators.rb', line 24

def refresh
  platform.refresh
end

#remove_cookiesObject Also known as: clear_cookies



20
21
22
# File 'lib/fluent/evaluators.rb', line 20

def remove_cookies
  platform.remove_cookies
end

#run_script(script) ⇒ Object Also known as: execute_script



28
29
30
# File 'lib/fluent/evaluators.rb', line 28

def run_script(script)
  platform.run_script(script)
end

#screenshot(file) ⇒ Object Also known as: save_screenshot



32
33
34
# File 'lib/fluent/evaluators.rb', line 32

def screenshot(file)
  platform.screenshot file
end

#textObject Also known as: page_text



52
53
54
# File 'lib/fluent/evaluators.rb', line 52

def text
  platform.text
end

#titleObject Also known as: page_title



48
49
50
# File 'lib/fluent/evaluators.rb', line 48

def title
  platform.title
end

#urlObject Also known as: current_url



16
17
18
# File 'lib/fluent/evaluators.rb', line 16

def url
  platform.url
end

#visit(url) ⇒ Object Also known as: navigate_to

Browser-Level Actions ##



6
7
8
# File 'lib/fluent/evaluators.rb', line 6

def visit(url)
  platform.visit(url)
end

#wait_for_app(value = 1) ⇒ Object



56
57
58
# File 'lib/fluent/evaluators.rb', line 56

def wait_for_app(value=1)
  sleep value
end

#wait_for_pending_requests(time_limit = 30, message_if_timeout = nil) ⇒ Object

Attempts to wait for pending jQuery requests and indicate if the requests did not occur in a given time period.

Parameters:

  • time_limit (Numeric) (defaults to: 30)

    time to wait for the block to return true

  • message_if_timeout (String) (defaults to: nil)

    the message to include with the error



71
72
73
74
75
76
77
78
79
# File 'lib/fluent/evaluators.rb', line 71

def wait_for_pending_requests(time_limit=30, message_if_timeout=nil)
  end_time = ::Time.now + time_limit
  until ::Time.now > end_time
    return if driver.execute_script('return jQuery.active') == 0
    wait_for_app 0.5
  end
  message = 'Pending jQuery requests never indicated completion.' unless message_if_timeout
  raise message
end

#wait_until(timeout = Fluent.page_level_wait, message = nil, &block) ⇒ Object Also known as: wait_for

Provides a context for an action that must succeed within a given time period. The logic here is simply that the result of the action will be true (meaning the action was carried out) or false, which means the action did not succeed in the time allotted.

Parameters:

  • timeout (Integer) (defaults to: Fluent.page_level_wait)

    the amount of time in seconds to wait

  • message (String) (defaults to: nil)

    the text to return if the action did not occur in time

  • block (Proc)

    the code that calls the desired action



89
90
91
# File 'lib/fluent/evaluators.rb', line 89

def wait_until(timeout=Fluent.page_level_wait, message=nil, &block)
  platform.wait_until(timeout, message, &block)
end