on develop help sign in
Merge branch 'ts-hydration' of github.com:reflex-frp/reflex-dom into ts-hydration
commite7a8a844330995e640840d9451962186bded09a0 authorTom Smalley <tfsmalley@gmail.com> dateTue 4 Dec 2018, 20:03 (8 years ago) parentc96bae27df7145
3 files changed+15−3
reflex-dom-core/default.nix+2−1 reflex-dom-core/reflex-dom-core.cabal+2−1 reflex-dom-core/test/hydration.hs+11−1
reflex-dom-core/default.nix+2−1
@@ -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
10+, iproute, chromium, hashable, selenium-server-standalone
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,6 +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 ];
4243 testHaskellDepends = [
4344 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
4445 http-types HUnit jsaddle jsaddle-warp linux-namespaces process
reflex-dom-core/reflex-dom-core.cabal+2−1
@@ -169,6 +169,7 @@ test-suite hydration
169169 , random
170170 , reflex == 0.5.*
171171 , reflex-dom-core
172+ , process
172173 , silently
173174 , temporary
174175 , text
@@ -178,7 +179,7 @@ test-suite hydration
178179 , webdriver
179180 , websockets
180181 hs-source-dirs: test
181− ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
182+ ghc-options: -threaded -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
182183 ghc-prof-options: -fprof-auto -optP-DPROFILING
183184 main-is: hydration.hs
184185 type: exitcode-stdio-1.0
reflex-dom-core/test/hydration.hs+11−1
@@ -27,6 +27,7 @@ import Network.Wai
2727import Network.WebSockets
2828import Reflex.Dom.Core
2929import Reflex.Dom.Builder.Immediate (GhcjsDomSpace)
30+import System.Process
3031import System.Random
3132import System.Timeout
3233import Test.Hspec
@@ -60,7 +61,7 @@ chromeConfig = WD.useBrowser (WD.chrome { WD.chromeBinary = Just "/run/current-s
6061-- parallel (requires port fix)
6162
6263main :: IO ()
63−main = hspec $ do
64+main = hspec $ beforeAll startSeleniumServer $ do
6465
6566 describe "text" $ do
6667 it "works" $ do
@@ -726,6 +727,15 @@ main = hspec $ do
726727 (traverse_ elementShouldBeRemoved)
727728 (el "span" $ prerender (text "One") (text "Two"))
728729
730+startSeleniumServer :: IO ()
731+startSeleniumServer = do
732+ (_,_,_,ph) <- createProcess $ (proc "selenium-server" [])
733+ { std_in = NoStream
734+ , std_out = NoStream
735+ }
736+ _ <- forkIO $ print =<< waitForProcess ph
737+ threadDelay $ 1000 * 1000 * 2 -- TODO poll or wait on a a signal to block on
738+
729739assertAttr :: WD.Element -> Text -> Maybe Text -> WD ()
730740assertAttr e k v = liftIO . assertEqual "Incorrect attribute value" v =<< WD.attr e k
731741