Drag & Drop upload
See original GitHub issueWe are still looking for an option to test Drag & Drop file uploads. Is there anything in the plans about this?
Would be nice if I could drop a fixture onto the selected subject. Something like this maybe:
// fixture reference according to:
// https://docs.cypress.io/api/commands/fixture.html#Shortcuts
cy.get('.dnd-upload-area').dropFile('fixture:image.jpg');
Thanks in advance 😊
Issue Analytics
- State:
- Created 6 years ago
- Comments:40 (10 by maintainers)
Top Results From Across the Web
File drag and drop - Web APIs | MDN
The main steps to drag and drop are to define a drop zone (i.e. a target element for the file drop) and to...
Read more >How To Make A Drag-and-Drop File Uploader With Vanilla ...
Drag -and-drop image uploader in action A demonstration of a web page in which you can upload images via drag and drop, preview...
Read more >Drag and Drop File Uploading - CSS-Tricks
I wanted to enrich the feed import experience by making allowing for drag and drop file upload alongside the traditional file input.
Read more >Drag and Drop Example - Uppy
Here you'll see a demo of how you might set up Drag and Drop with Uppy. autoProceed is on. Drop here or browse....
Read more >Creating a drag drop upload area | by Kim T - Medium
Here we will look at a quick way to implement drag/drop uploads without any external libraries/code. First off we need an area in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@egucciar You have to look at the way the particular drag and drop you want to test is currently working. The way I do this is, within the Sources panel of the DevTools, you set some Event Listener Breakpoints for Drag/drop, then you use the drag and drop normally in your app by dragging an image in. Then you can see exactly what these events look like and the data that it uses in your application.
Set a global Event Listener Breakpoint
The dataTransfer object from me dragging in a photo manually to their site
Doing this with the demo page of angular-file-upload, I can see that a
dragover
,drop
anddragleave
are all triggered (you’ll need to select and deselect them one by one as you set the breakpoint to inspect each one.From this, I can see that they have code around more data than my implementation above cared about in their
dragover
anddrop
event. They’re expecting atypes
array in thedataTransfer
object for example. And in order to get the filename to show up in the table, they have more data in their files array. The test code below should help get you started. I’m closing this issue.I’ve actually found a solution to my previous question, referring to this comment:
To drag and drop upload file
myfile.csv
fromfixtures/