Sha256: 85bd26147b61708edc1a3ecc9e3de91bd01fde5fa0354bc036e91341286fd076

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

class WebObjects
  include Symbiont
  include Symbiont::Factory

  url_is "http://localhost:9292/webobject"
  title_is "Web Objects | Symbiote"

  text_field  :name,                id: "name"
  text_field  :email,               id: "email"

  checkbox    :chameleoflage_armor, id: "camoArmor"
  checkbox    :make_sith_active,    id: "toggleSith"

  select_list :sith_power,          id: "sith"
  select      :physics_id,          id: "physics"
  select      :physics_name,        name: "physics"
  select      :physics_xpath,       xpath: "//select[@id='physics']"
  select      :physics_index,       index: 1

  button      :alert,               id: "alertButton"
  button      :confirm,             id: "confirmButton"
  button      :prompt,              id: "promptButton"

  def check_for_text(text)
    self.text.include? text
  end

  def check_for_markup(text)
    self.html.include? text
  end

  def check_for_title(text)
    self.title.should == text
  end

  def check_for_url(text)
    self.url.should == text
  end

  def check_for_focus(element)
    case element
      when "name"
        self.focus.should be_an_instance_of Symbiont::WebObjects::TextField
      when "cameleoflage armor"
        self.focus.should be_an_instance_of Symbiont::WebObjects::CheckBox
    end
  end

  def set_focus_for(locator)
    self.checkbox_object(locator).focus
  end

  def generate_alert(text)
    message = self.will_alert do
      self.alert
    end

    message.should == text
  end

  def generate_confirm(text)
    message = self.will_confirm(true) do
      self.confirm
    end

    message.should == text
  end

  def generate_prompt(text, value)
    message = self.will_prompt("Darth Invictus") do
      self.prompt
    end

    message[:message].should == text
    message[:default_value].should == value
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symbiont-0.2.1 specs/pages/web_objects.rb
symbiont-0.2.0 specs/pages/web_objects.rb