在Jenkins上以量角器上传文件

时间:2019-02-20 13:27:58

标签: jenkins file-upload protractor

我想上传一张图片,它可以在本地运行,但是无法在詹金斯上运行,代码如下:

HttpUtility.ParseQueryString(uri.Query).Get("personId")

我收到以下错误消息:

const fileToUpload = await '../../files/test-automation-660x330.png';
const absolutePath = await path.resolve(__dirname, fileToUpload);

await this.uploadButton.sendKeys(absolutePath);

3 个答案:

答案 0 :(得分:0)

您是否尝试在路径中使用双引号,例如“ ../../yourimg.png”? 我认为您需要在路径中加入“”。

答案 1 :(得分:0)

const path = require('path');
const fileToUpload = path.resolve('./e2e/files-to-upload/testFile1.txt');
const fileButton= element(by.css('input[data-id=addDownloadableFileButton]'));

await addDownloadableFileButton.s`enter code here`endKeys(fileToUpload);

我的项目中有类似的内容,并且效果很好。我们使用Bamboo而不是Jenkins

答案 2 :(得分:0)

似乎是文件远程检测问题(在jenkins上)。您可能必须使用量角器浏览器来设置文件检测。

我建议您看看Remote File Upload Protractor test