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] Support Firefox (Cypress 4.0.1) #154

Closed
sandrina-p opened this issue Feb 10, 2020 · 17 comments · Fixed by #163
Closed

[Bug] Support Firefox (Cypress 4.0.1) #154

sandrina-p opened this issue Feb 10, 2020 · 17 comments · Fixed by #163
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sandrina-p
Copy link

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

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

@abramenal abramenal added the help wanted Extra attention is needed label Feb 17, 2020
@bbonevPIT
Copy link

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.

@bbonevPIT
Copy link

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?

@abramenal
Copy link
Owner

abramenal commented Mar 2, 2020

Hi @bbonevPIT v4 is not yet released, expect it not later than Wednesday this week 🥂

Apologies for improper issue status, it was closed occasionally.

@abramenal abramenal reopened this Mar 2, 2020
@bbonevPIT
Copy link

@abramenal ah great, thank you very much. great job guys!

@dotwork
Copy link

dotwork commented Mar 20, 2020

My company has started using Cypress for our functional testing and we're loving it. We're hoping to replace our robot framework tests, but we need to have Firefox coverage. Any chance this fix will be coming in the next week or so?

@abramenal
Copy link
Owner

Hi all,
@sandrina-p @bbonevPIT @dotwork it's supported now with v4 release.
Please check out!

Cheers!

@dotwork
Copy link

dotwork commented Mar 23, 2020

Excellent, thank you!

@dotwork
Copy link

dotwork commented Mar 23, 2020

I have installed version 4.0.1, and am now getting the error TypeError: cy.get(...).upload is not a function on both Chrome and Firefox.

@dotwork
Copy link

dotwork commented Mar 23, 2020

To sanity check, I downgraded and re-ran tests on Chrome without any code changes and it worked fine.

@abramenal
Copy link
Owner

@dotwork the command itself was upgraded to simpler notation, please check out latest API guide 😄

@dotwork
Copy link

dotwork commented Mar 23, 2020

Got it, thank you!, nice improvement to the command! Much cleaner.

@dotwork
Copy link

dotwork commented Mar 23, 2020

I'm having a problem with the file upload. When uploading a valid docx file, it works on my test server if I do it manually, but when cypress does it, I get an error about it being corrupted. I've tried not passing an encoding, as well as using base64 which is what was working on the previous version, and binary as well.

Also, I am getting more generic mimetypes when I check the uploaded file. Where before I got:
epub > application/epub+zip
docx > application/vnd.openxmlformats-officedocument.wordprocessingml.document
odt > application/zip to equal application/vnd.oasis.opendocument.text
now all 3 above just return application/zip.

@dotwork
Copy link

dotwork commented Mar 23, 2020

Here is the docx file I am testing...
valid_minimal.docx

@abramenal
Copy link
Owner

@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.

@SonaliQA
Copy link

I know this is closed bug but still find the same issue on firefox browser
Upload a file is not working on firefox but its working on chrome and electron.
its not giving any error but file is not uploading as well
Using
"cypress": "^4.7.0",
"cypress-file-upload": "^4.0.0"

@abramenal
Copy link
Owner

@SonaliAvaya can you please do the following:

  • check your setup with latest plugin version (v4.0.7 as of now)
  • if that is not working, please check out the usage examples in README or complete setups in recipes folder
  • if that is not working still, please create a new issue and describe more specifically your setup, issue so I can work on that

Right now in auto tests suite I execute tests against Firefox, Chrome and Electron, so there's high possibility that something is wrong with your code setup ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants