The Cypress programming model is similar to async and await. When you write Cypress commands, they will be enqueued to be run at a later time, but they will run in the same order as you write them.
Recommended Homework:
Verify that Cypress commands run in the order you write them, and not based on when they asynchronously finish. Recommended solutions include using timeouts, and/or synchronously available values as with cy.wrap