From 3b782d71bbcfc3c3720ac918fb3551dfc72b9a65 Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Thu, 30 Oct 2025 20:09:37 -0700 Subject: [PATCH] [test]: fix broken scroll restoration test --- .../scroll-back-restoration/test/index.test.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/integration/scroll-back-restoration/test/index.test.js b/test/integration/scroll-back-restoration/test/index.test.js index d96a60ae2a3a1..6e711e982f747 100644 --- a/test/integration/scroll-back-restoration/test/index.test.js +++ b/test/integration/scroll-back-restoration/test/index.test.js @@ -8,7 +8,7 @@ import { launchApp, nextStart, nextBuild, - check, + retry, } from 'next-test-utils' const appDir = join(__dirname, '../') @@ -35,17 +35,15 @@ const runTests = () => { await browser.eval(() => window.next.router.push('/another')) - await check( - () => browser.eval(() => document.documentElement.innerHTML), - /hi from another/ - ) + await retry(async () => { + const html = await browser.eval(() => document.documentElement.innerHTML) + expect(html).toMatch(/hi from another/) + }) await browser.eval(() => (window.didHydrate = false)) await browser.eval(() => window.history.back()) - await check(() => browser.eval(() => window.didHydrate), { - test(content) { - return content - }, + await retry(async () => { + expect(await browser.eval(() => window.didHydrate)).toBe(true) }) const newScrollX = Math.floor(await browser.eval(() => window.scrollX))