Ok, so I'm looking to test the https response code of a URL using Nightwatch.js.
I've install the npm 'request' package, and successfully tested the response of the URL under test using the following code;
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (response.statusCode != 200)
console.log("error!!!")
});
My problem is 'converting' this working (request) code into a standard nightwatch.js setup, so that if the response code is not a 200 then the test will fail?
At the moment my nightwatch.js scripts begin with, for example;
module.exports = {
'test response code': function (browser) {
browser
and I would like to keep it in a similar format.
Any help would be greatly appreciated.