Overview

The FILE_UPLOAD step allows you to upload files to file input elements. It bypasses native file dialogs to directly set files on the input element, making file upload testing reliable and automated.

Parameters

targetDescription
string
required
File input element selector. Must target an input element with type=“file”.
files
array
required
Array of file references to upload. Each file reference should include the file path or content.
waitForProcessing
boolean
default:"false"
Wait for the file upload to be processed by the application

Behavior

  1. Element Location: Finds the file input element using the selector
  2. Input Validation: Validates that the element is a file input (input[type=“file”])
  3. File Setting: Sets the files on the input element
  4. Event Firing: Fires appropriate change and input events
  5. Optional Processing Wait: Waits for file processing if configured

Common Use Cases

  • Uploading profile pictures or avatars
  • Submitting documents for verification
  • Testing file size and type validation
  • Uploading multiple files at once
  • Testing drag-and-drop file upload areas

Error Handling

The step will fail if:
  • The element cannot be found using the selector
  • The element is not a file input element
  • The specified files do not exist
  • The input element is disabled
  • The input does not accept the file type being uploaded
Clear error messages help identify whether the issue is with the selector, element type, or file availability.