It's more like a theoretical question and I am seeking the best practice here.
Given an application where you have different user types, newly registered users get a new UI while old users are getting the old UI.
When you login with a user you are getting into a main page where your user can do stuff, but the two UIs are very much different (different buttons, elements with different locators) except search bar and some others.
I have thought about a few options here:
a. Create seperate page objects (AMainPage, BMainPage) for the two landing pages which both implements an IMainPage interface and use them like
LoginPage loginPage = new LoginPage(GetDriver());
IMainPage mainPage = loginPage.loginWithUser(user);
And then implement the login something like
public IMainPage loginWithUser(User user)
{
//implement the actual action
//return page object based on user.UserType (e.g. AMainPage or BMainPage)
}
b. Similar to the first but with an abstract parent which implements the actions where the two UIs are the same, and define other actions where it differs.
c. Use one common page object to implement all actions for both UIs.
Or something else could be better? Suggestions?