I'm using nightwatch "0.8.6". Per the documentation on pages, I've created a pages/login.js
file and add the directory to the config file with:
module.exports = {
url: function() {
return this.launchUrl;
}
};
The documentation mentions this.api
, but thats not a property of the client / browser. this.launchUrl
apparently is available, however.
I changed an existing test to use it:
module.exports = {
'Login page has a login button' : function (browser) {
browser
.url(browser.page.login().url())
.waitForElementVisible('body', 10000)
.assert.containsText('button', 'SIGN IN')
.end();
}
}
The test now fails. .url tries to open selenium with data:,
, instead of the value of this.launchUrl, which is localhost:3000.
The page object is apparently evaluated in the context of the login test, so this in the page object should have this.launchUrl. Diving into the source I see there are also page wrapper objects in the mix, somehow.
How can I use correctly create and use a page object in 0.8.6?