Download Actions#

This section documents download action functions used in the automation testing suite.

downloadFile#

download-actions.downloadFile(page, downloadButtonText, downloadsDir, exactMatch, timeout, parentSelector, buttonIndex, buttonLocator)#

downloadFile

  1. Ensures the “Download” button is enabled

  2. Clicks it (via safeClickWithDelay or locator.click())

  3. Waits for the download event

  4. Saves the file to a specified directory

  5. Returns the downloaded file name (just in case you want to log or do more with it)

Arguments:
  • page (Page) – Playwright Page object

  • downloadButtonText (string) – The exact or partial text for the download button. E.g., ‘Download 1 Invoice(s) in PDF’

  • downloadsDir (string) – Where to save the downloaded file (defaults to )

  • exactMatch (boolean) – Whether the match must be exact or not (default )

  • timeout (number) – How long to wait for the button to become enabled & the download event (default 10s)

  • parentSelector (string) – (optional) A selector string for a parent element to scope the button search (e.g., ‘app-monthly-summary’)

  • buttonIndex (number)

  • buttonLocator (Locator) – (optional) A Playwright Locator for the button (overrides all other selection logic)

Returns:

Promise