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 29, 2024
1 parent a54e161 commit 6902316
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion sandwich-webdriver/src/Test/Sandwich/WebDriver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ module Test.Sandwich.WebDriver (
, introduceWebDriverViaNix
, introduceWebDriverViaNix'

-- * Specifying how to obtain dependencies
-- * Non-Nix dependency fetching
-- | When you aren't using Nix, these types specify how to obtain the necessary dependencies.
, defaultWebDriverDependencies
, WebDriverDependencies(..)

-- * Running an example in a given session
-- | Once you have a 'WebDriver' in context, you can run one or more sessions.
-- Each session will open an independent browser instance.
, withSession
, withSession1
, withSession2
Expand Down Expand Up @@ -49,6 +52,7 @@ module Test.Sandwich.WebDriver (
, WebDriverSession
, HasWebDriverSessionContext
-- * Shorthands
-- | These are used to make type signatures shorter.
, BaseMonad
, ContextWithBaseDeps
, ContextWithWebdriverDeps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ obtainXvfb :: (
MonadReader context m, HasBaseContext context
, MonadUnliftIO m, MonadLoggerIO m
) => XvfbToUse -> m (Either T.Text FilePath)
obtainXvfb UseXvfbFromPath = findExecutable "xvfb" >>= \case
Nothing -> return $ Left [i|Couldn't find "xvfb" on the PATH.|]
obtainXvfb UseXvfbFromPath = findExecutable "Xvfb" >>= \case
Nothing -> return $ Left [i|Couldn't find "Xvfb" on the PATH.|]
Just p -> return $ Right p
obtainXvfb (UseXvfbAt path) = doesFileExist path >>= \case
False -> return $ Left [i|Path '#{path}' didn't exist|]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ data XvfbDependenciesSpec = XvfbDependenciesSpec {
, xvfbDependenciesSpecFluxbox :: Maybe FluxboxToUse
}

-- | How to obtain the @xvfb-run@ binary.
-- | How to obtain the @Xvfb@ binary.
data XvfbToUse =
-- | Search the PATH for the @xvfb-run@ binary.
-- | Search the PATH for the @Xvfb@ binary.
UseXvfbFromPath
-- | Use the @xvfb-run@ at the given path.
-- | Use the @Xvfb@ at the given path.
| UseXvfbAt FilePath
-- | Get @xvfb-run@ from Nixpkgs.
-- | Get @Xvfb@ from Nixpkgs.
| UseXvfbFromNixpkgs NixContext
deriving Show

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ data BrowserDependenciesSpec = BrowserDependenciesSpecChrome {
-- * Download Selenium to @\/tmp\/tools@, reusing the one there if found.
-- * Use @firefox@ from the PATH as the browser.
-- * Download a compatible @geckodriver@ to @\/tmp\/tools@, reusing the one there if found.
-- * If applicable, it will also get @xvfb-run@, @fluxbox@, and/or @ffmpeg@ from the PATH.
-- * If applicable, it will also get @Xvfb@, @fluxbox@, and/or @ffmpeg@ from the PATH.
--
-- But, it's easy to customize this behavior. You can define your own 'WebDriverDependencies' and customize
-- how each of these dependencies are found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data RunMode =
-- ^ Run with a headless browser. Supports screenshots but videos will be black.
| RunInXvfb XvfbConfig
-- ^ Run inside <https://en.wikipedia.org/wiki/Xvfb Xvfb> so that tests run in their own X11 display.
-- xvfb-run script must be installed and on the PATH.
-- The @Xvfb@ binary must be installed and on the PATH.

data WdOptions = WdOptions {
capabilities :: W.Capabilities
Expand Down

0 comments on commit 6902316

Please sign in to comment.