Playwright

Trigger and verify a download

Medium70 pts
  • waitForEvent
  • Downloads
  • File Handling
Practice app · Document Vault

File upload and download, cookies, localStorage, sessionStorage and JavaScript execution.

Test URL
/lab/playwright-trigger-and-verify-a-download

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Intercept and verify a file download event when exporting reports.

Your Task

  1. 1Navigate to the file management vault at TEST_URL.
  2. 2Set up an asynchronous listener for the browser download event.
  3. 3Click the download report button (#download-button or #download-report).
  4. 4Await the completed download event.
  5. 5Assert that the downloaded file's suggested filename is 'report.csv'.

Validation Checks

  • File management vault is loaded at TEST_URL
  • Download event listener is registered before clicking
  • Download button (#download-button) is clicked
  • Downloaded file's suggested filename is verified as 'report.csv'
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Actions & inputs