Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] attachFile called once, but posting two files #276

Closed
8gentile opened this issue Mar 1, 2021 · 5 comments · Fixed by #290
Closed

[Bug] attachFile called once, but posting two files #276

8gentile opened this issue Mar 1, 2021 · 5 comments · Fixed by #290
Assignees
Labels
bug Something isn't working
Projects

Comments

@8gentile
Copy link

8gentile commented Mar 1, 2021

Current behavior:

Attempting to use this package with react-dropzone and I have the following code which does everything I want except it does it twice for every time I call it.

cy.get('[data-testid=dropzone]')
      .attachFile(['media/diff.png'], {
        subjectType: 'drag-n-drop',
      })
      .wait('@postMedia');

Screen Shot 2021-03-01 at 6 09 03 PM

If I add a second call, I get four. Seems like it is performing an additional attachment even though I have a single file in the array.

Desired behavior:

I only want one file uploaded, without the copy.

Steps to reproduce: (app code and test code)

I'm using a small png file for upload. My fixture for the api request returns a single media uri and looks like this:

{
  "uri": "https://storage.googleapis.com/testimg.getrevvup.com/o/43be7942-11c6-4956-b377-c3c12ceb28e3.png"
}

Versions

 "cypress": "^6.5.0",
 "cypress-file-upload": "^5.0.2",
 "react-dropzone": "^11.3.1",
@8gentile 8gentile added the bug Something isn't working label Mar 1, 2021
@8gentile 8gentile changed the title [Bug] [Bug] attachFile called once, but posting two files Mar 1, 2021
@8gentile
Copy link
Author

8gentile commented Mar 1, 2021

For clarity, if I remove the processingOptions

{
     subjectType: 'drag-n-drop',
 }

I get only a single file, the expected behavior.

I'm reporting this bug for the drag and drop option.

@boardofchris
Copy link

Same issue with { subjectType: 'drag-n-drop' }. Attached is test runner showing two upload events.

Screen Shot 2021-03-02 at 3 13 28 PM

@vitalii
Copy link

vitalii commented Mar 25, 2021

any workarounds for it?
Have the same issue

@abramenal abramenal added this to To do in v5 Mar 25, 2021
@adamalston
Copy link

One workaround is deleting the second uploaded file (from Cypress) so that only one file gets uploaded in the end. How to delete the duplicate upload would vary by project.

@Rafsonic
Copy link

Rafsonic commented Apr 2, 2021

Have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
v5
Done
Development

Successfully merging a pull request may close this issue.

6 participants