Skip to content

Commit

Permalink
sandwich-webdriver: more haddocks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Oct 21, 2024
1 parent 91ade7c commit 89c26c8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 0 additions & 2 deletions sandwich-webdriver/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 7 additions & 2 deletions sandwich-webdriver/sandwich-webdriver.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions sandwich-webdriver/src/Test/Sandwich/WebDriver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ module Test.Sandwich.WebDriver (
, webdriverSession
, WebDriverSession
, HasWebDriverSessionContext
-- * Shorthands
, BaseMonad
, ContextWithWebdriverDeps
, WebDriverMonad

-- * On demand options
, OnDemandOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions sandwich-webdriver/src/Test/Sandwich/WebDriver/Video.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module Test.Sandwich.WebDriver.Video (
, qualityX11VideoOptions
, defaultAvfoundationOptions
, defaultGdigrabOptions

-- * Types
, BaseVideoConstraints
) where

import Control.Monad.Catch (MonadMask)
Expand Down
7 changes: 6 additions & 1 deletion sandwich-webdriver/src/Test/Sandwich/WebDriver/Windows.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 89c26c8

Please sign in to comment.