Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydration test fixes for spurious failures/hangs #457

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions reflex-dom-core/test/hydration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ import qualified Test.WebDriver.Capabilities as WD
import Test.Util.ChromeFlags
import Test.Util.UnshareNetwork

-- ORPHAN: https://github.com/kallisti-dev/hs-webdriver/pull/167
deriving instance MonadMask WD

chromium :: FilePath
chromium = $(staticWhich "chromium")

Expand Down Expand Up @@ -717,6 +714,8 @@ tests withDebugging wdConfig caps _selenium = do
inputRef <- newRef ("" :: Text)
let checkValue = do
WD.sendKeys "hello world" =<< findElemWithRetry (WD.ByTag "textarea")
-- This delay is for fixing spurious CI failures
liftIO $ threadDelay (4000 * 1000)
WD.click =<< findElemWithRetry (WD.ByTag "button")
readRef inputRef `shouldBeWithRetryM` "hello world"
testWidget (pure ()) checkValue $ do
Expand Down Expand Up @@ -919,6 +918,8 @@ tests withDebugging wdConfig caps _selenium = do
e <- findElemWithRetry $ WD.ByTag "select"
assertAttr e "value" (Just "one")
WD.click =<< findElemWithRetry (WD.ById "two")
-- This delay is for fixing spurious CI failures
liftIO $ threadDelay (4000 * 1000)
assertAttr e "value" (Just "two")
WD.click =<< findElemWithRetry (WD.ByTag "button")
readRef inputRef `shouldBeWithRetryM` "two"
Expand Down Expand Up @@ -991,7 +992,10 @@ tests withDebugging wdConfig caps _selenium = do
performEvent_ $ liftIO . writeRef focusRef <$> updated (_selectElement_hasFocus e)
it "has correct initial value" $ runWD $ do
valueRef :: IORef Text <- newRef ""
let checkValue = readRef valueRef `shouldBeWithRetryM` "one"
let checkValue = do
-- This is a no-op, but prevents a deadlock situation
_ <- findElemWithRetry $ WD.ByTag "body"
readRef valueRef `shouldBeWithRetryM` "one"
testWidget (pure ()) checkValue $ do
prerender_ (pure ()) $ do
(e, ()) <- selectElement def { _selectElementConfig_initialValue = "one" } options
Expand Down Expand Up @@ -1163,6 +1167,8 @@ tests withDebugging wdConfig caps _selenium = do
liftIO $ do
writeChan replaceChan1 "one"
takeMVar lock
-- This delay is for fixing spurious CI failures
threadDelay (1000 * 1000)
one <- findElemWithRetry $ WD.ByTag "div"
shouldContainText "pb" one
liftIO $ writeChan replaceChan2 "two"
Expand Down