[Wtr-general] UI Mapping Revisited.

George Flaherty George.Flaherty at sas.com
Mon Jul 3 12:49:01 EDT 2006


ahhh cool, I had "roughly" the same thing...but I figured I was doing it wrong :)
I couldn't figure out the @browser = modal part...
 
thanks Bret
-george

________________________________

From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Bret Pettichord
Sent: Monday, July 03, 2006 12:42 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] UI Mapping Revisited.


On 7/3/06, George Flaherty <George.Flaherty at sas.com> wrote: 

	Is there a preferred way to map out Watir UI components/features before test execution, then possibly "bind" them later? I know there have been some conversations regarding a Watir::Map class, but is there some other way until that feature is added? My main goal is to not duplicate UI features throughout various Test Suites. 
	
	Thanks
	-george


I know that i was talking about creating a Map class, but recently  i've found that it was easier to just create small methods that returned various elements. Here's some of my code: 

  class AddMatterDialogMap
    def initialize (modal)
      @browser = modal
    end
    
    def matter_name; @browser.text_field(:id, 'txtMatterName'); end
    def matter_no; @browser.text_field (:id, 'txtMatterNo'); end
    def work_group; @browser.select_list(:id, 'ddWorkGroup'); end
    def professional_in_charge; @browser.select_list(:id, 'ddPic'); end
    def city; @browser.text_field(:id, 'txtCity'); end 
    def zip; @browser.text_field(:id, 'txtZip'); end
    def country; @browser.select_list(:id, 'ddlCountry'); end
    def open_date; @browser.text_field(:id, 'txtOpenDate'); end
    def matter_type; @browser.select_list (:id, 'ddMatterType'); end
    def close_date; @browser.text_field(:id, 'txtCloseDate'); end
    def litigation; @browser.select_list(:id, 'ddLitigation'); end
    def closed; @browser.checkbox(:id, 'chkClosed'); end 
    def notes; @browser.text_field(:id, 'txtNotes'); end
  end  



So to use this ...

  map = AddMatterDialogMap.new ie
  map.open_date.set '1/1/06'

Bret

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060703/607c1fc0/attachment.html 


More information about the Wtr-general mailing list