From c4859f9b01c7791b9c4e88d4f04a20d150a0913d Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Wed, 6 Apr 2022 22:41:13 +0200 Subject: [PATCH] Fix flaky test (#35951) Failed here: https://github.com/vercel/next.js/runs/5855144575?check_suite_focus=true#step:9:1795 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` --- .../react-streaming-and-server-components/test/rsc.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/react-streaming-and-server-components/test/rsc.js b/test/integration/react-streaming-and-server-components/test/rsc.js index 0444891c1581..1085b7526219 100644 --- a/test/integration/react-streaming-and-server-components/test/rsc.js +++ b/test/integration/react-streaming-and-server-components/test/rsc.js @@ -109,13 +109,15 @@ export default function (context, { runtime, env }) { expect(content).toContain('component:index.server') await browser.waitForElementByCss('#goto-streaming-rsc').click() - await new Promise((res) => setTimeout(res, 1500)) + + // Wait for navigation and streaming to finish. + await check( + () => browser.elementByCss('#content').text(), + 'next_streaming_data' + ) expect(await browser.url()).toBe( `http://localhost:${context.appPort}/streaming-rsc` ) - - content = await browser.elementByCss('#content').text() - expect(content).toContain('next_streaming_data') }) it('should handle streaming server components correctly', async () => {