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

153
Visualizações
Testcafe - Wait for an HTTP call to respond without waiting for an arbitrary period of time

In my project, I have a suite of end-to-end tests created using testcafe.

Context

In some scenarios, the user/script has to do some operations on the page, like clicking on a button, that triggers an HTTP call to the BE to fetch some result.
Since it's an async operation (that can take a bit of time) I'm forced to put a wait(X) to be sure that the HTTP call has responded.

For example:

test("should render result with ascending order when lowerPrice option got selected", async (t) => {
  const sortButton = Selector(".sortsortButton");
  const lowerPriceSortSelector = Selector(".lowerPriceSortSelector");
  const gridResult = Selector(".gridResult");

  await t
    .click(sortButton)
    .click(lowerPriceSortSelector)
    .wait(5000) //<--- I want to avoid this!
    .expect(gridResult.exists).ok();
});

I've checked but in the documentation, I haven't found any utility that allows waiting until a given route has replied.

How Cypress handle it

In the past, I've played with Cypress and there was this awesome feature: https://docs.cypress.io/api/commands/wait#Alias

// Wait for the route aliased as 'getAccount' to respond
// without changing or stubbing its response
cy.intercept('/accounts/*').as('getAccount')
cy.visit('/accounts/123')
cy.wait('@getAccount').then((interception) => {
  // we can now access the low level interception
  // that contains the request body,
  // response body, status, etc
})

Questions

There is anything similar in Testcafe?
If not, how can I do to avoid waiting an arbitrary period of time?

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