Is there anyone who have already implemented the famous \"Page Object Pattern\" with casperjs, it\'s very useful for test maintenability in the long term ?
It\'s ver
Using the example in your second link, you can convert this to a Javascript class-like object and encapsulate in its own module:
var LoginPage = function(casper) {
this.casper = casper;
};
LoginPage.prototype.typeUsername = function(username) {
this.evaluate(function() {
__utils__.findOne('input.username').value = username;
});
};
exports = LoginPage;
and then use it in your test:
var LoginPage = require("./LoginPage.js");
var login = new LoginPage(this);
login.typeUsername("geoff");