Skip to content

Commit

Permalink
Wait for patient banner to render before running assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Aug 19, 2024
1 parent 5e1ccbd commit 0d5b738
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions e2e/specs/register-new-patient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { deletePatient, getPatient } from '../commands';

let patientUuid: string;

test('Register a new patient', async ({ page, api }) => {
test('Register a new patient', async ({ page }) => {
test.setTimeout(5 * 60 * 1000);
const patientRegistrationPage = new RegistrationAndEditPage(page);

Expand Down Expand Up @@ -38,7 +38,12 @@ test('Register a new patient', async ({ page, api }) => {
const patientChartUrlRegex = new RegExp('^[\\w\\d:\\/.-]+\\/patient\\/[\\w\\d-]+\\/chart\\/.*$');
await page.waitForURL(patientChartUrlRegex);
await expect(page).toHaveURL(patientChartUrlRegex);
await expect(page.getByText(/Johnny Donny Ronny/i)).toBeVisible();
await page.locator('header[data-openmrs-role="patient banner"]').waitFor();
await expect(page.locator('header[data-openmrs-role="patient banner"]')).toBeVisible();
});

await test.step("And I should the newly registered patient's details in the patient banner", async () => {
await expect(page.getByText(/johnny donny ronny/i)).toBeVisible();
await expect(page.getByText(/male/i)).toBeVisible();
await expect(page.getByText(/4 yrs, 6 mths/i)).toBeVisible();
await expect(page.getByText(/01 Feb 2020/i)).toBeVisible();
Expand Down

0 comments on commit 0d5b738

Please # to comment.