Skip to content

Commit

Permalink
use check
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Feb 24, 2020
1 parent b26b848 commit cbb15a1
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions test/integration/prerender/test/index.test.js
@@ -1,26 +1,27 @@
/* eslint-env jest */
/* global jasmine */
import fs from 'fs-extra'
import { join, dirname } from 'path'
import cheerio from 'cheerio'
import webdriver from 'next-webdriver'
import escapeRegex from 'escape-string-regexp'
import fs from 'fs-extra'
import {
renderViaHTTP,
check,
fetchViaHTTP,
findPort,
launchApp,
getReactErrorOverlayContent,
initNextServerScript,
killApp,
waitFor,
launchApp,
nextBuild,
nextStart,
stopApp,
nextExport,
nextStart,
normalizeRegEx,
renderViaHTTP,
startStaticServer,
initNextServerScript,
getReactErrorOverlayContent,
stopApp,
waitFor,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { dirname, join } from 'path'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
const appDir = join(__dirname, '..')
Expand Down Expand Up @@ -398,10 +399,10 @@ const runTests = (dev = false, looseMode = false) => {
const text1 = await browser.elementByCss('#catchall').text()
expect(text1).toBe('fallback')

await new Promise(resolve => setTimeout(resolve, 4000))

const text2 = await browser.elementByCss('#catchall').text()
expect(text2).toMatch(/Hi.*?delayby3s/)
await check(
() => browser.elementByCss('#catchall').text(),
/Hi.*?delayby3s/
)
}
})

Expand Down Expand Up @@ -430,10 +431,10 @@ const runTests = (dev = false, looseMode = false) => {
const text1 = await browser.elementByCss('#catchall').text()
expect(text1).toBe('fallback')

await new Promise(resolve => setTimeout(resolve, 4000))

const text2 = await browser.elementByCss('#catchall').text()
expect(text2).toMatch(/Hi.*?delayby3s nested/)
await check(
() => browser.elementByCss('#catchall').text(),
/Hi.*?delayby3s nested/
)
}
})

Expand Down

0 comments on commit cbb15a1

Please sign in to comment.