module SpecTest::Generators

Public Instance Methods

button(identifier, locator=nil, &block) click to toggle source

Creates methods to do the following:

Click a button object.
Return a button object.

@param [String] identifier how a button will be referred to @param [Hash] locator how a button will be recognized @param []optional] block to be invoked when object method is called

# File lib/spectest/generators.rb, line 64
def button(identifier, locator=nil, &block)
  define_method(identifier) do
    return @platform.click_button_for locator.clone unless block_given?
    self.send("#{identifer}_object").click
  end

  define_method("#{identifier}_object") do
    return process_block(&block) if block_given?
    @platform.get_button_for locator.clone
  end

  alias_method "#{identifier}_button".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