Sha256: 94dcdc9e9fa11bbffb588542cd2fd905b908c8ed27e3cde223fe61f2577f10b1

Contents?: true

Size: 1.63 KB

Versions: 39

Compression:

Stored size: 1.63 KB

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, :src, :alt, :css].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, :src, :alt, :css].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') }

    it "should register with type :submit" do
      ::PageObject::Elements.element_class_for(:input, :submit).should == ::PageObject::Elements::Button
    end

    it "should register with type :image" do
      ::PageObject::Elements.element_class_for(:input, :image).should == ::PageObject::Elements::Button
    end

    it "should register with type :button" do
      ::PageObject::Elements.element_class_for(:input, :button).should == ::PageObject::Elements::Button
    end

    it "should retisger with type :reset" do
      ::PageObject::Elements.element_class_for(:input, :reset).should == ::PageObject::Elements::Button
    end

    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

39 entries across 39 versions & 2 rubygems

Version Path
meeane-page-object-0.1.11 spec/page-object/elements/button_spec.rb
page-object-1.0.2 spec/page-object/elements/button_spec.rb
page-object-1.0.1 spec/page-object/elements/button_spec.rb
page-object-1.0 spec/page-object/elements/button_spec.rb
page-object-0.9.8 spec/page-object/elements/button_spec.rb
page-object-0.9.7 spec/page-object/elements/button_spec.rb
page-object-0.9.6 spec/page-object/elements/button_spec.rb
page-object-0.9.5 spec/page-object/elements/button_spec.rb
page-object-0.9.4 spec/page-object/elements/button_spec.rb
page-object-0.9.3 spec/page-object/elements/button_spec.rb
page-object-0.9.2 spec/page-object/elements/button_spec.rb
page-object-0.9.1 spec/page-object/elements/button_spec.rb
page-object-0.9.0 spec/page-object/elements/button_spec.rb
page-object-0.8.10 spec/page-object/elements/button_spec.rb
page-object-0.8.9 spec/page-object/elements/button_spec.rb
page-object-0.8.8 spec/page-object/elements/button_spec.rb
page-object-0.8.7 spec/page-object/elements/button_spec.rb
page-object-0.8.6.1 spec/page-object/elements/button_spec.rb
page-object-0.8.6 spec/page-object/elements/button_spec.rb
page-object-0.8.5 spec/page-object/elements/button_spec.rb