Module: Symbiont::Evaluators
- Included in:
- Symbiont
- Defined in:
- lib/symbiont/evaluators.rb
Instance Method Summary collapse
- #back ⇒ Object
-
#focus ⇒ Object
(also: #what_has_focus?)
Returns the element on a page that has the focus.
- #forward ⇒ Object
- #markup ⇒ Object (also: #html)
- #refresh ⇒ Object
- #remove_cookies ⇒ Object (also: #clear_cookies)
-
#run_script(script) ⇒ Object
(also: #execute_script)
Executes JavaScript against the browser instance.
-
#screenshot(file) ⇒ Object
(also: #save_screenshot)
Save a snapshot of the current screen to a provided file location.
-
#text ⇒ Object
Page-Level Actions ##.
- #title ⇒ Object
- #url ⇒ Object (also: #current_url)
-
#visit(url) ⇒ Object
(also: #navigate_to)
Browser-Level Actions ##.
- #wait_for_app(value = 1) ⇒ Object
-
#wait_for_pending_requests(time_limit = 30, message_if_timeout = nil) ⇒ Object
Provides an evaluator that attempts to wait for any pending AJAX requests from the jQuery library.
Instance Method Details
#back ⇒ Object
34 35 36 |
# File 'lib/symbiont/evaluators.rb', line 34 def back platform.back end |
#focus ⇒ Object Also known as: what_has_focus?
Returns the element on a page that has the focus.
69 70 71 |
# File 'lib/symbiont/evaluators.rb', line 69 def focus platform.focus end |
#forward ⇒ Object
38 39 40 |
# File 'lib/symbiont/evaluators.rb', line 38 def forward platform.forward end |
#markup ⇒ Object Also known as: html
58 59 60 |
# File 'lib/symbiont/evaluators.rb', line 58 def markup platform.markup end |
#refresh ⇒ Object
42 43 44 |
# File 'lib/symbiont/evaluators.rb', line 42 def refresh platform.refresh end |
#remove_cookies ⇒ Object Also known as:
46 47 48 |
# File 'lib/symbiont/evaluators.rb', line 46 def platform. end |
#run_script(script) ⇒ Object Also known as: execute_script
Executes JavaScript against the browser instance.
28 29 30 |
# File 'lib/symbiont/evaluators.rb', line 28 def run_script(script) platform.run_script(script) end |
#screenshot(file) ⇒ Object Also known as: save_screenshot
Save a snapshot of the current screen to a provided file location. The file will be saved as a PNG file in the path specified or in the location where the tests are being run from.
21 22 23 |
# File 'lib/symbiont/evaluators.rb', line 21 def screenshot(file) platform.screenshot file end |
#text ⇒ Object
Page-Level Actions ##
54 55 56 |
# File 'lib/symbiont/evaluators.rb', line 54 def text platform.text end |
#title ⇒ Object
64 65 66 |
# File 'lib/symbiont/evaluators.rb', line 64 def title platform.title end |
#url ⇒ Object Also known as: current_url
12 13 14 |
# File 'lib/symbiont/evaluators.rb', line 12 def url platform.url end |
#visit(url) ⇒ Object Also known as:
Browser-Level Actions ##
6 7 8 |
# File 'lib/symbiont/evaluators.rb', line 6 def visit(url) platform.visit(url) end |
#wait_for_app(value = 1) ⇒ Object
75 76 77 |
# File 'lib/symbiont/evaluators.rb', line 75 def wait_for_app(value=1) sleep value end |
#wait_for_pending_requests(time_limit = 30, message_if_timeout = nil) ⇒ Object
Provides an evaluator that attempts to wait for any pending AJAX requests from the jQuery library.
81 82 83 84 85 86 87 88 89 |
# File 'lib/symbiont/evaluators.rb', line 81 def wait_for_pending_requests(time_limit=30, =nil) end_time = ::Time.now + time_limit until ::Time.now > end_time return if @browser.execute_script('return jQuery.active') == 0 sleep 0.5 end = "Pending jQuery requests never indicated completion." unless raise end |