Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ describe('ReactRefreshLogBox-builtins app', () => {
}
`
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(() => document.documentElement.innerHTML)
).toContain('index page')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ describe.skip('ReactRefreshLogBox scss app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()

// Syntax error
await session.patch('index.module.scss', `.button { font-size: :5px; }`)
await session.assertHasRedbox()
await session.waitForRedbox()
const source = await session.getRedboxSource()
expect(source).toMatchSnapshot()

// Fix syntax error
await session.patch('index.module.scss', `.button { font-size: 5px; }`)
await session.assertNoRedbox()
await session.waitForNoRedbox()
})

test('scss module pure selector error', async () => {
Expand All @@ -69,7 +69,7 @@ describe.skip('ReactRefreshLogBox scss app', () => {
// Checks for selectors that can't be prefixed.
// Selector "button" is not pure (pure selectors must contain at least one local class or id)
await session.patch('index.module.scss', `button { font-size: 5px; }`)
await session.assertHasRedbox()
await session.waitForRedbox()
const source2 = await session.getRedboxSource()
expect(source2).toMatchSnapshot()
})
Expand Down
22 changes: 11 additions & 11 deletions test/development/acceptance-app/ReactRefreshLogBox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('ReactRefreshLogBox app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()

await session.patch(
'index.js',
Expand Down Expand Up @@ -388,7 +388,7 @@ describe('ReactRefreshLogBox app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('hello')
Expand Down Expand Up @@ -452,7 +452,7 @@ describe('ReactRefreshLogBox app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('hello new')
Expand All @@ -477,7 +477,7 @@ describe('ReactRefreshLogBox app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()

await session.patch('index.module.css', `.button`)

Expand Down Expand Up @@ -957,7 +957,7 @@ describe('ReactRefreshLogBox app', () => {
}
`
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
await session.patch(
'index.js',
outdent`
Expand Down Expand Up @@ -985,7 +985,7 @@ describe('ReactRefreshLogBox app', () => {
}
`
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
await session.patch(
'index.js',
outdent`
Expand All @@ -1011,7 +1011,7 @@ describe('ReactRefreshLogBox app', () => {
}
`
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
await session.patch(
'index.js',
outdent`
Expand Down Expand Up @@ -1131,7 +1131,7 @@ describe('ReactRefreshLogBox app', () => {
await retry(async () => {
expect(await getToastErrorCount(browser)).toBe(4)
})
await session.assertNoRedbox()
await session.waitForNoRedbox()

// Add Component error
await session.patch(
Expand Down Expand Up @@ -1363,7 +1363,7 @@ describe('ReactRefreshLogBox app', () => {
expect(await browser.waitForElementByCss('#text').text()).toBe(
'Hello world'
)
await session.assertNoRedbox()
await session.waitForNoRedbox()

// Re-add error
await session.patch(
Expand Down Expand Up @@ -1544,7 +1544,7 @@ describe('ReactRefreshLogBox app', () => {

await retry(async () => {
// Should use `await expect(browser).toDisplayRedbox()`
await session.assertHasRedbox()
await session.waitForRedbox()
})

if (isRspack) {
Expand Down Expand Up @@ -1589,7 +1589,7 @@ describe('ReactRefreshLogBox app', () => {
'index.js',
'export default function Page() {return <p>hello world</p>}'
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
})
}

Expand Down
4 changes: 2 additions & 2 deletions test/development/acceptance-app/ReactRefreshModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('ReactRefreshModule app', () => {
it('should allow any variable names', async () => {
await using sandbox = await createSandbox(next, new Map([]))
const { session } = sandbox
await session.assertNoRedbox()
await session.waitForNoRedbox()

const variables = [
'_a',
Expand All @@ -34,7 +34,7 @@ describe('ReactRefreshModule app', () => {
}
`
)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(next.cliOutput).not.toContain(
`'${variable}' has already been declared`
)
Expand Down
12 changes: 6 additions & 6 deletions test/development/acceptance-app/ReactRefreshRegression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('ReactRefreshRegression app', () => {
)

// Verify no hydration mismatch:
await session.assertNoRedbox()
await session.waitForNoRedbox()
})

// https://github.com/vercel/next.js/issues/13978
Expand Down Expand Up @@ -277,7 +277,7 @@ describe('ReactRefreshRegression app', () => {
`export default function () { throw new Error('boom'); }`
)

await session.assertHasRedbox()
await session.waitForRedbox()

const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
Expand All @@ -296,7 +296,7 @@ describe('ReactRefreshRegression app', () => {
`export default function Page() { throw new Error('boom'); }`
)

await session.assertHasRedbox()
await session.waitForRedbox()

const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
Expand All @@ -318,7 +318,7 @@ describe('ReactRefreshRegression app', () => {
`
)

await session.assertHasRedbox()
await session.waitForRedbox()

const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
Expand Down Expand Up @@ -366,7 +366,7 @@ describe('ReactRefreshRegression app', () => {

let didNotReload = await session.patch('app/content.mdx', `Hello Foo!`)
expect(didNotReload).toBe(true)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(
() => document.querySelector('#content').textContent
Expand All @@ -375,7 +375,7 @@ describe('ReactRefreshRegression app', () => {

didNotReload = await session.patch('app/content.mdx', `Hello Bar!`)
expect(didNotReload).toBe(true)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(
() => document.querySelector('#content').textContent
Expand Down
4 changes: 2 additions & 2 deletions test/development/acceptance-app/app-hmr-changes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ describe('Error overlay - RSC build errors', () => {
await session.patch(pagePath, break2.replace('break 3', '<Hello />'))

await session.patch(pagePath, break2)
await session.assertHasRedbox()
await session.waitForRedbox()

await session.patch(pagePath, break1)

await session.patch(pagePath, originalPage)
await session.assertNoRedbox()
await session.waitForNoRedbox()
}

expect(
Expand Down
6 changes: 3 additions & 3 deletions test/development/acceptance-app/editor-links.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Error overlay - editor links', () => {
expect(loaded).toBe(true)
})

await session.assertHasRedbox()
await session.waitForRedbox()
await clickSourceFile(browser)
await check(() => editorRequestsCount, /1/)
})
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('Error overlay - editor links', () => {
`
)

await session.assertHasRedbox()
await session.waitForRedbox()
await clickImportTraceFiles(browser)
await check(() => editorRequestsCount, /4/)
})
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('Error overlay - editor links', () => {
`
)

await session.assertHasRedbox()
await session.waitForRedbox()
await clickImportTraceFiles(browser)
await check(() => editorRequestsCount, /3/)
})
Expand Down
2 changes: 1 addition & 1 deletion test/development/acceptance-app/error-message-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Error overlay - error message urls', () => {
content + '\nexport function getServerSideProps() {}'
)

await session.assertHasRedbox()
await session.waitForRedbox()

const link = await browser.elementByCss(
'[data-nextjs-terminal] a, [data-nextjs-codeframe] a'
Expand Down
12 changes: 6 additions & 6 deletions test/development/acceptance-app/error-recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('Error recovery app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()

await check(
() => session.evaluate(() => document.querySelector('p').textContent),
Expand Down Expand Up @@ -384,7 +384,7 @@ describe('Error recovery app', () => {
`
)

await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(await session.hasErrorToast()).toBe(false)

expect(
Expand All @@ -395,7 +395,7 @@ describe('Error recovery app', () => {
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('Count: 2')

await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(await session.hasErrorToast()).toBe(false)
})

Expand Down Expand Up @@ -472,7 +472,7 @@ describe('Error recovery app', () => {

// TODO-APP: re-enable when error recovery doesn't reload the page.
// expect(didNotReload).toBe(true)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('Hello')
Expand Down Expand Up @@ -566,7 +566,7 @@ describe('Error recovery app', () => {

// TODO-APP: re-enable when error recovery doesn't reload the page.
// expect(didNotReload).toBe(true)
await session.assertNoRedbox()
await session.waitForNoRedbox()
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('Hello')
Expand Down Expand Up @@ -868,7 +868,7 @@ describe('Error recovery app', () => {
)

// Expected: this fixes the problem
await session.assertNoRedbox()
await session.waitForNoRedbox()
})

// https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/3#issuecomment-554137262
Expand Down
4 changes: 2 additions & 2 deletions test/development/acceptance-app/hydration-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FileRef, nextTestSetup } from 'e2e-utils'
import path from 'path'
import { outdent } from 'outdent'
import {
assertNoRedbox,
waitForNoRedbox,
getRedboxErrorLink,
getToastErrorCount,
retry,
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Error overlay for hydration errors in App router', () => {
}
`,
async () => {
await assertNoRedbox(browser)
await waitForNoRedbox(browser)
expect(await browser.elementByCss('.child').text()).toBe('Value')
}
)
Expand Down
6 changes: 3 additions & 3 deletions test/development/acceptance-app/invalid-imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Error Overlay invalid imports', () => {
const withoutUseClient = content.replace("'use client'", '')
await session.patch(pageFile, withoutUseClient)

await session.assertHasRedbox()
await session.waitForRedbox()
if (process.env.IS_TURBOPACK_TEST) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./app
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('Error Overlay invalid imports', () => {
const withoutUseClient = content.replace("'use client'", '')
await session.patch(pageFile, withoutUseClient)

await session.assertHasRedbox()
await session.waitForRedbox()
if (process.env.IS_TURBOPACK_TEST) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/client-only-package
Expand Down Expand Up @@ -249,7 +249,7 @@ describe('Error Overlay invalid imports', () => {
const content = await next.readFile(file)
await session.patch(file, "'use client'\n" + content)

await session.assertHasRedbox()
await session.waitForRedbox()
if (process.env.IS_TURBOPACK_TEST) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/server-only-package
Expand Down
Loading
Loading