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 () => {