Cypress · Senior · Question 74 of 76
What is the main risk of using cy.task to read the database directly in assertions?
- 1Tasks can't connect to databases at all
- 2Tests couple to schema details instead of behaviour
- 3It makes tests much slower than UI assertions
Show the answer
Correct answer: Tests couple to schema details instead of behaviour
Explanation
Prefer checking outcomes through the UI or API; use direct DB checks sparingly for side effects that aren't visible.