Cypress · Method
cy.readFile
cy.readFile() reads a file from disk and yields its contents. It can reread the file while chained queries or assertions are not passing, so it works well for downloads and files created during a test.
Last updated
- Since
- 0.17.1
Syntax
cy.readFile(filePath)
cy.readFile(filePath, encoding)
cy.readFile(filePath, options)
cy.readFile(filePath, encoding, options)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
cy.fixture()cy.selectFile()cy.task()cy.writeFile()