@@ -6,7 +6,6 @@ import Data.Maybe (Maybe(..))
66import Effect (Effect)
77import Effect.Class (liftEffect)
88import Effect.Ref as Ref
9−import Foreign (unsafeToForeign)
109import Node.FS.Aff as FS
1110import Playwright
1211import Playwright.ConsoleMessage as ConsoleMessage
@@ -79,12 +78,11 @@ main = runTest do
7978 withBrowserPage hello
8079 \page -> do
8180 void $ evaluate page
82− "setTimeout(() => document.body.textContent += 'test', 200)"
81+ "setTimeout(() => document.body.textContent += 'uniqstring', 1)"
8382 void $ waitForFunction
8483 page
85− "x => document.body.textContent.includes(x)"
86− (unsafeToForeign "test")
87− { timeout: 3000 }
84+ "document.body.textContent.includes('uniqstring')"
85+ { timeout: 5000, polling: 100 }
8886 suite "events" do
8987 test "console" do
9088 withBrowserPage hello
@@ -96,15 +94,7 @@ main = runTest do
9694 void $ evaluate page
9795 """
9896 console.log('hi');
99− setTimeout(() => {
100− document.body.textContent += 'test';
101− }, 100)
10297 """
103− void $ waitForFunction
104− page
105− "x => document.body.textContent.includes(x)"
106− (unsafeToForeign "test")
107− { timeout: 3000 }
10898 realMessage <- liftEffect $ Ref.read messageRef
10999 Assert.equal (Just "hi") realMessage
110100 test "console: ConsoleMessageType" do
@@ -117,14 +107,6 @@ main = runTest do
117107 void $ evaluate page
118108 """
119109 console.debug('hi');
120− setTimeout(() => {
121− document.body.textContent += 'test';
122− }, 100)
123110 """
124− void $ waitForFunction
125− page
126− "x => document.body.textContent.includes(x)"
127− (unsafeToForeign "test")
128− { timeout: 3000 }
129111 realType <- liftEffect $ Ref.read typeRef
130112 Assert.equal (Just ConsoleMessage.Debug) realType