JohnPix
JohnPix

Reputation: 1843

How to set an attachFile folder in cypress-file-upload

In my tests I download the file first, then upload it further. By using cypress-file-upload I faced an issue that file can be uploaded only from fixtures folder. The question is how to upload the file from downloads folder? I tried just to add downloads in front of the file name but it doesn't work.

cy.get('[data-cy="dropzone"]')
            .attachFile('downloads/img.png', {subjectType: 'drag-n-drop' });

A fixture file could not be found at any of the following paths:

cypress/fixtures/downloads/img.png

Upvotes: 2

Views: 1579

Answers (1)

user16695029
user16695029

Reputation: 4461

Try a relative path

.attachFile('../downloads/img.png'

Upvotes: 3

Related Questions