condition-based-waiting

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

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/Kuass/kiro-gateway-plus --skill condition-based-waiting-kuass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/Kuass/kiro-gateway-plus/tree/main/.opencode/skill/condition-based-waiting
Command: npx skills add https://github.com/Kuass/kiro-gateway-plus --skill condition-based-waiting-kuass

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill replaces arbitrary timeouts and sleep calls in tests with condition-based polling, which waits for actual state changes instead of guessing how long operations will take. This eliminates flaky tests caused by race conditions and timing dependencies.

Core Features & Use Cases

  • Intelligent Waiting: Polls for specific conditions (e.g., element visibility, state change, event occurrence) rather than relying on fixed delays.
  • Flaky Test Resolution: Significantly improves test reliability by removing timing-related failures.
  • Use Case: In an e-commerce test suite, instead of waiting 5 seconds for an order confirmation page to load, this Skill would wait until the "Order Confirmed" message actually appears on the page, making the test faster and more reliable.

Quick Start

Use the condition-based waiting skill to wait for the element with the ID 'submit-button' to become visible on the page.

Frequently Asked Questions about condition-based-waiting

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

FAQPage Schema
How do I eliminate flaky tests caused by race conditions and timing dependencies?

Eliminate flaky tests by replacing arbitrary sleep calls and fixed timeouts with condition-based polling. This approach waits for actual state changes, such as element visibility or event occurrences, rather than guessing operation durations, resolving inconsistent timing failures.

What is the best way to wait for an element to appear in automated testing instead of using sleep?

The best way to wait for an element in automated testing is condition-based polling. Instead of pausing execution for a fixed duration, polling continuously checks for specific conditions like element visibility or state changes, making tests both faster and more reliable.

How does condition-based polling improve test reliability compared to fixed delays?

Condition-based polling improves test reliability by actively checking for state changes or event occurrences. Fixed delays either waste execution time waiting too long or fail prematurely if operations exceed the timeout, whereas polling proceeds exactly when the target condition is met.

Can I use condition-based waiting for domain-specific state checking and event waiting?

Yes, condition-based waiting can be used for domain-specific state checking and event waiting. It implements generic polling functions alongside domain-specific helpers, allowing tests to wait for specific application events and state transitions beyond simple element visibility.

Why do my automated tests pass and fail inconsistently when timing dependencies change?

Automated tests pass and fail inconsistently due to timing dependencies and race conditions. When tests use arbitrary timeouts, varying system load times cause premature failures; implementing condition-based polling waits for actual state changes, resolving this inconsistent behavior.

When should I not use fixed sleep calls in my test suite?

You should not use fixed sleep calls when operations have unpredictable durations or when testing dynamic state changes. Sleep calls create timing dependencies and race conditions, so condition-based polling should replace them to wait for actual events and ensure reliable test execution.