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] Upload to hidden input doesn't work #41

Closed
daniula opened this issue Mar 26, 2019 · 2 comments
Closed

[Bug] Upload to hidden input doesn't work #41

daniula opened this issue Mar 26, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@daniula
Copy link

daniula commented Mar 26, 2019

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.

https://on.cypress.io/element-cannot-be-interacted-with

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
@abramenal
Copy link
Owner

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

@allcontributors
Copy link
Contributor

@abramenal

I've put up a pull request to add @daniula! 🎉

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
None yet
Development

No branches or pull requests

2 participants