Why the Protractor do steps not one by one?
The code example:
browser.get('http://mywebpage.com');
element(by.css('[ng-click="fileCtrl.saveFile()"]')).click();
var today = new Date();
var todayPlus = new Date();
while(todayPlus.valueOf()<today.valueOf()+7000){
todayPlus = new Date();
}
browser.driver.sleep(2000);
var fs = require('fs');
var util = require('util');
var c = fs.exists('C:\\Users\\volodymyr.nabok\\Downloads\\file.txt', function(ex){ util.debug(ex ? "Yes." : "No-p"); });
In my case the Protractor firstly check if the 'file.txt' exists then download it. As you see I tried to freeze script for 7 seconds and freeze the browser for 2 seconds but it didn't help.