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: E2E test for Immunizations workflow #2148

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
44 changes: 43 additions & 1 deletion e2e/specs/immunizations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test.beforeEach(async ({ api }) => {
visit = await startVisit(api, patient.uuid);
});

test('Add an immunization', async ({ page }) => {
test('Add and edit an immunization', async ({ page }) => {
const immunizationsPage = new ImmunizationsPage(page);
const headerRow = immunizationsPage.immunizationsTable().locator('thead > tr');
const immunizationType = immunizationsPage.immunizationsTable().locator('tbody td:nth-child(2)');
Expand Down Expand Up @@ -55,6 +55,48 @@ test('Add an immunization', async ({ page }) => {
await expect(immunizationType).toContainText(/hepatitis b vaccination/i);
await expect(vaccinationDate).toContainText(/mar 8, 2024/i);
});

await test.step('When I click the expand All rows in the table header with the newly recorded immunization', async () => {
await page.getByRole('button', { name: /expand all rows/i }).click();
});

await test.step('Then I should see the immunization saved row in the table', async () => {
await expect(page.getByText(/dose number within series/i)).toBeVisible();
await expect(page.getByText(/vaccination date/i)).toBeVisible();
});

await test.step('And I click on the `Edit` button', async () => {
await page.getByRole('button', { name: /edit/i }).click();
});

await test.step('Then I should see the immunization form launch in the workspace in edit mode`', async () => {
await expect(page.getByText(/immunization form/i)).toBeVisible();
await expect(page.getByRole('cell', { name: /hepatitis b vaccination/i })).toBeVisible();
});

await test.step('When I change the immunization type to `measles vaccination`', async () => {
await page.getByRole('combobox', { name: /immunization/i }).click();
await page.getByText(/measles vaccination/i).click();
});

await test.step('And I change the immunization Dose number within series to `2`', async () => {
await page.getByRole('spinbutton', { name: /dose number within series/i }).clear();
await page.getByRole('spinbutton', { name: /dose number within series/i }).fill('2');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the corresponding test in the validation step.

});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also modify the vaccination date?

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 notification', async () => {
await expect(page.getByText(/vaccination saved successfully/i)).toBeVisible();
});

await test.step('And I should see the updated immunization in the list', async () => {
await expect(page.getByRole('columnheader', { name: /vaccine/i })).toContainText(/vaccine/i);
await expect(page.getByText(/recent vaccination/i)).toBeVisible();
await expect(page.getByRole('cell', { name: /measles vaccination/i })).toBeVisible();
});
});

test.afterEach(async ({ api }) => {
Expand Down
Loading