Skip to content

Commit

Permalink
(test) Make patient list e2e test use UI rather than API
Browse files Browse the repository at this point in the history
  • Loading branch information
NethmiRodrigo committed Feb 17, 2025
1 parent 820e1c8 commit 281a371
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions e2e/specs/patient-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,24 @@ test('Manage patients in a list', async ({ api, page }) => {
await patientListPage.goto(cohort.uuid);
});

await test.step('Then I should be able to add and remove patients from that list', async () => {
await test.step('Then I should be able to add a patient to the list', async () => {
// Add a patient to the list
cohortMember = await addPatientToCohort(api, cohort.uuid, patient.uuid);
await patientListPage.goto(cohort.uuid);
await expect(patientListPage.patientListHeader()).toHaveText(/1 patients/);
await expect(patientListPage.patientsTable()).toHaveText(new RegExp(patient.person.display));
});

// Remove a patient from the list
await removePatientFromCohort(api, cohortMember.uuid);
await patientListPage.goto(cohort.uuid);
await expect(patientListPage.patientListHeader()).toHaveText(/0 patients/);
await test.step('And then I should be able to remove a patient from the list', async () => {
await page.getByLabel(/remove from list/i).click();
});

await test.step("And then I click the 'Remove from list' to confirm", async () => {
await page.getByRole('button', { name: 'danger Remove from list' }).click();
});

await test.step('And then I should see a success message', async () => {
await expect(page.getByText(/patient removed from list/i)).toBeVisible();
cohortMember = null;
});
});
Expand Down

0 comments on commit 281a371

Please sign in to comment.