From 13b0861187a85807bb1e9ca95f0cb249218bdadb Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Mon, 20 May 2024 08:08:03 -0700 Subject: [PATCH] de-flake test --- .../prefetch-searchparam/prefetch-searchparam.test.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/e2e/app-dir/prefetch-searchparam/prefetch-searchparam.test.ts b/test/e2e/app-dir/prefetch-searchparam/prefetch-searchparam.test.ts index c122c412edf49..594c690aa5d32 100644 --- a/test/e2e/app-dir/prefetch-searchparam/prefetch-searchparam.test.ts +++ b/test/e2e/app-dir/prefetch-searchparam/prefetch-searchparam.test.ts @@ -1,4 +1,5 @@ import { nextTestSetup } from 'e2e-utils' +import { retry } from 'next-test-utils' describe('prefetch-searchparam', () => { const { next } = nextTestSetup({ @@ -11,12 +12,14 @@ describe('prefetch-searchparam', () => { // navigate to different search param, should update the search param await browser.elementByCss('[href="/?q=bar"]').click() - await browser.waitForElementByCss('p', 5000) - expect(await browser.elementByCss('p').text()).toBe('{"q":"bar"}') + await retry(async () => { + expect(await browser.elementByCss('p').text()).toBe('{"q":"bar"}') + }) // navigate to home, should clear the searchParams value await browser.elementByCss('[href="/"]').click() - await browser.waitForElementByCss('p', 5000) - expect(await browser.elementByCss('p').text()).toBe('{}') + await retry(async () => { + expect(await browser.elementByCss('p').text()).toBe('{}') + }) }) })