I have a Protractor
test to validate that an excel file is correctly downloaded in the Downloads
folder and then I am able to upload the same. Since I will be running the test multiple times, I need a way to clear my Downloads
directory before I run the Protractor tests. That way any duplicate files from the previous runs are cleared. How can I do that? This is how my test to upload an excel file looks:
var fileToUpload = 'Test.xlsm';
it('Test Case: to Validate the Excel Upload', function() {
var absolutePath = path.resolve('C:/Users/.../Downloads', fileToUpload);
$('input[type="file"]').sendKeys(absolutePath);
});
});