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)

graph LR handleWait["handleWait"] sleep["sleep"] findElement["findElement"] handleWait -->|calls| sleep handleWait -->|calls| findElement style handleWait fill:#dbeafe,stroke:#2563eb,stroke-width:2px click handleWait "1e0c6f2b3548f948.html" click sleep "25404f77365ed229.html" click findElement "db37f185eea489b4.html"
TargetType
sleep calls
findElement calls

Impact (Incoming)

graph LR handleWait["handleWait"] executeStep["executeStep"] executeStep -->|calls| handleWait style handleWait fill:#dbeafe,stroke:#2563eb,stroke-width:2px click handleWait "1e0c6f2b3548f948.html" click executeStep "a26ccfb820921de2.html"
SourceType
executeStep calls