Skip to content
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

Merged
merged 4 commits into from Mar 15, 2022
Merged

(test) Assert appearance and disappearance of Add and Edit buttons #603

merged 4 commits into from Mar 15, 2022

Conversation

nanfuka
Copy link
Contributor

@nanfuka nanfuka commented Mar 11, 2022

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide.
  • My work includes tests or is validated by existing tests.

Summary

Screenshots

Related Issue

Other

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2022

File size impact

Merging testClinicalOverview into master impact files as follow:

@openmrs/esm-form-entry-app (+8.02%)
Files new size
packages/esm-form-entry-app/dist/1.openmrs-esm-form-entry-app.js 1.48 MB (+109 kB / +7.92%) ↗️
packages/esm-form-entry-app/dist/openmrs-esm-form-entry-app.js 84.5 kB (+5.83 kB / +7.41%) ↗️
packages/esm-form-entry-app/dist/2.openmrs-esm-form-entry-app.js 46.1 kB (+5.19 kB / +12.69%) ↗️
Unmodified (1) 155 B (0 B / +0%) 👻
Total (4) 1.62 MB (+120 kB / +8.02%) ↗️
@openmrs/esm-generic-patient-widgets-app (no impact)
Files new size
Unmodified (14) 2.99 MB (0 B / +0%) 👻
Total (14) 2.99 MB (0 B / +0%) 👻
@openmrs/esm-patient-allergies-app (no impact)
Files new size
Unmodified (31) 2.68 MB (0 B / +0%) 👻
Total (31) 2.68 MB (0 B / +0%) 👻
@openmrs/esm-patient-appointments-app (no impact)
Files new size
Unmodified (24) 2.15 MB (0 B / +0%) 👻
Total (24) 2.15 MB (0 B / +0%) 👻
@openmrs/esm-patient-attachments-app (no impact)
Files new size
Unmodified (19) 1.7 MB (0 B / +0%) 👻
Total (19) 1.7 MB (0 B / +0%) 👻
@openmrs/esm-patient-banner-app (no impact)
Files new size
Unmodified (15) 1.07 MB (0 B / +0%) 👻
Total (15) 1.07 MB (0 B / +0%) 👻
@openmrs/esm-patient-biometrics-app (no impact)
Files new size
Unmodified (21) 2.62 MB (0 B / +0%) 👻
Total (21) 2.62 MB (0 B / +0%) 👻
@openmrs/esm-patient-chart-app (no impact)
Files new size
Unmodified (39) 3.66 MB (0 B / +0%) 👻
Total (39) 3.66 MB (0 B / +0%) 👻
@openmrs/esm-patient-clinical-view-app (no impact)
Files new size
Unmodified (18) 1.5 MB (0 B / +0%) 👻
Total (18) 1.5 MB (0 B / +0%) 👻
@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)
Files new size
Unmodified (25) 2.01 MB (0 B / +0%) 👻
Total (25) 2.01 MB (0 B / +0%) 👻
@openmrs/esm-patient-forms-app (no impact)
Files new size
Unmodified (26) 2.21 MB (0 B / +0%) 👻
Total (26) 2.21 MB (0 B / +0%) 👻
@openmrs/esm-patient-immunizations-app (no impact)
Files new size
Unmodified (21) 1.9 MB (0 B / +0%) 👻
Total (21) 1.9 MB (0 B / +0%) 👻
@openmrs/esm-patient-medications-app (no impact)
Files new size
Unmodified (21) 2.91 MB (0 B / +0%) 👻
Total (21) 2.91 MB (0 B / +0%) 👻
@openmrs/esm-patient-notes-app (no impact)
Files new size
Unmodified (26) 2.17 MB (0 B / +0%) 👻
Total (26) 2.17 MB (0 B / +0%) 👻
@openmrs/esm-patient-programs-app (no impact)
Files new size
Unmodified (20) 1.99 MB (0 B / +0%) 👻
Total (20) 1.99 MB (0 B / +0%) 👻
@openmrs/esm-patient-test-results-app (no impact)
Files new size
Unmodified (30) 4.08 MB (0 B / +0%) 👻
Total (30) 4.08 MB (0 B / +0%) 👻
@openmrs/esm-patient-vitals-app (no impact)
Files new size
Unmodified (25) 3.53 MB (0 B / +0%) 👻
Total (25) 3.53 MB (0 B / +0%) 👻
Generated by @jsenv/file-size-impact during Report bundle size#1985668118 on 1bb66ae

@@ -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';
Copy link
Member

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' });
Copy link
Member

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();

Copy link
Contributor Author

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

@denniskigen denniskigen changed the title Test clinical overview (test) Assert appearance and disappearance of Add and Edit buttons Mar 15, 2022
@denniskigen
Copy link
Member

Thanks, @nanfuka!

@denniskigen denniskigen merged commit 9bd7a8d into openmrs:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants