packages feed

webdriver-precore-0.2.0.1: webdriver-precore.cabal

cabal-version: 3.12

name:           webdriver-precore
version:        0.2.0.1
homepage:       https://github.com/pyrethrum/webdriver-precore#readme
bug-reports:    https://github.com/pyrethrum/webdriver-precore/issues
author:         John Walker, Adrian Glouftsis
maintainer:     theghostjw@gmail.com
category:       Webb, WebDriver, Testing
copyright:      2025 John Walker, Adrian Glouftsis
license:        BSD-3-Clause
license-file:   LICENSE
build-type:     Simple

extra-doc-files: 
  README.md
  ChangeLog.md

tested-with: GHC == { 9.8.2, 9.8.4, 9.10.1 }

synopsis:       A typed wrapper for W3C WebDriver (HTTP and BiDi) protocols.

description:
  This library provides typed definitions for the WebDriver W3C spec, both @<https://www.w3.org/TR/2025/WD-webdriver2-20251028/ HTTP>@ and @<https://www.w3.org/TR/2026/WD-webdriver-bidi-20260109/ BiDi>@.

  It is designed as a foundation for building WebDriver client libraries providing type-safe endpoint definitions and response parsers without any client implementation.

  If you are looking for a fully implemented web client library, you should check out an alternative such as [haskell-webdriver](https://github.com/haskell-webdriver/haskell-webdriver#readme).

  __For complete documentation, module organisation, and migration guides, see "WebDriverPreCore".__
  
  See also the @<https://github.com/pyrethrum/webdriver project repo>@ and the test directory for @<https://github.com/pyrethrum/webdriver/tree/main/webdriver-precore/test#readme examples>@.
  
common commonExtensions
  default-extensions:
    AllowAmbiguousTypes
      BangPatterns
      BlockArguments
      ConstrainedClassMethods
      ConstraintKinds
      DisambiguateRecordFields
      DuplicateRecordFields
      DataKinds
      DefaultSignatures
      DeriveFoldable
      DeriveFunctor
      DeriveGeneric
      DeriveLift
      DeriveTraversable
      DerivingStrategies
      EmptyCase
      ExistentialQuantification
      ExtendedDefaultRules
      FlexibleContexts
      FlexibleInstances
      FunctionalDependencies
      GADTs
      GeneralizedNewtypeDeriving
      ImportQualifiedPost
      InstanceSigs
      KindSignatures
      LambdaCase
      LiberalTypeSynonyms
      MultiParamTypeClasses
      MultiWayIf
      NamedFieldPuns
      NoFieldSelectors
      NumericUnderscores
      OverloadedStrings
      OverloadedRecordDot
      PartialTypeSignatures
      PatternSynonyms
      PolyKinds
      QuasiQuotes
      RankNTypes
      RecordWildCards
      ScopedTypeVariables
      StandaloneDeriving
      StrictData
      TemplateHaskell
      TupleSections
      TypeApplications
      TypeFamilies
      TypeFamilyDependencies
      TypeOperators

common commonGhcOptions
  ghc-options:
    -fmax-pmcheck-models=10000000 
    -ferror-spans 
    -fprint-potential-instances 
    -Wall 
    -Wcompat 
    -Wincomplete-record-updates 
    -Wincomplete-uni-patterns 
    -Wredundant-constraints
    -fwarn-tabs 
    -fwrite-ide-info 
    -fno-warn-type-defaults 
    -fno-warn-unused-do-bind 
    -Wno-overlapping-patterns 
    -Wno-deprecations
    -fbyte-code-and-object-code 
    -- -fdefer-type-errors
  cpp-options: 
    -DHTMLSpecURL=https://www.w3.org/TR/2025/WD-webdriver2-20251028/
    -DBiDiSpecURL=https://www.w3.org/TR/2026/WD-webdriver-bidi-20260109/

library utils-internal
  import: commonExtensions, commonGhcOptions
  exposed-modules:
      AesonUtils
      Utils
  hs-source-dirs: utils
  build-depends:
    base          >=4.16  && <5,
    aeson         >=1.4   && <2.3,
    aeson-pretty  >=0.8   && <0.9,
    bytestring    >=0.10  && <0.12.3,
    text          >=2.1   && <2.2,
    containers    >=0.6   && <0.9,
    pretty-show ^>=1.10
  default-language: Haskell2010

library
  import: commonExtensions, commonGhcOptions
  exposed-modules:
      -- Main documentation module
      WebDriverPreCore
      -- BiDi
      WebDriverPreCore.BiDi.API
      WebDriverPreCore.BiDi.Protocol
      -- HTTP
      WebDriverPreCore.HTTP.API
      WebDriverPreCore.HTTP.Protocol
      -- Deprecated (to be removed ~ 2027-02-01)
      WebDriverPreCore.Http
      WebDriverPreCore.HTTP.SpecDefinition
      WebDriverPreCore.HTTP.HttpResponse
  other-modules:
      -- Shared
      WebDriverPreCore.Internal.HTTPBidiCommon
      -- HTTP
      WebDriverPreCore.HTTP.Capabilities
      WebDriverPreCore.HTTP.Command
      -- BiDI
      WebDriverPreCore.BiDi.Browser
      WebDriverPreCore.BiDi.BrowsingContext
      WebDriverPreCore.BiDi.Capabilities
      WebDriverPreCore.BiDi.Command
      WebDriverPreCore.BiDi.CoreTypes
      WebDriverPreCore.BiDi.Emulation
      WebDriverPreCore.BiDi.Event
      WebDriverPreCore.BiDi.Log
      WebDriverPreCore.BiDi.Input
      WebDriverPreCore.BiDi.Network
      WebDriverPreCore.BiDi.Script
      WebDriverPreCore.BiDi.Session
      WebDriverPreCore.BiDi.Storage
      WebDriverPreCore.BiDi.WebExtensions
      -- Shared
      WebDriverPreCore.Error
  hs-source-dirs: src
  build-depends:
    webdriver-precore:utils-internal,
    aeson         >=1.4   && <2.3, 
    base          >=4.16  && <5,
    bytestring    >=0.10  && <0.12.3,
    text          >=2.1   && <2.2,
    containers    >=0.6   && <0.9,
    vector        >=0.12  && <0.14
  default-language: Haskell2010

flag legacy-test
  description: Use legacy deprecated HTTP test implementations
  default: False
  manual: True

flag debug-local-config
  description: Use local debug configuration (ignore Dhall file in test/.config)
  default: False
  manual: True

test-suite test
  import: commonExtensions, commonGhcOptions
  if flag(legacy-test)
    cpp-options: -DLEGACY_TEST
  if flag(debug-local-config)
    cpp-options: -DDEBUG_LOCAL_CONFIG
  type: exitcode-stdio-1.0
  main-is: Test.hs
  hs-source-dirs: test
  build-depends:
    aeson
    , webdriver-precore:utils-internal
    , base
    , base64
    , bytestring
    , containers
    , dhall
    , directory >=1.3 && <1.4
    , falsify
    , filepath
    , ghc
    , network
    , pretty-show ^>=1.10
    , raw-strings-qq
    , req
    , tasty
    , tasty-hunit
    , time
    , text
    , unliftio
    , webdriver-precore
    , websockets
  other-modules:
   -- true unit/property tests
    ApiCoverageTest
    , ErrorCoverageTest
    , JSONParsingTest
    -- demos 
    , Config
    , ConfigLoader
    , Const
    , IOUtils
    , Logger
    , TestData
    , TestServerAPI
    , HTTP.Runner
    , HTTP.HttpClient
    , HTTP.Actions
    , HTTP.HttpActionsDeprecated
    , HTTP.DemoUtils
    , HTTP.HttpDemo
    , HTTP.ErrorDemo
    , HTTP.FallbackDemo
    , BiDi.Runner
    , BiDi.Response
    , BiDi.Socket
    , BiDi.Actions
    , BiDi.DemoUtils
    , BiDi.BiDiUrl
    , BiDi.ErrorDemo
    , BiDi.Demos.BrowserDemos
    , BiDi.Demos.BrowsingContextDemos
    , BiDi.Demos.BrowsingContextEventDemos
    , BiDi.Demos.EmulationDemos
    , BiDi.Demos.FallbackDemos
    , BiDi.Demos.InputDemos
    , BiDi.Demos.InputEventDemos
    , BiDi.Demos.LogEventDemos
    , BiDi.Demos.NetworkDemos
    , BiDi.Demos.NetworkEventDemos
    , BiDi.Demos.NetworkSupportTest
    , BiDi.Demos.OtherDemos
    , BiDi.Demos.ScriptDemos
    , BiDi.Demos.ScriptEventDemos
    , BiDi.Demos.SessionDemos
    , BiDi.Demos.StorageDemos
    , BiDi.Demos.WebExtensionDemos
    , RuntimeConst
    , HTTP.HttpRunnerDeprecated
  if flag(debug-local-config)
    other-modules:
      DebugConfig
  default-language: Haskell2010