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

Large File handling - Cypress.fixture(fileName, fileEncoding) - cannot create a string longer than #16823

Closed
LoganWlv opened this issue Jun 7, 2021 · 2 comments

Comments

@LoganWlv
Copy link

LoganWlv commented Jun 7, 2021

Current behavior

Cypress.fixture(fileName, fileEncoding) breaks when loading a 500MB csv file.

image

Desired behavior

Be able to load a ~500MB fixture.

Test code to reproduce

.js

import { Given, Then } from 'cypress-cucumber-preprocessor/steps'

Given('Load file {string} and {string}', (fileName, fileEncoding) => {
  cy.fixture(fileName, fileEncoding).then(v => console.log(v))
})

Then('File should be loaded', loadedFile => {
  return true;
})

.feature

Feature: Test

  Scenario Outline: Load large file

    Given Load file '<file>' and '<encoding>'
    Then File should be loaded
    Examples:
      | file              | encoding |
      | tuto_DB_italy.csv | utf8     |

use any .csv file that size is at least 500MB

Versions

dependencies:

"@testing-library/cypress": "^7.0.6",
"clipboardy": "^2.3.0",
"cypress": "^7.4.0",
"cypress-cucumber-preprocessor": "^4.1.0",
"cypress-file-upload": "^5.0.7"

OS: MacOs Catalina 10.15.7
Browser: Chrome 91

@LoganWlv
Copy link
Author

LoganWlv commented Jun 7, 2021

It seems to happen in the server side.

Extra logs:

image

Here's what I get in the web socket:

image

@BlueWinds
Copy link
Contributor

BlueWinds commented Feb 17, 2022

In Cypress 9.0.0, we added the null encoding, which helps significantly when dealing with large fixtures and files. This transfers the data as an ArrayBuffer rather than a base64 encoded string.
https://docs.cypress.io/api/commands/fixture#Arguments

Cypress still tends to encounter issues with files in the gigabyte range, but 500mb should now be doable. Going to close this issue as resolved, feel free to let us know if the above still isn't working for you.

It's possible you may still run into #7365, but hopefully this is at least a step forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants