On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote: > > Did not get a chance to dive into creating my first Class but I will do > asap. > I quite understand the concept of the Page Object (I will still need > practice to get to the understanding of where exactly should I use it and > how) and that is why I was looking into Classes yesterday. > > I guess what I am still confused about is what makes the difference? > To me it looks like by doing so (create class Login) I would only do a > translation of my problem to a sub-level. > Why would I be able to use more easily (from anywhere) an instance of > "Login" than an instance of "Browser"? > > I mean, I understand I can use the instance from where it's been > instantiated, but how do I use it from elsewhere ? > (I hope my question makes sense) > > Things are starting to make sense as I am typing and trying to even myself > understand my problem. > So now, I would turn my question in a different angle: why is my Browser > instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB > *** file? > Does it mean that Modules or Class are segregated from the "rest of the > world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen > as a unique big Class? > > Thanks for helping me thru the process of sorting things out! > > Titus thanks for the advice on BDD, when I started I did not know about > RSpec and spec_helper, but I will definitely take your advice ! >
Rather than a login class, I would suggest you create what I call a 'Domain Object' class, in this case a User class. You can then put methods like Login, Logout, Register, Update_Profile, etc. What objects to create depends on the nature of the business domain.. In a retail setting you might have a shopping cart class, (an instance of which could be included in your user class). When working at one company that made a site for farmers I had domain objects (defined as classes) for the user, and their fields, etc. Have a look at the Test Factory gem it is a simple approach to both page objects and domain objects and is designed to work with watir. -- -- 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] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
