Unverified Commit bbf54263 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

[test] consolidate hmr test for react 18.3 (#76975)

Update flaky 18.3 test

x-ref:
https://github.com/vercel/next.js/actions/runs/13770136279/job/38509693811
parent 8331b8c0
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
import { createSandbox } from 'development-sandbox' import { createSandbox } from 'development-sandbox'
import { FileRef, nextTestSetup } from 'e2e-utils' import { FileRef, nextTestSetup } from 'e2e-utils'
import { import {
getRedboxTotalErrorCount,
getStackFramesContent, getStackFramesContent,
retry,
toggleCollapseCallStackFrames, toggleCollapseCallStackFrames,
} from 'next-test-utils' } from 'next-test-utils'
import path from 'path' import path from 'path'
...@@ -1103,8 +1105,11 @@ describe('ReactRefreshLogBox', () => { ...@@ -1103,8 +1105,11 @@ describe('ReactRefreshLogBox', () => {
const { browser } = sandbox const { browser } = sandbox
if (isReact18) { if (isReact18) {
// TODO(veil): Why different error count between Turbopack and Webpack?
if (isTurbopack) { if (isTurbopack) {
// Wait for the error to reach the correct count
await retry(async () => {
expect(await getRedboxTotalErrorCount(browser)).toBe(3)
})
await expect(browser).toDisplayRedbox(` await expect(browser).toDisplayRedbox(`
{ {
"count": 3, "count": 3,
...@@ -1120,9 +1125,13 @@ describe('ReactRefreshLogBox', () => { ...@@ -1120,9 +1125,13 @@ describe('ReactRefreshLogBox', () => {
} }
`) `)
} else { } else {
// Wait for the error to reach the correct count
await retry(async () => {
expect(await getRedboxTotalErrorCount(browser)).toBe(3)
})
await expect(browser).toDisplayRedbox(` await expect(browser).toDisplayRedbox(`
{ {
"count": 2, "count": 3,
"description": "Error: Client error", "description": "Error: Client error",
"environmentLabel": null, "environmentLabel": null,
"label": "Unhandled Runtime Error", "label": "Unhandled Runtime Error",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment