Skip to content

[test] App.spec.tsx: logged-in route asserts login-page tagline — fix test to match route intent #7156

@coderabbitai

Description

@coderabbitai

Summary
The test in src/App.spec.tsx:

  • Suite: "Testing the App Component"
  • Test: "Component should be rendered properly and user is logged in"

fails in CI when navigating to "/admin/orglist" with a logged-in user and then asserting for the login-page tagline text:

"An open source application by Palisadoes Foundation volunteers"

Evidence

  • CI run (Feb 09, 2026): Run ID 21813615131, Shard 12
  • Error: TestingLibraryElementError: Unable to find the tagline text.
  • DOM snapshot shows only the Toastify container at failure time.

Root cause
The tagline is rendered only by LoginPage.tsx (via t('fromPalisadoes')). In the logged-in scenario at '/admin/orglist', the app routes into the secured admin area (SuperAdminScreen -> OrgList). The login screen (and its tagline) should not be present. The assertion is therefore pointing to the wrong page for the chosen route and auth state.

Proposed fixes (choose one)

Option A — Assert the logged-in view (recommended)
Keep the route '/admin/orglist' and assert for content that is expected after authentication (the suite already mocks OrgList).

Diff:

--- a/src/App.spec.tsx
+++ b/src/App.spec.tsx
@@ -401,14 +401,15 @@ describe('Testing the App Component', () => {
   });

   it('Component should be rendered properly and user is logged in', async () => {
     renderApp(link, '/admin/orglist');

-    await wait();
-
-    expect(
-      screen.getByText(
-        'An open source application by Palisadoes Foundation volunteers',
-      ),
-    ).toBeTruthy();
+    // Assert that the authenticated Org List screen renders.
+    const orgList = await screen.findByTestId('mock-org-list');
+    expect(orgList).toBeInTheDocument();
   });

Option B — Verify the login tagline explicitly
If you want to validate the login footer, change the route to '/' or '/admin' and ensure the user is not logged in:

-  renderApp(link, '/admin/orglist');
+  renderApp(link, '/admin'); // or '/'

-  await wait();
-  expect(
-    screen.getByText('An open source application by Palisadoes Foundation volunteers'),
-  ).toBeTruthy();
+  const tagline = await screen.findByText(
+    'An open source application by Palisadoes Foundation volunteers',
+    { exact: false }
+  );
+  expect(tagline).toBeInTheDocument();

Stability tips

  • Prefer findBy…/waitFor over synchronous getBy… after arbitrary waits.
  • Avoid hardcoding i18n literals when practical; consider using t('fromPalisadoes') or stable test ids.

Links

Requested action
Pick Option A (recommended) or Option B, update the spec accordingly, and rerun CI.

Metadata

Metadata

Labels

good first issueGood for newcomerstestTesting applicationui/uxissue related and being worked with the figma file of the Admin UI

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions