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

This step defines the test for attaching files to the file input element, enabling their upload for use in a subsequent action.

 

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


A folder containing a set of test files (e.g., images, documents, etc.) should be placed under the tests/assets directory.
These files must be uploaded in advance with the appropriate file name. During the feature steps, the files are referenced and loaded into the file input element. In the subsequent step, the intended action is performed on the uploaded file.

For proper configuration of the tests/assets folder path, see the Global Settings page.

 

Create a step that enables attaching a file to a field identified by its id|class|name|label.

Example:

When I attach the file "profileIcon.jpg" to "#profileIconUpload"