-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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…/waitForover synchronousgetBy…after arbitrary waits. - Avoid hardcoding i18n literals when practical; consider using
t('fromPalisadoes')or stable test ids.
Links
- PR: Linting fixes in codebase (Batch 1) #7147
- CI job: https://github.com/PalisadoesFoundation/talawa-admin/actions/runs/21813615131/job/62930932323?pr=7147
Requested action
Pick Option A (recommended) or Option B, update the spec accordingly, and rerun CI.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status