-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C2C-355: E2E tests for the observation forms
- Loading branch information
Showing
9 changed files
with
251 additions
and
114 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { Bahmni } from '../utils/functions/bahmni'; | ||
|
||
let bahmni: Bahmni; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
bahmni = new Bahmni(page); | ||
|
||
await bahmni.login(); | ||
await expect(page.getByText(/registration/i)).toBeVisible(); | ||
await expect(page.getByText(/linical/i)).toBeVisible(); | ||
await expect(page.getByText(/admin/i)).toBeVisible(); | ||
await expect(page.getByText(/appointment scheduling/i)).toBeVisible(); | ||
await expect(page.getByText(/patient documents/i)).toBeVisible(); | ||
}); | ||
|
||
test('Anthropometry form should save observations.', async ({ page }) => { | ||
// setup | ||
await bahmni.registerPatient(); | ||
|
||
// replay | ||
await bahmni.navigateToPatientDashboard(); | ||
await bahmni.navigateToForms(); | ||
await page.getByRole('button', { name: 'Anthropométrie' }).click(); | ||
await expect(page.getByText('Anthropométrie added successfully')).toBeVisible(); | ||
await bahmni.fillAnthropometryForm(); | ||
|
||
// verify | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('a.visit')).toBeVisible(); | ||
await page.locator('a.visit').click(); | ||
await expect(page.locator('#observationSection h2')).toHaveText('Observations'); | ||
await expect(page.locator('#observationSection').getByText('BMI Data')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('22.49')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('BMI Status Data')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Normal')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Height')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('170')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Weight')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('65')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Head Circumference')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('23')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Abdominal Diameter')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('25.5')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Mid-Upper Arm Circumference')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('24', {exact: true})).toBeVisible(); | ||
}); | ||
|
||
test('Gynecological ultrasound form should save observations.', async ({ page }) => { | ||
// setup | ||
await bahmni.registerPatient(); | ||
|
||
// replay | ||
await bahmni.navigateToPatientDashboard(); | ||
await bahmni.navigateToForms(); | ||
await page.getByRole('button', { name: 'Echographie gynécologique' }).click(); | ||
await expect(page.getByText('Echographie gynécologique added successfully')).toBeVisible(); | ||
await bahmni.fillGynecologicalUltrasoundForm(); | ||
|
||
// verify | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('a.visit')).toBeVisible(); | ||
await page.locator('a.visit').click(); | ||
await expect(page.getByText('Echographie gynécologique')).toBeVisible(); | ||
await expect(page.locator('div:nth-child(2) span.value-text-only').getByText('Normal left ovary. The right ovary contains a complex mass. No free fluid in the pelvis.')).toBeVisible(); | ||
}); | ||
|
||
test('Obstetric ultrasound 3 form should save observations.', async ({ page }) => { | ||
// setup | ||
await bahmni.registerPatient(); | ||
|
||
// replay | ||
await bahmni.navigateToPatientDashboard(); | ||
await bahmni.navigateToForms(); | ||
await page.getByRole('button', { name: 'Echographie obstétricale 3' }).click(); | ||
await expect(page.getByText('Echographie obstétricale 3 added successfully')).toBeVisible(); | ||
await bahmni.fillObstetricUltrasound3Form(); | ||
|
||
// verify | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('a.visit')).toBeVisible(); | ||
await page.locator('a.visit').click(); | ||
await expect(page.getByText('Echographie obstétricale 3')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Number of Fetuses')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('2', {exact: true}).nth(0)).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Number of Placenta')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('2', {exact: true}).nth(1)).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Localisation de Placenta')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Posterior')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Presentation')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Transverse')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Other observations')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('The two fetuses are in a good growing state.')).toBeVisible(); | ||
}); | ||
|
||
test('Physical examination form should save observations.', async ({ page }) => { | ||
// setup | ||
await bahmni.registerPatient(); | ||
|
||
// replay | ||
await bahmni.navigateToPatientDashboard(); | ||
await bahmni.navigateToForms(); | ||
await page.getByRole('button', { name: 'Examen physique' }).click(); | ||
await expect(page.getByText('Examen physique added successfully')).toBeVisible(); | ||
await bahmni.fillPhysicalExaminationForm(); | ||
|
||
// verify | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('a.visit')).toBeVisible(); | ||
await page.locator('a.visit').click(); | ||
await expect(page.getByText('Examen physique')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('General Examination')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Normal').nth(0)).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Cardiovascular Examination', {exact: true})).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Abnormal').nth(0)).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Cardiovascular Examination Details')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('The blood vessels are very narrow.')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Respiratory Examination')).toBeVisible(); | ||
await expect(page.locator('#observationSection').getByText('Normal').nth(1)).toBeVisible() | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await bahmni.voidPatient(); | ||
await page.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.