condition-based-waiting

Replace fixed delays with configurable polling waitFor utilities in tests.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/liamtran96/msm-car-booking --skill condition-based-waiting-liamtran96
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/liamtran96/msm-car-booking/tree/main/.claude/skills/condition-based-waiting
Command: npx skills add https://github.com/liamtran96/msm-car-booking --skill condition-based-waiting-liamtran96

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves flaky tests caused by race conditions and timing dependencies by replacing arbitrary timeouts with condition polling to await actual state changes.

Core Features & Use Cases

  • Deterministic waiting by polling for a state, event, or count until the condition is met.
  • Reduces CI flakiness by avoiding reliance on random delays and parallel timing.
  • Common use cases include waiting for async operations to complete, for a resource to reach a ready state, or for a multi-step workflow to progress.

Quick Start

To start using condition-based waiting, import a waitFor helper and replace setTimeout-based waits with waitFor(() => ...). Example: await waitFor(() => getResult() !== undefined)

Frequently Asked Questions about condition-based-waiting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix flaky tests caused by asynchronous operations and race conditions?

To fix flaky tests, replace arbitrary timeouts with condition polling using a waitFor utility that waits for actual state changes. This eliminates race conditions by checking predicate-based conditions until they are met.

What is condition polling in test automation?

Condition polling is a testing technique that waits for an actual state, event, or count to be met before proceeding. It uses a generic waitFor helper with configurable timeouts to ensure deterministic test execution.

How do I wait for an async operation to complete in integration tests?

You can wait for async operations by importing a waitFor helper and replacing setTimeout-based waits with waitFor(() => getResult() !== undefined). This polls until the condition is satisfied or the timeout is reached.

Does condition polling work for parallel test executions?

Yes, condition polling reduces CI flakiness by avoiding reliance on random delays and parallel timing. It supports waiting for resources to reach a ready state across unit and integration test suites.

What is the best way to wait for a state change instead of using fixed delays?

The best way to wait for state changes is using a generic polling waitFor utility with configurable timeouts. It supports predicate-based checks, event waiting, and count-based waits to ensure deterministic outcomes.