on develop help sign in
add argument to chrome config, lookup chromium using 'whereis'
37b761chsloan
reflex-dom-core/reflex-dom-core.cabal+1
@@ -165,6 +165,7 @@ test-suite hydration
165 , HUnit
165 , HUnit
166 , jsaddle
166 , jsaddle
167 , jsaddle-warp
167 , jsaddle-warp
168+ , lens
168 , random
169 , random
169 , reflex == 0.5.*
170 , reflex == 0.5.*
170 , reflex-dom-core
171 , reflex-dom-core
reflex-dom-core/test/hydration.hs+10−3
@@ -15,6 +15,7 @@ import Control.Monad
15import Control.Monad.Catch
15import Control.Monad.Catch
16import Control.Monad.Fix
16import Control.Monad.Fix
17import Control.Monad.IO.Class
17import Control.Monad.IO.Class
18+import qualified Data.ByteString as BS
18import Data.Foldable (traverse_)
19import Data.Foldable (traverse_)
19import Data.IORef
20import Data.IORef
20import Data.Maybe (fromMaybe)
21import Data.Maybe (fromMaybe)
@@ -39,6 +40,7 @@ import qualified GHCJS.DOM.File as File
39--import System.IO.Silently
40--import System.IO.Silently
40import System.IO.Temp
41import System.IO.Temp
41import System.Directory
42import System.Directory
43+import System.Process
42import qualified System.FilePath as FilePath
44import qualified System.FilePath as FilePath
43
45
44import qualified GHCJS.DOM.EventM as EventM
46import qualified GHCJS.DOM.EventM as EventM
@@ -52,8 +54,8 @@ import qualified Test.WebDriver as WD
52testTimeLimit :: Int
54testTimeLimit :: Int
53testTimeLimit = 1 * 1000 * 1000
55testTimeLimit = 1 * 1000 * 1000
54
56
55−chromeConfig :: WD.WDConfig
57+chromeConfig :: FilePath -> WD.WDConfig
56−chromeConfig = WD.useBrowser (WD.chrome { WD.chromeBinary = Just "/run/current-system/sw/bin/chromium", WD.chromeOptions = ["--headless"]}) WD.defaultConfig
58+chromeConfig chromePath = WD.useBrowser (WD.chrome { WD.chromeBinary = Just "/nix/store/hf9r4nmjsz03mb73c11gn4prdcf47sxa-chromium-69.0.3497.81/bin/chromium", WD.chromeOptions = ["--headless"]}) WD.defaultConfig
57
59
58-- TODO list
60-- TODO list
59-- use only available ports
61-- use only available ports
@@ -680,7 +682,12 @@ testWidget' beforeJS afterSwitchover bodyWidget = maybe (error "test timed out")
680 -- hSilence to get rid of ConnectionClosed logs
682 -- hSilence to get rid of ConnectionClosed logs
681 jsaddleWarp = forkIO $ Warp.runSettings settings application
683 jsaddleWarp = forkIO $ Warp.runSettings settings application
682 bracket jsaddleWarp killThread $ \_ -> do
684 bracket jsaddleWarp killThread $ \_ -> do
685+ (_, Just out, Just err, _) <- createProcess $ (shell "whereis chromium") { std_out = CreatePipe }
686+ whereisRes <- liftIO $ TE.decodeUtf8 <$> BS.hGetContents out
687+ let chromePath = case T.words whereisRes of
688+ _:path:_ -> path
689+ _ -> "/run/current-system/sw/bin/chromium" -- TODO: Need proper error if chrome not found
683− WD.runSession chromeConfig . WD.finallyClose $ do
690+ WD.runSession (chromeConfig (T.unpack chromePath)) . WD.finallyClose $ do
684 WD.openPage $ "http://localhost:" <> show port
691 WD.openPage $ "http://localhost:" <> show port
685 a <- beforeJS
692 a <- beforeJS
686 liftIO $ putMVar waitBeforeJS ()
693 liftIO $ putMVar waitBeforeJS ()