-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(test) Assert appearance and disappearance of Add
and Edit
buttons
#603
Conversation
File size impactMerging testClinicalOverview into master impact files as follow: @openmrs/esm-form-entry-app (+8.02%)
@openmrs/esm-generic-patient-widgets-app (no impact)
@openmrs/esm-patient-allergies-app (no impact)
@openmrs/esm-patient-appointments-app (no impact)
@openmrs/esm-patient-attachments-app (no impact)
@openmrs/esm-patient-banner-app (no impact)
@openmrs/esm-patient-biometrics-app (no impact)
@openmrs/esm-patient-chart-app (no impact)
@openmrs/esm-patient-clinical-view-app (no impact)
@openmrs/esm-patient-common-lib (no impact)No file in @openmrs/esm-patient-common-lib group (see config below). {
"./packages/esm-patient-common-lib/dist/*.js": true,
"./packages/esm-patient-common-lib/dist/*.css": true,
"./packages/esm-patient-common-lib/dist/*.map": false,
"./packages/esm-patient-common-lib/dist/*.txt": false,
"./packages/esm-patient-common-lib/dist/*.json": false
} @openmrs/esm-patient-conditions-app (no impact)
@openmrs/esm-patient-forms-app (no impact)
@openmrs/esm-patient-immunizations-app (no impact)
@openmrs/esm-patient-medications-app (no impact)
@openmrs/esm-patient-notes-app (no impact)
@openmrs/esm-patient-programs-app (no impact)
@openmrs/esm-patient-test-results-app (no impact)
@openmrs/esm-patient-vitals-app (no impact)
|
@@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'; | |||
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; | |||
import { mockPatient } from '../../../../__mocks__/patient.mock'; | |||
import ClinicalViewOverview from './clinical-view-overview.component'; | |||
import { ExtensionSlot } from '@openmrs/esm-framework'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If what you're asserting is the appearance of the Edit View
button and the disappearance of the Add View
button when the user clicks on a clinical view, you do not need this import.
@@ -44,6 +45,9 @@ describe('ClinicalViewOverview: ', () => { | |||
mockClinicalViews.map((clinicalView) => | |||
expect(screen.getByRole('tab', { name: clinicalView.slot })).toBeInTheDocument(), | |||
); | |||
const breadCrampCheck = screen.getByRole('tab', { name: 'Breadcrumbs' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the assertions you're making are the ones listed above, a preferable way to do this would be to check for the appearance and absence of the two buttons in each case. Like:
renderClinicalViewOverview();
expect(screen.getByRole('tablist')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Add view/i })).toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Edit view/i })).not.toBeInTheDocument();
mockClinicalViews.map((clinicalView) =>
expect(screen.getByRole('tab', { name: clinicalView.slot })).toBeInTheDocument(),
);
userEvent.click(screen.getByRole('tab', { name: /breadcrumbs/i }));
expect(screen.getByRole('button', { name: /Edit view/i })).toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Add view/i })).not.toBeInTheDocument();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denniskigen thanks for the review. issue has been worked on
Add
and Edit
buttons
Thanks, @nanfuka! |
Requirements
Summary
Screenshots
Related Issue
Other