我正在尝试验证PDF文档的上载功能,但是它在本地工作得很好,它可以从本地文件夹中选择路径,但是由于Bamboo + Sauce + Qtest集成执行的一部分而失败。
Below is the code snippet i have used to upload the documentin local which is working fine :
var path = require('path');
var absolutePath = path.resolve(__dirname, "../uploads/Replace.pdf");
element(by.css('input[type=file][ng-model="detailDocuments.selectedFiles.selectedIbl"]')).sendKeys(absolutePath);
browserActions.clickOn(applicants.uploadBtn('Replace'));
Below is the code snippet which i have used to upload document as part of CI.
var path = require('path');
var remote = require('selenium-webdriver/remote');
browser.setFileDetector(new remote.FileDetector());
var absolutePath = path.resolve(__dirname, "../uploads/Replace.pdf");
element(by.css('input[type=file][ng-model="detailDocuments.selectedFiles.selectedIbl"]')).sendKeys(absolutePath);
browser.sleep(2000);
browserActions.clickOn(applicants.uploadBtn('Replace'));
browser.sleep(3000);
In the bamboo it showing below error message:
Failures:
build 18-Feb-2019 13:15:56 1) IEATA.2356*: validation_for_upload_or_replace_documents_IEATA-2356 IEATA-2356 step 4: verification of applicantdetails page
build 18-Feb-2019 13:15:56 Message:
build 18-Feb-2019 13:15:56 [31m Failed: invalid argument: File not found : /opt/atlassian-bamboo/bamboo-agent-home/xml-data/build-dir/EQ-PBR-JOB1/regression/bws/uploads/Test.pdf
build 18-Feb-2019 13:15:56 (Session info: chrome=71.0.3578.80)
build 18-Feb-2019 13:15:56 (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 6.1.7601 SP1 x86_64)[0m
build 18-Feb-2019 13:15:56 Stack:
build 18-Feb-2019 13:15:56 WebDriverError: invalid argument: File not found : /opt/atlassian-bamboo/bamboo-agent-home/xml-data/build-dir/EQ-PBR-JOB1/regression/bws/uploads/Test.pdf
build 18-Feb-2019 13:15:56 (Session info: chrome=71.0.3578.80)
build 18-Feb-2019 13:15:56 (Driver info: chromedriver=2.44.609538
The PDF documents are available in protractor/uploads.