In the context of test automation I'm using a simple version of the Page Object Pattern and facing the problem of having redundance in my code.
That said, in a class I'm having multiple methods which basically do the same thing but just return different page objects:
gotoNextPageExpectPageA() {
clickSubmitButton();
return new PageA();
};
gotoNextPageExpectPageB() {
clickSubmitButton();
return new PageB();
};
...
gotoNextPageExpectPageZ() {
clickSubmitButton();
return new PageZ();
};
I've done some research and thought of some design patterns like State Pattern, Template Method, Chain-of-responsibility, but am also thinking these might be overkill and that I'll have to do a huge refactoring.
Does anyone come up with a simpler solution?
PS.: I'm using node.js
Aucun commentaire:
Enregistrer un commentaire