Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download a file protractor test case

Tags:

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?

like image 837
Hmahwish Avatar asked Nov 28 '14 17:11

Hmahwish


People also ask

How do you write a test case using a protractor?

Files required by ProtractorThe test code is written by using the syntax of our testing framework. For example, if we are using Jasmine framework, then the test code will be written by using the syntax of Jasmine. This file will contain all the functional flows and assertions of the test.

Which is the default test framework for protractor?

By default, Protractor uses the Jasmine test framework for its testing interface. This tutorial assumes some familiarity with Jasmine, and we will use version 2.4. This tutorial will set up a test using a local standalone Selenium Server to control browsers.

What is protractor e2e testing?

Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, using Selenium. We can say in other words that Protractor is a tool that helps us to test Angular Apps using Selenium.


1 Answers

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

like image 67
Leo Gallucci Avatar answered Oct 03 '22 20:10

Leo Gallucci