Safe Haskell | Safe-Infered |
---|

- waitUntil :: SessionState m => Double -> m a -> m a
- waitUntil' :: SessionState m => Int -> Double -> m a -> m a
- waitWhile :: SessionState m => Double -> m a -> m ()
- waitWhile' :: SessionState m => Int -> Double -> m a -> m ()
- data ExpectFailed
- expect :: MonadBaseControl IO m => Bool -> m ()
- unexpected :: MonadBaseControl IO m => m a
- expectAny :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()
- expectAll :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()
- ifM :: (ToBool b, Monad m) => m b -> m a -> m a -> m a
- (<||>) :: (ToBool b, Boolean b, Monad m) => m b -> m b -> m b
- (<&&>) :: (ToBool b, Boolean b, Monad m) => m b -> m b -> m b
- notM :: (Boolean b, Monad m) => m b -> m b

# Wait on expected conditions

waitUntil :: SessionState m => Double -> m a -> m aSource

Wait until either the given action succeeds or the timeout is reached.
The action will be retried every .25 seconds until no `ExpectFailed`

or
`NoSuchElement`

exceptions occur. If the timeout is reached,
then a `Timeout`

exception will be raised. The timeout value
is expressed in seconds.

waitUntil' :: SessionState m => Int -> Double -> m a -> m aSource

Similar to `waitUntil`

but allows you to also specify the poll frequency
of the `WD`

action. The frequency is expressed as an integer in microseconds.

waitWhile :: SessionState m => Double -> m a -> m ()Source

Like `waitUntil`

, but retries the action until it fails or until the timeout
is exceeded.

waitWhile' :: SessionState m => Int -> Double -> m a -> m ()Source

Like `waitUntil'`

, but retries the action until it either fails or
until the timeout is exceeded.

# Expected conditions

data ExpectFailed Source

An exception representing the failure of an expected condition.

expect :: MonadBaseControl IO m => Bool -> m ()Source

An expected condition. This function allows you to express assertions in
your explicit wait. This function raises `ExpectFailed`

if the given
boolean is False, and otherwise does nothing.

unexpected :: MonadBaseControl IO m => m aSource

throws `ExpectFailed`

. This is nice for writing your own abstractions.

## Convenience functions

expectAny :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()Source

Apply a predicate to every element in a list, and expect that at least one succeeds.

expectAll :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()Source

Apply a predicate to every element in a list, and expect that all succeed.