My goal is to create an automated test using Nightwatch.js to validate the functionality of software download links. Instead of downloading the files, I simply want to confirm that the links are returning a 200 HTTP response, indicating that they are directing users to the correct location.
Does anyone have suggestions for testing downloadable file links with Nightwatch.js?
Below is the current setup I have:
/**
* Test Software Downloads
*
* Verify that software downloads are working
*/
module.exports = {
"Download redirect links": function (browser) {
// download links
var downloadLinks = {
"software-download-latest-mac": "http://downloads.company.com/mac/latest/",
"software-download-latest-linux": "http://downloads.company.com/linux/latest/",
"software-download-latest-win32": "http://downloads.company.com/windows/32/latest/",
"software-download-latest-win64": "http://downloads.company.com/windows/64/latest/"
};
// loop through download links
for (var key in downloadLinks) {
if (downloadLinks.hasOwnProperty(key)) {
// test each link's status
browser
.url(downloadLinks[key]);
}
}
// end testing
browser.end();
}
};