Sha256: 8d0999c4f447f95a7689c3bf207f136a2712627455f0abdaaafbfd40fe98eb09

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

class PageObjectTestPageObject
  include PageObject

  text_field(:tf, :id => 'id')
  text_area(:ta, :id => 'id')
  select_list(:sl, :id => 'id')
  file_field(:ff, :id => 'id')
  checkbox(:cb, :id => 'id')
  radio_button(:rb, :id => 'id')
end

describe PageObject::PagePopulator  do
  let(:browser) { mock_watir_browser }
  let(:page_object) { PageObjectTestPageObject.new(browser) }

  it "should set a value in a text field" do
    page_object.should_receive(:tf=).with('value')
    page_object.populate_page_with('tf' => 'value')
  end

  it "should not set a value if it is not found on the page" do
    browser.should_not_receive(:text_field)
    page_object.populate_page_with('coffee' => 'value')
  end

  it "should set a value in a text area" do
    page_object.should_receive(:ta=).with('value')
    page_object.populate_page_with('ta' => 'value')
  end

  it "should set a value in a select list" do
    page_object.should_receive(:sa=).with('value')
    page_object.populate_page_with('sa' => 'value')
  end

  it "should set a value in a file field" do
    page_object.should_receive(:ff=).with('value')
    page_object.populate_page_with('ff' => 'value')
  end

  it "should check a checkbox to true is specified" do
    page_object.should_receive(:check_cb)
    page_object.populate_page_with('cb' => true)
  end

  it "should uncheck a checkbox to false is specified" do
    page_object.should_receive(:uncheck_cb)
    page_object.populate_page_with('cb' => false)
  end

  it "should select a radio button when true is specified" do
    page_object.should_receive(:select_rb)
    page_object.populate_page_with('rb' => true)
  end

  it "should clear a radio button when false is specified" do
    page_object.should_receive(:clear_rb)
    page_object.populate_page_with('rb' => false)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page-object-0.5.4 spec/page-object/page_populator_spec.rb