# tmuxtest.WaitFor

- **Module:** tmuxtest
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/tmuxtest/wait.go#L18
- **Page:** https://libtmux.org/reference/go/tmuxtest-waitfor/

```
tmuxtest.WaitFor(ctx: context.Context, interval: time.Duration, condition: func(context.Context) (bool, error)) -> error
```

WaitFor checks condition serially and immediately, then after each interval, until it succeeds, returns an error, or ctx ends. It validates interval, condition, and ctx in that order: interval must be positive, condition must be non-nil, and an already-ended context prevents every check. Condition errors and context errors are returned unchanged. A running condition receives ctx and must observe it itself; WaitFor cannot interrupt the condition.
