[Bug] Upload to hidden input doesn't work
daniula opened this issue · 2 comments
Current behavior:
Uploading file to a hidden input ends up with below error:
CypressError: Timed out retrying: cy.trigger() failed because this element is not visible:
This element '<input#image-upload>' is not visible because it has CSS property: 'display: none'
Fix this problem, or use {force: true} to disable error checking.
There is no way to pass option { force: true }
as an error message suggests. Current workaround is calling .invoke('show')
before calling .upload()
:
cy.fixture('avatar.jpg').then((fileContent) => {
cy.get('=image-upload input')
.invoke('show')
.upload(
{ fileContent, mimeType: 'image/jpeg' },
{ subjectType: 'input' }
)
})
Desired behaviour:
.upload
command accepts force
option:
cy.fixture('avatar.jpg').then((fileContent) => {
cy.get('=image-upload input')
.upload(
{ fileContent, mimeType: 'image/jpeg' },
{ subjectType: 'input', force: true }
)
})
Versions
- cypress: 3.2.0
- cypress-file-upload: 3.0.4
- operating system: macOS 10.14.1
Hi @daniula
Thanks for your contribution.
Just released v3.0.5!
Check out the new API and re-open issue in case of any further issues.
@allcontributors[bot] add @daniula for question
I've put up a pull request to add @daniula! 🎉