bumpy-lion-62664
04/27/2023, 2:56 PMconst setup = () => {
cy.window()
.its('e2eFirestore')
.then(
(firestore: FirestoreService) =>
new Cypress.Promise(async (resolve) => {
await firestore.update(id, {
test: 'test'
});
resolve();
})
);
}
it('test', () => {
setup(); // doesn't wait for test data to be written in the db
cy.visit('/');
// it should display test data, but it doesn't, that gets loaded after
})
It seems cypress is not waiting for the Cypress Promise to complete. What is the recommended approach for handling async api functionality? I don't want to visit the route until the data has been stored in the db.
Thank you in advance!