Skip to content

Commit

Permalink
(test) O3-4070: E2E test for abnormal biometrics
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud committed Nov 6, 2024
1 parent 7122212 commit e0ca25f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions e2e/specs/biometrics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,52 @@ test('Record biometrics', async ({ page }) => {
});
});

test('Record abnormal biometrics', async ({ page }) => {
const biometricsPage = new BiometricsAndVitalsPage(page);

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

await test.step('And I click on the `Record biometrics` link to launch the form', async () => {
await biometricsPage.page.getByText(/record biometrics/i).click();
});

await test.step('Then I should see the `Record Vitals and Biometrics` form launch in the workspace', async () => {
await expect(biometricsPage.page.getByText(/record vitals and biometrics/i)).toBeVisible();
});

await test.step('When I fill `255` as the patient height', async () => {
await biometricsPage.page.getByRole('spinbutton', { name: /height/i }).fill('170');
});

await test.step('And I fill `275` as the patient weight', async () => {
await biometricsPage.page.getByRole('spinbutton', { name: /weight/i }).fill('65');
});

await test.step('Then I should see `33.7` as the auto calculated patient body mass index', async () => {
await expect(biometricsPage.page.getByRole('spinbutton', { name: /bmi/i })).toHaveValue('33.7');
});

await test.step('When I fill `25` as the mid upper arm circumference ', async () => {
await biometricsPage.page.getByRole('spinbutton', { name: /muac/i }).fill('25');
});

await test.step('And I click on the `Save and close` button', async () => {
await biometricsPage.page.getByRole('button', { name: /save and close/i }).click();
});

await test.step('Then the system should not save the abnormal biometrics', async () => {
await expect(biometricsPage.page.getByText(/some of the values entered are invalid/i)).toBeVisible();
await expect(biometricsPage.page.getByText(/error saving vitals and biometrics/i)).toBeVisible();
});

await test.step(`And the abnormal vitals should be visible in the 'Biometrics' section with an indication that they exceed normal thresholds.`, async () => {
await expect(biometricsPage.page.getByText(/value must be between 0 and 250/i)).toBeVisible();
await expect(biometricsPage.page.getByText(/value must be between 10 and 272/i)).toBeVisible();
});
});

test.afterEach(async ({ api }) => {
await endVisit(api, visit.uuid);
await deletePatient(api, patient.uuid);
Expand Down

0 comments on commit e0ca25f

Please sign in to comment.