Safe Haskell | Safe-Infered |
---|
- data ExpectFailed
- expect :: Bool -> WD ()
- unexpected :: WD a
- expectAny :: (a -> WD Bool) -> [a] -> WD ()
- expectAll :: (a -> WD Bool) -> [a] -> WD ()
- (<||>) :: Monad m => m Bool -> m Bool -> m Bool
- (<&&>) :: Monad m => m Bool -> m Bool -> m Bool
- waitUntil :: Double -> WD a -> WD a
- waitUntil' :: Int -> Double -> WD a -> WD a
- waitWhile :: Double -> WD a -> WD ()
- waitWhile' :: Int -> Double -> WD a -> WD ()
Expected conditions
data ExpectFailed Source
An exception representing the failure of an expected condition.
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 :: WD aSource
throws ExpectFailed
. This is nice for writing your own abstractions.
Convenience functions
expectAny :: (a -> WD Bool) -> [a] -> WD ()Source
Apply a predicate to every element in a list, and expect that at least one succeeds.
expectAll :: (a -> WD Bool) -> [a] -> WD ()Source
Apply a predicate to every element in a list, and expect that all succeed.
Wait on expected conditions
waitUntil :: Double -> WD a -> WD 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' :: Int -> Double -> WD a -> WD 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.