-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.selectFile within cy.origin not working correctly #25261
Comments
@mduft Interesting! Thank you for the reproduction! I am able to reproduce the issue you are seeing with the example you provided and verifying it works without the use of cy.origin('https://www.w3schools.com', () => {
cy.visit('/howto/howto_html_file_upload_button.asp');
cy.fixture('example.json', { encoding: null }).as('myFixture')
cy.get('input[type=file]').selectFile('@myFixture', { force: true });
}); and am seeing: Something is def acting wonky with |
Are there any workarounds for this in the meantime? |
None that I know of. My 12.x update is completely blocked by this ATM. |
Any news on this? I'm stuck on Cypress 11.x without any way to update to 12.x due to this issue. |
We still cannot move forward with Cypress 12 due to this BLOCKER. Any plans to fix this anytime soon? |
This issue is also blocking one of my tests, so +1 |
Just wanted to chime in saying this issue is blocking the writing of our tests as well, would be great to have any updates. |
I was able to find a workaround for this issue by reading a fixture and stringifying it into an alias: cy.origin('https://www.w3schools.com', () => {
cy.visit('/howto/howto_html_file_upload_button.asp');
cy.fixture('example.json').then(JSON.stringify).as('myFixture'); // <= read the fixture with default encoding, then stringify it before saving it as an alias
cy.get('input[type=file]').selectFile('@myFixture');
}); |
Unfortunately that does not help with binaries (ZIP files, pictures, etc.), right? We're still blocked on this issue, and still are forced to stay on 11, even though it has been quite many 12 releases now - any chance to get this properly fixed? |
Please, any news on it?=(( it is a blocker indeed |
Hi, is there any solution about that. I have a problem same |
Thanks to @chrisbreiding, cy.origin('https://example.com', () => {
cy.visit('/upload');
cy.fixture('user.csv').as('myFixture');
cy.get('[data-testid="file-input"]').selectFile('@myFixture')
}); |
Can a fix for this be prioritized and expedited ? We have multiple use cases for uploading image files within origin ? I don't see any workaround for this. |
@shastrisubramaniam Have you tried the workaround described here? #25261 (comment) |
@jennifer-shehane My understanding is that the workaround above does not work for image files |
I'm also having this problem in cypress 13.16.0 . The cy.origin is interfering with .selectFile for image files. |
Current behavior
cy.selectFile behaves wrong as soon as wrapped in a cy.origin call. I had multiple different kinds of errors while playing with it, but did not get it to work properly somehow. I tried with the filename shortcut and the fixture syntax, both to no avail. The fixture syntax does look like it works, but somehow the file content is not properly attached to the input, e.g. an image is not shown correctly when uploading an image.
Desired behavior
File should be attached to selectFile properly.
Test code to reproduce
https://github.com/mduft/cypress-test-tiny/tree/master
Cypress Version
12.2.0
Node version
16.17.2
Operating System
Windows 11
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: