Other helper functions
File uploads
Function
cy.upload(fileName, fileType)
File uploads are not yet natively supported in Cypress. We have a custom command for uploading files that’s based off of this workaround. It must be chained from a command that retrieves an upload input element.
cy.findByText('Upload', { selector: 'button' }).upload(
'src/platform/testing/example-upload.png',
'image/jpg'
);
Source file
Description
Allows us to upload files, which Cypress does not natively support. This implementation is based on this workaround.
Arguments
fileName
- a stringfileType
- a string
This function must be chained from a command that retrieves an upload input element.
cy.findByText('Upload', { selector: 'button' }).upload(
'src/platform/testing/example-upload.png',
'image/jpg'
);
Expand Accordions
Function
cy.expandAccordions()
Source file
Description
The custom command cy.expandAccordions()
expands all accordions and AdditionalInfo
components.
Arguments
None
Help and feedback
Create an issue ticket to suggest changes to this page