Sha256: d3b6bf51396c091766eae433f17c594bfdd5904061c8a24fb86e98d005c106b2

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 KB

Contents

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

describe PageObject::Elements::Link do
  let(:link) { PageObject::Elements::Link }

  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :href, :id, :index, :name, :text, :xpath, :css, :title].each do |t|
        identifier = link.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end

    it "should map selenium types to watir" do
      [:link, :link_text].each do |t|
        identifier = link.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql :text
      end
    end

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

    it "should map watir types to selenium" do
      key, value = link.selenium_identifier_for :text => 'value'
      expect(key).to eql :link_text
    end
  end

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

    it "should register with tag :a" do
      expect(::PageObject::Elements.element_class_for(:a)).to eql ::PageObject::Elements::Link
    end

    context "for selenium" do
      it "should return error when asked for its' value" do
        link = PageObject::Elements::Link.new(link_element, :platform => :selenium_webdriver)
        expect(lambda { link.value }).to raise_error
      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/link_spec.rb
page-object-1.1.1 spec/page-object/elements/link_spec.rb
page_object-1.1.3 spec/page-object/elements/link_spec.rb
page_object-1.1.2 spec/page-object/elements/link_spec.rb
page_object-1.1.1 spec/page-object/elements/link_spec.rb
page-object-1.1.0 spec/page-object/elements/link_spec.rb
page-object-1.0.3 spec/page-object/elements/link_spec.rb