2014-11-05 114 views
2

如何編寫下載文件並將其張貼在表單中的測試。下載並使用量角器e2e測試文件

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

目前上傳工作,但我如何下載文件之前,並得到它的路徑?

回答

2

加入到項目中的文件解決,並得到像這樣的絕對路徑:

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

這個答案只解決問題的上裝部分。下載工作如何? – LPoblet 2017-08-29 05:02:13

相關問題