When I attach the file "file name" to "element"

Attach a file from tests/assets/ to a file input.

The file path is resolved against this.assetsFolder (default
tests/assets/). The target selector must address an <input type="file">.

Step pattern

When (I |we )*attach( the)* file "([^"]*)?" to "([^"]*)?"

Examples

Example #1
When I attach the file "profile-icon.jpg" to "#profile-icon-upload"
Example #2
When we attach file "resume.pdf" to "#resume"
Example #3
And I attach the file "logo.svg" to "input[name=logo]"
Example #4
When I attach file "report-2026-q1.csv" to "[data-testid=csv-upload]"
Example #5
Given I am on "/upload"
When I attach the file "video.mp4" to "#video-input"
And I press "Upload"
Then I should see "Upload complete"