From 9688032451fc52017df537fd6f7b86baa49503fc Mon Sep 17 00:00:00 2001 From: Paco Cartones <253313177+pacocartones@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:52:34 +0200 Subject: [PATCH] test(dashboard): reactivate request logger coverage (#13843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test(dashboard): reactivate request logger coverage * test(dashboard): assert the request-logger modal by its own label The drift this PR unblocks is real — the next-intl mock lost its `useLocale` export in #7935, so the suite died on `No "useLocale" export is defined`. Restoring it is the actual fix. The dialog assertions were also loosened to `[role="dialog"]`, and that part was not needed: 20 components under src/ render that role, so the selector stops proving this particular modal is the one on screen. Measured — keeping only the `useLocale` fix and restoring a precise selector still passes 6/6. Now asserting `[aria-label="ariaLabel"]`, which is what RequestLoggerDetail.tsx:469 renders (the mock returns the key rather than the translation). --------- Co-authored-by: Paco Cartones Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --- config/quality/vitest-exclusions.json | 6 ------ ...quest-logger-autorefresh-visibility-3972.test.tsx | 12 ++++++++---- vitest.config.ts | 1 - 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/config/quality/vitest-exclusions.json b/config/quality/vitest-exclusions.json index 902aaf4d81..01ce992f59 100644 --- a/config/quality/vitest-exclusions.json +++ b/config/quality/vitest-exclusions.json @@ -2,12 +2,6 @@ "_comment": "Inventário dos arquivos de teste excluídos do Vitest. Toda entrada precisa de uma issue de rastreio ABERTA. Gate: npm run check:vitest-exclusions. Contexto: #13204.", "_measured": "2026-09-10 — cada arquivo rodado isoladamente com as exclusões removidas", "excluded": [ - { - "file": "tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx", - "issue": "#13204", - "measured": "2026-09-10", - "status": "Tests 1 failed | 5 passed (6)" - }, { "file": "tests/unit/ui/logs-page-detail-modal-reopen-on-close.test.tsx", "issue": "#13204", diff --git a/tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx b/tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx index c0027b1a00..d03dcb54d1 100644 --- a/tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx +++ b/tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx @@ -24,6 +24,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; vi.mock("next-intl", () => ({ useTranslations: () => (key: string) => key, + useLocale: () => "en", })); vi.mock("next/navigation", () => ({ @@ -67,6 +68,9 @@ function deferredResponse() { } beforeEach(() => { + ( + globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean } + ).IS_REACT_ACT_ENVIRONMENT = true; callLogsRequests = 0; if (!globalThis.localStorage) { const store = new Map(); @@ -163,14 +167,14 @@ describe("RequestLoggerV2 detail modal lifecycle", () => { await act(async () => { row?.dispatchEvent(new MouseEvent("click", { bubbles: true })); }); - expect(container.querySelector('[aria-label="Request log detail"]')).not.toBeNull(); + expect(container.querySelector('[aria-label="ariaLabel"]')).not.toBeNull(); await act(async () => { container - .querySelector('[aria-label="Close detail modal"]') + .querySelector('[aria-label="close"]') ?.dispatchEvent(new MouseEvent("click", { bubbles: true })); }); - expect(container.querySelector('[aria-label="Request log detail"]')).toBeNull(); + expect(container.querySelector('[aria-label="ariaLabel"]')).toBeNull(); await act(async () => { detail.resolve( @@ -189,7 +193,7 @@ describe("RequestLoggerV2 detail modal lifecycle", () => { await detail.promise; }); - expect(container.querySelector('[aria-label="Request log detail"]')).toBeNull(); + expect(container.querySelector('[aria-label="ariaLabel"]')).toBeNull(); }); }); diff --git a/vitest.config.ts b/vitest.config.ts index ffe27130f9..49fd2c2b09 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -38,7 +38,6 @@ export default defineConfig({ "tests/e2e/ecosystem.test.ts", "tests/e2e/protocol-clients.test.ts", // ── Pre-existing failures tracked by #8618 ─────────────────────────────── - "tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado "tests/unit/ui/logs-page-detail-modal-reopen-on-close.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado "tests/unit/ui/agent-card.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado "src/app/(dashboard)/dashboard/cache/__tests__/CacheTrends.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado