So this is sort of a follow up question to me previous question: Page Object Model: How much abstraction is necessary?
In an effort to make my test scripts simpler and methods easier (since implementing a very discrete PoM didn't really reduce my test scripts) i've came into the problem of how to handle methods that handle complex forms for example.
With a page object model something like a Login()
method is pretty easy, it takes a username and password. So even if we have to pass parameters in the test script it's not a big deal.
But for example I have a page that deals with creating a widget for example (That's this particular pages sole purpose). The form is a series of input text fields, dropdowns, etc... (This framework is written in Ruby
by the way).
How do I go about dealing with this with PoM?
Currently i've made a method for each input (along with the "save" button)...but that doesn't really abstract away anything, and honestly is just as long in the test script as using pure selenium calls.
I could make a method that handles all this (Which makes sense) but the number of parameters I would need to pass would be staggering. OR I could just use default parameters (perhaps using a gem such as faker
to fill in inputs within the method). Or perhaps have another class (which seems overkill) or fixture to pass into the method.
I've seen some guides that sort of have a default data of {}
that uses default in the method by merging the defaults into a blank object (if nothing is otherwise passed). Which seems like an ok way of handling it.
What's the best way to handle this?