Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda