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'
);
NONE

Source file

upload.js

Description

Allows us to upload files, which Cypress does not natively support. This implementation is based on this workaround.

Arguments

  • fileName - a string

  • fileType - 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'
);
CODE

Expand Accordions

Function

cy.expandAccordions()

Source file

explandAccordions.js

Description

The custom command cy.expandAccordions() expands all accordions and AdditionalInfo components.

Arguments

None


Help and feedback