Download a file protractor test case

Hmahwish picture Hmahwish · Nov 28, 2014 · Viewed 19.8k times · Source

I am writting a protractor test case to download a file which can be of any type.

  • Scenario: Download a file
  • Step 1: Click on the Download Link
  • Step 2: Check whether the file is downloaded or not

How do i check if the file is downloaded correctly or not?

Answer

Leo Gallucci picture Leo Gallucci · Nov 28, 2014

I was able to achieve download testing with Chrome.

  1. Follow this config setup: https://stackoverflow.com/a/26127745/511069

  2. Create a function waitFileExists(fileAbsPath) and performs your expectations after the file is completely downloaded: https://stackoverflow.com/a/27031924/511069