webdriver 0.10.0.1 → 0.11.0.0
raw patch · 6 files changed
+64/−75 lines, 6 filesdep ~aeson
Dependency ranges changed: aeson
Files
- CHANGELOG.md +5/−0
- src/Test/WebDriver/Class.hs +0/−8
- src/Test/WebDriver/Commands.hs +0/−1
- src/Test/WebDriver/Cookies.hs +25/−18
- src/Test/WebDriver/Session.hs +31/−45
- webdriver.cabal +3/−3
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Change Log +## 0.11.0.0+* Support GHC 9.6+* Fix a link to the wrong GitHub branch in package description+* Remove instances for deprecated ListT and ErrorT+ ## 0.10.0.1 * Update links to reflect this package's new home at https://github.com/haskell-webdriver/haskell-webdriver/
src/Test/WebDriver/Class.hs view
@@ -11,10 +11,8 @@ import Data.Text (Text) import Network.HTTP.Types.Method (methodDelete, methodGet, methodPost, Method) import Control.Monad.Trans.Class-import Control.Monad.Trans.Error import Control.Monad.Trans.Except import Control.Monad.Trans.Identity-import Control.Monad.Trans.List import Control.Monad.Trans.Maybe import Control.Monad.Trans.RWS.Lazy as LRWS import Control.Monad.Trans.RWS.Strict as SRWS@@ -56,9 +54,6 @@ instance WebDriver wd => WebDriver (IdentityT wd) where doCommand rm t a = lift (doCommand rm t a) -instance WebDriver wd => WebDriver (ListT wd) where- doCommand rm t a = lift (doCommand rm t a)- instance (Monoid w, WebDriver wd) => WebDriver (LW.WriterT w wd) where doCommand rm t a = lift (doCommand rm t a) @@ -66,9 +61,6 @@ doCommand rm t a = lift (doCommand rm t a) instance WebDriver wd => WebDriver (ReaderT r wd) where- doCommand rm t a = lift (doCommand rm t a)--instance (Error e, WebDriver wd) => WebDriver (ErrorT e wd) where doCommand rm t a = lift (doCommand rm t a) instance WebDriver wd => WebDriver (ExceptT e wd) where
src/Test/WebDriver/Commands.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE ExistentialQuantification #-}-{-# LANGUAGE TemplateHaskell #-} -- | This module exports basic WD actions that can be used to interact with a -- browser session.
src/Test/WebDriver/Cookies.hs view
@@ -1,33 +1,39 @@-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Test.WebDriver.Cookies where - import Data.Aeson-import Data.Aeson.TH import Data.Aeson.Types import qualified Data.Char as C import Data.Text (Text)+import GHC.Generics import Test.WebDriver.JSON -- | Cookies are delicious delicacies. When sending cookies to the server, a value -- of Nothing indicates that the server should use a default value. When receiving -- cookies from the server, a value of Nothing indicates that the server is unable -- to specify the value.-data Cookie = Cookie { cookName :: Text- , cookValue :: Text -- ^- , cookPath :: Maybe Text -- ^path of this cookie.- -- if Nothing, defaults to /- , cookDomain :: Maybe Text -- ^domain of this cookie.- -- if Nothing, the current pages- -- domain is used- , cookSecure :: Maybe Bool -- ^Is this cookie secure?- , cookExpiry :: Maybe Double -- ^Expiry date expressed as- -- seconds since the Unix epoch- -- Nothing indicates that the- -- cookie never expires- } deriving (Eq, Show)+data Cookie = Cookie {+ cookName :: Text+ , cookValue :: Text -- ^+ , cookPath :: Maybe Text -- ^path of this cookie.+ -- if Nothing, defaults to /+ , cookDomain :: Maybe Text -- ^domain of this cookie.+ -- if Nothing, the current pages+ -- domain is used+ , cookSecure :: Maybe Bool -- ^Is this cookie secure?+ , cookExpiry :: Maybe Double -- ^Expiry date expressed as+ -- seconds since the Unix epoch+ -- Nothing indicates that the+ -- cookie never expires+ } deriving (Eq, Show, Generic) +aesonOptionsCookie :: Options+aesonOptionsCookie = defaultOptions {+ omitNothingFields = True+ , fieldLabelModifier = map C.toLower . drop 4+ }+ -- |Creates a Cookie with only a name and value specified. All other -- fields are set to Nothing, which tells the server to use default values. mkCookie :: Text -> Text -> Cookie@@ -36,6 +42,9 @@ cookSecure = Nothing, cookExpiry = Nothing } +instance ToJSON Cookie where+ toJSON = genericToJSON aesonOptionsCookie+ toEncoding = genericToEncoding aesonOptionsCookie instance FromJSON Cookie where parseJSON (Object o) = Cookie <$> req "name" <*> req "value"@@ -49,5 +58,3 @@ opt :: FromJSON a => Text -> a -> Parser a opt k d = o .:?? k .!= d parseJSON v = typeMismatch "Cookie" v--$( deriveToJSON (defaultOptions{omitNothingFields = True, fieldLabelModifier = map C.toLower . drop 4}) ''Cookie )
src/Test/WebDriver/Session.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} module Test.WebDriver.Session ( -- * WDSessionState class@@ -19,33 +20,26 @@ import Data.Text (Text) import Data.Maybe (listToMaybe) import Data.Monoid- import Control.Applicative import Control.Monad.Base import Control.Monad.Trans.Class import Control.Monad.Trans.Control import Control.Monad.Trans.Maybe import Control.Monad.Trans.Identity-import Control.Monad.Trans.List import Control.Monad.Trans.Reader-import Control.Monad.Trans.Error import Control.Monad.Trans.Except---import Control.Monad.Cont import Control.Monad.Trans.Writer.Strict as SW import Control.Monad.Trans.Writer.Lazy as LW import Control.Monad.Trans.State.Strict as SS import Control.Monad.Trans.State.Lazy as LS import Control.Monad.Trans.RWS.Strict as SRWS import Control.Monad.Trans.RWS.Lazy as LRWS- import Control.Exception.Lifted (SomeException, try, throwIO)----import Network.HTTP.Types.Header (RequestHeaders) import Network.HTTP.Client (Manager, Request) import Network.HTTP.Types (RequestHeaders)- import Prelude -- hides some "redundant import" warnings + {- |An opaque identifier for a WebDriver session. These handles are produced by the server on session creation, and act to identify a session in progress. -} newtype SessionId = SessionId Text@@ -54,35 +48,35 @@ {- |The local state of a WebDriver session. This structure is passed implicitly through all 'WD' computations -} data WDSession = WDSession {- -- server hostname- wdSessHost :: BS.ByteString- -- server port- , wdSessPort :: Int- -- Base path for API requests- , wdSessBasePath :: BS.ByteString- -- |An opaque reference identifying the session to- -- use with 'WD' commands.- -- A value of Nothing indicates that a session- -- hasn't been created yet.- -- Sessions can be created within 'WD' via- -- 'Test.WebDriver.createSession', or created- -- automatically with 'Test.WebDriver.runSession'- , wdSessId :: Maybe SessionId- -- |The complete history of HTTP requests and- -- responses, most recent first.- , wdSessHist :: [SessionHistory]- -- |Update function used to append new entries to session history- , wdSessHistUpdate :: SessionHistoryConfig- -- |HTTP 'Manager' used for connection pooling by the http-client library.- , wdSessHTTPManager :: Manager- -- |Number of times to retry a HTTP request if it times out- , wdSessHTTPRetryCount :: Int- -- |Custom request headers to add to every HTTP request.- , wdSessRequestHeaders :: RequestHeaders- -- |Custom request headers to add *only* to session creation requests. This is usually done- -- when a WebDriver server requires HTTP auth.- , wdSessAuthHeaders :: RequestHeaders- }+ -- server hostname+ wdSessHost :: BS.ByteString+ -- server port+ , wdSessPort :: Int+ -- Base path for API requests+ , wdSessBasePath :: BS.ByteString+ -- |An opaque reference identifying the session to+ -- use with 'WD' commands.+ -- A value of Nothing indicates that a session+ -- hasn't been created yet.+ -- Sessions can be created within 'WD' via+ -- 'Test.WebDriver.createSession', or created+ -- automatically with 'Test.WebDriver.runSession'+ , wdSessId :: Maybe SessionId+ -- |The complete history of HTTP requests and+ -- responses, most recent first.+ , wdSessHist :: [SessionHistory]+ -- |Update function used to append new entries to session history+ , wdSessHistUpdate :: SessionHistoryConfig+ -- |HTTP 'Manager' used for connection pooling by the http-client library.+ , wdSessHTTPManager :: Manager+ -- |Number of times to retry a HTTP request if it times out+ , wdSessHTTPRetryCount :: Int+ -- |Custom request headers to add to every HTTP request.+ , wdSessRequestHeaders :: RequestHeaders+ -- |Custom request headers to add *only* to session creation requests. This is usually done+ -- when a WebDriver server requires HTTP auth.+ , wdSessAuthHeaders :: RequestHeaders+ } -- |A function used by 'wdHistoryConfig' to append new entries to session history.@@ -174,10 +168,6 @@ getSession = lift getSession putSession = lift . putSession -instance WDSessionState m => WDSessionState (ListT m) where- getSession = lift getSession- putSession = lift . putSession- instance (Monoid w, WDSessionState m) => WDSessionState (LW.WriterT w m) where getSession = lift getSession putSession = lift . putSession@@ -187,10 +177,6 @@ putSession = lift . putSession instance WDSessionState m => WDSessionState (ReaderT r m) where- getSession = lift getSession- putSession = lift . putSession--instance (Error e, WDSessionState m) => WDSessionState (ErrorT e m) where getSession = lift getSession putSession = lift . putSession
webdriver.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.1.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack name: webdriver-version: 0.10.0.1+version: 0.11.0.0 synopsis: a Haskell client for the Selenium WebDriver protocol description: A Selenium WebDriver client for Haskell. You can use it to automate browser sessions@@ -16,7 +16,7 @@ . To find out what's been changed in this version and others, see the change log at- <https://github.com/haskell-webdriver/haskell-webdriver/blob/master/CHANGELOG.md>+ <https://github.com/haskell-webdriver/haskell-webdriver/blob/main/CHANGELOG.md> category: Web, Browser, Testing, WebDriver, Selenium homepage: https://github.com/haskell-webdriver/haskell-webdriver#readme bug-reports: https://github.com/haskell-webdriver/haskell-webdriver/issues