Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!