I am working on a flashcard app where each flashcard has a "term" and a "definition".
Each form field is accessible by a "data-testid" of either "term-{index value}" or "definition={index value}"
The code I've been trying to execute looks something like this:
let i = 0
let randomNumber = Math.floor(Math.random() * 20))
while (i < randomNumber) {
// Run Cypress code using "i" variable value
}
Currently, Cypress won't run the code.
I believe my issue has to do with the asynchronous nature of Cypress and the synchronous nature of the code above. Would anyone happen to know how I can get something like this code working?