Skip to content

Commit

Permalink
Add defaultTestArtifactsDirectory which works on Windows noci
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Nov 19, 2023
1 parent 825b070 commit ef3f772
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 46 deletions.
3 changes: 1 addition & 2 deletions demos/demo-command-line-args/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
module Main where

import Data.String.Interpolate
import Data.Time.Clock
import Options.Applicative
import Test.Sandwich

Expand All @@ -30,5 +29,5 @@ main :: IO ()
main = runSandwichWithCommandLineArgs' testOptions myArgsParser commandLineArgsDemo

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}
3 changes: 1 addition & 2 deletions demos/demo-context-dependencies/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Common
import Control.Exception.Lifted
import Control.Monad
import Data.String.Interpolate
import Data.Time.Clock
import Test.Sandwich

data DatabaseContext = MySQLDatabaseContext | SqliteDatabaseContext
Expand Down Expand Up @@ -46,7 +45,7 @@ databaseTest2 = do
it "uses the database 2" $ getContext database >>= \db -> info [i|Got database: '#{db}'|]

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-context-nested-dependencies/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Common
import Control.Exception.Lifted
import Control.Monad
import Data.String.Interpolate
import Data.Time.Clock
import Test.Sandwich

-- For the commented type signature
Expand Down Expand Up @@ -56,7 +55,7 @@ contextNestedDepsDemo = describe "Nested dependencies" $ do
debug [i|Got server: #{s}|]

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-contexts/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Common
import Control.Exception.Lifted
import Control.Monad
import Data.String.Interpolate
import Data.Time.Clock
import Test.Sandwich

data DatabaseContext = MySQLDatabaseContext | SqliteDatabaseContext
Expand All @@ -28,7 +27,7 @@ contextsDemo = describe "Contexts" $ do
info [i|Got database: '#{db}'|]

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-custom-exceptions/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Brick
import Control.Exception
import Control.Monad.IO.Class
import Data.Text as T
import Data.Time.Clock
import GHC.Stack
import Graphics.Vty.Attributes
import Test.Sandwich
Expand Down Expand Up @@ -47,7 +46,7 @@ formatMyColoredException e = case fromException e of
Nothing -> Nothing

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
, optionsFormatters = [SomeFormatter $ defaultTerminalUIFormatter {
terminalUICustomExceptionFormatters = [formatMyException, formatMyColoredException]
}]
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-discover/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

module Main (Main.main) where

import Data.Time.Clock
import Test.Sandwich

import qualified SeleniumTests
Expand All @@ -16,7 +15,7 @@ discoverDemo = describe "Discover" $ do
SeleniumTests.tests

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-hedgehog/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Main where

import Control.Monad.IO.Class
import Data.String.Interpolate
import Data.Time.Clock
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
Expand All @@ -25,7 +24,7 @@ quickCheckDemo = describe "Hedgehog tests" $ introduceHedgehog $ do
reverse xs === xs

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-landing/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Main where
import Common
import Control.Concurrent
import Control.Monad.IO.Class
import Data.Time.Clock
import System.Random
import Test.Sandwich

Expand Down Expand Up @@ -54,7 +53,7 @@ sleepRandom = liftIO $ do
threadDelay timeToSleep

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
, optionsProjectRoot = Just "demos/demo-landing"
}

Expand Down
3 changes: 1 addition & 2 deletions demos/demo-paralleln/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Main where
import Common
import Control.Concurrent
import Control.Monad.IO.Class
import Data.Time.Clock
import System.Random
import Test.Sandwich

Expand Down Expand Up @@ -37,7 +36,7 @@ sleepRandom = liftIO $ do
threadDelay timeToSleep

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-quickcheck/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Main where

import Control.Monad.IO.Class
import Data.String.Interpolate
import Data.Time.Clock
import Test.QuickCheck
import Test.Sandwich
import Test.Sandwich.QuickCheck
Expand All @@ -18,7 +17,7 @@ quickCheckDemo = describe "QuickCheck tests" $ introduceQuickCheck $ do
prop "Failing list reversal" $ \(xs :: [Int]) -> (reverse xs) == xs

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-slack/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Main where
import Common
import Control.Concurrent
import Control.Monad.IO.Class
import Data.Time.Clock
import System.Random
import Test.Sandwich
import Test.Sandwich.Formatters.Slack
Expand Down Expand Up @@ -55,7 +54,7 @@ sleepRandom = liftIO $ do
threadDelay timeToSleep

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
, optionsProjectRoot = Just "sandwich-demos"
, optionsFormatters = [SomeFormatter $ defaultSlackFormatter {
slackFormatterSlackConfig = SlackConfig ""
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-timing-parallel/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ timingParallelDemo = parallel $ do
pauseSeconds 0.3

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-timing/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
module Main where

import Common
import Data.Time.Clock
import Test.Sandwich

timingDemo :: TopSpec
Expand All @@ -21,7 +20,7 @@ timingDemo = describe "Dinner tests" $ do
pauseSeconds 1

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
4 changes: 2 additions & 2 deletions demos/demo-tui/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import Control.Concurrent
import Control.Monad.IO.Class
import Data.Maybe
import Data.String.Interpolate
import Data.Time.Clock
import System.Random
import Test.Sandwich
import Test.Sandwich.Formatters.Print
import Test.Sandwich.Formatters.TerminalUI


simple :: TopSpec
simple = parallel $ do
describe "Foo" $ do
Expand All @@ -30,7 +30,7 @@ simple = parallel $ do
it "tests bar #2" $ pauseRandomAndSucceed

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-webdriver-landing/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module Main where
import Control.Concurrent
import Control.Monad.IO.Class
import Data.String.Interpolate
import Data.Time.Clock
import System.FilePath
import Test.Sandwich
import Test.Sandwich.WebDriver
Expand All @@ -32,7 +31,7 @@ simple = introduceWebDriverOptions @() (defaultWdOptions "/tmp/tools") $ do
liftIO $ threadDelay 2000000

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-webdriver-pool/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Control.Monad.IO.Unlift
import Data.Maybe
import Data.Pool
import Data.String.Interpolate
import Data.Time.Clock
import System.FilePath
import Test.Sandwich
import Test.Sandwich.WebDriver
Expand Down Expand Up @@ -70,7 +69,7 @@ tests =
claimWebdriver $ it "opens Google" $ withSession1 $ openPage "http://www.google.com"

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-webdriver-positioning/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Main where

import Control.Concurrent
import Control.Monad.IO.Class
import Data.Time.Clock
import Test.Sandwich
import Test.Sandwich.WebDriver
import Test.Sandwich.WebDriver.Windows
Expand All @@ -27,7 +26,7 @@ positioning = introduceWebDriver (defaultWdOptions "/tmp/tools") $ do
liftIO $ threadDelay 5000000

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-webdriver-video/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ manualVideo = introduceWebDriver (defaultWdOptions "/tmp/tools") $ do
findElem (ByCSS [i|input[type="submit"]|]) >>= click

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions demos/demo-webdriver/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Control.Concurrent
import Control.Monad.IO.Class
import qualified Data.ByteString.Lazy as BL
import Data.String.Interpolate
import Data.Time.Clock
import System.FilePath
import Test.Sandwich
import Test.Sandwich.WebDriver
Expand All @@ -31,7 +30,7 @@ simple = introduceWebDriverOptions @() (defaultWdOptions "/tmp/tools") $ do
liftIO $ threadDelay 3000000

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}

main :: IO ()
Expand Down
2 changes: 1 addition & 1 deletion sandwich-hedgehog/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ main :: IO ()
main = runSandwich options verySimple
where
options = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}
3 changes: 1 addition & 2 deletions sandwich-quickcheck/test/Spec.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import Test.Sandwich
import Data.Time.Clock
import Test.Sandwich.Formatters.Print


Expand All @@ -12,5 +11,5 @@ main :: IO ()
main = runSandwich options verySimple
where
options = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}
3 changes: 1 addition & 2 deletions sandwich-slack/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Main where

import Control.Concurrent
import Control.Monad.IO.Class
import Data.Time
import GHC.Stack
import Test.Sandwich
import Test.Sandwich.Formatters.Print
Expand Down Expand Up @@ -43,7 +42,7 @@ main :: IO ()
main = runSandwich options simple
where
options = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
, optionsFormatters = [SomeFormatter defaultTerminalUIFormatter, SomeFormatter slackFormatter]
}

Expand Down
3 changes: 1 addition & 2 deletions sandwich-webdriver/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Control.Concurrent
import Control.Monad.IO.Class
import Data.Maybe
import Data.String.Interpolate
import Data.Time.Clock
import Test.Sandwich
import Test.Sandwich.Formatters.Print
import Test.Sandwich.WebDriver
Expand Down Expand Up @@ -91,7 +90,7 @@ wdOptions = (defaultWdOptions "/tmp/tools") {
}

testOptions = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
-- , optionsFormatters = [SomeFormatter defaultTerminalUIFormatter]
, optionsFormatters = [SomeFormatter defaultPrintFormatter]
}
Expand Down
2 changes: 1 addition & 1 deletion sandwich-webdriver/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ main :: IO ()
main = runSandwich options spec
where
options = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
}
3 changes: 1 addition & 2 deletions sandwich/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Logger (LogLevel(..))
import Data.String.Interpolate
import Data.Time.Clock
import Test.Sandwich
import Test.Sandwich.Formatters.FailureReport
import Test.Sandwich.Formatters.LogSaver
Expand Down Expand Up @@ -197,7 +196,7 @@ main :: IO ()
main = runSandwichWithCommandLineArgs options documentation
where
options = defaultOptions {
optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime)
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory
, optionsFormatters = [SomeFormatter defaultLogSaverFormatter]
, optionsProjectRoot = Just "sandwich"
}
Expand Down
Loading

0 comments on commit ef3f772

Please sign in to comment.