Search code examples
angularjsprotractorng-file-uploade2e-testing

protractor E2E TEST multiple file upload using ng-file-upload


I was writing E2E test-case using protractor for angularjs application. My application has multiple file uploading as one of its features. So, to write E2E test-case for my application, I have to automate multiple file-uploading.

I am able to upload single file using protractor but my application requires more than 1 file for seamless working.

browser.get(localUrl);
var button = element(by.css('[ngf-select]'));
button.click();
var input = element(by.css('input[type="file"]'));
input.sendKeys([ absolutePath, absolutePath1, absolutePath2]);

Image after performing button.click() operation Regards

Ajay


Solution

  • Have you tried

    browser.get(localUrl);

    var button = element(by.css('[ngf-select]'));
    
    button.click();
    
    var input = element(by.css('input[type="file"]'));
    
    input.sendKeys( absolutePath + "\n" + absolutePath1 + "\n" + absolutePath2);