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) O3-4177: Add E2E test for adding abnormal vitals #2132

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions e2e/specs/invalid.vitals.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { test } from '../core';
import { expect } from '@playwright/test';
import { type Visit } from '@openmrs/esm-framework';
import { generateRandomPatient, type Patient, startVisit, endVisit } from '../commands';
import { BiometricsAndVitalsPage } from '../pages';

let patient: Patient;
let visit: Visit;

test.beforeEach(async ({ api }) => {
patient = await generateRandomPatient(api);
visit = await startVisit(api, patient.uuid);
});

test('Flagging invalid vitals', async ({ page }) => {
lucyjemutai marked this conversation as resolved.
Show resolved Hide resolved
const vitalsPage = new BiometricsAndVitalsPage(page);

await test.step('When I visit the vitals and biometrics page', async () => {
await vitalsPage.goTo(patient.uuid);
});

await test.step('When the user navigates to the "Vitals & Biometrics" section', async () => {
lucyjemutai marked this conversation as resolved.
Show resolved Hide resolved
await vitalsPage.goTo(patient.uuid);
});

await test.step('And clicks on "Record vital signs"', async () => {
lucyjemutai marked this conversation as resolved.
Show resolved Hide resolved
await vitalsPage.page.getByText(/record vitals/i).click();
});

await test.step('Then a form to enter vitals details should be displayed', async () => {
lucyjemutai marked this conversation as resolved.
Show resolved Hide resolved
await expect(vitalsPage.page.getByText(/record vitals and biometrics/i)).toBeVisible();
});

await test.step('When the user enters abnormal temperature value', async () => {
lucyjemutai marked this conversation as resolved.
Show resolved Hide resolved
await vitalsPage.page.getByRole('spinbutton', { name: /temperature/i }).fill('43.0');
});

await test.step('When the user enters abnormal systolic value', async () => {
await vitalsPage.page.getByRole('spinbutton', { name: /systolic/i }).fill('250');
});

await test.step('When the user enters abnormal diastolic value', async () => {
await vitalsPage.page.getByRole('spinbutton', { name: /diastolic/i }).fill('150');
});

await test.step('When the user enters abnormal pulse value', async () => {
await vitalsPage.page.getByRole('spinbutton', { name: /pulse/i }).fill('230');
});

await test.step('When the user enters abnormal respiration rate value', async () => {
await vitalsPage.page.getByRole('spinbutton', { name: /respiration rate/i }).fill('999');
});

await test.step('When the user enters abnormal oxygen saturation value', async () => {
await vitalsPage.page.getByRole('spinbutton', { name: /oxygen saturation/i }).fill('100');
});

await test.step('And clicks "Save and close"', async () => {
await vitalsPage.page.getByRole('button', { name: /save and close/i }).click();
});

await test.step('Then the system should save the vitals', async () => {
await expect(vitalsPage.page.getByText(/vitals and biometrics saved/i)).toBeVisible();
});

await test.step('And the system should flag the abnormal values based on predefined thresholds', async () => {
await expect(vitalsPage.page.getByRole('cell', { name: '43 ↑↑' })).toBeVisible();
await expect(vitalsPage.page.getByRole('cell', { name: '/ 150 ↑↑' })).toBeVisible();
await expect(vitalsPage.page.getByRole('cell', { name: '230 ↑↑' })).toBeVisible();
await expect(vitalsPage.page.getByRole('cell', { name: '999 ↑↑' })).toBeVisible();
await expect(vitalsPage.page.getByRole('cell', { name: '100' })).toBeVisible();
});

await test.step('And the abnormal vitals should be visible in th Vitals section with indications they exceed normal thresholds', async () => {
await expect(vitalsPage.page.getByText(/temp43 deg c/i)).toBeVisible();
await expect(vitalsPage.page.getByText(/bp250 \/ 150 mmhg/i)).toBeVisible();
await expect(vitalsPage.page.getByText(/heart rate230 beats\/min/i)).toBeVisible();
await expect(vitalsPage.page.getByText(/r. rate999 breaths\/min/i)).toBeVisible();
});
});
Loading