module SpecTest::Generators
Public Instance Methods
link(identifier, locator=nil, &block)
click to toggle source
Create methods to do the following:
Select a link object. Return a link object.
@param [String] identifier how a link will be referred to @param [Hash] locator how a link will be recognized @param [optional] block to be invoked when object method is called
# File lib/spectest/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)
click to toggle source
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.
@param [String] identifier how a text field will be referred to @param [Hash] locator how a text field will be recognized @param [optional] block to be invoked when object method is called
# File lib/spectest/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)
click to toggle source
Allows you to specify a direct URL as part of a page object. @param [String] url the address for the page.
# File lib/spectest/generators.rb, line 6 def url_is(url) define_method("goto") do @platform.navigate_to url end end