Steps
This example runs against our test webshop and proceeds to download a receipt for a previous purchase. It includes the following steps:- Logging in to the website
- Navigating to the account page
- Downloading a linked file
href
value and use it to retrieve the file with a GET
request (performed with axios, for example).
file-download.spec.ts
file-download-alt.spec.ts
Takeaways
- Use environment variables to inject secrets.
- Compare the expected file with the newly downloaded one.
- There is more than one way to download a file within our script.
Further reading
- Playwright’s documentation on downloading files.