Assert on Your Redux Store with Cypress

Share this video with your friends

Send Tweet

Cypress doesn't provide out-of-the-box ability to make assertions on our frontend stores, so let's expose the store to the tests, and assert on it. We'll use our knowledge of Cypress's asynchronous programming style to access properties and functions on the store using cy.its and cy.invoke.

Recommended Homework:

  • Consider why it's valuable to test against your frontend store when you can test against the UI
Matt Pedersen
Matt Pedersen
~ 5 years ago

Hi Brett! Thank you for the course! I'm loving it so far!

I have a question: would you consider checking Redux state in this manner a good practice for real projects? You mentioned in a previous lecture (and I've read elsewhere) that testing implementation details can create brittle tests and it seems like this might fall into that category?

I totally understand that this lecture is probably aimed at showing off the capabilities of Cypress rather than suggesting this as a good practice. I'm just curious to hear your thoughts!