Cypress · Method
cy.writeFile
cy.writeFile() writes text or structured data to a file under the Cypress project root. It creates missing paths, overwrites files by default, and can use encodings or file options.
Last updated
- Since
- 1.0.0
Syntax
cy.writeFile(filePath, contents)
cy.writeFile(filePath, contents, encoding)
cy.writeFile(filePath, contents, options)
cy.writeFile(filePath, contents, encoding, options)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
cy.readFile()cy.fixture()cy.request()