Cypress · Senior · Question 74 of 76

What is the main risk of using cy.task to read the database directly in 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.

Further reading

Problem with a question

Cypress · Senior · question 74

Test yourself

Take the Cypress · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz