File upload
Use the File upload step to hand a file to the next native file picker that opens on the page.Setup
- Add a File upload step with a source (see Sources below). The
scalar form
fileUpload: <path>works when you don’t need to rename. - (Optional) Set
name(File name) to rename the file as it’s presented to the page. Defaults to the name in the URL or local path. - 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>
Reference a file captured by an earlier download
step via its saved environment variable.
path
Absolute path, or path relative to
momentic.config.yaml. CLI only.Limits
- One file per step.
- Max file size: 50 MB.
File download
Momentic captures a download by attaching to the Click step that triggers it, rather than a separate step type.Setup
- Add a Click step on the button or link that triggers the download.
- Set
waitForDownload: true(Wait for download) on that step. Momentic waits for the download to complete before moving on. - (Optional) Set
saveAs(Save to environment variable, e.g.DOWNLOADED_FILE) to capture the resulting file URL. Later steps can reference it, including a File upload step viafile://{{ env.DOWNLOADED_FILE }}.
Limits
- One file per Click step.
- Download timeout: 10 seconds.
- Max file size: 50 MB.
- Downloaded files are deleted at the end of the session, or after 15 minutes, whichever comes first.
- Direct file inspection (reading contents, checking format, verifying the filename) is not supported.
Round-trip: download then upload
A common pattern is downloading a file from one part of the app and uploading it somewhere else in the same test.- Click (download button) with Wait for download on and Save to
environment variable set to
DOWNLOADED_FILE. - File upload with source
file://{{ env.DOWNLOADED_FILE }}. - Click (the button that opens the next file picker).