This section describes the procedure for downloading a file and checking the download results.
Download a file
Use the Click or Click and download file command.
How to use different commands
When testing only in Chrome, Firefox, or Edge, either Click or Click and download file is acceptable, and you do not need to do anything special about the download operation. For example, if you specify that you want to "Click" on some button, the download will be performed automatically.
In the case of IE, simply clicking a button for downloading does not allow the above keyboard operation, so a special the Click and download file command is used, since MagicPod does not know which button will trigger the download process, If you specify the Click and download file command in Chrome, Firefox, or Edge, the operation will be the same as Click, so you can use the same test case for IE and these browsers.
The behavior when a file download occurs during the operation under test will vary depending on the browser.
- In case of Chrome, Firefox, and Edge
- No download confirmation dialog is displayed, and the file is downloaded to a predetermined location (by default, the magicPod/downloads folder under the desktop).
- In case of IE11
- Since IE11 cannot automatically hide the confirmation dialog, the file is saved in the same folder as in Chrome, Firefox, and Edge using keyboard operation. This makes the operation slower than other browsers.
- It also tends to be more unstable than other browsers in terms of operation, so unless you have a special need to test downloads in IE, we recommend that you test in a different browser.
Check download result
Check of file name
Use the Assert download completed command.
To check if a file has been downloaded without problems, check if a file with a specific name is in the download folder. Regular expressions can be used for file names. (e.g. "data_file_ver2.txt", "data_file_ver.*\.txt", etc.)
Check file contents (text files only)
Currently, MagicPod does not allow you to open downloaded files,
However, you can use the Store text file contents command to save the contents of a text file (TXT, CSV file) to a variable for confirmation or use. Regular expressions can be used for file names. (e.g. "data_file_ver2.txt", "data_file_ver.*.txt", etc.)
Waiting for time-consuming downloads
In case the file download seems as though it may take some time (10 seconds or more), enter the Wait until download completed command before the confirmation command. Regular expressions can be used for the filename here, too. If it finishes within 10 seconds, it will wait with the confirmation command alone, so you do not need to enter the wait command.
The final command will be as follows