Rayrun
← Back to videos

How to download file & attach to report | Playwright Tutorial part - 68

In this video, we'll learn how to download a file and attach it to the playwright report using testinfo, we can use the same to attach screenshots to the report.

In this video, the presenter demonstrates two topics: the use of test info and how to download a file.

The presenter starts by showing the viewers the screenshot that is generated after the completion of a test. However, they express the need to generate a screenshot for each step of the test. They show how to use the await page.screenshot function to generate screenshots and then use testInfo.attach to attach the screenshots to the test report. They demonstrate this by adding screenshots after the login step and after toggling the dropdown.

Next, the presenter showcases how to download a file using Playwright. They navigate to a specific URL where they input some text and click on a "Generate File" button. After the file is generated, they click on the "Download" button. They use promise.all to wait for the download event and use download.saveAs to specify the filename and save the file in a specific folder. Then, they demonstrate how to attach the downloaded file to the test report using testInfo.attach. The presenter shows that the downloaded file is saved in the project's root folder and is also copied to the Playwright report folder.

In summary, the video covers how to generate and attach screenshots for each step in a test using test info, and how to download and attach files in a test report using Playwright.

Related Videos

PLAYWRIGHT - UPDATES TO UI MODE & TRACEVIEWER
PLAYWRIGHT - UPDATES TO UI MODE & TRACEVIEWER
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright Version 1.14 | Playwright Tutorial - Part 45
Playwright Version 1.14 | Playwright Tutorial - Part 45
Playwright Test Runner | Playwright - Part 22
Playwright Test Runner | Playwright - Part 22
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.