Data driven testing in Cypress using Fixtures
In the previous post here we saw how to read external files in Cypress using cy.readFile. Cypress also provides another way to read files. In this post, I will show how to Fixtures to do data driven testing in Cypress. ####Syntax#### According to documentation, syntax is as below. cy.fixture(filePath) cy.fixture(filePath, encoding) cy.fixture(filePath, options) cy.fixture(filePath, encoding, options) ####Comparison with cy.readFile#### Main difference between cy.readFile and cy.Fixture is that former one starts looking for the files from project root folder and later looks for files under Fixture folder. cy.Fixture supports a wide range of file types/extensions like json, txt, html,jpeg,gif,png etc. If file name is not specified it looks for all supported filetypes in specific order starting with JSON. We can even assign alias to this , which will help to reuse this later on. ...