-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
122 additions
and
45 deletions.
There are no files selected for viewing
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,55 @@ | ||
import { expect } from '@playwright/test'; | ||
import { type Visit } from '@openmrs/esm-framework'; | ||
import { generateRandomPatient, type Patient, startVisit, deletePatient, createImmunizations } from '../commands'; | ||
import { test } from '../core'; | ||
import { ImmunizationsPage } from '../pages'; | ||
|
||
let patient: Patient; | ||
let visit: Visit; | ||
|
||
test.beforeEach(async ({ api }) => { | ||
patient = await generateRandomPatient(api); | ||
visit = await startVisit(api, patient.uuid); | ||
|
||
await createImmunizations(api, patient.uuid); | ||
}); | ||
|
||
test('Edit an immunization', async ({ page }) => { | ||
const immunizationsPage = new ImmunizationsPage(page); | ||
|
||
await test.step('When I go to the Immunizations page', async () => { | ||
await immunizationsPage.goTo(patient.uuid); | ||
}); | ||
|
||
await test.step('And I edit the Immunization', async () => { | ||
await page.getByRole('button', { name: 'Expand current row' }).click(); | ||
await page.getByRole('button', { name: 'Edit' }).click(); | ||
}); | ||
|
||
await test.step('Then I should see the Immunization form launch in the workspace', async () => { | ||
await expect(page.getByText(/immunization form/i)).toBeVisible(); | ||
}); | ||
|
||
await test.step('When I set `21/03/2024` as the vaccination date', async () => { | ||
await page.getByLabel(/vaccination date/i).clear(); | ||
await page.getByLabel(/vaccination date/i).fill('21/03/2024'); | ||
await page.getByLabel(/vaccination date/i).press('Tab'); | ||
}); | ||
|
||
await test.step('And I set `Polio vaccination, oral` as the immunization', async () => { | ||
await page.getByRole('combobox', { name: /immunization/i }).click(); | ||
await page.getByText(/polio vaccination, oral/i).click(); | ||
}); | ||
|
||
await test.step('And I click on the `Save` button', async () => { | ||
await page.getByRole('button', { name: /save/i }).click(); | ||
}); | ||
|
||
await test.step('Then I should see a success toast notification', async () => { | ||
await expect(page.getByText(/Vaccination saved successfully/i)).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
await deletePatient(api, patient.uuid); | ||
}); |
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