Thanks for all the help
You can use the selectFile method from cypress to upload the file.
cy.get('[title="Choose File"]').selectFile('path/to/txt') //Selects the Filecy.get('input[title="Upload"]').click() //Clicks upload button
You need to target the input[type="file"]
to add the file to the input
cy.get('input[type="file"]').selectFile(fileName).trigger('input'); // may also be required cy,get('input[type="submit"]).click();
or by finding the label and using sibling()
to move to the input
cy.contains('label', 'Choose file').sibling('input[type="file"]').selectFile(fileName).trigger('input'); // may also be required cy,get('input[type="submit"]).click();