Closed yonigibbs closed 3 years ago
@yonigibbs hi there, thanks for submitting the issue!
I wasn't completely sure about this logic, but we indeed have place where we keep previously attached files. https://github.com/abramenal/cypress-file-upload/blob/main/src/helpers/attachFileToElement.js#L5
I think originally it was related to command chaining calls, but since not it is not supported, we can drop this logic as well.
Same problem here :) Is there any workaround?
Edit: found a way cy.get('input[type=file]').then($el => { $el.val('') });
Thanks everyone, just released the fix in v5.0.1
Awesome! Thanks for the really fast turnaround, @abramenal 👍
Hey @abramenal. I just tried this out with the example repo I originally linked, and unfortunately it doesn't look like it's resolved the issue (at least in my example). If you check out that repo (the master branch) and update the dependency to v5.0.1 then run Cypress the example test still fails. (It passes when using v4.1.1.)
@abramenal, I might be totally barking up the wrong tree here, but is it possible that NPM hasn't quite got the right version of the code? I see that the code fix was basically to remove the call to Array.prototype.forEach.call(element.files, f => dataTransfer.items.add(f));
(see PR here). I checked the latest code in this GitHub repo and there are now no more calls to Array.prototype.forEach.call
. But when I grab the package from NPM and look in dist/bundle.js
I still see that call (albeit in the minified form). Is that maybe the culprit?
@yonigibbs this is rare, but might be possible still. If you still see it there, then it is indeed this. Let me publish a new build then. Will you me able to check it again with v5.0.2
?
Yup, got the notification email and already tried. 5.0.2 does indeed resolve it. Thanks! 👍
With version 5.0.0, if the test simulates a user uploading one file then another (to replace the first one), on the second upload the system thinks that two files are being uploaded at once, rather than just one. This is different from what happened in v4.x, and is different from what happens if a user manually executes the uploads.
The code I'm using is written in Elm rather than JS or TS, so that might be related, I'm not sure.
A repo that demonstrates the issue is available here: https://github.com/yonigibbs/cypress-file-upload-repeated-uploads
Versions
Cypress 5.0.0 Ubuntu 18.0.4 Chrome 87 / FireFox 84