Article Overview:
This article will cover how you can achieve the following:
How to access the downloaded file and verifying its content within Virtuoso.
Problem Statement:
In automated testing scenarios, it is often necessary to verify the content of a file that has been downloaded during a test. Manually checking the downloaded file for specific content, format, or file properties can be both time-consuming and inefficient. Users require a streamlined way to not only download files as part of a test but also validate the file’s content directly within Virtuoso.
This article provides a solution for accessing and verifying the details and content of downloaded files within Virtuoso using built-in variables and extensions.
Solution:
When a file is downloaded as a result of a test step (e.g., clicking a download link), it is automatically stored in Virtuoso for easy access and validation. The file or its details can be accessed by using two newly created variables:
- LAST_DOWNLOADED_FILE
- LAST_DOWNLOADED_FILE_DETAILS
How to access the properties of a downloaded file :
Steps:
1. Execute the Download Step:
- Perform the test step to download the file (e.g., clicking the "Download" button). The file will be downloaded and stored in the Virtuoso browser.
2. Check Download Details:
- Navigate to the Side Effects tab for this test step to view the details of downloaded files.
- LAST_DOWNLOADED_FILE: Stores the URL of the downloaded file.
- LAST_DOWNLOADED_FILE_DETAILS: Stores the details associated with the downloaded file.
3. Verify File Properties:
-
You can verify the filename, size, and length of the downloaded file using the variable $LAST_DOWNLOADED_FILE_DETAILS along with the "Assert" command to ensure the accuracy of all aspects of the downloaded file.
How to validate content in download File.
Steps:
1. Import the ShowPdf Extension:
- Add the ShowPdf extension to the extension manager of your project by clicking the link below and selecting the access level (Project or Organization).
- Extension Link: ShowPdf Extension
2. View Content in the Downloaded File:
-
Use the following step to view the content in the downloaded file:
ShowPdf($LAST_DOWNLOADED_FILES)
3. Check for Specific Content:
-
Use the "Look" NLP to search for specific content in the file.
Please refer to the example screenshot provided for further clarification on this process.
Comments
0 comments
Please sign in to leave a comment.