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-2943: Edit E2E test for the immunization recording workflow #1768

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
35 changes: 35 additions & 0 deletions e2e/specs/immunizations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,41 @@ test('Add an immunization', async ({ page }) => {
});
});

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