Skip to content

[Smoke test] Add deterministic unit tests for WaitHelper polling, timeout, and error paths #2763

Description

@EmmaYuan1015

Background

This branch adds waitHelper.test.ts, introducing fake-clock-based unit tests for WaitHelper. The change highlights a gap: WaitHelper is a core utility for smoke tests, but previously lacked deterministic coverage for key async/timer behaviors, increasing regression and flakiness risk.

Problem

WaitHelper implementation contains async polling, timeout handling, interval/timeout cleanup, and error propagation logic. Without focused unit tests, behavior changes can slip in during refactors, especially around timing-sensitive paths.

Expected Behavior

WaitHelper behavior should be validated with deterministic tests that do not rely on real-time delays, covering success, timeout, and failure scenarios consistently.

Acceptance Criteria

Add fake-clock-driven tests for waitIsTrue success and timeout paths.
Add tests for waitConditionUntil covering:
immediate success on first check
eventual success after polling
null on timeout
rejection when condition throws
Ensure tests avoid real sleep/timing dependencies and are stable across runs.
Keep tests integrated with existing smoke test compile/CI flow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions