on develop help sign in
Merge branch 'ts-hydration' of github.com:reflex-frp/reflex-dom into ts-hydration
e7a8a84Tom Smalley
reflex-dom-core/default.nix+2−1
@@ -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
10+, iproute, chromium, hashable, selenium-server-standalone
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,6 +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 testHaskellDepends = [
43 testHaskellDepends = [
43 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
44 aeson base bytestring containers exceptions ghcjs-dom hlint hspec
44 http-types HUnit jsaddle jsaddle-warp linux-namespaces process
45 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
169 , random
169 , random
170 , reflex == 0.5.*
170 , reflex == 0.5.*
171 , reflex-dom-core
171 , reflex-dom-core
172+ , process
172 , silently
173 , silently
173 , temporary
174 , temporary
174 , text
175 , text
@@ -178,7 +179,7 @@ test-suite hydration
178 , webdriver
179 , webdriver
179 , websockets
180 , websockets
180 hs-source-dirs: test
181 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
182 ghc-prof-options: -fprof-auto -optP-DPROFILING
183 ghc-prof-options: -fprof-auto -optP-DPROFILING
183 main-is: hydration.hs
184 main-is: hydration.hs
184 type: exitcode-stdio-1.0
185 type: exitcode-stdio-1.0
reflex-dom-core/test/hydration.hs+11−1
@@ -27,6 +27,7 @@ import Network.Wai
27import Network.WebSockets
27import Network.WebSockets
28import Reflex.Dom.Core
28import Reflex.Dom.Core
29import Reflex.Dom.Builder.Immediate (GhcjsDomSpace)
29import Reflex.Dom.Builder.Immediate (GhcjsDomSpace)
30+import System.Process
30import System.Random
31import System.Random
31import System.Timeout
32import System.Timeout
32import Test.Hspec
33import Test.Hspec
@@ -60,7 +61,7 @@ chromeConfig = WD.useBrowser (WD.chrome { WD.chromeBinary = Just "/run/current-s
60-- parallel (requires port fix)
61-- parallel (requires port fix)
61
62
62main :: IO ()
63main :: IO ()
63−main = hspec $ do
64+main = hspec $ beforeAll startSeleniumServer $ do
64
65
65 describe "text" $ do
66 describe "text" $ do
66 it "works" $ do
67 it "works" $ do
@@ -726,6 +727,15 @@ main = hspec $ do
726 (traverse_ elementShouldBeRemoved)
727 (traverse_ elementShouldBeRemoved)
727 (el "span" $ prerender (text "One") (text "Two"))
728 (el "span" $ prerender (text "One") (text "Two"))
728
729
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+
729assertAttr :: WD.Element -> Text -> Maybe Text -> WD ()
739assertAttr :: WD.Element -> Text -> Maybe Text -> WD ()
730assertAttr e k v = liftIO . assertEqual "Incorrect attribute value" v =<< WD.attr e k
740assertAttr e k v = liftIO . assertEqual "Incorrect attribute value" v =<< WD.attr e k
731
741