In this chapter, we'll explore how to extract test artifacts.
Cypress by default generates videos when running headlessly and takes screenshots for the failed test.
We would like to have these test artifacts available - they could be of great help while debugging.
And of course, we aren't limited to videos and screenshots.
After my "Publish Test Results" task, I'll add a new "PowerShell" task.
Let's update the display name to "Download Artifacts".
Our script would be "Inline".
We'll first compress our videos
folder, and then we'll upload the .zip
file using the uploadfile
logging command.
We can do the same for screenshots as well - pretty straightforward.
Azure DevOps has an impressive collection of tasks ready to use.
On top of that, we have the Marketplace.
But even then, if you can't find a task that suits your needs, consider writing a PowerShell or command line or a bash script for it.
This script will have our videos available along with the logs.
Let's create a release.
Now, if you click on "Download All Logs", it will download all the task logs for us.
Within the download, we have our videos
folder.
I hope this quick tip helps you.