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

O3-3078: Refactor Lab order test #1802

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions e2e/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './program-page';
export * from './results-viewer-page';
export * from './visits-page';
export * from './vitals-and-biometrics-page';
export * from './orders-page';
1 change: 0 additions & 1 deletion e2e/specs/clinical-forms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ test('Fill a clinical form', async ({ page }) => {
await expect(headerRow).toContainText(/last completed/i);

await expect(chartPage.page.getByRole('cell', { name: /covid 19/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /laboratory test orders/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /laboratory test results/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /soap note template/i })).toBeVisible();
await expect(chartPage.page.getByRole('cell', { name: /surgical operation/i })).toBeVisible();
Expand Down
55 changes: 18 additions & 37 deletions e2e/specs/lab-orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@playwright/test';
import { type Visit } from '@openmrs/esm-framework';
import { generateRandomPatient, type Patient, startVisit, endVisit, deletePatient } from '../commands';
import { test } from '../core';
import { ChartPage, VisitsPage } from '../pages';
import { ChartPage, OrdersPage } from '../pages';

let patient: Patient;
let visit: Visit;
Expand All @@ -14,58 +14,38 @@ test.beforeEach(async ({ api }) => {

test('Record, edit and discontinue a lab order', async ({ page }) => {
const chartPage = new ChartPage(page);
const visitsPage = new VisitsPage(page);
const ordersPage = new OrdersPage(page);

await test.step('When I visit the chart summary page', async () => {
await chartPage.goTo(patient.uuid);
await test.step('When I visit the orders page', async () => {
await ordersPage.goTo(patient.uuid);
});

await test.step('And I click on the `Clinical forms` button on the siderail', async () => {
await chartPage.page.getByLabel(/clinical forms/i).click();
await test.step('And I click on the `Order basket` button on the siderail', async () => {
await page.getByRole('button', { name: 'Record orders' }).click();
});

await test.step('Then I should see the clinical forms workspace', async () => {
const headerRow = chartPage.formsTable().locator('thead > tr');

await expect(chartPage.page.getByPlaceholder(/search this list/i)).toBeVisible();
await expect(headerRow).toContainText(/form name \(a-z\)/i);
await expect(headerRow).toContainText(/last completed/i);
await expect(chartPage.page.getByRole('cell', { name: /laboratory test orders/i })).toBeVisible();
await test.step('When I launch the `Lab Orders` form', async () => {
await page.getByRole('button', { name: 'Add', exact: true }).nth(1).click();
});

await test.step('When I launch the `Laboratory Test Orders` form', async () => {
await page.getByText(/laboratory test orders/i).click();
await test.step('And I search for the lab test`', async () => {
await page.getByPlaceholder('Search for a test type').fill('blood urea nitrogen');
});

await test.step('And I click on the `Add` button', async () => {
await page.getByRole('button', { name: 'Add', exact: true }).click();
await test.step('And I click on the order form button`', async () => {
await page.getByRole('button', { name: 'Order form' }).click();
});

await test.step('And I set the lab test to `Blood urea nitrogen`', async () => {
await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
await test.step('And I click on the `Save order` button', async () => {
await page.getByRole('button', { name: 'Save order' }).click();
});

await test.step('And I click on the `Save and close` button', async () => {
await page.getByRole('button', { name: /save and close/i }).click();
await page.getByRole('button', { name: 'Sign and close' }).click();
});

await test.step('Then I should see a success notification', async () => {
await expect(page.getByText('Lab order(s) generated')).toBeVisible();
await expect(page.getByText(/blood urea nitrogen/i)).toBeVisible();
});

await test.step('When I navigate to the visits dashboard', async () => {
await visitsPage.goTo(patient.uuid);
});

await test.step('And I go to the `All encounters` tab', async () => {
await page.getByRole('tab', { name: /all encounters/i }).click();
});

await test.step('Then I should see the newly added lab order in the list', async () => {
await expect(
page.getByRole('cell', { name: /laboratory test orders/i }).getByText('Laboratory Test Orders'),
).toBeVisible();
await expect(page.getByText('Placed order for blood urea nitrogen ')).toBeVisible();
});

await test.step('When I click the overflow menu in the table row with the newly created lab order', async () => {
Expand All @@ -74,7 +54,7 @@ test('Record, edit and discontinue a lab order', async ({ page }) => {
.nth(0)
.click();
});

/*
await test.step('And I click on the `Edit` button', async () => {
await page.getByRole('menuitem', { name: /edit this encounter/i }).click();
});
Expand Down Expand Up @@ -120,6 +100,7 @@ test('Record, edit and discontinue a lab order', async ({ page }) => {
page.getByLabel(/all encounters/i).getByText(/there are no encounters to display for this patient/i),
).toBeVisible();
});
*/
});

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