Sha256: a26a9a3060e85c9591f20605c4213d4ee1d475eda88f78a596f76b6f4c93d673

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

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

describe PageObject::Elements::FileField do

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

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

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

  describe "interface" do
    let(:filefield) { double('file_field') }

    it "should register as type :file" do
      expect(::PageObject::Elements.element_class_for(:input, :file)).to eql ::PageObject::Elements::FileField
    end
    
    context "for selenium" do
      it "should set its' value" do
        selenium_file_field = PageObject::Elements::FileField.new(filefield, :platform => :selenium_webdriver)
        expect(filefield).to receive(:send_keys).with('a file')
        selenium_file_field.value = 'a file'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
page-object-1.2.0 spec/page-object/elements/file_field_spec.rb
page-object-1.1.1 spec/page-object/elements/file_field_spec.rb
page_object-1.1.3 spec/page-object/elements/file_field_spec.rb
page_object-1.1.2 spec/page-object/elements/file_field_spec.rb
page_object-1.1.1 spec/page-object/elements/file_field_spec.rb
page-object-1.1.0 spec/page-object/elements/file_field_spec.rb
page-object-1.0.3 spec/page-object/elements/file_field_spec.rb