>From reading your code, it looks like you are using the page objects pattern in a good way. I would be curious to see the entire stack trace of the exception you are describing
On Fri, Jun 3, 2011 at 12:44 PM, Rahul Sharma <[email protected]>wrote: > Hi Guys, > > I have got a problem that I run into frequently using the page object > pattern for Watir and was wondering if anyone could help. > > I have a booking page on which a user could click book button to book > an event. If the user is eligible for the booking, a Succesful booking > page is returned and if not then Requirement not met page is returned. > Currently following the page object pattern I have different page > classes for each page. So my code goes like this: > My feature file: > > Scenario 1: > When I book event #(member eligible) > Then Successful booking page should be displayed > > Scenario 2: > When I book event #(member not eligible) > Then Requirement not met page should be displayed > > My Ruby file: > When "I book an event" do > @booking_page.book_event > end > > Then "Successful booking page should be displayed" do > @successful_page.should be_displayed > > Then "Requirement not met page should be displayed" do > @requirement_not_met_page.should be_displayed > end > > My book_event method that evaluates the page to be returned is like > this: > > def book_event > book_button.click > if @browser.url =~ /requirementNotMet/ > > > @requirement_not_met_page=Pages::WhiteLabel::Community::RequirementNotMetPage.new(@browser) > else > > > @successful_page=Pages::WhiteLabel::Community::SuccessfulBookingPage.new(@browser) > end > end > Now this does not seem to work and I get method not defined for Nil > Class error. So I guess in the book_event method, the page objects > from teh two classes are not being assigned to the variables. > > Any ideas how I can do this? > > Thanks in advance > > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
