webdriver v0.7 Release Notes
-
⚡️ Because this is a fairly major update, changes have been described in detail and organized into categories. Most of the potentially breaking changes are to the "intermediate" API that might affect library code or advanced applications; changes that are not entirely "user-facing" but also not quite "internal".
✅ Basic web test code only has to contend with a few additional symbol exports, overloading of type signatures on some existing functions, and the reworked session history API.
✅ Top-level API (exposed by
Test.WebDriver
module)withSession
is now overloaded over the new constraint aliasWDSessionStateControl
(see below). This means that it can be used with monad transformer stacks overWD
without any lifting required.- Added several new
WDConfig
convenience functions:modifyCaps
,useBrowser
,useVersion
,usePlatform
,useProxy
; these functions are overloaded over the newHasCapabilities
constraint alias (see below) Reworked and improved session history API
- Added a
SessionHistory
record type to replace the old(Request, Response ByteString)
type. The new type has the same data as the previous tuple, but additionally records the number of attempted HTTP retries, and instead ofResponse ByteString
usesEither SomeException (Response ByteString)
so that HTTP request errors can be logged. - Removed
wdKeepSessHist
field fromWDConfig
and replaced it withwdHistoryConfig
, which uses a newSessionHistoryConfig
type.
-- |A function used to append new requests/responses to session history. type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory]
- The new field can be configured using several new constants:
noHistory
,onlyMostRecentHistory
, andunlimitedHistory
. Note:unlimitedHistory
is now the default configuration for history. For the old behavior, useonlyMostRecentHistory
. - New top-level functions for accessing session history
-- |Gets the command history for the current session. getSessionHistory :: WDSessionState wd => wd [SessionHistory] -- |Prints a history of API requests to stdout after computing the given action -- or after an exception is thrown dumpSessionHistory :: WDSessionStateControl wd => wd a -> wd a
- Added a
✅ Implicit waits API (
Test.WebDriver.Commands.Wait
)- ➕ Added functions for checking some expected conditions in explicit waits:
expectNotStale
,expectAlertOpen
,catchFailedCommand
Typeclass API
WDSessionState
is now a superclass ofMonad
andApplicative
instead ofMonadBaseControl IO
. This makes the class significantly more flexible in how it can be used, as it no longer requiresIO
as a base monad.- For convenience the following constraint aliases were added (requires
ConstraintKinds
extension to use). Several existing API functions have been updated to use these new constraints where appropriate.
type WDSessionStateIO s = (WDSessionState s, MonadBase IO s) type WDSessionStateControl s = (WDSessionState s, MonadBaseControl IO s)
- The
WDSessionStateControl
constraint is equivalent to the previousWDSessionState
constraint. - The
WebDriver
class is unaffected (it is now a superclass ofWDSessionStateControl
), so code using the basicTest.WebDriver
API will not be affected.
- For convenience the following constraint aliases were added (requires
🆕 New typeclasses added to
Test.WebDriver.Capabilities
:GetCapabilities
andSetCapabilities
; for convenience a constraint aliasHasCapabilities
has been added to work with both of these classes (requiresConstraintKinds
extension to use)-- |A typeclass for readable 'Capabilities' class GetCapabilities t where getCaps :: t -> Capabilities -- |A typeclass for writable 'Capabilities' class SetCapabilities t where setCaps :: Capabilities -> t -> t -- |Read/write 'Capabilities' type HasCapabilities t = (GetCapabilities t, SetCapabilities t)
✅ Minor API changes (not exposed to
Test.WebDriver
module)- ✅
Test.WebDriver.Session
changes- new function
mostRecentHistory
added lastHTTPRequest
renamed tomostRecentHTTPRequest
(for consistency)mkSession
moved fromTest.WebDriver.Config
toTest.WebDriver.Session
- new function
- ✅
Test.WebDriver.Internal
changessendHTTPRequest
now returns(Either SomeException (Response ByteString))
and catches any exceptions that occur during the request. When using default configuration, the exceptions are also saved in 'wdSessHist'.Test.WebDriver.Internal
no longer defines and exports exception types. All exception defined here previously have been moved to an unexposedTest.WebDriver.Exceptions.Internal
module. These types are still exported in the usual places.
Dependencies
- 👍 Now supports http-types up to 0.9