https://cypress.io logo
any good way to upload a csv file on a drag and dr...
# e2e-testing
c
any good way to upload a csv file on a drag and drop section? im using something like this
Copy code
cy.fixture('example.csv', 'utf8')
  .then(csvContent => {
    // Select the file input element on the page
    cy.get('#file-input')
      // Trigger a 'change' event on the element with the CSV file content
      .trigger('change', { target: { files: [csvContent] } })
      // Assert that the file has been uploaded successfully
      .then(() => {
        cy.get('#upload-status')
          .should('have.text', 'File uploaded successfully')
      });
  });