Cypress · Senior · Question 67 of 76

How should Cypress tests handle randomness in the app, like shuffled lists?

Show the answer

Correct answer: Seed or stub the randomness for stable output

Explanation

Stub Math.random in onBeforeLoad or set a seed via config to make tests repeatable.

Further reading

Problem with a question

Cypress · Senior · question 67

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