Skip to content

Commit

Permalink
sandwich-webdriver: add introduceWebDriverViaNix'
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Aug 14, 2024
1 parent 7ae05c1 commit fff9887
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions sandwich-webdriver/src/Test/Sandwich/WebDriver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Test.Sandwich.WebDriver (
-- * Introducing a WebDriver server
introduceWebDriver
, introduceWebDriverViaNix
, introduceWebDriverViaNix'

-- * Specifying how to obtain dependencies
, defaultWebDriverDependencies
Expand Down Expand Up @@ -100,10 +101,21 @@ introduceWebDriverViaNix :: forall m context. (
=> WdOptions
-> SpecFree (ContextWithWebdriverDeps context) m ()
-> SpecFree context m ()
introduceWebDriverViaNix wdOptions =
introduceFileViaNixPackage' @"selenium.jar" "selenium-server-standalone" (findFirstFile (return . (".jar" `L.isSuffixOf`)))
. introduceBinaryViaNixPackage @"java" "jre"
. introduceBrowserDependenciesViaNix
introduceWebDriverViaNix = introduceWebDriverViaNix' (defaultNodeOptions { nodeOptionsVisibilityThreshold = 100 })

-- | Same as 'introduceWebDriverViaNix', but allows passing custom 'NodeOptions'.
introduceWebDriverViaNix' :: forall m context. (
BaseMonadContext m context, HasSomeCommandLineOptions context, HasNixContext context
)
=> NodeOptions
-- | Options
-> WdOptions
-> SpecFree (ContextWithWebdriverDeps context) m ()
-> SpecFree context m ()
introduceWebDriverViaNix' nodeOptions wdOptions =
introduceFileViaNixPackage'' @"selenium.jar" nodeOptions "selenium-server-standalone" (findFirstFile (return . (".jar" `L.isSuffixOf`)))
. introduceBinaryViaNixPackage' @"java" nodeOptions "jre"
. introduceBrowserDependenciesViaNix' nodeOptions
. introduce "Introduce WebDriver session" webdriver alloc cleanupWebDriver
where
alloc = do
Expand Down

0 comments on commit fff9887

Please sign in to comment.