From 38b2f34d87964ba6808f34b62ec3f5324b429548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sat, 19 Sep 2026 18:00:20 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A7=AA=20restore=20deploy=20test?= =?UTF-8?q?=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - align insight report and course-detail tests with the refined inline and panel flows - wait for podcast capabilities before interacting with the Suspense-backed form - bring the notification count badge back within the minimum text-size rule --- .../insights/insight-detail.test.tsx | 42 ++++++++++++------- .../insights/insight-run-report.test.tsx | 2 +- src/components/layout/notification-center.tsx | 2 +- src/components/notes/podcast-panel.test.tsx | 2 +- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/components/insights/insight-detail.test.tsx b/src/components/insights/insight-detail.test.tsx index 37de571..7bbada4 100644 --- a/src/components/insights/insight-detail.test.tsx +++ b/src/components/insights/insight-detail.test.tsx @@ -278,6 +278,12 @@ const renderInsight = (value: StudentInsight) => )); +const openMarksCourse = () => { + const courseRow = screen.getByRole("cell", { name: "Matematik" }).closest("tr") as HTMLElement; + fireEvent.click(courseRow); + return screen.getByRole("dialog", { name: "Matematik" }); +}; + /** The fixture's single course with its `trend` member swapped. */ const marksWith = (trend: UnknownRecord): StudentInsight => { const summary = insight.summary ?? { confidence: "none", computed_at: NOW, retain_until: NOW + WEEK }; @@ -296,6 +302,8 @@ describe("InsightDetail", () => { it("labels every module member in Turkish instead of echoing payload keys", () => { renderDrawer(); const human = screen.getByTestId("insight-human").textContent ?? ""; + const marksDetail = openMarksCourse().textContent ?? ""; + const visible = `${human} ${marksDetail}`; for (const label of [ "Devam oranı", @@ -306,7 +314,7 @@ describe("InsightDetail", () => { "Şubedeki konumu", "Yeterli veri yok", ]) { - expect(human, `label ${label}`).toContain(label); + expect(visible, `label ${label}`).toContain(label); } expect(human).toContain("Dersler arası denge"); expect(human).toContain("Yaklaşan teslimler"); @@ -326,7 +334,7 @@ describe("InsightDetail", () => { "n_marks", "within_student_contrast", ]) { - expect(human, `raw key ${rawKey}`).not.toContain(rawKey); + expect(visible, `raw key ${rawKey}`).not.toContain(rawKey); } }); @@ -345,17 +353,19 @@ describe("InsightDetail", () => { it("renders the service's honest reasons as sentences", () => { renderDrawer(); const human = screen.getByTestId("insight-human").textContent ?? ""; + const marksDetail = openMarksCourse().textContent ?? ""; + const visible = `${human} ${marksDetail}`; - expect(human).toContain("eğilim için en az 6 not gerekir"); - expect(human).toContain("Veri toplanıyor (2/3)"); - expect(human).toContain("kontrast için bantlanmış en az 3 ders gerekir"); - expect(human).toContain("Isı haritası için 3/5 oturum"); - expect(human).toContain("Erteleme profili submitted_at gerektirir"); - expect(human).toContain("Dönem kümülatifi; son 30 gün penceresi yok."); + expect(visible).toContain("eğilim için en az 6 not gerekir"); + expect(visible).toContain("Veri toplanıyor (2/3)"); + expect(visible).toContain("kontrast için bantlanmış en az 3 ders gerekir"); + expect(visible).toContain("Isı haritası için 3/5 oturum"); + expect(visible).toContain("Erteleme profili submitted_at gerektirir"); + expect(visible).toContain("Dönem kümülatifi; son 30 gün penceresi yok."); // A rate-space difference is percentage points: -0.16 is "-16 puan", not // "-0,2 puan" — the raw number must never leak through unconverted. - expect(human).toContain("-16 puan"); - expect(human).toContain("-4 puan"); + expect(visible).toContain("-16 puan"); + expect(visible).toContain("-4 puan"); }); it("keeps the whole raw payload in the collapsed technical disclosure", () => { @@ -428,10 +438,10 @@ describe("InsightDetail", () => { rising: false, }), ); - const human = screen.getByTestId("insight-human").textContent ?? ""; + const marksDetail = openMarksCourse().textContent ?? ""; - expect(human).toContain(reason); - expect(human).not.toContain("/ 30 gün"); + expect(marksDetail).toContain(reason); + expect(marksDetail).not.toContain("/ 30 gün"); }); it("shows the slope row when the trend computed one", () => { @@ -448,10 +458,10 @@ describe("InsightDetail", () => { rising: false, }), ); - const human = screen.getByTestId("insight-human").textContent ?? ""; + const marksDetail = openMarksCourse().textContent ?? ""; - expect(human).toContain("+3,4 puan / 30 gün"); - expect(human).not.toContain("eğim hesaplanmadı"); + expect(marksDetail).toContain("+3,4 puan / 30 gün"); + expect(marksDetail).not.toContain("eğim hesaplanmadı"); }); it("keeps the cards-only mode free of the drawer's full-view sections", () => { diff --git a/src/components/insights/insight-run-report.test.tsx b/src/components/insights/insight-run-report.test.tsx index d38f5d3..e2a6aee 100644 --- a/src/components/insights/insight-run-report.test.tsx +++ b/src/components/insights/insight-run-report.test.tsx @@ -147,7 +147,7 @@ const INSIGHT_S2: StudentInsight = { const INSIGHT_S3: StudentInsight = { user_id: "s3", summary: null, attention: [], cards: [], segments: [] }; -const panel = () => within(document.querySelector(".side-panel-body") as HTMLElement); +const panel = () => within(screen.getByRole("region", { name: /^Çalıştırma günü / })); async function openReport(runDay: string) { render(() => ( diff --git a/src/components/layout/notification-center.tsx b/src/components/layout/notification-center.tsx index 0a9f145..801f546 100644 --- a/src/components/layout/notification-center.tsx +++ b/src/components/layout/notification-center.tsx @@ -353,7 +353,7 @@ export function NotificationCenter() { {notificationGroupLabel(group.type)} - + {group.items.length} diff --git a/src/components/notes/podcast-panel.test.tsx b/src/components/notes/podcast-panel.test.tsx index cf191da..f6e7787 100644 --- a/src/components/notes/podcast-panel.test.tsx +++ b/src/components/notes/podcast-panel.test.tsx @@ -42,7 +42,7 @@ describe("PodcastPanel", () => { )); - fireEvent.change(screen.getByLabelText("Narration style"), { target: { value: "tek_ogretici" } }); + fireEvent.change(await screen.findByLabelText("Narration style"), { target: { value: "tek_ogretici" } }); fireEvent.click(screen.getByRole("button", { name: "Create podcast" })); await waitFor(() => {