on develop help sign in
Fix tests for hspec-webdriver changes
1398edcTom Smalley
reflex-dom-core/test/hydration.hs+11−11
@@ -1129,7 +1129,7 @@ tests wdConfig caps _selenium = do
1129 (dmap, _evt) <- traverseIntMapWithKeyWithAdjust widget intMap $ leftmost [postBuildPatch <$ pb, replace]
1129 (dmap, _evt) <- traverseIntMapWithKeyWithAdjust widget intMap $ leftmost [postBuildPatch <$ pb, replace]
1130 liftIO $ dmap `H.shouldBe` intMap
1130 liftIO $ dmap `H.shouldBe` intMap
1131
1131
1132− describe "traverseDMapWithKeyWithAdjustWithMove" $ do
1132+ describe "traverseDMapWithKeyWithAdjustWithMove" $ session' $ do
1133 let widget :: DomBuilder t m => Key2 a -> Identity a -> m (Identity a)
1133 let widget :: DomBuilder t m => Key2 a -> Identity a -> m (Identity a)
1134 widget k (Identity v) = elAttr "li" ("id" =: textKey k) $ do
1134 widget k (Identity v) = elAttr "li" ("id" =: textKey k) $ do
1135 elClass "span" "key" $ text $ textKey k
1135 elClass "span" "key" $ text $ textKey k
@@ -1171,19 +1171,19 @@ tests wdConfig caps _selenium = do
1171 e <- WD.findElem (WD.ById $ textKey k)
1171 e <- WD.findElem (WD.ById $ textKey k)
1172 checkItem e (textKey k) (T.pack $ show v)
1172 checkItem e (textKey k) (T.pack $ show v)
1173 moveSpec testMove = do
1173 moveSpec testMove = do
1174− it "can insert an item" $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 3 ==> 3]) $ \body chan -> do
1174+ it "can insert an item" $ runWD $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 3 ==> 3]) $ \body chan -> do
1175 shouldContainText (T.strip $ T.unlines ["i11","i33"]) body
1175 shouldContainText (T.strip $ T.unlines ["i11","i33"]) body
1176 liftIO $ writeChan chan (insertDMapKey (Key2_Int 2) 2)
1176 liftIO $ writeChan chan (insertDMapKey (Key2_Int 2) 2)
1177 shouldContainText (T.strip $ T.unlines ["i11","i22","i33"]) body
1177 shouldContainText (T.strip $ T.unlines ["i11","i22","i33"]) body
1178− it "can delete an item" $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3]) $ \body chan -> do
1178+ it "can delete an item" $ runWD $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3]) $ \body chan -> do
1179 shouldContainText (T.strip $ T.unlines ["i11","i22","i33"]) body
1179 shouldContainText (T.strip $ T.unlines ["i11","i22","i33"]) body
1180 liftIO $ writeChan chan (deleteDMapKey (Key2_Int 2))
1180 liftIO $ writeChan chan (deleteDMapKey (Key2_Int 2))
1181 shouldContainText (T.strip $ T.unlines ["i11","i33"]) body
1181 shouldContainText (T.strip $ T.unlines ["i11","i33"]) body
1182− it "can swap items" $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3, Key2_Int 4 ==> 4]) $ \body chan -> do
1182+ it "can swap items" $ runWD $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3, Key2_Int 4 ==> 4]) $ \body chan -> do
1183 shouldContainText (T.strip $ T.unlines ["i11","i22","i33","i44"]) body
1183 shouldContainText (T.strip $ T.unlines ["i11","i22","i33","i44"]) body
1184 liftIO $ writeChan chan (swapDMapKey (Key2_Int 2) (Key2_Int 3))
1184 liftIO $ writeChan chan (swapDMapKey (Key2_Int 2) (Key2_Int 3))
1185 shouldContainText (T.strip $ T.unlines ["i11","i33","i22","i44"]) body
1185 shouldContainText (T.strip $ T.unlines ["i11","i33","i22","i44"]) body
1186− it "can move items" $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3, Key2_Int 4 ==> 4]) $ \body chan -> do
1186+ it "can move items" $ runWD $ testMove (DMap.fromList [Key2_Int 1 ==> 1, Key2_Int 2 ==> 2, Key2_Int 3 ==> 3, Key2_Int 4 ==> 4]) $ \body chan -> do
1187 shouldContainText (T.strip $ T.unlines ["i11","i22","i33", "i44"]) body
1187 shouldContainText (T.strip $ T.unlines ["i11","i22","i33", "i44"]) body
1188 liftIO $ writeChan chan (moveDMapKey (Key2_Int 2) (Key2_Int 3))
1188 liftIO $ writeChan chan (moveDMapKey (Key2_Int 2) (Key2_Int 3))
1189 shouldContainText (T.strip $ T.unlines ["i11","i22","i44"]) body
1189 shouldContainText (T.strip $ T.unlines ["i11","i22","i44"]) body
@@ -1195,7 +1195,7 @@ tests wdConfig caps _selenium = do
1195 shouldContainText (T.strip $ T.unlines ["i11","i22","i44"]) body
1195 shouldContainText (T.strip $ T.unlines ["i11","i22","i44"]) body
1196
1196
1197 describe "hydration" $ moveSpec $ \initMap test -> do
1197 describe "hydration" $ moveSpec $ \initMap test -> do
1198− chan <- newChan
1198+ chan <- liftIO newChan
1199 let static = getAndCheckInitialItems initMap
1199 let static = getAndCheckInitialItems initMap
1200 check xs = do
1200 check xs = do
1201 checkInitialItems initMap xs
1201 checkInitialItems initMap xs
@@ -1203,12 +1203,12 @@ tests wdConfig caps _selenium = do
1203 test body chan
1203 test body chan
1204 testWidget' static check $ void $ do
1204 testWidget' static check $ void $ do
1205 (dmap, _evt) <- traverseDMapWithKeyWithAdjustWithMove widget initMap =<< triggerEventWithChan chan
1205 (dmap, _evt) <- traverseDMapWithKeyWithAdjustWithMove widget initMap =<< triggerEventWithChan chan
1206− liftIO $ dmap `shouldBe` initMap
1206+ liftIO $ assertEqual "DMap" initMap dmap
1207
1207
1208 describe "hydration/immediate" $ moveSpec $ \initMap test -> do
1208 describe "hydration/immediate" $ moveSpec $ \initMap test -> do
1209− chan <- newChan
1209+ chan <- liftIO newChan
1210− replace <- newChan
1210+ replace <- liftIO newChan
1211− lock <- newEmptyMVar
1211+ lock <- liftIO newEmptyMVar
1212 let check = do
1212 let check = do
1213 liftIO $ do
1213 liftIO $ do
1214 writeChan replace ()
1214 writeChan replace ()
@@ -1223,7 +1223,7 @@ tests wdConfig caps _selenium = do
1223 pb <- getPostBuild
1223 pb <- getPostBuild
1224 performEvent_ $ liftIO (putMVar lock ()) <$ pb
1224 performEvent_ $ liftIO (putMVar lock ()) <$ pb
1225 (dmap, _evt) <- traverseDMapWithKeyWithAdjustWithMove widget initMap =<< triggerEventWithChan chan
1225 (dmap, _evt) <- traverseDMapWithKeyWithAdjustWithMove widget initMap =<< triggerEventWithChan chan
1226− liftIO $ dmap `shouldBe` initMap
1226+ liftIO $ assertEqual "DMap" initMap dmap
1227
1227
1228data Selenium = Selenium
1228data Selenium = Selenium
1229 { _selenium_portNumber :: PortNumber
1229 { _selenium_portNumber :: PortNumber