how do I check the HTTP status code using nightwatch.js? I tried
browser.url(function (response) {
browser.assert.equal(response.statusCode, 200);
});
Supplementing to Hilarion Galushka's answer: you can use the perform() command from nightwatch to intergrate request and assert into your nightwatch tests. http://nightwatchjs.org/api/perform.html
For example:
module.exports = {
'test response code': function (browser) {
browser.perform(done => {
request('http://stackoverflow.com', function (error, response, body) {
browser.assert.equal(response.statusCode, 200);
done()
});
})
}
}