condition-based-waiting

Replace arbitrary timeouts with condition-based polling in automated tests.

1|Updated Sep 26, 2025
One-click install
npx skills add https://github.com/pascallammers/mylo-travel-concierge-v2 --skill condition-based-waiting-pascallammers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/pascallammers/mylo-travel-concierge-v2/tree/main/.factory/skills/condition-based-waiting
Command: npx skills add https://github.com/pascallammers/mylo-travel-concierge-v2 --skill condition-based-waiting-pascallammers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common issue of flaky tests caused by arbitrary timeouts and race conditions, ensuring more reliable test suites.

Core Features & Use Cases

  • Condition Polling: Replaces fixed setTimeout or sleep with checks for actual state changes.
  • Flaky Test Resolution: Significantly reduces test failures due to timing inconsistencies.
  • Use Case: When a test needs to wait for a UI element to become visible or for a background process to complete, this skill polls for the specific condition instead of guessing a delay.

Quick Start

Use the condition-based-waiting skill to wait for the user.isLoggedIn state to become true before proceeding with the test.

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 race conditions and arbitrary timeouts?

Polling resolves flaky tests by repeatedly executing a condition callback until it returns true or a timeout is reached. This verifies actual application state changes instead of relying on arbitrary sleep delays that cause timing inconsistencies.

How do I wait for a background process to complete in automated testing?

Wait for background processes by implementing a generic polling function that accepts a condition callback. Instead of using fixed setTimeout delays, the test polls for the specific state change to become true before proceeding with execution.

What is the best way to eliminate timing dependencies in automated testing frameworks?

Eliminate timing dependencies by using condition-based polling instead of arbitrary timeouts. This technique targets race conditions directly by verifying that a specific condition is met, significantly reducing test failures caused by timing inconsistencies.

Do I need a specific polling function to resolve race conditions in my test suite?

Yes, resolving race conditions requires a generic polling function that accepts a condition callback and a timeout parameter. This setup ensures reliable state verification by continuously checking for actual state changes rather than relying on fixed sleep intervals.

Why does my automated test fail intermittently when checking if a user is logged in?

Intermittent failures occur because arbitrary timeouts cannot account for race conditions. Replacing fixed waits with condition-based polling ensures the test waits for the user isLoggedIn state to actually become true before proceeding.