11open ReactRouter
22open Vitest
33
4- @module ("vitest" )
5- external testWithTimeout : (string , unit => promise <unit >, int ) => unit = "test"
6-
7- let sleep = ms =>
8- Promise .make ((resolve , _ ) => {
9- let _timeoutId = setTimeout (~handler = () => {
10- resolve ()
11- }, ~timeout = ms )
12- })
13-
144let snapshotSection = async (~width , ~height , ~sectionTestId , ~screenshotName ) => {
155 await viewport (width , height )
166
@@ -29,11 +19,11 @@ let snapshotSection = async (~width, ~height, ~sectionTestId, ~screenshotName) =
2919
3020 if sectionTestId == "landing-other-selling-points" {
3121 let sourceSelector = ` [data-testid="${sectionTestId}"]`
32- await waitForImages (sourceSelector )
22+ await TestUtils . waitForImages (sourceSelector )
3323 // Headless UI's appear transition mutates classes after first render. Since
3424 // these tests snapshot a cloned outerHTML string, wait for the live section
3525 // to settle so the clone does not preserve a transient opacity-0 state.
36- await sleep (1100 )
26+ await TestUtils . sleep (1100 )
3727 }
3828
3929 let sandboxTestId = ` ${sectionTestId}-snapshot`
@@ -50,7 +40,7 @@ let snapshotSection = async (~width, ~height, ~sectionTestId, ~screenshotName) =
5040
5141 let snapshotTarget = await snapshotScreen -> getByTestId (sandboxTestId )
5242 await element (snapshotTarget )-> toBeVisible
53- await waitForImages (` [data-testid="${sandboxTestId}"]` )
43+ await TestUtils . waitForImages (` [data-testid="${sandboxTestId}"]` )
5444 await element (snapshotTarget )-> toMatchScreenshot (screenshotName )
5545 await snapshotScreen -> unmount
5646}
0 commit comments