From eb4ef544ca203b5561587b083c2f3ec88c1ce76a Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 15 May 2017 10:43:22 +0530 Subject: [PATCH] Possible fix for dynamic import test in travis. --- test/integration/static/test/browser.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/integration/static/test/browser.js b/test/integration/static/test/browser.js index 6a8c4c6b..9529b3dc 100644 --- a/test/integration/static/test/browser.js +++ b/test/integration/static/test/browser.js @@ -1,5 +1,6 @@ /* global describe, it, expect */ import webdriver from 'next-webdriver' +import { waitFor } from 'next-test-utils' export default function (context) { describe('Render via browser', () => { @@ -95,9 +96,15 @@ export default function (context) { it('should render dynamic import components in the client', async () => { const browser = await webdriver(context.port, '/') - const text = await browser + await browser .elementByCss('#dynamic-imports-page').click() .waitForElementByCss('#dynamic-imports-page') + + // Wait until browser loads the dynamic import chunk + // TODO: We may need to find a better way to do this + await waitFor(5000) + + const text = await browser .elementByCss('#dynamic-imports-page p').text() expect(text).toBe('Welcome to dynamic imports.')