I have some code that currently sits in my Steps class (I am using Cucumber BDD).
I am calling a function that waits for one of two elements to be present, for 12s.
There seem to be some problems with this:
- I am using the page object model, and according to the general principles of this, the locators I am referencing should be private and therefore only accessible by the page object
- The steps class is not supposed to be accessing 'low level' concepts like the driver.
However, if I choose one of the page objects and move the wait function to that, within a new method, I will introduce a dependency between one page and another. It seems to violate Single Responsible Responsibility, as each page should only be handling things related to that page.
Is there a design pattern I can apply to resolve this, so I have a good place to put these waitForEitherElements? Ideally, it would allow me to make the driver protected and only accessible by page objects. However, that might mean this is impossible to resolve.