Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

374
Vistas
Trying compare 2 CSV File in Cypress

I'm trying to compare 2 CSV files, the intention is to verify that what I'm uploading contains the same information as what I'm downloading. The problem is that only 1 of the files is returning the values, the other one returns null.

it.only('Download a Material', function () {

  var csvDownloaded = 'cypress/downloads/Materiais.csv';
  var csvUploaded = 'cypress/fixtures/materials-configuration/MaterialsUpload.csv'

  materialsConfig.donwloadCsv();
  cy.readFile(csvUploaded, 'utf-8').then((uploadTxt) => {
    cy.readFile(csvDownloaded, 'utf-8', { timeout: 10000 }).then((downloadTxt) => {
      cy.readFile(downloadTxt, 'utf-8', { timeout: 40000 }).should('eq',uploadTxt)
    });
  });
});

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think your problem is that you don't need to use cy.readFile on the result of cy.readFile(csvDownloaded), but can instead just compare it's result with the result of cy.readFile(csvUploaded). I think you're getting null for one of your comparison values because cy.readFile(downloadText) isn't a filepath that Cypress can find and open.

  cy.readFile(csvUploaded, 'utf-8').then((uploadTxt) => {
    cy.readFile(csvDownloaded, 'utf-8', { timeout: 10000 }).then((downloadTxt) => {
      expect(downloadTxt).to.equal(uploadTxt);
    });
  });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda