11 / 18 · Module 14 — External Automated Testing of Mule Integrations · filtered: cheatsheet← 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.