You can load fixture data using the cy.fixture()
command. The tests in the cypress/integration folder show how to:
- Load a single file in single-fixture-spec.js
- Load multiple files using closures in multiple-fixtures-spec.js
- Load multiple files once or before each test in load-fixtures-spec.js
- Require multiple JSON fixtures in require-fixtures-spec.js
- Iterate over a list loaded from a JSON fixture in list-spec.js
For more examples see the "Fixtures" section in the Cypress Testing Workshop.