i want to upload a file as an automated test, with the following code, it correctly selects the file & clicks the upload button, however nothing happens after the upload button is clicked, I believe its not triggering the javascript on the page:
var fileUpload = './testFile.txt',
absolutePath = path.resolve('./testFile.txt', fileUpload);
$('input[type="file"]').sendKeys(absolutePath);
element(by.model('documentFile'));
element(by.css('button[ng-click="uploadSelectedFiles()"]')).click();
Is there another method for this?
EDIT: I have managed to do this, thank you to who helped me, here is my code:
var fileUpload = './testFile.jpg',
absolutePath = path.resolve('/home/xxx/workspace/xxx/xxx/xxx/xxxxx/test/x/x/x/x/filesToUpload', fileUpload);
var uploadInput = $('input[type="file"]');
uploadInput.sendKeys(absolutePath);
uploadInput.submit();
element(by.css('button[ng-click="uploadSelectedFiles()"]')).click();