Issue : File getting downloaded in one of e2e tescases is not getting saved to given folder in jenkins workspace
Setup : jenkins + protractor + cucumber + headless browser (chrome).
seetings :
capabilities:
{
'browserName': 'chrome',
chromeOptions: {
args: ['--headless','window-size=1366,768'],
prefs: {
'download': {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': process.cwd()+'/Commons/downloads/'
}
}
}
},
Code :
var workbook = XLSX.readFile(process.cwd()+'/Commons/downloads/test.xls');
whats happening : Same setup is working fine on my system : File gets downloaded to respective project folder and i am able to read it .
jenkins throws
"error_message": "Error: ENOENT: no such file or directory, open '/opt/jenkins_build/workspace/Projects/Project123/e2e-Test/Commons/downloads/test.xls'\n at Error (native)\n at Object.fs.openSync .
Tried :
Replacing process.cwd() with process.env.WORKSPACE.
creating a file using above paths .
var fd = fs.openSync(process.env.WORKSPACE+'/Commons/downloads/test1.txt', 'w');
It successfully creates a file at desired workscope folder . This shows that path is correct and accesscible i think.
Can it be a issue that jenkins not allowing that downloaded file due to access /security related policies ? .