Skip to content

(03-5301 )-fix failing test expectation in queue-table.test.tsx#2183

Open
bhavya-jpg wants to merge 1 commit intoopenmrs:mainfrom
bhavya-jpg:fix-queue-table-test
Open

(03-5301 )-fix failing test expectation in queue-table.test.tsx#2183
bhavya-jpg wants to merge 1 commit intoopenmrs:mainfrom
bhavya-jpg:fix-queue-table-test

Conversation

@bhavya-jpg
Copy link

Fix Broken Queue Table Test Expectation

Problem Statement
The queue-table.test.tsx file contained a skipped test expectation marked with a TODO. The test intended to verify that the "Queue Number" column correctly renders the visit attribute, but it was failing and thus commented out. This left a gap in test coverage for the queue table's rendering logic.

Summary:
Solution: This PR enables and fixes the failing test case in packages/esm-service-queues-app/src/queue-table/queue-table.test.tsx. It corrects the test configuration to match the mock data and refactors the row selection logic to be more robust.

Key Changes:

Test Configuration Fix:

Updated visitQueueNumberAttributeUuid in the test config to use the Attribute Type UUID (queue-number-visit-attr-type-uuid) instead of the Instance UUID. This matches the structure in queue-entry.mock.ts
, allowing the component to correctly find the attribute.

Robust Row Selection:
Refactored Row Selector: Changed the test to find the row by patient name (getByText('Alice Johnson')) instead of using a hardcoded index (rows[2]).

Why: The previous index rows[2] incorrectly targeted a hidden "expansion row" (due to Carbon Design System's table structure), which caused the test to read undefined cells. The new selection logic is robust and correctly identifies the visible row.

Enabled Test:
Uncommented the expectation expect(cells[1].childNodes[0]).toHaveTextContent('42'); to verify the fix and ensure future regressions are caught.

Screenshots
Screenshot 2026-01-01 at 4 11 51 PM

Related Issue
https://openmrs.atlassian.net/browse/O3-5301

Other
Impact: Improves codebase health by resolving tech debt (TODOs) and ensuring accurate test coverage.
Testing: Verified that the specific test suite (
src/queue-table/queue-table.test.tsx
) passes successfully.

@bhavya-jpg
Copy link
Author

@gitcliff Hi ,can I please get a review on this

@gitcliff gitcliff changed the title 03-5301 )Fix failing test expectation in queue-table.test.tsx (03-5301 )-fix failing test expectation in queue-table.test.tsx Jan 13, 2026
@gitcliff
Copy link
Contributor

@bhavya-jpg have you seen the E2E test failure ?

Copy link

@BlessedAmrita BlessedAmrita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bhavya-jpg , thanks for contributing!
Could you please update the description to follow the standard PR template? This will make the PR look much cleaner for the maintainers.

Copy link
Member

@jayasanka-sack jayasanka-sack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @bhavya-jpg!

Could you also update the other two places in the same test file where the incorrect UUID is used? Even though those tests don’t currently rely on the value fixing it now will help avoid mysteries later if someone extends or modifies them.

Also, could you please follow the conventional PR title format outlined in the PR template? I noticed the template content was removed in this one. Going forward it would be great to stick to the template.

Keep up the good work!

@bhavya-jpg
Copy link
Author

@jayasanka-sack thank you for the review on this ,ill surely look into this and try and update the other two places in the same test file and surely I'll rewrite my pr msg to match the format .
thank you so much again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants