Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

371
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!