Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
Using async await inside a .then() statement in cypress

In the cypress test I am writing I need to first get a value from an attribute of an element and then with that attribute value I can then make a query to the database and compare values on the page with those in the database.

To do this I have tried to use a .then() with asynchronous code inside and await the database query. However, cypress keeps generating the following error:

cy.then() timed out after waiting 15000ms.Your callback function returned a promise that never resolved.

Below is the code I am trying to use:

  checkForAndSelectNextDropdown(indexArray: Array<number>): void {
    for (const index in indexArray) {
      this.loadingUnitIcon.should('not.exist');
      cy.get('.symbolic-button').eq(parseInt(index)).click();
      cy.get('.task.open').eq(parseInt(index)).then(async (el) => {
        const parentTaskOrgID = el.attr('data-testid').split('-')[1];
        const queryResult = await GraphqlService.runQuery('siblingSequence.graphql', { parentTaskOrgID });
        const { workforce, vehicles } = queryResult;
        cy.contains(`Vehicles (${vehicles}) Workforce (${workforce})`).should('be.visible');
      })
    }
  }

If anyone can spot issues with my code or knows a way around this issue then please let me know

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda