Skip to content

Instantly share code, notes, and snippets.

@dariayermolova
Created January 21, 2020 13:42
Show Gist options
  • Save dariayermolova/c2d05c0f29d5d4fb7d436e1e639cabaf to your computer and use it in GitHub Desktop.
Save dariayermolova/c2d05c0f29d5d4fb7d436e1e639cabaf to your computer and use it in GitHub Desktop.
cypress (upload file)
import 'cypress-file-upload';
Cypress.Commands.add('uploadFile', (fileName, input, mime) => {
cy.fixture(fileName).then(fileContent => {
cy.get(input).upload(
{ fileContent, fileName, mimeType: mime },
{ subjectType: 'input' },);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment