Sha256: 5adbdca529df9e789eb7572a72914a8712a3d360c0376a0b261db6057d36534c

Contents?: true

Size: 995 Bytes

Versions: 10

Compression:

Stored size: 995 Bytes

Contents

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

describe PageObject::Elements::Button do
  let(:button) { PageObject::Elements::Button }

  context "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :name, :value, :xpath].each do |t|
        identifier = button.watir_identifier_for t => 'value'
        identifier.keys.first.should == t
      end
    end

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

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

    context "for selenium" do
      it "should return error when asked for its' text" do
        button = PageObject::Elements::Button.new(button_element, :platform => :selenium_webdriver)
        lambda { button.text }.should raise_error
      end
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
page-object-0.5.1 spec/page-object/elements/button_spec.rb
page-object-0.5.0 spec/page-object/elements/button_spec.rb
page-object-0.4.4 spec/page-object/elements/button_spec.rb
page-object-0.4.3 spec/page-object/elements/button_spec.rb
page-object-0.4.2 spec/page-object/elements/button_spec.rb
page-object-0.4.1 spec/page-object/elements/button_spec.rb
page-object-0.4.0 spec/page-object/elements/button_spec.rb
page-object-0.3.2 spec/page-object/elements/button_spec.rb
page-object-0.3.1 spec/page-object/elements/button_spec.rb
page-object-0.3.0 spec/page-object/elements/button_spec.rb