Sha256: 754f8b387abbd0f2fb4a9d535b824d11ff21da820ecb96e616923e652245f736

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

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

class TestPageObject
  include PageObject
end

describe PageObject::SeleniumPageObject do
  let(:selenium_browser) { mock_selenium_browser }
  let(:selenium_page_object) { TestPageObject.new(selenium_browser) }

  context "when building identifiers hash" do
    it "should add tag_name when identifying by text for hidden_field" do
      expected_identifier = {:text => 'foo', :tag_name => 'input', :type => 'hidden'}
      PageObject::Elements::HiddenField.should_receive(:selenium_identifier_for).with(expected_identifier)
      selenium_browser.should_receive(:find_element)
      selenium_page_object.platform.hidden_field_for(:text => 'foo')
    end
    
    it "should add tag_name when identifying by href for anchor" do
      expected_identifier = {:href => 'foo', :tag_name => 'a'}
      PageObject::Elements::Link.should_receive(:selenium_identifier_for).with(expected_identifier)
      selenium_browser.should_receive(:find_element)
      selenium_page_object.platform.link_for(:href => 'foo')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page-object-0.1.1 spec/page-object/selenium_page_object_spec.rb