
In playwright we can launch browser in two ways:
1. Just import the Page from @playwright/test lib
2. Create your own browser instance and pass the download path(Other launch options too)
By default Playwright creates a temp folder and downloads the files to that folder and deletes after execution.
If one needs to assert on the file downloaded and also to read and perform operation, its hard to keep that file in temp folder.
So the way to handle this would be store the file to a custom folder and then using Download API, save the file with actual name(As playwright downloads the file with random GUID)
Below code snippet shows how to achieve this and also uses Chai-Files assertion library to check for the existence of the file


Leave a comment