Reputation: 1
How to automate the drag and drop feature in an application using cypress? I am not able to pick a file using cypress. I have tried using cypress-file-upload
Upvotes: 0
Views: 1135
Reputation: 459
there are some solutions:
First option: I recommend using cypress-drag-drop plugin you can know more about this option in the following link https://github.com/4teamwork/cypress-drag-drop
Second option: You can use cypress-file-upload plugin you can know more about this option in the following link https://www.npmjs.com/package/cypress-file-upload in this case you will need to something similar to:
cy.get('your-element').attachFile('myfixture.json', { subjectType: 'drag-n-drop' });
or
cy.get('your-element').attachFile('image.jpg',
{
subjectType: 'drag-n-drop', events: ['dragenter', 'drop']
})
Upvotes: 1