Sha256: 3fc806a5c7be3e461d2c3bec732367b7267d7ca66bd95ec9fae5345f0d8e2237

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

# def wrappers with suggested semantic names for elements
class Person < Watirloo::Page
  
  def last
    @b.text_field(:name, 'last_nm')
  end

  def first
    @b.text_field(:name, 'first_nm')
  end

  def dob
    @b.text_field(:name, 'dob')
  end

  def street
    @b.text_field(:name, 'addr1')
  end
  
  def gender
    @b.select_list(:name, 'sex_cd')
  end
  
end


describe "Person Page with def wrapper methods" do
  
  before :each do
    @page = Person.new
    @page.b.goto testfile('person.html')
  end
  
  it 'calling face when there is wrapper method' do
    
    @page.last.set 'Wonkatonka'
    @page.last.value.should == 'Wonkatonka'
    @page.face(:last).value.should == 'Wonkatonka'
    
    @page.face(:last).set 'Oompaloompa'
    @page.last.value.should == 'Oompaloompa'
    
  end
  
  it 'spray using methods wrappers for watir elements' do
    mapping = {:street => '13 Sad Enchiladas Lane', :dob => '02/03/1977'}
    @page.spray mapping
    @page.street.value.should == mapping[:street]
    @page.dob.value.should == mapping[:dob]
  end
  
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marekj-watirloo-0.0.2 test/person_def_wrappers_test.rb