Sha256: 64d5d737da29a8fdc0b373f1b2b604e084d4a23825e9f6edcc99f35ecbe6f409

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'
require 'page-object/elements'

describe PageObject::Elements::TextField do

  describe "when mapping how to find an element" do
    let(:textfield) { PageObject::Elements::TextField }

    it "should map watir types to same" do
      [:class, :id, :index, :name, :tag_name, :title, :xpath].each do |t|
        identifier = textfield.watir_identifier_for t => 'value'
        identifier.keys.first.should == t
      end
    end

    it "should map selenium types to watir" do
      identifier = textfield.watir_identifier_for :css => 'value'
      identifier.keys.first.should == :tag_name
    end

    it "should map selenium types to same" do
      [:class, :css, :id, :name, :title, :xpath, :index].each do |t|
        key, value = textfield.selenium_identifier_for t => 'value'
        key.should == t
      end
    end

    it "should map watir types to selenium" do
      key, value = textfield.selenium_identifier_for :tag_name => 'value'
      key.should == :css
    end
  end
  
  describe "interface" do
    context "for selenium" do
      it "should set its' value" do
        text_field_element = double('selenium_text_field')
        selenium_text_field = PageObject::Elements::TextField.new(text_field_element, :platform => :selenium_webdriver)
        text_field_element.should_receive(:clear)
        text_field_element.should_receive(:send_keys).with('Joseph')
        selenium_text_field.value = 'Joseph'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page-object-0.5.4 spec/page-object/elements/text_field_spec.rb