diff --git a/tests/component/app-shell.test.tsx b/tests/component/app-shell.test.tsx index 9c9ff358..da23dd48 100644 --- a/tests/component/app-shell.test.tsx +++ b/tests/component/app-shell.test.tsx @@ -90,7 +90,6 @@ describe("app shell mobile navigation drawer", () => { const heading = await screen.findByRole( "heading", { name: "UI 구성요소", level: 1 }, - { timeout: 5000 }, ); await waitFor(() => expect(heading).toHaveFocus()); expect(menuButton).toHaveAttribute("aria-expanded", "false"); diff --git a/tests/component/boot-module-failure.test.tsx b/tests/component/boot-module-failure.test.tsx index d715a695..e8d248b1 100644 --- a/tests/component/boot-module-failure.test.tsx +++ b/tests/component/boot-module-failure.test.tsx @@ -18,7 +18,7 @@ describe("boot entry (09-03)", () => { await import("../../src/bootstrap/main.tsx"); - const shell = await screen.findByRole("alert", undefined, { timeout: 5_000 }); + const shell = await screen.findByRole("alert"); expect(shell).toHaveTextContent("애플리케이션을 시작할 수 없습니다."); expect(document.querySelector("[data-boot-shell]")).toBeNull(); }); diff --git a/tests/component/boot-unexpected-failure.test.tsx b/tests/component/boot-unexpected-failure.test.tsx index f8c2503b..9da395bb 100644 --- a/tests/component/boot-unexpected-failure.test.tsx +++ b/tests/component/boot-unexpected-failure.test.tsx @@ -26,7 +26,7 @@ describe("unexpected boot failure (09-04)", () => { await import("../../src/bootstrap/main.tsx"); - const shell = await screen.findByRole("alert", undefined, { timeout: 5_000 }); + const shell = await screen.findByRole("alert"); expect(shell).toHaveTextContent("BOOT_UNEXPECTED_FAILURE"); expect(shell).not.toHaveTextContent("BOOT_CONFIG_FAILURE"); expect(shell).toHaveTextContent("local-build"); diff --git a/tests/component/chunk-recovery-boundary.test.tsx b/tests/component/chunk-recovery-boundary.test.tsx index 98efa952..1f9fe904 100644 --- a/tests/component/chunk-recovery-boundary.test.tsx +++ b/tests/component/chunk-recovery-boundary.test.tsx @@ -195,7 +195,6 @@ describe("chunk recovery boundary classification", () => { await screen.findByRole( "heading", { name: "UI 구성요소", level: 1 }, - { timeout: 5000 }, ), ).toBeVisible(); expect( diff --git a/tests/component/product-feature-switch.test.tsx b/tests/component/product-feature-switch.test.tsx index 10a51793..d91b04a4 100644 --- a/tests/component/product-feature-switch.test.tsx +++ b/tests/component/product-feature-switch.test.tsx @@ -68,8 +68,6 @@ describe("runtime product feature switch", () => { const surface = await screen.findByText( (_, element) => element?.getAttribute("data-disabled-feature") === FEATURE_ID, - {}, - { timeout: 5000 }, ); expect(surface).toBeTruthy(); }); diff --git a/tests/component/route-status-surfaces.test.tsx b/tests/component/route-status-surfaces.test.tsx index 2fda7e8b..5344b45b 100644 --- a/tests/component/route-status-surfaces.test.tsx +++ b/tests/component/route-status-surfaces.test.tsx @@ -64,7 +64,6 @@ describe("route-level status surfaces", () => { await screen.findByRole( "heading", { name: "Clean Architecture Frontend", level: 1 }, - { timeout: 5000 }, ), ).toBeVisible(); }); @@ -80,7 +79,6 @@ describe("route-level status surfaces", () => { const heading = await screen.findByRole( "heading", { name: "세션이 필요합니다.", level: 1 }, - { timeout: 5000 }, ); const surface = container.querySelector( '[data-surface="authentication-required"]', @@ -131,7 +129,6 @@ describe("route-level status surfaces", () => { await screen.findByRole( "button", { name: "로그인 시작" }, - { timeout: 5000 }, ), ); expect(beginSignIn).toHaveBeenCalledWith("/examples/auth#session"); @@ -143,7 +140,6 @@ describe("route-level status surfaces", () => { const heading = await screen.findByRole( "heading", { name: "페이지를 찾을 수 없습니다.", level: 1 }, - { timeout: 5000 }, ); const page = heading.closest("section"); expect(page).not.toBeNull(); diff --git a/tests/component/router.test.tsx b/tests/component/router.test.tsx index 294e527f..18026297 100644 --- a/tests/component/router.test.tsx +++ b/tests/component/router.test.tsx @@ -62,15 +62,8 @@ describe("generic application router", () => { window.history.pushState({}, "", "/"); renderRouter(); - // The starter action lives inside the lazily loaded home chunk, so this is - // the first wait in the file that has to outlast a chunk load rather than - // an already-mounted shell element. await user.click( - await screen.findByRole( - "link", - { name: "플랫폼 구성 보기" }, - { timeout: 5000 }, - ), + await screen.findByRole("link", { name: "플랫폼 구성 보기" }), ); await waitFor(() => @@ -195,7 +188,6 @@ describe("generic application router", () => { expect( container.querySelector(`[data-surface="${surface}"]`), ).not.toBeNull(), - { timeout: 5000 }, ); await waitFor(() => expect(document.title).toBe(title)); expect( @@ -220,7 +212,6 @@ describe("generic application router", () => { await screen.findByRole( "heading", { name: "UI 구성요소", level: 1 }, - { timeout: 5000 }, ), ).toBeVisible(); expect(container.querySelector('[data-surface="invalid-route"]')).toBeNull(); diff --git a/tests/features/reference-feature/reference-page.test.tsx b/tests/features/reference-feature/reference-page.test.tsx index 84b80d92..a9e69d67 100644 --- a/tests/features/reference-feature/reference-page.test.tsx +++ b/tests/features/reference-feature/reference-page.test.tsx @@ -4,15 +4,9 @@ import { QueryClient, QueryClientProvider, } from "@tanstack/react-query"; -import { - configure, - getConfig, - render, - screen, - waitFor, -} from "@testing-library/react"; +import { render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import { createDemoSessionAdapter } from "../../../src/adapters/auth/external-session-adapter.ts"; import type { AuthSessionPort } from "../../../src/application/ports/auth-session-port.ts"; @@ -128,16 +122,6 @@ function inputWith( } describe("reference feature page states", () => { - // Entering an installed route resolves the context route table and then a - // lazy page, and React holds each Suspense reveal for up to 300ms. That - // floor alone uses half of Testing Library's 1s findBy default, so a busy - // host misses it and reports a missing heading instead of a slow route. - // Keep the wider wait scoped to this file; the test timeout still catches - // a real hang. - const defaultAsyncUtilTimeout = getConfig().asyncUtilTimeout; - beforeAll(() => configure({ asyncUtilTimeout: 5_000 })); - afterAll(() => configure({ asyncUtilTimeout: defaultAsyncUtilTimeout })); - it("mounts list and detail keys under the installed governed namespace", async () => { expect(REFERENCE_RESOURCE_QUERY_NAMESPACE).toEqual({ namespaceId: "reference-resource", diff --git a/tests/setup.ts b/tests/setup.ts index d9a6d8e8..1272638d 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -1,7 +1,17 @@ import "@testing-library/jest-dom/vitest"; -import { cleanup } from "@testing-library/react"; +import { cleanup, configure } from "@testing-library/react"; import { afterEach, vi } from "vitest"; +// findBy*/waitFor settle on the DOM change itself; their deadline only reports +// a hang. Routes render through React.lazy, and React 19 holds every Suspense +// reveal on a real 300ms timer (FALLBACK_THROTTLE_MS). A route entered through +// a context table and then a lazy page spends 600ms of the 1s default before +// any rendering work, so on a loaded host the default turns into a speed +// requirement. Fake timers cannot shorten it: Testing Library advances only +// Jest's fake timers, and MSW and user-event run on the real clock. Half the +// 10s test timeout still reports a real hang with the DOM dump. +configure({ asyncUtilTimeout: 5_000 }); + afterEach(() => { cleanup(); // A test that fails before its own vi.useRealTimers() must not leave fake