Skip to content

Commit

Permalink
(test) Assert presence of registration data in patient header
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Aug 18, 2024
1 parent 5ae28d3 commit 975d3a1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion e2e/specs/register-new-patient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('Register a new patient', async ({ page, api }) => {
await patientRegistrationPage.waitUntilTheFormIsLoaded();
});

await test.step('And then I click on fill new values into the registration form and then click the `Submit` button', async () => {
await test.step('And then I fill the registration form and then click the `Submit` button', async () => {
await patientRegistrationPage.fillPatientRegistrationForm(formValues);
});

Expand All @@ -54,6 +54,21 @@ test('Register a new patient', async ({ page, api }) => {
expect(person.preferredAddress.stateProvince).toBe(formValues.stateProvince);
expect(person.preferredAddress.country).toBe(formValues.country);
expect(person.attributes[0].display).toBe(formValues.phone);

await expect(page.getByRole('main')).toContainText(person.display);
await expect(page.getByRole('main')).toContainText(/male/i);
await expect(page.getByRole('main')).toContainText(/4 yrs, 6 mths/i);
await expect(page.getByRole('main')).toContainText(/01 — Feb — 2020/i);
await expect(page.getByRole('main')).toContainText(/OpenMRS ID/i);
await page.getByRole('button', { name: /show details/i }).click();
await expect(page.getByRole('button', { name: /hide details/i })).toBeVisible();
await expect(page.getByText(/^address$/i)).toBeVisible();
await expect(page.getByText(/address line 1: bom jesus street/i)).toBeVisible();
await expect(page.getByText(/city: recife/i)).toBeVisible();
await expect(page.getByText(/state: pernambuco/i)).toBeVisible();
await expect(page.getByText(/country: brazil/i)).toBeVisible();
await expect(page.getByText(/contact details/i)).toBeVisible();
await expect(page.getByText(/telephone number: 5555551234/i)).toBeVisible();
});
});

Expand Down

0 comments on commit 975d3a1

Please sign in to comment.