on develop help sign in
Merge branch 'is-dont-hardcode-chromium' of https://github.com/reflex-frp/reflex-dom into is-dont-hardcode-chromium
commit061e14eab5b63ca3ec18e65100c364253850022d authorhsloan <ishaqsloan@gmail.com> dateThu 6 Dec 2018, 22:37 (8 years ago) parentcbb686a9935d0c
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
@@ -55,8 +55,8 @@ import qualified Test.WebDriver as WD
5555testTimeLimit :: Int
5656testTimeLimit = 1 * 1000 * 1000
5757
58−chromeConfig :: FilePath -> WD.WDConfig
59−chromeConfig chromePath = WD.useBrowser (WD.chrome { WD.chromeBinary = Just chromePath, WD.chromeOptions = ["--headless"]}) WD.defaultConfig
58+chromeConfig :: Text -> WD.WDConfig
59+chromeConfig fp = WD.useBrowser (WD.chrome { WD.chromeBinary = Just $ T.unpack fp, WD.chromeOptions = ["--headless"] }) WD.defaultConfig
6060
6161-- TODO list
6262-- 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" [ "chromium" ] ""
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 ()