Module: Testable::Interface::Page
- Defined in:
- lib/testable/interface.rb
Defined Under Namespace
Modules: Attribute
Instance Method Summary collapse
- #has_correct_title? ⇒ Boolean
- #has_correct_url? ⇒ Boolean (also: #displayed?)
- #markup ⇒ Object (also: #html)
- #resize(width, height) ⇒ Object (also: #resize_to)
- #secure? ⇒ Boolean
- #text ⇒ Object (also: #page_text)
- #title ⇒ Object (also: #page_title)
- #title_attribute ⇒ Object
- #url ⇒ Object (also: #page_url, #current_url)
- #url_attribute ⇒ Object
- #url_match_attribute ⇒ Object
- #visit(url = nil) ⇒ Object (also: #view, #navigate_to, #goto, #perform)
Instance Method Details
#has_correct_title? ⇒ Boolean
100 101 102 103 |
# File 'lib/testable/interface.rb', line 100 def has_correct_title? no_title_is_provided if title_attribute.nil? !title.match(title_attribute).nil? end |
#has_correct_url? ⇒ Boolean Also known as: displayed?
91 92 93 94 95 96 |
# File 'lib/testable/interface.rb', line 91 def has_correct_url? if url_attribute.nil? && url_match_attribute.nil? no_url_match_is_possible end !(url =~ url_match_attribute).nil? end |
#markup ⇒ Object Also known as: html
62 63 64 |
# File 'lib/testable/interface.rb', line 62 def markup browser.html end |
#resize(width, height) ⇒ Object Also known as: resize_to
74 75 76 |
# File 'lib/testable/interface.rb', line 74 def resize(width, height) browser.window.resize_to(width, height) end |
#secure? ⇒ Boolean
80 81 82 |
# File 'lib/testable/interface.rb', line 80 def secure? !url.match(/^https/).nil? end |
#text ⇒ Object Also known as: page_text
68 69 70 |
# File 'lib/testable/interface.rb', line 68 def text browser.text end |
#title ⇒ Object Also known as: page_title
56 57 58 |
# File 'lib/testable/interface.rb', line 56 def title @browser.title end |
#title_attribute ⇒ Object
109 110 111 |
# File 'lib/testable/interface.rb', line 109 def title_attribute self.class.title_attribute end |
#url ⇒ Object Also known as: page_url, current_url
49 50 51 |
# File 'lib/testable/interface.rb', line 49 def url @browser.url end |
#url_attribute ⇒ Object
105 106 107 |
# File 'lib/testable/interface.rb', line 105 def url_attribute self.class.url_attribute end |
#url_match_attribute ⇒ Object
84 85 86 87 88 89 |
# File 'lib/testable/interface.rb', line 84 def url_match_attribute value = self.class.url_match_attribute return if value.nil? value = Regexp.new(value) unless value.is_a?(Regexp) value end |
#visit(url = nil) ⇒ Object Also known as: view, , goto, perform
37 38 39 40 41 42 |
# File 'lib/testable/interface.rb', line 37 def visit(url = nil) no_url_provided if url.nil? && url_attribute.nil? @browser.goto(url) unless url.nil? @browser.goto(url_attribute) if url.nil? self end |