on develop help sign in
Use which to find chromium path
commit6fb99ee363143d8780a24d3a82948f6b05494000 authorLuigy Leon <luigy.leon@obsidian.systems> dateThu 6 Dec 2018, 17:53 (8 years ago) parent37b761c
2 files changed+7−10
reflex-dom-core/default.nix+2−2 reflex-dom-core/test/hydration.hs+5−8
reflex-dom-core/default.nix+2−2
@@ -7,7 +7,7 @@
77, process, random, ref-tf, reflex, semigroups, silently, stdenv
88, stm, template-haskell, temporary, text, these, transformers, unix
99, wai, wai-websockets, warp, webdriver, websockets, zenc
10−, iproute, chromium, hashable, selenium-server-standalone
10+, iproute, chromium, hashable, selenium-server-standalone, which
1111}:
1212let addGcTestDepends = drv: if stdenv.system != "x86_64-linux" then drv else drv // {
1313 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ temporary jsaddle-warp process linux-namespaces ];
@@ -39,7 +39,7 @@ in mkDerivation (addGcTestDepends {
3939 # Show some output while running tests, so we might notice what's wrong
4040 testTarget = "--show-details=streaming";
4141
42− testSystemDepends = [ selenium-server-standalone ];
42+ testSystemDepends = [ selenium-server-standalone which ];
4343 testHaskellDepends = [
4444 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
4545 http-types HUnit jsaddle jsaddle-warp linux-namespaces process
reflex-dom-core/test/hydration.hs+5−8
@@ -54,8 +54,8 @@ import qualified Test.WebDriver as WD
5454testTimeLimit :: Int
5555testTimeLimit = 1 * 1000 * 1000
5656
57−chromeConfig :: FilePath -> WD.WDConfig
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+chromeConfig :: Text -> WD.WDConfig
58+chromeConfig fp = WD.useBrowser (WD.chrome { WD.chromeBinary = Just $ T.unpack fp, WD.chromeOptions = ["--headless"] }) WD.defaultConfig
5959
6060-- TODO list
6161-- use only available ports
@@ -682,12 +682,9 @@ testWidget' beforeJS afterSwitchover bodyWidget = maybe (error "test timed out")
682682 -- hSilence to get rid of ConnectionClosed logs
683683 jsaddleWarp = forkIO $ Warp.runSettings settings application
684684 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
690− WD.runSession (chromeConfig (T.unpack chromePath)) . WD.finallyClose $ do
685+ browserPath <- T.strip . T.pack <$> readProcess "which" [ "chromiium" ] ""
686+ when (T.null browserPath) $ fail "No browser was not found"
687+ WD.runSession (chromeConfig browserPath) . WD.finallyClose $ do
691688 WD.openPage $ "http://localhost:" <> show port
692689 a <- beforeJS
693690 liftIO $ putMVar waitBeforeJS ()