未验证 提交 bc845f22 编写于 作者: J Joe Haddad 提交者: GitHub

Stabilize HMR tests on CI (#12029)

上级 450d4bd0
......@@ -213,6 +213,12 @@ function handleErrors(errors) {
// Do not attempt to reload now.
// We will reload on next success instead.
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB(formatted.errors[0])
self.__NEXT_HMR_CB = null
}
}
}
function tryDismissErrorOverlay() {
......
......@@ -69,7 +69,7 @@ export async function sandbox(id = nanoid()) {
console.log('Application re-loaded.')
// Slow down tests a bit:
await new Promise(resolve => setTimeout(resolve, 250))
await new Promise(resolve => setTimeout(resolve, 750))
return false
}
if (status === 'success') {
......@@ -83,8 +83,8 @@ export async function sandbox(id = nanoid()) {
await new Promise(resolve => setTimeout(resolve, 30))
}
// Slow down tests a bit:
await new Promise(resolve => setTimeout(resolve, 250))
// Slow down tests a bit (we don't know how long re-rendering takes):
await new Promise(resolve => setTimeout(resolve, 750))
return true
},
async remove(fileName) {
......@@ -103,6 +103,16 @@ export async function sandbox(id = nanoid()) {
)
}
},
async getOverlayContent() {
await browser.waitForElementByCss('iframe', 10000)
const hasIframe = await browser.hasElementByCssSelector('iframe')
if (!hasIframe) {
throw new Error('Unable to find overlay')
}
return browser.eval(
`document.querySelector('iframe').contentWindow.document.body.innerHTML`
)
},
},
function cleanup() {
async function _cleanup() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册