i have a web site written in angular and i'm trying to do E2E testing Using Protractor
my web site have an "add button" , that opens "a windows OS choose file dialog box" i want to add a file tried using this code :
var path = require('path');
it('should upload a file', function() {
var fileToUpload = '...\folder\xxx.txt',
absolutePath = path.resolve(__dirname, fileToUpload);
$('#uploadButton').click();
$('input[type="file"]').sendKeys(absolutePath);
but it don't upload the file or closes the dialog box . anyone have an idea ?
i tried to create a exe file that controls the dialog box via (autoIt) and it works fine ( when the dialog box pop up i run the exe and everything is eorking fine ... BUT . . . i don't understand how to tell the protractor to lunch an exe after the dialog box apper ... i tried using this code :
var exec = require('child_process').execFile;
var fun =function(){
console.log("fun() start");
exec('c:\\Upload_Nonce.exe', function(err, data) {
console.log(err)
console.log(data.toString());
});
}
fun();
i failed with both ways ... can anyone help me out ?
thanks Oded
Aucun commentaire:
Enregistrer un commentaire