Best Practices: Using global fixtures and intercepts to test adding new data #20710
Unanswered
groovenectar
asked this question in
Component Testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Say there is a fixture of
users
, and an XHR request adds a new user... then it's necessary to check that a listing table has the newly faked added user.The route/endpoint for the intercept is still the same, e.g.
/api/users/list
, but it will have to temporarily return a different fixture that contains the newly-added user.The intercepts would not be defined in test files, but rather in a global suite of commands using intercepts and fixtures that create test responses for the entire application.
Would this be a common use case to test adding data? Is there a way to make an internal session for Cypress to tell the intercepts to return the appropriate fixture with added data, or are there any best practices for this scenario?
Beta Was this translation helpful? Give feedback.
All reactions