webdriver 0.8.1 → 0.8.2
raw patch · 5 files changed
+22/−6 lines, 5 filesdep ~aesondep ~transformers
Dependency ranges changed: aeson, transformers
Files
- CHANGELOG.md +3/−0
- src/Test/WebDriver/Class.hs +4/−0
- src/Test/WebDriver/Commands.hs +6/−2
- src/Test/WebDriver/Session.hs +6/−1
- webdriver.cabal +3/−3
CHANGELOG.md view
@@ -1,4 +1,7 @@ #Change Log+###0.8.2+* Added a `saveScreenshot` command, for conenience, which writes the results of the `screenshot` command directly to a given file path.+* Added new `WebDriver` instance for `ExceptT`. ###0.8.1 * Previously internal convenience functions `noReturn` and `ignoreReturn` are now exported in Test.WebDriver.JSON
src/Test/WebDriver/Class.hs view
@@ -23,6 +23,7 @@ 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@@ -72,6 +73,9 @@ 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 doCommand rm t a = lift (doCommand rm t a)
src/Test/WebDriver/Commands.hs view
@@ -9,7 +9,7 @@ -- ** Web navigation , openPage, forward, back, refresh -- ** Page info- , getCurrentURL, getSource, getTitle, screenshot, screenshotBase64+ , getCurrentURL, getSource, getTitle, saveScreenshot, screenshot, screenshotBase64 -- * Timeouts , setImplicitWait, setScriptTimeout, setPageLoadTimeout -- * Web elements@@ -87,7 +87,7 @@ import qualified Data.Text as T import Data.Text (Text, append, toUpper, toLower) import Data.ByteString.Base64.Lazy as B64-import Data.ByteString.Lazy as LBS (ByteString)+import Data.ByteString.Lazy as LBS (ByteString, writeFile) import Network.URI hiding (path) -- suppresses warnings import Codec.Archive.Zip import qualified Data.Text.Lazy.Encoding as TL@@ -222,6 +222,10 @@ timeout (FailedCommand Timeout _) = return Nothing timeout (FailedCommand ScriptTimeout _) = return Nothing timeout err = throwIO err+ +-- |Save a screenshot to a particular location+saveScreenshot :: WebDriver wd => FilePath -> wd ()+saveScreenshot path = screenshot >>= liftBase . LBS.writeFile path -- |Grab a screenshot of the current page as a PNG image screenshot :: WebDriver wd => wd LBS.ByteString
src/Test/WebDriver/Session.hs view
@@ -33,6 +33,7 @@ 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@@ -196,7 +197,11 @@ instance (Error e, WDSessionState m) => WDSessionState (ErrorT e m) where getSession = lift getSession putSession = lift . putSession- ++instance WDSessionState m => WDSessionState (ExceptT r m) where+ getSession = lift getSession+ putSession = lift . putSession+ instance (Monoid w, WDSessionState m) => WDSessionState (SRWS.RWST r w s m) where getSession = lift getSession putSession = lift . putSession
webdriver.cabal view
@@ -1,5 +1,5 @@ Name: webdriver-Version: 0.8.1+Version: 0.8.2 Cabal-Version: >= 1.10 License: BSD3 License-File: LICENSE@@ -44,14 +44,14 @@ if flag(developer) cpp-options: -DCABAL_BUILD_DEVELOPER build-depends: base == 4.*- , aeson >= 0.6.2.0 && < 0.11+ , aeson >= 0.6.2.0 && < 0.12 , http-client >= 0.3 && < 0.5 , http-types >= 0.8 && < 0.10 , text >= 0.11.3 && < 1.3 , bytestring >= 0.9 && < 0.11 , attoparsec >= 0.10 && < 0.14 , base64-bytestring >= 1.0 && < 1.1- , transformers >= 0.2 && < 0.5+ , transformers >= 0.4 && < 0.5 , monad-control >= 0.3 && < 1.1 , transformers-base >= 0.1 && < 1.0 , lifted-base >= 0.1 && < 0.3