Custom NightwatchJS command for file upload using remote selenium grid
This works only for NightwatchJS v1.4+
This project requires adm-zip
npm i adm-zip
- Place the folder customCommands in the root of your project
- Update NightwatchJ Config:
custom_commands_path: ["customCommands"],
module.exports = {
'File Upload Test' : function (browser) {
browser
.url('https://the-internet.herokuapp.com/upload')
.UploadLocalFile("/path_to_file/testfile.txt", "#file-upload")
.click('#file-submit')
.pause(10000)
.end();
}
};