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

Fixture doesn't contain mimetype when loaded twice #26095

Closed
royk opened this issue Mar 14, 2023 · 5 comments
Closed

Fixture doesn't contain mimetype when loaded twice #26095

royk opened this issue Mar 14, 2023 · 5 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory stale no activity on this issue for a long period

Comments

@royk
Copy link

royk commented Mar 14, 2023

Current behavior

When loading a file using fixture, in the first test the file is loaded with a mimetype. In the second test, the mimetype is empty.

Desired behavior

Fixture should be loaded with mimetype every time.

Test code to reproduce

https://github.com/royk/cypress-test-tiny-1

Cypress Version

12.7.0

Node version

v16.18.0

Operating System

Windows 10.0.22621

Debug Logs

No response

Other

No response

@lmiller1990 lmiller1990 added the pkg/driver This is due to an issue in the packages/driver directory label Mar 16, 2023
@lmiller1990
Copy link
Contributor

I confirmed this in indeed the case - that's very strange, the second uploaded file type is '', instead of audio/wave. I tried creating a different fixture named kicks2.wav and it works - this seems to only happen when selecting the same fixture.

@BartRamharter
Copy link

BartRamharter commented May 11, 2023

Hi Lachlan,
We just discovered the same bug. We want to use the same PDF as input in different input[type='file'] fields in our tests so put the cy.fixture in the beforeEach() hook but then only the first test succeeds (even if that test uses the pdf to upload in several input fields). From the second test on, the uploads fail because of the missing file mime type.
We also expirimented in putting the cy.fixture() call near the code that uses the .selectFile but then it will fail after the first upload input field even in the same test.
Extra remark: we also noticed when the bug happens that the filename of the fixture is also empty, not just the mimetype. Our front-end shows the reported filename of the uploaded file and this is also blank after the second cy.fixture call for the same PDF.
BTW: for people impacted by this issue: simply not using cy.fixture() but using the actual file path at .selectFile(file), will do the trick of getting to run the tests successfully. Downside is this will read the same file over and over again, but at least it will get the tests to run as they should.

@lmiller1990
Copy link
Contributor

BTW: for people impacted by this issue: simply not using cy.fixture() but using the actual file path at .selectFile(file), will do the trick of getting to run the tests successfully.

Woah, nice find. This is very useful for when someone tries to debug and patch this. I am not sure I've got the bandwidth to do it now, but a PR would be very welcome if anyone wants to take a look. I wonder if cy.fixture is doing some caching that selectFile doesn't do that somehow leads to this bug.

@lmiller1990 lmiller1990 removed their assignment Jun 28, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Nov 8, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

4 participants