webdriver 0.8.0.2 → 0.8.0.3
raw patch · 8 files changed
+31/−18 lines, 8 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +4/−0
- src/Test/WebDriver/Class.hs +3/−0
- src/Test/WebDriver/Commands.hs +5/−5
- src/Test/WebDriver/Commands/Wait.hs +6/−8
- src/Test/WebDriver/Firefox/Profile.hs +1/−1
- src/Test/WebDriver/Internal.hs +8/−2
- src/Test/WebDriver/Session.hs +2/−1
- webdriver.cabal +2/−1
CHANGELOG.md view
@@ -1,4 +1,8 @@ #Change Log++##0.8.0.3+* Fixed build errors for GHC < 7.10. webdriver now builds with GHC stable releases 7.4.2, 7.6.3, and 7.8.4+ ##0.8.0.2 * Fixed issue introduced in 0.8 that caused build failure when using aeson < 0.10
src/Test/WebDriver/Class.hs view
@@ -11,6 +11,9 @@ import Data.Aeson import Data.Text (Text)+#if !MIN_VERSION_base(4,8,0)+import Data.Monoid (Monoid) -- for some reason "import Prelude" trick doesn't work with "import Data.Monoid"+#endif import Network.HTTP.Types.Method (methodDelete, methodGet, methodPost, Method)
src/Test/WebDriver/Commands.hs view
@@ -102,7 +102,7 @@ import Data.Word import Data.String (fromString) import Data.Maybe-import Data.Foldable+import qualified Data.Foldable as F import qualified Data.Char as C import Prelude -- hides some "unused import" warnings@@ -210,10 +210,10 @@ list and the values may be accessed via the arguments object in the order specified. -}-executeJS :: (Foldable f, FromJSON a, WebDriver wd) => f JSArg -> Text -> wd a+executeJS :: (F.Foldable f, FromJSON a, WebDriver wd) => f JSArg -> Text -> wd a executeJS a s = fromJSON' =<< getResult where- getResult = doSessCommand methodPost "/execute" . pair ("args", "script") $ (toList a,s)+ getResult = doSessCommand methodPost "/execute" . pair ("args", "script") $ (F.toList a,s) {- |Executes a snippet of Javascript code asynchronously. This function works similarly to 'executeJS', except that the Javascript is passed a callback@@ -222,11 +222,11 @@ returned as the result of asyncJS. A result of Nothing indicates that the Javascript function timed out (see 'setScriptTimeout') -}-asyncJS :: (Foldable f, FromJSON a, WebDriver wd) => f JSArg -> Text -> wd (Maybe a)+asyncJS :: (F.Foldable f, FromJSON a, WebDriver wd) => f JSArg -> Text -> wd (Maybe a) asyncJS a s = handle timeout $ Just <$> (fromJSON' =<< getResult) where getResult = doSessCommand methodPost "/execute_async" . pair ("args", "script")- $ (toList a,s)+ $ (F.toList a,s) timeout (FailedCommand Timeout _) = return Nothing timeout (FailedCommand ScriptTimeout _) = return Nothing timeout err = throwIO err
src/Test/WebDriver/Commands/Wait.hs view
@@ -23,13 +23,11 @@ import Data.Time.Clock import Data.Typeable-import Data.Foldable+import qualified Data.Foldable as F import Data.Text (Text) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 706+#if !MIN_VERSION_base(4,6,0) || defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 706 import Prelude hiding (catch)-#else-import Prelude -- hides some "redundant import" warnings #endif instance Exception ExpectFailed@@ -52,13 +50,13 @@ -- |Apply a monadic predicate to every element in a list, and 'expect' that -- at least one succeeds.-expectAny :: (Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m ()-expectAny p xs = expect . or =<< mapM p (toList xs)+expectAny :: (F.Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m ()+expectAny p xs = expect . F.or =<< mapM p (F.toList xs) -- |Apply a monadic predicate to every element in a list, and 'expect' that all -- succeed.-expectAll :: (Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m ()-expectAll p xs = expect . and =<< mapM p (toList xs)+expectAll :: (F.Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m ()+expectAll p xs = expect . F.and =<< mapM p (F.toList xs) -- | 'expect' the given 'Element' to not be stale and returns it expectNotStale :: WebDriver wd => Element -> wd Element
src/Test/WebDriver/Firefox/Profile.hs view
@@ -47,7 +47,7 @@ import Control.Applicative import Control.Arrow -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 706+#if !MIN_VERSION_base(4,6,0) || defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 706 import Prelude hiding (catch) #endif
src/Test/WebDriver/Internal.hs view
@@ -22,9 +22,10 @@ import Data.Text as T (Text, splitOn, null) import qualified Data.Text.Encoding as TE import Data.ByteString.Lazy.Char8 (ByteString)-import Data.ByteString.Lazy.Char8 as LBS (length, unpack, null, fromStrict)+import Data.ByteString.Lazy.Char8 as LBS (length, unpack, null) import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Base64.Lazy as B64+import qualified Data.ByteString.Lazy.Internal as LBS (ByteString(..)) import Control.Monad.Base import Control.Exception.Lifted (throwIO)@@ -37,6 +38,11 @@ import Prelude -- hides some "unused import" warnings +--This is the defintion of fromStrict used by bytestring >= 0.10; we redefine it here to support bytestring < 0.10+fromStrict :: BS.ByteString -> LBS.ByteString+fromStrict bs | BS.null bs = LBS.Empty+ | otherwise = LBS.Chunk bs LBS.Empty+ -- |Constructs an HTTP 'Request' value when given a list of headers, HTTP request method, and URL fragment mkRequest :: (WDSessionState s, ToJSON a) => Method -> Text -> a -> s Request@@ -93,7 +99,7 @@ Just ct | "application/json" `BS.isInfixOf` ct -> parseJSON' - (maybe body LBS.fromStrict $ lookup "X-Response-Body-Start" headers)+ (maybe body fromStrict $ lookup "X-Response-Body-Start" headers) >>= handleJSONErr >>= maybe noReturn returnErr | otherwise ->
src/Test/WebDriver/Session.hs view
@@ -22,6 +22,7 @@ import Data.ByteString as BS(ByteString) import Data.Text (Text) import Data.Maybe (listToMaybe)+import Data.Monoid import Control.Applicative import Control.Monad.Base@@ -46,7 +47,7 @@ import Network.HTTP.Client (Manager, Request) import Network.HTTP.Types (RequestHeaders) -import Prelude -- hides some "unused import" warnings+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. -}
webdriver.cabal view
@@ -1,5 +1,5 @@ Name: webdriver-Version: 0.8.0.2+Version: 0.8.0.3 Cabal-Version: >= 1.8 License: BSD3 License-File: LICENSE@@ -11,6 +11,7 @@ Synopsis: a Haskell client for the Selenium WebDriver protocol Build-type: Simple Extra-source-files: README.md, TODO.md, CHANGELOG.md, .ghci+Tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2 Description: A Selenium WebDriver client for Haskell. You can use it to automate browser sessions