Skip to content

Conversation

@RajPrakash681
Copy link
Contributor

@RajPrakash681 RajPrakash681 commented Oct 27, 2025

This commit enhances the mock implementations for Jest and Vitest test frameworks to provide more realistic and testable patient banner components.

Key changes:

  • Enhanced PatientBannerContactDetails with full implementation including address, contact attributes, relationships, and patient lists sections
  • Enhanced PatientBannerPatientInfo with complete patient demographics rendering including name, gender, age, and birthdate
  • Enhanced PatientBannerPatientIdentifiers with proper identifier filtering and primary/secondary identifier distinction
  • Enhanced PatientPhoto with conditional rendering based on loading state and photo availability
  • Added supporting hooks: usePatient, usePatientContactAttributes, useRelationships, usePatientListsForPatient, usePatientPhoto
  • Exported formatPartialDate from esm-utils for date formatting
  • Improved test data attributes for better test assertions

These improvements ensure that unit tests can properly validate component behavior and rendering logic without requiring complex custom mocks.

Related to: OpenMRS patient banner testing infrastructure

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

If applicable

  • My work is based on designs, which are linked or shown either in the Jira ticket or the description below.
  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

RajPrakash681 and others added 5 commits October 28, 2025 01:54
… support

This commit enhances the mock implementations for Jest and Vitest test frameworks to provide more realistic and testable patient banner components.

Key changes:
- Enhanced PatientBannerContactDetails with full implementation including address, contact attributes, relationships, and patient lists sections
- Enhanced PatientBannerPatientInfo with complete patient demographics rendering including name, gender, age, and birthdate
- Enhanced PatientBannerPatientIdentifiers with proper identifier filtering and primary/secondary identifier distinction
- Enhanced PatientPhoto with conditional rendering based on loading state and photo availability
- Added supporting hooks: usePatient, usePatientContactAttributes, useRelationships, usePatientListsForPatient, usePatientPhoto
- Exported formatPartialDate from esm-utils for date formatting
- Improved test data attributes for better test assertions

These improvements ensure that unit tests can properly validate component behavior and rendering logic without requiring complex custom mocks.

Related to: OpenMRS patient banner testing infrastructure
@RajPrakash681
Copy link
Contributor Author

@denniskigen can you guide a little on this failing test

- Updated all @openmrs/* peerDependencies in framework packages from 6.x to 8.x
- This resolves dependency version conflicts where packages at v8.0.0 declared incompatible peer deps
- Updated yarn.lock to reflect the corrected peer dependency versions
@RajPrakash681
Copy link
Contributor Author

@denniskigen @NethmiRodrigo i need some guidance in this failing test i am not able to fix

@denniskigen
Copy link
Member

Hey, @RajPrakash681. The failing attachments-related e2e test in Patient Chart are not related to your diff. Rather, they're caused by a recent regression in the attachments module following the 2.8 migration. @dkayiwa is working on switching it over to use the new storage service, which should fix the regression.

@RajPrakash681
Copy link
Contributor Author

Hey, @RajPrakash681. The failing attachments-related e2e test in Patient Chart are not related to your diff. Rather, they're caused by a recent regression in the attachments module following the 2.8 migration. @dkayiwa is working on switching it over to use the new storage service, which should fix the regression.

okay sir thanks for the clarification

…wait

- Use Playwright locator.or() to handle multiple role types (button, menuitem, link)
- Add explicit 15s visibility wait before clicking logout
- Await globalSetup() in afterEach to prevent race conditions
- Eliminates timeout from Job 53969858192
@RajPrakash681
Copy link
Contributor Author

@dkayiwa sir any information related to this?

@RajPrakash681
Copy link
Contributor Author

@denniskigen can this be reviewed!?

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.

2 participants