From 89c26c88050641ce2c7f6362a926bb36c6593c72 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Mon, 21 Oct 2024 14:34:32 -0700 Subject: [PATCH] sandwich-webdriver: more haddocks --- sandwich-webdriver/package.yaml | 2 -- sandwich-webdriver/sandwich-webdriver.cabal | 9 +++++++-- sandwich-webdriver/src/Test/Sandwich/WebDriver.hs | 4 ++++ .../src/Test/Sandwich/WebDriver/Internal/Types.hs | 3 ++- sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs | 3 +++ .../src/Test/Sandwich/WebDriver/Windows.hs | 7 ++++++- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sandwich-webdriver/package.yaml b/sandwich-webdriver/package.yaml index 637166ec..026e5bd2 100644 --- a/sandwich-webdriver/package.yaml +++ b/sandwich-webdriver/package.yaml @@ -67,8 +67,6 @@ library: - Test.Sandwich.WebDriver - Test.Sandwich.WebDriver.Binaries - Test.Sandwich.WebDriver.Config - - Test.Sandwich.WebDriver.Resolution - - Test.Sandwich.WebDriver.Types - Test.Sandwich.WebDriver.Video - Test.Sandwich.WebDriver.Windows ghc-options: diff --git a/sandwich-webdriver/sandwich-webdriver.cabal b/sandwich-webdriver/sandwich-webdriver.cabal index 6e6a1c4d..e4807391 100644 --- a/sandwich-webdriver/sandwich-webdriver.cabal +++ b/sandwich-webdriver/sandwich-webdriver.cabal @@ -29,8 +29,6 @@ library Test.Sandwich.WebDriver Test.Sandwich.WebDriver.Binaries Test.Sandwich.WebDriver.Config - Test.Sandwich.WebDriver.Resolution - Test.Sandwich.WebDriver.Types Test.Sandwich.WebDriver.Video Test.Sandwich.WebDriver.Windows other-modules: @@ -59,6 +57,7 @@ library Test.Sandwich.WebDriver.Internal.Types.Video Test.Sandwich.WebDriver.Internal.Util Test.Sandwich.WebDriver.Internal.Video + Test.Sandwich.WebDriver.Types Paths_sandwich_webdriver hs-source-dirs: src @@ -111,14 +110,20 @@ library , webdriver default-language: Haskell2010 if os(darwin) + other-modules: + Test.Sandwich.WebDriver.Resolution hs-source-dirs: darwin-src frameworks: CoreGraphics if os(windows) + other-modules: + Test.Sandwich.WebDriver.Resolution hs-source-dirs: windows-src if os(linux) + other-modules: + Test.Sandwich.WebDriver.Resolution hs-source-dirs: linux-src build-depends: diff --git a/sandwich-webdriver/src/Test/Sandwich/WebDriver.hs b/sandwich-webdriver/src/Test/Sandwich/WebDriver.hs index dbe134b7..81b56e77 100644 --- a/sandwich-webdriver/src/Test/Sandwich/WebDriver.hs +++ b/sandwich-webdriver/src/Test/Sandwich/WebDriver.hs @@ -48,6 +48,10 @@ module Test.Sandwich.WebDriver ( , webdriverSession , WebDriverSession , HasWebDriverSessionContext + -- * Shorthands + , BaseMonad + , ContextWithWebdriverDeps + , WebDriverMonad -- * On demand options , OnDemandOptions diff --git a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Internal/Types.hs b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Internal/Types.hs index b3029f21..3f70e46a 100644 --- a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Internal/Types.hs +++ b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Internal/Types.hs @@ -80,9 +80,10 @@ defaultOnDemandOptions = OnDemandOptions { , xvfbToUse = UseXvfbFromPath } +-- | Configuration for a headless browser. data HeadlessConfig = HeadlessConfig { headlessResolution :: Maybe (Int, Int) - -- ^ Resolution for the headless browser. Defaults to (1920, 1080) + -- ^ Resolution for the headless browser. Defaults to @(1920, 1080)@. } -- | Default headless config. diff --git a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs index 243c0a52..82fac40d 100644 --- a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs +++ b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs @@ -18,6 +18,9 @@ module Test.Sandwich.WebDriver.Video ( , qualityX11VideoOptions , defaultAvfoundationOptions , defaultGdigrabOptions + + -- * Types + , BaseVideoConstraints ) where import Control.Monad.Catch (MonadMask) diff --git a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Windows.hs b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Windows.hs index 2a0c2339..e49bce59 100644 --- a/sandwich-webdriver/src/Test/Sandwich/WebDriver/Windows.hs +++ b/sandwich-webdriver/src/Test/Sandwich/WebDriver/Windows.hs @@ -6,8 +6,12 @@ module Test.Sandwich.WebDriver.Windows ( , setWindowRightSide , setWindowFullScreen - -- * Querying screen info + -- * Screen resolution , getScreenResolution + + -- * Lower-level + , getResolution + , getResolutionForDisplay ) where import Control.Monad.IO.Class @@ -64,6 +68,7 @@ setWindowFullScreen = do setWindowSize (round screenWidth, round screenHeight) -- | Get the screen resolution as (x, y, width, height). (The x and y coordinates may be nonzero in multi-monitor setups.) +-- This function works with both normal 'RunMode' and Xvfb mode. getScreenResolution :: (MonadIO m) => WebDriver -> m (Int, Int, Int, Int) getScreenResolution (WebDriver {wdWebDriver=(_, maybeXvfbSession)}) = case maybeXvfbSession of Nothing -> liftIO getResolution