I have the error: 'Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.' when changing the format of a test from using promise .then() based syntax which worked to use async/await. Which was my attempt below.
it('downloads successfully', async () => {
cy.get(downloadButton).click();
const csv = await cy.readFile(filename, { timeout: 15000 });
csv.should('have.length.gt', 20);
expect(csv, 'number of records').to.have.length(10);
})
before
cy.readFile(filename, { timeout: 15000 })
.should('have.length.gt', 20)
.then(validateCsv);