...

/

Fixtures and Integration

Fixtures and Integration

Learn the purpose of the fixture and integration folders, and how they can help us write more stable and organized tests.

We'll cover the following...

When creating a test suite for a web application, we have to consider network connection fails. Any function that relies on fetching data from a server or requires sending data to the server has side effects. And side effects can easily break tests.

Our network request can come back either successfully or with a failure, or anything in between. There are just too many status codes to keep in mind. To work around this, Cypress introduces a folder called “fixtures”.


What are fixtures?

Fixtures are pieces of static data that can be used inside our test cases whenever we need to stub a network request.

This way, we can eliminate any side effects, and ensure that our test cases are deterministic. We can also use them to match our data against a fixed set without cluttering the actual test cases.

Configuring fixtures

Let’s take the ...