handleWait function
Last updated: 2026-03-05T20:45:07.036Z
Metrics
LOC: 20
Complexity: 5
Params: 1
Signature
handleWait(step: FlowStep): : Promise<StepResult>
Source Code
async function handleWait(step: FlowStep): Promise<StepResult> {
const timeout = step.waitTimeout ?? 10_000;
if (!step.selector) {
// Simple delay
await sleep(timeout);
return { status: "success" };
}
// Wait for element to appear
const start = Date.now();
while (Date.now() - start < timeout) {
if (findElement(step)) {
return { status: "success" };
}
await sleep(200);
}
return { status: "timeout" };
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| sleep | calls |
| findElement | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| executeStep | calls |