webdriver-precore 0.2.0.1 → 0.2.0.2
raw patch · 2 files changed
+19/−19 lines, 2 files
Files
- test/HTTP/Runner.hs +14/−14
- webdriver-precore.cabal +5/−5
test/HTTP/Runner.hs view
@@ -1,26 +1,28 @@ module HTTP.Runner ( mkRunner,- HttpRunner (..)+ HttpRunner (..), ) where import Data.Aeson (FromJSON (..), Value, withObject, (.:)) import Data.Aeson.Types (Parser, Value (..), parseEither, parseMaybe) import Data.Function ((&))+import Data.Text (pack) import GHC.Exception (throw)+import HTTP.HttpClient (callWebDriver', mkRequest) import IOUtils (DemoActions (..)) import Network.HTTP.Req ( Scheme (..), Url, ) import UnliftIO (catchAny)-import WebDriverPreCore.HTTP.Protocol ( Command(..), WebDriverException(..), parseWebDriverException)+import WebDriverPreCore.HTTP.Protocol+ ( Command (..),+ WebDriverException (..),+ parseWebDriverException,+ ) import Prelude hiding (log) -import HTTP.HttpClient ( callWebDriver', mkRequest)-import Data.Text (pack)-- -- ############# Runner ############# data HttpRunner = MkHttpRunner@@ -62,19 +64,17 @@ PostEmpty {} -> pure () Delete {} -> pure () - parseResultIO :: forall r. (FromJSON r) => Value -> IO r-parseResultIO body =+parseResultIO body = parseMaybe valueParser body & maybe- ( throw $ ResponseParseException "No value property found in WebDriver response" body- )+ (throw $ ResponseParseException "No value property found in WebDriver response" body) ( \val ->- parseEither @_ @r parseJSON val & either- (\e -> throw $ parseWebDriverException (pack e) val)- pure+ parseEither @_ @r parseJSON val+ & either+ (\e -> throw $ parseWebDriverException (pack e) val)+ pure )- valueParser :: Value -> Parser Value valueParser body = body & withObject "body value" (.: "value")
webdriver-precore.cabal view
@@ -1,7 +1,7 @@-cabal-version: 3.12+cabal-version: 2.4 name: webdriver-precore-version: 0.2.0.1+version: 0.2.0.2 homepage: https://github.com/pyrethrum/webdriver-precore#readme bug-reports: https://github.com/pyrethrum/webdriver-precore/issues author: John Walker, Adrian Glouftsis@@ -16,7 +16,7 @@ README.md ChangeLog.md -tested-with: GHC == { 9.8.2, 9.8.4, 9.10.1 }+tested-with: GHC == 9.8.2 || == 9.8.4 || == 9.10.1 synopsis: A typed wrapper for W3C WebDriver (HTTP and BiDi) protocols. @@ -162,7 +162,7 @@ WebDriverPreCore.Error hs-source-dirs: src build-depends:- webdriver-precore:utils-internal,+ utils-internal, aeson >=1.4 && <2.3, base >=4.16 && <5, bytestring >=0.10 && <0.12.3,@@ -192,7 +192,7 @@ hs-source-dirs: test build-depends: aeson- , webdriver-precore:utils-internal+ , utils-internal , base , base64 , bytestring