From 2ec856292c1c9605f4696e0e1b0c33e71337e34d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 13:19:42 +0530 Subject: [PATCH] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 28 +++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 3eb71655f0..9927d8ee1b 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -13,7 +13,6 @@ test('Mark a patient as deceased', async ({ page }) => { const markPatientDeceasedPage = new MarkPatientDeceasedPage(page); const todayDate = new Date().toLocaleDateString('en-GB').replace(/\//g, '-'); const causeOfDeath = 'Neoplasm'; - const actionsButton = () => page.getByRole('button', { name: /actions/i }); const markDeceasedMenuItem = () => page.getByRole('menuitem', { name: /mark patient deceased/i }); @@ -23,42 +22,39 @@ test('Mark a patient as deceased', async ({ page }) => { const deceasedTag = () => page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); - await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { - await markPatientDeceasedPage.goTo(patient.uuid); }); - await test.step('When I click on the "Actions" button and select "Mark patient deceased"', async () => { await actionsButton().click(); await markDeceasedMenuItem().click(); }); - // Then I should see a form to enter the patient's death details await test.step('Then I should see a form to enter the patient\'s death details', async () => { await expect(deathDetailsForm()).toBeVisible(); await expect(dateOfDeathInput()).toBeVisible(); await expect(page.getByRole('radio', { name: causeOfDeath })).toBeVisible(); }); - - await test.step('When I enter the "Date of death" to today’s date and the "Cause of death" to Neoplasm and click "Save and close"', async () => { - - await dateOfDeathInput().fill(todayDate); - await page.keyboard.press('Enter'); - await page.locator('text=Neoplasm').waitFor({ state: 'visible' }); - await page.locator('text=Neoplasm').click(); +await test.step('When I enter the "Date of death" to today’s date', async () => { + await dateOfDeathInput().fill(todayDate); + await page.keyboard.press('Enter'); +}); - await saveAndCloseButton().click(); - }); +await test.step('When I set the "Cause of death" to Neoplasm', async () => { + await page.locator('text=Neoplasm').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm').click(); +}); + +await test.step('And I click "Save and close"', async () => { + await saveAndCloseButton().click(); +}); - await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { const deceasedTagLocator = page.locator( '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' ); - await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); }); });