BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
670 / 1048 · Module 14 — External Automated Testing of Mule Integrations← prev⊞ allnext →

14.24Don't use arbitrary sleeps

Bad:

await page.waitForTimeout(10000);

or:

await new Promise(r => setTimeout(r, 10000));

Then query once.

Why bad?

sometimes 1 sec was enough
→ tests unnecessarily slow

sometimes 12 sec needed
→ test flakes

Better:

poll expected condition
with timeout

This is the same principle you already know from UI automation.