Assuming there is no possible way to make the input[type="file] element visible (see Quality Product's answer) due to layers upon layers of javascript it is possible to upload a file through the file browser using robotjs.
You will need to change to below code snippets around to fit your specific circumstances but this is how I was able to get robotjs to work (utilizing page object design pattern)
Page Object
var robot = require("robotjs");
var path = require("path");
var MediaPO = function() {
...
...
...
this.clickBrowseFileLink = function() {
return browseFileLink.click(); //returns a promise
};
this.uploadFile = function(filename) {
robot.moveMouse(648, 264) //May need to change based on desktop size
var uploadPath = path.resolve(__dirname,'../PATH/TO/UPLOAD/', filename); //change to your upload file's path
robot.setKeyboardDelay(1000);
console.log(uploadPath); //for debugging
robot.typeString(uploadPath);
robot.keyTap("enter");
browser.sleep(3000);
};
...
...
...
Spec
//Note: all code but uploadFile should be replaced with the code from your project
// this is just an example
it("should upload .png files successfully", function() {
...
...
...
//your page object function for opening the file explorer
//must return a promise otherwise the string will be typed too early
mediaPO.clickBrowseFileLink().then(function() {
mediaPO.uploadFile("teddy.png");
mediaPO.clickUploadNowButton(); //replace with your method of confirming upload.
expect(mediaPO.pngFileExists()).toBeTruthy();
});
};