Cypress · Middle · Question 68 of 77
Why should tests avoid depending on the exact order of API items?
- 1Arrays can't be compared at all in Cypress assertions
- 2Order may differ between runs unless the API guarantees it
- 3Cypress randomizes the order of all arrays
Show the answer
Correct answer: Order may differ between runs unless the API guarantees it
Explanation
Assert on items by content or sort explicitly. Otherwise tests fail when the backend returns the same items in another order.