I searched for an answer about this, but could not find it. I use nightwatch.js to write UI tests. It works fine, but I need to send custom headers for HTTP requests, as the application is protected by digital signage and does not have a login form that tests can use to access the site itself.
I am looking for something similar that can be installed in PhantomJS, but for my nightwatch.json configuration or the tests themselves.
Is it possible?
var webPage = require('webpage');
var page = webPage.create();
page.customHeaders = {
"X-Test": "foo",
"DNT": "1"
};
page.onInitialized = function() {
page.customHeaders = {};
};
source
share