On 7/3/06, <b class="gmail_sendername">George Flaherty</b> <<a href="mailto:George.Flaherty@sas.com">George.Flaherty@sas.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.
<br><br>Thanks<br>-george</blockquote><div><br>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:
<br><br> class AddMatterDialogMap<br> def initialize (modal)<br> @browser = modal<br> end<br> <br> def matter_name; @browser.text_field(:id, 'txtMatterName'); end<br> def matter_no; @browser.text_field
(:id, 'txtMatterNo'); end<br> def work_group; @browser.select_list(:id, 'ddWorkGroup'); end<br> def professional_in_charge; @browser.select_list(:id, 'ddPic'); end<br> def city; @browser.text_field(:id, 'txtCity'); end
<br> def zip; @browser.text_field(:id, 'txtZip'); end<br> def country; @browser.select_list(:id, 'ddlCountry'); end<br> def open_date; @browser.text_field(:id, 'txtOpenDate'); end<br> def matter_type; @browser.select_list
(:id, 'ddMatterType'); end<br> def close_date; @browser.text_field(:id, 'txtCloseDate'); end<br> def litigation; @browser.select_list(:id, 'ddLitigation'); end<br> def closed; @browser.checkbox(:id, 'chkClosed'); end
<br> def notes; @browser.text_field(:id, 'txtNotes'); end<br> end <br></div><br><br>So to use this ...<br><br> map = AddMatterDialogMap.new ie<br> map.open_date.set '1/1/06'<br><br>Bret<br></div>