siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
25 lines (16 loc) • 569 B
JavaScript
StartTest(t => {
//==================================================
t.diag('Some simple waitFor tests, check the docs to learn how to wait for different conditions')
let condition = false
setTimeout(() => { condition = true }, 500);
t.waitFor(() => condition, () => {
t.ok("Condition has been satisfied")
});
let condition2 = false
setTimeout(() => { condition2 = true }, 500);
// Or as a step in a chain
t.chain(
{ waitFor : () => condition2 },
{ diag : "Wait completed"}
);
});