From 8ccadb478891952d426824f932ddcf6f833ecd96 Mon Sep 17 00:00:00 2001 From: Richard Lundeen Date: Fri, 4 Sep 2026 15:41:55 -0700 Subject: [PATCH] MAINT: Updating title to see the version Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e1f7c796-e59c-4474-a31b-07dd752d3f01 --- frontend/index.html | 4 ++-- frontend/src/components/Layout/MainLayout.test.tsx | 9 ++++----- frontend/src/components/Layout/MainLayout.tsx | 10 ++++++++-- frontend/src/main.tsx | 2 -- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 8086bd3010..55475d8c20 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,9 +2,9 @@ - + - PyRIT - Python Risk Identification Tool + Co-PyRIT
diff --git a/frontend/src/components/Layout/MainLayout.test.tsx b/frontend/src/components/Layout/MainLayout.test.tsx index 3cd1412c16..50bbadb47e 100644 --- a/frontend/src/components/Layout/MainLayout.test.tsx +++ b/frontend/src/components/Layout/MainLayout.test.tsx @@ -66,15 +66,12 @@ describe("MainLayout", () => { ); - expect(screen.getByText("Co-PyRIT")).toBeInTheDocument(); expect( screen.getByText("Python Risk Identification Tool") ).toBeInTheDocument(); - // Wait for async useEffect to complete - await waitFor(() => { - expect(mockedVersionApi.getVersion).toHaveBeenCalled(); - }); + expect(await screen.findByText("Co-PyRIT 1.0.0")).toBeInTheDocument(); + expect(document.title).toBe("Co-PyRIT 1.0.0"); }); it("renders children content", async () => { @@ -179,6 +176,8 @@ describe("MainLayout", () => { await waitFor(() => { expect(mockedVersionApi.getVersion).toHaveBeenCalled(); }); + expect(screen.getByText("Co-PyRIT")).toBeInTheDocument(); + expect(document.title).toBe("Co-PyRIT"); }); it("renders a 'Take a tour' button in the top bar when onStartTour is provided", async () => { diff --git a/frontend/src/components/Layout/MainLayout.tsx b/frontend/src/components/Layout/MainLayout.tsx index a106fbc497..14fda065cc 100644 --- a/frontend/src/components/Layout/MainLayout.tsx +++ b/frontend/src/components/Layout/MainLayout.tsx @@ -36,12 +36,18 @@ export default function MainLayout({ versionApi.getVersion() .then(data => { setVersion(data.version) + document.title = `Co-PyRIT ${data.version}` setCommit(data.version.includes('.dev') ? data.commit ?? null : null) setDatabaseInfo(data.database_info ?? null) }) - .catch(() => setVersion('Unknown')) + .catch(() => { + setVersion('Unknown') + document.title = 'Co-PyRIT' + }) }, []) + const title = version === 'Unknown' ? 'Co-PyRIT' : `Co-PyRIT ${version}` + return (
@@ -61,7 +67,7 @@ export default function MainLayout({ className={styles.logo} /> - Co-PyRIT + {title} Python Risk Identification Tool
{onStartTour && ( diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 8bf976690d..5e14330407 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -6,8 +6,6 @@ import { AuthProvider } from './auth/AuthProvider' import { ThemeProvider } from './hooks/useTheme' import './styles/global.css' -document.title = 'Co-PyRIT' - ReactDOM.createRoot(document.getElementById('root')!).render(