is just an abstract class that leaves the implementation of what you consider “the page is loaded” to yourself.

Where does loadable component come into play here?

That depends on what page you’d like to check for being loaded. See the link below in my answer. You, basically, should apply the pattern to the particular page.

Like this:

public class LoginPage extends LoadableComponent<LoginPage> {

    // @FindBy locators

    public DashboardPage login(String user, String pass) {
       // something
       return new DashboardPage().get();
    }

   // TODO: !!! -  isLoaded() and load() methods - !!!

}

public class DashboardPage extends LoadableComponent<DashboardPage> {

    //  @FindBy locators

    public UsersPage navigateToUsersPage() {
        return new UsersPage().get() // !!! - This call requires UsersPage is also extending LoadableComponent
    }

   // TODO: !!! -  isLoaded() and load() methods - !!!

}

how can we ensure the page(s) are loaded

LoadableComponent pattern will not answer you how to ensure the page is loaded. It just prescribes you to implement the method where you will code the logic for your particular case and your particular pages.

For example you might implement that method in the way it awaits for certain conditions against certain page elements.

There is a good post regarding the topic here.



Source link https://sqa.stackexchange.com/questions/33314/how-to-implement--loadablecomponent-with-a--

LEAVE A REPLY

Please enter your comment!
Please enter your name here