1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Possible fix for dynamic import test in travis.

This commit is contained in:
Arunoda Susiripala 2017-05-15 10:43:22 +05:30
parent 737c283bb7
commit eb4ef544ca

View file

@ -1,5 +1,6 @@
/* global describe, it, expect */ /* global describe, it, expect */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { waitFor } from 'next-test-utils'
export default function (context) { export default function (context) {
describe('Render via browser', () => { describe('Render via browser', () => {
@ -95,9 +96,15 @@ export default function (context) {
it('should render dynamic import components in the client', async () => { it('should render dynamic import components in the client', async () => {
const browser = await webdriver(context.port, '/') const browser = await webdriver(context.port, '/')
const text = await browser await browser
.elementByCss('#dynamic-imports-page').click() .elementByCss('#dynamic-imports-page').click()
.waitForElementByCss('#dynamic-imports-page') .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() .elementByCss('#dynamic-imports-page p').text()
expect(text).toBe('Welcome to dynamic imports.') expect(text).toBe('Welcome to dynamic imports.')