使用Protractor e2e测试下载并使用文件

时间:2014-11-05 12:36:38

标签: protractor angularjs-e2e

如何编写下载文件的测试,并以表格形式发布。

it "should support download and upload a file", ->
    upload = element(By.id 'UploadInput');
    upload.sendKeys 'C:\\path\\to\\file\\file.txt'

目前上传工作正常,但我如何下载文件并获取它的路径?

1 个答案:

答案 0 :(得分:2)

通过将文件添加到项目来解决它并得到如下的绝对路径:

it "should support download and upload a file", ->
    upload = element(By.id 'UploadInput');
    upload.sendKeys path.resolve(__dirname, '../../assets/file.txt')