Module: TerminusSpec::Generators
- Defined in:
- lib/terminus_spec/generators.rb
Instance Method Summary collapse
-
#button(identifier, locator = nil, &block) ⇒ Object
Creates methods to do the following: Click a button object.
-
#link(identifier, locator = nil, &block) ⇒ Object
Create methods to do the following: Select a link object.
-
#text_field(identifier, locator = nil, &block) ⇒ Object
Creates methods to do the following: Enter text into a text field object Get the text that is in a text field object Return a text field object.
-
#url_is(url) ⇒ Object
Allows you to specify a direct URL as part of a page object.
Instance Method Details
#button(identifier, locator = nil, &block) ⇒ Object
Creates methods to do the following:
Click a button object.
Return a button object.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/terminus_spec/generators.rb', line 65 def (identifier, locator=nil, &block) define_method(identifier) do return @platform. locator.clone unless block_given? self.send("#{identifer}_object").click end define_method("#{identifier}_object") do return process_block(&block) if block_given? @platform. locator.clone end alias_method "#{identifier}_button".to_sym, "#{identifier}_object".to_sym end |
#link(identifier, locator = nil, &block) ⇒ Object
Create methods to do the following:
Select a link object.
Return a link object.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/terminus_spec/generators.rb', line 18 def link(identifier, locator=nil, &block) define_method(identifier) do return @platform.click_link_for locator.clone unless block_given? self.send("#{identifier}_object").click end define_method("#{identifier}_object") do return process_block(&block) if block_given? @platform.get_link_for locator.clone end alias_method "#{identifier}_link".to_sym, "#{identifier}_object".to_sym end |
#text_field(identifier, locator = nil, &block) ⇒ Object
Creates methods to do the following:
Enter text into a text field object
Get the text that is in a text field object
Return a text field object.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/terminus_spec/generators.rb', line 39 def text_field(identifier, locator=nil, &block) define_method(identifier) do return @platform.get_text_field_value_for locator.clone unless block_given? self.send("#{identifier}_object").value end define_method("#{identifier}=") do |value| return @platform.set_text_field_value_for(locator.clone, value) unless block_given? self.send("{identifier}_object").value = value end define_method("#{identifier}_object") do return process_block(&block) if block_given? @platform.get_text_field_for locator.clone end alias_method "#{identifier}_text_field".to_sym, "#{identifier}_object".to_sym end |
#url_is(url) ⇒ Object
Allows you to specify a direct URL as part of a page object.
6 7 8 9 10 |
# File 'lib/terminus_spec/generators.rb', line 6 def url_is(url) define_method("goto") do @platform.navigate_to url end end |