The mabl Trainer detects and automatically adds download assertions whenever a download completes during a training session. Upon download completion, the Trainer shows a new assertion step for your download. This article explains how to work with download assertions in the Trainer, including how to…
- Configure download assertions
- Assert against files with dynamically generated filenames
- Replay download assertions
A download assertion step in the Trainer
Note
Download assertions are not currently supported for the following:
- Click steps that use CSS or XPath do not trigger a download assertion
- Multiple downloads in parallel
Configuring download assertions
By default, the Trainer asserts against the name of the downloaded file. To configure the download assertion, take the following steps:
- Hover over the download assertion step.
- Click on the pencil icon that appears.
- Update the value for the attribute(s) that you want to assert against, including filename, MIME type, exact file size, minimum file size, and maximum file size
- Click OK.
Configuring wait times
Download assertions wait up to 30 seconds before timing out. If the download takes longer than the default 30-second download timeout, add a wait step before the download assertion.
Dynamically generated filenames
If your application creates a dynamically generated filename for the file download, you may try one of the following workflows to assert that the file has downloaded:
Use mabl variable syntax
If you know how the filename is generated, or if you can extract the filename from the page before downloading, store the filename in a variable and assert against that filename using mabl variable syntax.
Using mabl variable syntax in a download assertion
Remove the filename assertion
If you do not know what the filename will be before downloading it, remove the filename from the download assertion and assert against other attributes, such as the MIME type or file size.
Limitation
mabl does not support asserting against partial strings in file names or using wildcard (*
) characters. If this functionality is important to your team, please let us know in the mabl Product Portal.
Replaying download assertions
To replay a download assertion in the Trainer, move the Trainer cursor to just above the click step that triggers the download and click play.
The Trainer automatically elides numbers that are added to repeatedly downloaded files so that foo (1).zip
becomes foo.zip
for the assertion comparison. This feature enables replay testing without need of manual file cleanup.
Manual download limit
Due to Chrome limits, you may only download a file 100 times. If you replay a download step in the mabl Trainer more than 100 times, Chrome automatically opens a save file modal for every additional download, preventing further replay of the download step. To restore replay functionality, remove the downloaded files from your machine.