I am trying to implement the Page Object Model in my TestCafe project. How do I implement page transitions from one page to another? For e.g. Move from Login page object to obtain Home page object, both pages have different properties/fields. In Selenium there is a PageFactory and webdriver to work with, how should I implement it in TestCafe?
1 Answer
You don't need to worry about page transitions. TestCafe's Selectors are lazy by default. Just declare the necessary Page Objects in the fixture file and use it. See the detailed example in the Use Page Model help topic.
2 Comments
Manoj
Thank you @mlosev but in that case, how do I make sure that I (or my team) don't refer to a selector/property which is not present on the current page(mistakenly)?
Alex Kamaev
If your page models are implemented correctly, you should not think about page transitions at all. TestCafe will wait for a new page automatically. This means that you do not need to do anything special for using your second page model. If your page model has mistakes (i.e. selectors which do not exist), the test fails, but again if the model is defined correctly, it will wait for the element of a new page to appear.