cypress-file-upload: [Bug] Support Firefox (Cypress 4.0.1)

Current behavior:

I have a test to upload a file (image/png) and it’s been working fine on Chrome with Cypress 3.x and the [new release 4.0](https://cypress.io/blog/2020/02/06/introducing-firefox-and-edge-support-in-cypress-4-0/9. But when I run it on Firefox (with Cypress 4.0.1) it doesn’t work anymore.

  • Firefox Developer Edition 73 image

Desired behavior:

  • Chrome 79 (the test is passing on Cypress 3.x and Cypress 4.0.1 image

Steps to reproduce: (app code and test code)

The HTML is like this:


  <label>
    <img src="image.png" alt="">
    <span>Change avatar</span>
    <input type="file" name="picture" accept="image/*" placeholder="http://" data-test="avatar" class="sr-only">
  </label>
  <div>
      <i class="icon-check-circle"></i>
      <div data-test="avatarMsg" class="c-inner-text">Avatar updated!</div>
  </div>

The Cypress is the following:

  it('user1 changes avatar and profile settings', () => {
    const profilePicture = 'imageTest.png' // at fixtures/imageTest

    cy.getByDT('settingsBtn').click()

    cy.fixture(profilePicture, 'base64').then(fileContent => {
      cy.get('[data-test="avatar"]').upload({ fileContent, fileName: profilePicture, mimeType: 'image/png' }, { subjectType: 'input' })
    })

    cy.getByDT('avatarMsg').should('contain', 'Avatar updated!')
  });

Versions

  • Cypress 3.5 (working on Chrome 79)
  • Cypress 4.0.1 (not working on Firefox)
  • Firefox Developer Edition 73
  • Mac OS Mojave

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@dotwork is this relevant only in Firefox? If not, let’s move to a separate issue.

As for the mime type, I’ll revert back the possibility to provide mime type manually, now there’s auto-detection mechanism which relies on mime package.

I installed the latest changes from the plugin but it still doesnt upload the image in firefox, it doest on chrome though without problems as usual.

I dont get an error in firefox its just passing it but not uploaded, has anyone else have the same issue with latest version of cypress?

I am having similar issue, Its working on chrome but not on firefox, its not failing it but its not working on firefox for sure.

Hi @sandrina-p Thanks for submitting the issue!

Never tested v4 yet, so any contribution is appreciated. I expect to have time fixing it later this week