From the course: Advanced Cypress

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

What are Cypress fixtures?

What are Cypress fixtures? - Cypress Tutorial

From the course: Advanced Cypress

What are Cypress fixtures?

In this video, we're going to talk about setting up fixtures. And fixtures are a way of setting up some local data that can be used for a variety of things. In this video, we're going to look at understanding how to set up and import those fixtures or those bits of hard-coded data that we can use. And then we're going to actually write a test that uses stubbed data or this kind of hard-coded set of fixtures to kind of mock out a network request so that we'll have a set of reliable data. So let's go ahead and dive in. So we have our test runner running. We've got our application running locally. And we're in our my first test.spec.js. So first of all, whenever you initially make your Cypress like initial setup, Cypress bundles this fixtures folder. And inside of it, they've got an example.json file. Now you can use this, which we're going to in this video. You can add more JSON files as well. And the default path to finding and accessing these fixtures, which we'll talk about in a…

Contents