Skip to main content
Momentic can upload files into native file pickers and capture files that the page downloads. Uploads use fileUpload; downloads use the options on the click step that triggers them.

File upload

Use the File upload step to hand a file to the next native file picker that opens on the page.
The step installs a listener on the next file picker. It must run before the picker is triggered, otherwise nothing is uploaded.

Setup

  1. Add a File upload step with a source (see Sources below). The scalar form fileUpload: <path> works when you don’t need to rename.
  2. (Optional) Set name (File name) to the name the page sees. The file name defaults to the name in the URL or local path.
  3. Add a Click step on the button or element that opens the picker.

Sources

http:// or https://
Any publicly accessible direct file URL. Must resolve to the file itself, not an HTML wrapper or redirect.
file://<key>
Read downloadedFile from an earlier download step’s saved return value. The value already includes file://.
path
Absolute path, or path relative to the CLI’s working directory. CLI only. This differs from JavaScript and auth-state references, which resolve from the YAML file containing the step.Use fixtures/notes.md for a relative local file. In simplified YAML, ./notes.md, ../notes.md, and momentic://notes.md refer to files uploaded to Momentic by name, rather than files on your machine.
momentic://<name>
A file uploaded to your Momentic organization. Use the uploaded name, for example fileUpload: momentic://notes.md.

Limits

  • One file per step.
  • Max file size: 50 MiB.

File download

Momentic captures a download by attaching to the Click step that triggers it, rather than a separate step type.

Setup

  1. Add a Click step on the button or link that triggers the download.
  2. Set waitForDownload: true (Wait for download) on that step. Momentic waits for the download to complete before moving on.
  3. (Optional) Set saveAs (Save to environment variable, e.g. DOWNLOADED_FILE) to capture the return value. Its downloadedFile field contains the file URI. Later steps can reference it, including a File upload step via {{ env.DOWNLOADED_FILE.downloadedFile }}.

Limits

  • One file per Click step.
  • Download timeout: 30 seconds by default. Set click.downloadTimeout in milliseconds to change it.
  • The step returns a file reference for reuse in the same session. It does not validate the file’s contents or format.
  • The saved download is deleted after 5 minutes. Reuse it before that deadline.

Round-trip: download then upload

Download a file from one part of the app and upload it somewhere else in the same test.
  1. Click (download button) with Wait for download on and Save to environment variable set to DOWNLOADED_FILE.
  2. File upload with source {{ env.DOWNLOADED_FILE.downloadedFile }}.
  3. Click (the button that opens the next file picker).