Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

375
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda