on develop help sign in
Merge branch 'is-dont-hardcode-chromium' of https://github.com/reflex-frp/reflex-dom into is-dont-hardcode-chromium
061e14ehsloan
reflex-dom-core/default.nix+2−2
@@ -7,7 +7,7 @@
7, process, random, ref-tf, reflex, semigroups, silently, stdenv
7, process, random, ref-tf, reflex, semigroups, silently, stdenv
8, stm, template-haskell, temporary, text, these, transformers, unix
8, stm, template-haskell, temporary, text, these, transformers, unix
9, wai, wai-websockets, warp, webdriver, websockets, zenc
9, wai, wai-websockets, warp, webdriver, websockets, zenc
10−, iproute, chromium, hashable, selenium-server-standalone
10+, iproute, chromium, hashable, selenium-server-standalone, which
11}:
11}:
12let addGcTestDepends = drv: if stdenv.system != "x86_64-linux" then drv else drv // {
12let addGcTestDepends = drv: if stdenv.system != "x86_64-linux" then drv else drv // {
13 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ temporary jsaddle-warp process linux-namespaces ];
13 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ temporary jsaddle-warp process linux-namespaces ];
@@ -39,7 +39,7 @@ in mkDerivation (addGcTestDepends {
39 # Show some output while running tests, so we might notice what's wrong
39 # Show some output while running tests, so we might notice what's wrong
40 testTarget = "--show-details=streaming";
40 testTarget = "--show-details=streaming";
41
41
42− testSystemDepends = [ selenium-server-standalone ];
42+ testSystemDepends = [ selenium-server-standalone which ];
43 testHaskellDepends = [
43 testHaskellDepends = [
44 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
44 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
45 http-types HUnit jsaddle jsaddle-warp linux-namespaces process
45 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
55testTimeLimit :: Int
55testTimeLimit :: Int
56testTimeLimit = 1 * 1000 * 1000
56testTimeLimit = 1 * 1000 * 1000
57
57
58−chromeConfig :: FilePath -> WD.WDConfig
58+chromeConfig :: Text -> WD.WDConfig
59−chromeConfig chromePath = WD.useBrowser (WD.chrome { WD.chromeBinary = Just chromePath, WD.chromeOptions = ["--headless"]}) WD.defaultConfig
59+chromeConfig fp = WD.useBrowser (WD.chrome { WD.chromeBinary = Just $ T.unpack fp, WD.chromeOptions = ["--headless"] }) WD.defaultConfig
60
60
61-- TODO list
61-- TODO list
62-- use only available ports
62-- use only available ports
@@ -682,12 +682,9 @@ testWidget' beforeJS afterSwitchover bodyWidget = maybe (error "test timed out")
682 -- hSilence to get rid of ConnectionClosed logs
682 -- hSilence to get rid of ConnectionClosed logs
683 jsaddleWarp = forkIO $ Warp.runSettings settings application
683 jsaddleWarp = forkIO $ Warp.runSettings settings application
684 bracket jsaddleWarp killThread $ \_ -> do
684 bracket jsaddleWarp killThread $ \_ -> do
685− (_, Just out, Just err, _) <- createProcess $ (shell "whereis chromium") { std_out = CreatePipe }
685+ browserPath <- T.strip . T.pack <$> readProcess "which" [ "chromium" ] ""
686− whereisRes <- liftIO $ TE.decodeUtf8 <$> BS.hGetContents out
686+ when (T.null browserPath) $ fail "No browser was not found"
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
687+ WD.runSession (chromeConfig browserPath) . WD.finallyClose $ do
691 WD.openPage $ "http://localhost:" <> show port
688 WD.openPage $ "http://localhost:" <> show port
692 a <- beforeJS
689 a <- beforeJS
693 liftIO $ putMVar waitBeforeJS ()
690 liftIO $ putMVar waitBeforeJS ()