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 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 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,49 @@ 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 expect(page.getByRole('button', { name: /expand all rows/i })).toBeVisible();
Muta-Jonathan marked this conversation as resolved.
Show resolved Hide resolved
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');
Muta-Jonathan marked this conversation as resolved.
Show resolved Hide resolved
});

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
2 changes: 1 addition & 1 deletion packages/esm-patient-orders-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"errorSavingLabResults": "Error saving lab results",
"goToDrugOrderForm": "Order form",
"indication": "Indication",
"labResultError": "Error loading lab results",
"inStock": "In stock",
"instructions": "Instructions",
"labResultError": "Error loading lab results",
"launchOrderBasket": "Launch order basket",
"loading": "Loading",
"loadingInitialValues": "Loading initial values",
Expand Down
Loading