From 68114ff5ec8001af5809e15ce10735a5d14ed888 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 4 Dec 2024 17:46:23 +0530 Subject: [PATCH 01/45] Add files via upload --- e2e/pages/mark-patient-deceased-page.ts | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 e2e/pages/mark-patient-deceased-page.ts diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts new file mode 100644 index 0000000000..dd3e642d67 --- /dev/null +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -0,0 +1,32 @@ +import { type Page, expect } from '@playwright/test'; + +export class MarkPatientDeceasedPage { + constructor(private readonly page: Page) {} + + // Navigate to the patient's chart page + async goToPatientChart(patientUuid: string) { + await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); + } + + // Open the "Mark Patient Deceased" form + async openMarkDeceasedForm() { + await this.page.locator('button', { hasText: /actions/i }).click(); + await this.page.locator('role=menuitem', { hasText: /mark patient deceased/i }).click(); + } + + // Fill out the details in the "Mark Patient Deceased" form + async fillDeathDetails(date: string, causeOfDeath: string) { + await this.page.fill('input[placeholder="dd/mm/yyyy"]', date); + await this.page.locator(`role=radio[name="${causeOfDeath}"]`).click(); + } + + // Save and close the "Mark Patient Deceased" form + async saveAndClose() { + await this.page.locator('button', { hasText: /save and close/i }).click(); + } + + // Verify that the deceased tag is visible on the page + async verifyDeceasedTag() { + await expect(this.page.locator('text=deceased')).toBeVisible(); + } +} From 159ed129a89380e21b270a09450d7d3bf7001113 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 4 Dec 2024 17:47:06 +0530 Subject: [PATCH 02/45] Update index.ts --- e2e/pages/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/pages/index.ts b/e2e/pages/index.ts index 8ebeb0db36..8690826c72 100644 --- a/e2e/pages/index.ts +++ b/e2e/pages/index.ts @@ -6,6 +6,7 @@ export * from './immunizations-page'; export * from './medications-page'; export * from './orders-page'; export * from './program-page'; +export * from './mark-patient-deceased-page'; export * from './results-viewer-page'; export * from './visits-page'; export * from './vitals-and-biometrics-page'; From dc061e77f723c5cf4ba9571fd8d74c9279d3808b Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 4 Dec 2024 17:47:51 +0530 Subject: [PATCH 03/45] Add files via upload --- e2e/specs/mark-patient-deceased.spec.ts | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 e2e/specs/mark-patient-deceased.spec.ts diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts new file mode 100644 index 0000000000..a0f19077c0 --- /dev/null +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -0,0 +1,34 @@ +import { test, expect } from '@playwright/test'; +import { MarkPatientDeceasedPage } from '../pages/mark-patient-deceased-page'; + +test.describe('Mark Patient Deceased', () => { + const patientUuid = 'e5a00ecf-4caa-423d-9321-31e7efccb133'; // Example patient UUID + const todayDate = new Date().toLocaleDateString('en-GB').replace(/\//g, '-'); // Format: DD-MM-YYYY + const causeOfDeath = 'Neoplasm'; + + test('should mark patient as deceased and display deceased tag', async ({ page }) => { + const markPatientDeceasedPage = new MarkPatientDeceasedPage(page); + + // Given that I have a patient + // And I am on the Patient’s chart page + await markPatientDeceasedPage.goToPatientChart(patientUuid); + + // When I click on the "Actions" button + // And I select "Mark patient deceased" + await markPatientDeceasedPage.openMarkDeceasedForm(); + + // Then I should see a form to enter the patient's death details + await expect(page.locator('form')).toBeVisible(); + await expect(page.locator('text=Date of death')).toBeVisible(); + await expect(page.locator('text=Cause of death')).toBeVisible(); + + // When I enter the "Date of death" to today’s date + // And the "Cause of death" to Neoplasm + // And click "Save and close" + await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); + await markPatientDeceasedPage.saveAndClose(); + + // Then I should see a “deceased” patient tag in the patient banner + await markPatientDeceasedPage.verifyDeceasedTag(); + }); +}); From 2ce4ac17725bc716b2e929072c15fd15c1cdf08e Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 08:26:53 +0530 Subject: [PATCH 04/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 27 ++++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index dd3e642d67..7b7bd0911a 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -1,32 +1,35 @@ -import { type Page, expect } from '@playwright/test'; +import { type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { constructor(private readonly page: Page) {} - // Navigate to the patient's chart page + readonly actionsButton = () => this.page.getByRole('button', { name: /actions/i }); + readonly markDeceasedMenuItem = () => this.page.getByRole('menuitem', { name: /mark patient deceased/i }); + readonly deathDetailsForm = () => this.page.locator('form'); + readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); + readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); + readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); + readonly deceasedTag = () => this.page.getByText(/deceased/i); + async goToPatientChart(patientUuid: string) { await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); } - // Open the "Mark Patient Deceased" form async openMarkDeceasedForm() { - await this.page.locator('button', { hasText: /actions/i }).click(); - await this.page.locator('role=menuitem', { hasText: /mark patient deceased/i }).click(); + await this.actionsButton().click(); + await this.markDeceasedMenuItem().click(); } - // Fill out the details in the "Mark Patient Deceased" form async fillDeathDetails(date: string, causeOfDeath: string) { - await this.page.fill('input[placeholder="dd/mm/yyyy"]', date); - await this.page.locator(`role=radio[name="${causeOfDeath}"]`).click(); + await this.dateOfDeathInput().fill(date); + await this.causeOfDeathRadio(causeOfDeath).click(); } - // Save and close the "Mark Patient Deceased" form async saveAndClose() { - await this.page.locator('button', { hasText: /save and close/i }).click(); + await this.saveAndCloseButton().click(); } - // Verify that the deceased tag is visible on the page async verifyDeceasedTag() { - await expect(this.page.locator('text=deceased')).toBeVisible(); + await expect(this.deceasedTag()).toBeVisible(); } } From 093965ce8d3b1dfd34ad43234d01be305e6ed21d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 08:28:52 +0530 Subject: [PATCH 05/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 51 +++++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index a0f19077c0..8c32b39dd5 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -1,34 +1,43 @@ -import { test, expect } from '@playwright/test'; -import { MarkPatientDeceasedPage } from '../pages/mark-patient-deceased-page'; +import { expect } from '@playwright/test'; +import { generateRandomPatient, deletePatient, type Patient } from '../commands'; +import { test } from '../core'; +import { MarkPatientDeceasedPage } from '../pages'; -test.describe('Mark Patient Deceased', () => { - const patientUuid = 'e5a00ecf-4caa-423d-9321-31e7efccb133'; // Example patient UUID - const todayDate = new Date().toLocaleDateString('en-GB').replace(/\//g, '-'); // Format: DD-MM-YYYY - const causeOfDeath = 'Neoplasm'; +let patient: Patient; - test('should mark patient as deceased and display deceased tag', async ({ page }) => { - const markPatientDeceasedPage = new MarkPatientDeceasedPage(page); +test.beforeEach(async ({ api }) => { + patient = await generateRandomPatient(api); +}); + +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/cancer'; - // Given that I have a patient - // And I am on the Patient’s chart page - await markPatientDeceasedPage.goToPatientChart(patientUuid); + await test.step('When I go to the Patient’s chart page', async () => { + await markPatientDeceasedPage.goToPatientChart(patient.uuid); + }); - // When I click on the "Actions" button - // And I select "Mark patient deceased" + await test.step('And I select "Mark patient deceased" from the Actions menu', async () => { await markPatientDeceasedPage.openMarkDeceasedForm(); + }); - // Then I should see a form to enter the patient's death details - await expect(page.locator('form')).toBeVisible(); - await expect(page.locator('text=Date of death')).toBeVisible(); - await expect(page.locator('text=Cause of death')).toBeVisible(); + await test.step('Then I should see a form to enter death details', async () => { + await expect(markPatientDeceasedPage.deathDetailsForm()).toBeVisible(); + await expect(markPatientDeceasedPage.dateOfDeathInput()).toBeVisible(); + await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); + }); - // When I enter the "Date of death" to today’s date - // And the "Cause of death" to Neoplasm - // And click "Save and close" + await test.step('When I add all the death details and save', async () => { await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); await markPatientDeceasedPage.saveAndClose(); + }); - // Then I should see a “deceased” patient tag in the patient banner + await test.step('Then I should see a “deceased” tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); }); }); + +test.afterEach(async ({ api }) => { + await deletePatient(api, patient.uuid); +}); From eb27823b2ede0e1cfc5e275adae8f737237bb17e Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 09:03:40 +0530 Subject: [PATCH 06/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 8c32b39dd5..20c48c946a 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -29,7 +29,12 @@ test('Mark a patient as deceased', async ({ page }) => { }); await test.step('When I add all the death details and save', async () => { - await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); + // Fill the date input directly + await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + // Select the cause of death + await markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath).click(); + // Close the date picker if still open + await page.keyboard.press('Enter'); await markPatientDeceasedPage.saveAndClose(); }); From 72279a332c3874dc1d12eaca31fb1f43c69e547f Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 09:27:13 +0530 Subject: [PATCH 07/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 20c48c946a..c68aec2815 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -28,15 +28,19 @@ test('Mark a patient as deceased', async ({ page }) => { await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); }); - await test.step('When I add all the death details and save', async () => { - // Fill the date input directly - await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); - // Select the cause of death - await markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath).click(); - // Close the date picker if still open - await page.keyboard.press('Enter'); - await markPatientDeceasedPage.saveAndClose(); - }); + await test.step('When I add all the death details and save', async () => { + // Fill the date input directly + await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + + // Select the cause of death radio button + await page.locator('text=Neoplasm/cancer').click(); // Updated locator + + // Close the date picker if still open + await page.keyboard.press('Enter'); + + // Save and close + await markPatientDeceasedPage.saveAndClose(); +}); await test.step('Then I should see a “deceased” tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); From 9f2b3a2a94a6bfc87f0778c95230785bea24738d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 09:45:10 +0530 Subject: [PATCH 08/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index c68aec2815..de4fff0752 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -32,12 +32,13 @@ test('Mark a patient as deceased', async ({ page }) => { // Fill the date input directly await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); - // Select the cause of death radio button - await page.locator('text=Neoplasm/cancer').click(); // Updated locator - - // Close the date picker if still open + // Close the date picker if still open await page.keyboard.press('Enter'); + // Select the cause of death radio button + await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm/cancer').click(); + // Save and close await markPatientDeceasedPage.saveAndClose(); }); From 6d46bbc3290b75c49e20e7c5a90d5bdd372b1477 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:03:51 +0530 Subject: [PATCH 09/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 7b7bd0911a..4d4070f90f 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -1,4 +1,4 @@ -import { type Page } from '@playwright/test'; +import { expect, type Page } from '@playwright/test'; // Importing expect export class MarkPatientDeceasedPage { constructor(private readonly page: Page) {} @@ -30,6 +30,6 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible(); + await expect(this.deceasedTag()).toBeVisible(); // Ensure expect is used for the assertion } } From 480aeeeb2744ecca3ec529894d485d12deaee6f8 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:04:28 +0530 Subject: [PATCH 10/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index de4fff0752..32e47ee184 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -28,20 +28,20 @@ test('Mark a patient as deceased', async ({ page }) => { await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); }); - await test.step('When I add all the death details and save', async () => { - // Fill the date input directly - await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + await test.step('When I add all the death details and save', async () => { + // Fill the date input directly + await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); // Close the date picker if still open - await page.keyboard.press('Enter'); + await page.keyboard.press('Enter'); // Ensure the date picker closes - // Select the cause of death radio button - await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); - await page.locator('text=Neoplasm/cancer').click(); + // Wait for the "Neoplasm/cancer" radio button to be visible and select it + await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm/cancer').click(); - // Save and close - await markPatientDeceasedPage.saveAndClose(); -}); + // Save and close + await markPatientDeceasedPage.saveAndClose(); + }); await test.step('Then I should see a “deceased” tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); From 4237f7a7ff73fa01aad9bd2403f6c9501e60c14d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:14:20 +0530 Subject: [PATCH 11/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 4d4070f90f..75063f0c90 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -9,7 +9,8 @@ export class MarkPatientDeceasedPage { readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - readonly deceasedTag = () => this.page.getByText(/deceased/i); + readonly deceasedTag = () => this.page.locator('div:has-text("Deceased")'); + async goToPatientChart(patientUuid: string) { await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); @@ -29,7 +30,8 @@ export class MarkPatientDeceasedPage { await this.saveAndCloseButton().click(); } - async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible(); // Ensure expect is used for the assertion - } + async verifyDeceasedTag() { + await expect(this.deceasedTag()).toBeVisible(); // Verifying the "Deceased" label +} + } From 8501b939703c7a2d9848e09a58d44f9b623bac2a Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:24:24 +0530 Subject: [PATCH 12/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 32e47ee184..61d0715328 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -40,7 +40,11 @@ test('Mark a patient as deceased', async ({ page }) => { await page.locator('text=Neoplasm/cancer').click(); // Save and close - await markPatientDeceasedPage.saveAndClose(); + await expect(markPatientDeceasedPage.saveAndCloseButton()).toBeVisible(); + await expect(markPatientDeceasedPage.saveAndCloseButton()).not.toBeDisabled(); + + // Save and close + await markPatientDeceasedPage.saveAndCloseButton().click(); }); await test.step('Then I should see a “deceased” tag in the patient banner', async () => { From c0346dd5bd0eefe2ea550d1d8f7eef538c7f83c3 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:36:01 +0530 Subject: [PATCH 13/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 75063f0c90..b234442909 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -9,7 +9,7 @@ export class MarkPatientDeceasedPage { readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - readonly deceasedTag = () => this.page.locator('div:has-text("Deceased")'); + readonly deceasedTag = () => this.page.locator('div:has-text("Deceased")'); // Adjust if needed async goToPatientChart(patientUuid: string) { @@ -30,8 +30,8 @@ export class MarkPatientDeceasedPage { await this.saveAndCloseButton().click(); } - async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible(); // Verifying the "Deceased" label -} - + async verifyDeceasedTag() { + await this.page.waitForSelector('div:has-text("Deceased")', { state: 'visible' }); // Ensure "Deceased" is visible + await expect(this.deceasedTag()).toBeVisible(); // Verifying the "Deceased" label + } } From 4fd05e1deeca9dadcac05c3f22e5eb349c94c648 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:38:15 +0530 Subject: [PATCH 14/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 61d0715328..1a47c30bbb 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -47,7 +47,8 @@ test('Mark a patient as deceased', async ({ page }) => { await markPatientDeceasedPage.saveAndCloseButton().click(); }); - await test.step('Then I should see a “deceased” tag in the patient banner', async () => { + await test.step('Then I should see a “deceased” tag in the patient banner', async () => { + // Wait for the "Deceased" tag to be visible before asserting await markPatientDeceasedPage.verifyDeceasedTag(); }); }); From ad7be939f62e5f7b0acd904f929f876e5b4cde6c Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 10:51:46 +0530 Subject: [PATCH 15/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index b234442909..5f20f2c606 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -32,6 +32,7 @@ export class MarkPatientDeceasedPage { async verifyDeceasedTag() { await this.page.waitForSelector('div:has-text("Deceased")', { state: 'visible' }); // Ensure "Deceased" is visible - await expect(this.deceasedTag()).toBeVisible(); // Verifying the "Deceased" label + await expect(this.deceasedTag()).toBeVisible({ timeout: 10000 }); // Waits up to 10 seconds for visibility + } } From b60beb3667f86e7168c40d0b29818857bd5d56c6 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 11:09:53 +0530 Subject: [PATCH 16/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 5f20f2c606..48a97758b0 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -32,7 +32,7 @@ export class MarkPatientDeceasedPage { async verifyDeceasedTag() { await this.page.waitForSelector('div:has-text("Deceased")', { state: 'visible' }); // Ensure "Deceased" is visible - await expect(this.deceasedTag()).toBeVisible({ timeout: 10000 }); // Waits up to 10 seconds for visibility + await expect(this.deceasedTag()).toBeVisible({ timeout: 40000 }); // Waits up to 10 seconds for visibility } } From 9702014badd79ae0e75f7d002991b074f9472afc Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 11:18:00 +0530 Subject: [PATCH 17/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 48a97758b0..28a2bfd563 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -9,8 +9,7 @@ export class MarkPatientDeceasedPage { readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - readonly deceasedTag = () => this.page.locator('div:has-text("Deceased")'); // Adjust if needed - + readonly deceasedTag = () => this.page.getByText(/deceased/i); async goToPatientChart(patientUuid: string) { await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); @@ -31,8 +30,6 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - await this.page.waitForSelector('div:has-text("Deceased")', { state: 'visible' }); // Ensure "Deceased" is visible - await expect(this.deceasedTag()).toBeVisible({ timeout: 40000 }); // Waits up to 10 seconds for visibility - - } + await expect(this.deceasedTag()).toBeVisible(); +  } } From 2da373ae507cbf6b89735e8e042e4c806c308385 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 11:18:22 +0530 Subject: [PATCH 18/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 1a47c30bbb..cecbd80e02 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -48,9 +48,8 @@ test('Mark a patient as deceased', async ({ page }) => { }); await test.step('Then I should see a “deceased” tag in the patient banner', async () => { - // Wait for the "Deceased" tag to be visible before asserting await markPatientDeceasedPage.verifyDeceasedTag(); - }); +  }); }); test.afterEach(async ({ api }) => { From b6ef2d75a5dd94f7840e6f923f610ffdadec121b Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 11:27:35 +0530 Subject: [PATCH 19/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 28a2bfd563..f3fca65ff6 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -30,6 +30,6 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible(); + await expect(this.deceasedTag()).toBeVisible({ timeout: 20000 });   } } From 86a41a6747ac8878b817e9d1bb7a9d396d1d9ca1 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Mon, 16 Dec 2024 11:36:22 +0530 Subject: [PATCH 20/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index f3fca65ff6..25c43bbc29 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -30,6 +30,6 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible({ timeout: 20000 }); + await expect(this.deceasedTag()).toBeVisible({ timeout: 70000 });   } } From 9fb15f308bba2d8641d78502ca3f29363b20bf57 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Tue, 17 Dec 2024 20:49:18 +0530 Subject: [PATCH 21/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 25c43bbc29..6c03375c93 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -1,4 +1,4 @@ -import { expect, type Page } from '@playwright/test'; // Importing expect +import { expect, type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { constructor(private readonly page: Page) {} @@ -9,7 +9,7 @@ export class MarkPatientDeceasedPage { readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - readonly deceasedTag = () => this.page.getByText(/deceased/i); + readonly deceasedTag = () => this.page.getByText(/deceased/i); async goToPatientChart(patientUuid: string) { await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); @@ -31,5 +31,5 @@ export class MarkPatientDeceasedPage { async verifyDeceasedTag() { await expect(this.deceasedTag()).toBeVisible({ timeout: 70000 }); -  } + } } From 742c34cd77ba948879a0dc4748d5471189711caa Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Tue, 17 Dec 2024 20:49:58 +0530 Subject: [PATCH 22/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 32 +++++++------------------ 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index cecbd80e02..51b6a36b3e 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -12,44 +12,30 @@ test.beforeEach(async ({ api }) => { 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/cancer'; + const causeOfDeath = 'Neoplasm'; - await test.step('When I go to the Patient’s chart page', async () => { + await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { await markPatientDeceasedPage.goToPatientChart(patient.uuid); }); - await test.step('And I select "Mark patient deceased" from the Actions menu', async () => { + await test.step('When I click on the "Actions" button and select "Mark patient deceased"', async () => { await markPatientDeceasedPage.openMarkDeceasedForm(); }); - await test.step('Then I should see a form to enter death details', async () => { + await test.step('Then I should see a form to enter the patient\'s death details', async () => { await expect(markPatientDeceasedPage.deathDetailsForm()).toBeVisible(); await expect(markPatientDeceasedPage.dateOfDeathInput()).toBeVisible(); await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); }); - await test.step('When I add all the death details and save', async () => { - // Fill the date input directly - await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); - - // Close the date picker if still open - await page.keyboard.press('Enter'); // Ensure the date picker closes - - // Wait for the "Neoplasm/cancer" radio button to be visible and select it - await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); - await page.locator('text=Neoplasm/cancer').click(); - - // Save and close - await expect(markPatientDeceasedPage.saveAndCloseButton()).toBeVisible(); - await expect(markPatientDeceasedPage.saveAndCloseButton()).not.toBeDisabled(); - - // Save and close - await markPatientDeceasedPage.saveAndCloseButton().click(); + await test.step('When I enter the "Date of death" to today\'s date, "Cause of death" to Neoplasm, and click "Save and close"', async () => { + await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); + await markPatientDeceasedPage.saveAndClose(); }); - await test.step('Then I should see a “deceased” tag in the patient banner', async () => { + await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); -  }); + }); }); test.afterEach(async ({ api }) => { From 43729b13d24256c2d3d480ce2d8723f96843e0bc Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 07:01:51 +0530 Subject: [PATCH 23/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 51b6a36b3e..e5d73acfd5 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -29,7 +29,11 @@ test('Mark a patient as deceased', async ({ page }) => { }); await test.step('When I enter the "Date of death" to today\'s date, "Cause of death" to Neoplasm, and click "Save and close"', async () => { - await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); + // Fill the date input directly + await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + // Close the date picker if still open + await page.keyboard.press('Enter'); + await markPatientDeceasedPage.fillDeathDetails(causeOfDeath); await markPatientDeceasedPage.saveAndClose(); }); From 5a852e69978d318280f9fcd7f59c0e6ee58f7f65 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 07:30:15 +0530 Subject: [PATCH 24/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index e5d73acfd5..375e78e867 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -12,7 +12,7 @@ test.beforeEach(async ({ api }) => { 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 causeOfDeath = 'Neoplasm/cancer'; await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { await markPatientDeceasedPage.goToPatientChart(patient.uuid); @@ -28,14 +28,22 @@ test('Mark a patient as deceased', async ({ page }) => { await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); }); - await test.step('When I enter the "Date of death" to today\'s date, "Cause of death" to Neoplasm, and click "Save and close"', async () => { - // Fill the date input directly + await test.step('When I add all the death details and save', async () => { + // Fill the date input directly await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + // Close the date picker if still open - await page.keyboard.press('Enter'); - await markPatientDeceasedPage.fillDeathDetails(causeOfDeath); - await markPatientDeceasedPage.saveAndClose(); + await page.keyboard.press('Enter'); // Ensure the date picker closes + + // Wait for the "Neoplasm/cancer" radio button to be visible and select it + await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm/cancer').click(); + + // Save and close + await markPatientDeceasedPage.saveAndCloseButton().click(); }); + + await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); From 029685b40a5545039de3e78623bf7016af1b7eaa Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 07:46:27 +0530 Subject: [PATCH 25/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 6c03375c93..4d6b5d1a7b 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -9,7 +9,10 @@ export class MarkPatientDeceasedPage { readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - readonly deceasedTag = () => this.page.getByText(/deceased/i); + + // Use a more specific selector for the deceased tag + readonly deceasedTag = () => + this.page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); async goToPatientChart(patientUuid: string) { await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); @@ -30,6 +33,8 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - await expect(this.deceasedTag()).toBeVisible({ timeout: 70000 }); + // Explicitly wait for the deceased tag with a refined selector + const deceasedTagLocator = this.deceasedTag(); + await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); } } From f8f986519a17ceabbb75531081e0a641c5d611e6 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 07:46:54 +0530 Subject: [PATCH 26/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 375e78e867..dcd2bef002 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -29,21 +29,12 @@ test('Mark a patient as deceased', async ({ page }) => { }); await test.step('When I add all the death details and save', async () => { - // Fill the date input directly - await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); - // Close the date picker if still open - await page.keyboard.press('Enter'); // Ensure the date picker closes - - // Wait for the "Neoplasm/cancer" radio button to be visible and select it - await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); - await page.locator('text=Neoplasm/cancer').click(); - - // Save and close - await markPatientDeceasedPage.saveAndCloseButton().click(); + // Ensure Save and Close button is visible and then click + await markPatientDeceasedPage.saveAndCloseButton().waitFor({ state: 'visible' }); + await markPatientDeceasedPage.saveAndClose(); }); - - await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { await markPatientDeceasedPage.verifyDeceasedTag(); From 94929310c7c74d36816b6ba0053f429e431793ea Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 08:10:36 +0530 Subject: [PATCH 27/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index dcd2bef002..80d42b1fa5 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -29,11 +29,18 @@ test('Mark a patient as deceased', async ({ page }) => { }); await test.step('When I add all the death details and save', async () => { - await markPatientDeceasedPage.fillDeathDetails(todayDate, causeOfDeath); + + await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); - // Ensure Save and Close button is visible and then click - await markPatientDeceasedPage.saveAndCloseButton().waitFor({ state: 'visible' }); - await markPatientDeceasedPage.saveAndClose(); + + await page.keyboard.press('Enter'); + + + await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm/cancer').click(); + + + await markPatientDeceasedPage.saveAndCloseButton().click(); }); await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { From 58f4120dc0227ecfdf65dec7021bca8f8bf0ce6c Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Wed, 18 Dec 2024 08:11:13 +0530 Subject: [PATCH 28/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 4d6b5d1a7b..823b616ea6 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -10,7 +10,7 @@ export class MarkPatientDeceasedPage { readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - // Use a more specific selector for the deceased tag + readonly deceasedTag = () => this.page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); @@ -33,8 +33,14 @@ export class MarkPatientDeceasedPage { } async verifyDeceasedTag() { - // Explicitly wait for the deceased tag with a refined selector - const deceasedTagLocator = this.deceasedTag(); + + const deceasedTagLocator = this.page.locator( + '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' + ); + + await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); } + + } From da1c408f72424d1ca08a36df60f5e6d52c55e21d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:23:45 +0530 Subject: [PATCH 29/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 43 ++----------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 823b616ea6..f4a2f7c7c2 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -1,46 +1,9 @@ -import { expect, type Page } from '@playwright/test'; +import { type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { constructor(private readonly page: Page) {} - readonly actionsButton = () => this.page.getByRole('button', { name: /actions/i }); - readonly markDeceasedMenuItem = () => this.page.getByRole('menuitem', { name: /mark patient deceased/i }); - readonly deathDetailsForm = () => this.page.locator('form'); - readonly dateOfDeathInput = () => this.page.getByPlaceholder(/dd\/mm\/yyyy/i); - readonly causeOfDeathRadio = (cause: string) => this.page.getByRole('radio', { name: cause }); - readonly saveAndCloseButton = () => this.page.getByRole('button', { name: /save and close/i }); - - - readonly deceasedTag = () => - this.page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); - - async goToPatientChart(patientUuid: string) { - await this.page.goto(`/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`); - } - - async openMarkDeceasedForm() { - await this.actionsButton().click(); - await this.markDeceasedMenuItem().click(); + getPatientChartPath(patientUuid: string): string { + return `/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`; } - - async fillDeathDetails(date: string, causeOfDeath: string) { - await this.dateOfDeathInput().fill(date); - await this.causeOfDeathRadio(causeOfDeath).click(); - } - - async saveAndClose() { - await this.saveAndCloseButton().click(); - } - - async verifyDeceasedTag() { - - const deceasedTagLocator = this.page.locator( - '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' - ); - - - await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); - } - - } From a2116cc867da92891cedb15681e8be05eefea7ca Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:24:16 +0530 Subject: [PATCH 30/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 56 +++++++++++++++++-------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 80d42b1fa5..be51094c93 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; import { generateRandomPatient, deletePatient, type Patient } from '../commands'; import { test } from '../core'; -import { MarkPatientDeceasedPage } from '../pages'; +import { MarkPatientDeceasedPage } from '../pages/mark-patient-deceased-page'; let patient: Patient; @@ -12,39 +12,59 @@ test.beforeEach(async ({ api }) => { 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/cancer'; + const causeOfDeath = 'Neoplasm'; + // Locators + const actionsButton = () => page.getByRole('button', { name: /actions/i }); + const markDeceasedMenuItem = () => page.getByRole('menuitem', { name: /mark patient deceased/i }); + const deathDetailsForm = () => page.locator('form'); + const dateOfDeathInput = () => page.getByPlaceholder(/dd\/mm\/yyyy/i); + const saveAndCloseButton = () => page.getByRole('button', { name: /save and close/i }); + const deceasedTag = () => + page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); + + // Given that I have a patient and I am on the Patient’s chart page await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { - await markPatientDeceasedPage.goToPatientChart(patient.uuid); + const patientChartPath = markPatientDeceasedPage.getPatientChartPath(patient.uuid); + await page.goto(patientChartPath); }); + // When I click on the "Actions" button and select "Mark patient deceased" await test.step('When I click on the "Actions" button and select "Mark patient deceased"', async () => { - await markPatientDeceasedPage.openMarkDeceasedForm(); + 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(markPatientDeceasedPage.deathDetailsForm()).toBeVisible(); - await expect(markPatientDeceasedPage.dateOfDeathInput()).toBeVisible(); - await expect(markPatientDeceasedPage.causeOfDeathRadio(causeOfDeath)).toBeVisible(); + await expect(deathDetailsForm()).toBeVisible(); + await expect(dateOfDeathInput()).toBeVisible(); + await expect(page.getByRole('radio', { name: causeOfDeath })).toBeVisible(); }); - await test.step('When I add all the death details and save', async () => { - - await markPatientDeceasedPage.dateOfDeathInput().fill(todayDate); + // When I add all the death details and save + 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 () => { + // Fill the date input + await dateOfDeathInput().fill(todayDate); - - await page.keyboard.press('Enter'); + // Close the date picker if still open + await page.keyboard.press('Enter'); // Ensure the date picker closes - - await page.locator('text=Neoplasm/cancer').waitFor({ state: 'visible' }); - await page.locator('text=Neoplasm/cancer').click(); + // Wait for the "Neoplasm" radio button to be visible and select it + await page.locator('text=Neoplasm').waitFor({ state: 'visible' }); + await page.locator('text=Neoplasm').click(); - - await markPatientDeceasedPage.saveAndCloseButton().click(); + // Save and close + await saveAndCloseButton().click(); }); + // Then I should see a “deceased” patient tag in the patient banner await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { - await markPatientDeceasedPage.verifyDeceasedTag(); + const deceasedTagLocator = page.locator( + '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' + ); + + await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); }); }); From 077a8876a33a7308611eeeb2ae69103ab39a0053 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:36:32 +0530 Subject: [PATCH 31/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index f4a2f7c7c2..64bd2312be 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -2,8 +2,9 @@ import { type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { constructor(private readonly page: Page) {} - - getPatientChartPath(patientUuid: string): string { - return `/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`; + + async goTo(patientUuid: string) { + const patientChartPath = `/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`; + await this.page.goto(patientChartPath); } } From ee04abbb4d9ae261ed7c1dd5cc65fa2f37956b33 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:37:20 +0530 Subject: [PATCH 32/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index be51094c93..00e6c0646e 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -25,8 +25,7 @@ test('Mark a patient as deceased', async ({ page }) => { // Given that I have a patient and I am on the Patient’s chart page await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { - const patientChartPath = markPatientDeceasedPage.getPatientChartPath(patient.uuid); - await page.goto(patientChartPath); + await markPatientDeceasedPage.goTo(patient.uuid); }); // When I click on the "Actions" button and select "Mark patient deceased" @@ -42,7 +41,7 @@ test('Mark a patient as deceased', async ({ page }) => { await expect(page.getByRole('radio', { name: causeOfDeath })).toBeVisible(); }); - // When I add all the death details and save + // When I enter the "Date of death" to today’s date and the "Cause of death" to Neoplasm and click "Save and close" 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 () => { // Fill the date input await dateOfDeathInput().fill(todayDate); @@ -63,7 +62,6 @@ test('Mark a patient as deceased', async ({ page }) => { const deceasedTagLocator = page.locator( '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' ); - await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); }); }); From ae154b19ff3edfec22b5f9d04f612c97d7090cad Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:54:13 +0530 Subject: [PATCH 33/45] Update mark-patient-deceased-page.ts --- e2e/pages/mark-patient-deceased-page.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 64bd2312be..760e812162 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -1,10 +1,12 @@ import { type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { - constructor(private readonly page: Page) {} - + constructor(readonly page: Page) {} + + async goTo(patientUuid: string) { - const patientChartPath = `/openmrs/spa/patient/${patientUuid}/chart/Patient%20Summary`; - await this.page.goto(patientChartPath); + await this.page.goto('/openmrs/spa/patient/' + patientUuid + '/chart/Patient%20Summary'); } + + } From 9aadd8b3ec3a275a1ec02b69fb14bd159b86a80d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 07:54:37 +0530 Subject: [PATCH 34/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 00e6c0646e..d504963ec8 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -25,6 +25,7 @@ test('Mark a patient as deceased', async ({ page }) => { // Given that I have a patient and I am on the Patient’s chart page await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { + // Use the goTo method instead of getPatientChartPath await markPatientDeceasedPage.goTo(patient.uuid); }); @@ -62,6 +63,7 @@ test('Mark a patient as deceased', async ({ page }) => { const deceasedTagLocator = page.locator( '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' ); + await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); }); }); From 174ae26e739d356acf042d67d719c8926a1a5207 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 08:02:24 +0530 Subject: [PATCH 35/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index d504963ec8..3eb71655f0 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -14,7 +14,7 @@ test('Mark a patient as deceased', async ({ page }) => { const todayDate = new Date().toLocaleDateString('en-GB').replace(/\//g, '-'); const causeOfDeath = 'Neoplasm'; - // Locators + const actionsButton = () => page.getByRole('button', { name: /actions/i }); const markDeceasedMenuItem = () => page.getByRole('menuitem', { name: /mark patient deceased/i }); const deathDetailsForm = () => page.locator('form'); @@ -23,13 +23,13 @@ test('Mark a patient as deceased', async ({ page }) => { const deceasedTag = () => page.locator('[data-extension-id="deceased-patient-tag"] span', { hasText: 'Deceased' }); - // Given that I have a patient and I am on the Patient’s chart page + await test.step('Given that I have a patient and I am on the Patient’s chart page', async () => { - // Use the goTo method instead of getPatientChartPath + await markPatientDeceasedPage.goTo(patient.uuid); }); - // When I click on the "Actions" button and select "Mark patient deceased" + await test.step('When I click on the "Actions" button and select "Mark patient deceased"', async () => { await actionsButton().click(); await markDeceasedMenuItem().click(); @@ -42,23 +42,18 @@ test('Mark a patient as deceased', async ({ page }) => { await expect(page.getByRole('radio', { name: causeOfDeath })).toBeVisible(); }); - // When I enter the "Date of death" to today’s date and the "Cause of death" to Neoplasm and click "Save and close" + 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 () => { - // Fill the date input + await dateOfDeathInput().fill(todayDate); - - // Close the date picker if still open - await page.keyboard.press('Enter'); // Ensure the date picker closes - - // Wait for the "Neoplasm" radio button to be visible and select it + await page.keyboard.press('Enter'); await page.locator('text=Neoplasm').waitFor({ state: 'visible' }); await page.locator('text=Neoplasm').click(); - // Save and close await saveAndCloseButton().click(); }); - // Then I should see a “deceased” patient tag in the patient banner + 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"]' From fb2c3185b445601a57eaf5517bba27dd865acbbc Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 13:16:18 +0530 Subject: [PATCH 36/45] Update e2e/pages/mark-patient-deceased-page.ts Co-authored-by: Daud Kakumirizi --- e2e/pages/mark-patient-deceased-page.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 760e812162..8db417ec36 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -3,7 +3,6 @@ import { type Page } from '@playwright/test'; export class MarkPatientDeceasedPage { constructor(readonly page: Page) {} - async goTo(patientUuid: string) { await this.page.goto('/openmrs/spa/patient/' + patientUuid + '/chart/Patient%20Summary'); } From c5c0361f85284524dad87b84cd8da92322004867 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 13:16:37 +0530 Subject: [PATCH 37/45] Update e2e/pages/mark-patient-deceased-page.ts Co-authored-by: Daud Kakumirizi --- e2e/pages/mark-patient-deceased-page.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/pages/mark-patient-deceased-page.ts b/e2e/pages/mark-patient-deceased-page.ts index 8db417ec36..f1003747fd 100644 --- a/e2e/pages/mark-patient-deceased-page.ts +++ b/e2e/pages/mark-patient-deceased-page.ts @@ -7,5 +7,4 @@ export class MarkPatientDeceasedPage { await this.page.goto('/openmrs/spa/patient/' + patientUuid + '/chart/Patient%20Summary'); } - } From 2ec856292c1c9605f4696e0e1b0c33e71337e34d Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 13:19:42 +0530 Subject: [PATCH 38/45] 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 }); }); }); From 24018491faae32a4b1be45cfac3aeaa621789f10 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 13:20:12 +0530 Subject: [PATCH 39/45] Update e2e/specs/mark-patient-deceased.spec.ts Co-authored-by: Daud Kakumirizi --- e2e/specs/mark-patient-deceased.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 9927d8ee1b..b02c4a93c4 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 }); const deathDetailsForm = () => page.locator('form'); From 8bfaf6e53f77fe9f0839fb1635b5262bafb63f9a Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Thu, 19 Dec 2024 22:32:07 +0530 Subject: [PATCH 40/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index b02c4a93c4..867a49da6b 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -41,12 +41,12 @@ await test.step('When I enter the "Date of death" to today’s date', async () = await page.keyboard.press('Enter'); }); -await test.step('When I set the "Cause of death" to Neoplasm', async () => { +await test.step('And 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 test.step('And click "Save and close"', async () => { await saveAndCloseButton().click(); }); From 7cff878749d6d2635200ddfe46d0cfb192515a7b Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Sat, 21 Dec 2024 06:28:30 +0530 Subject: [PATCH 41/45] Update e2e/specs/mark-patient-deceased.spec.ts Co-authored-by: Jayasanka Weerasinghe <33048395+jayasanka-sack@users.noreply.github.com> --- e2e/specs/mark-patient-deceased.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 867a49da6b..575a803537 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -42,7 +42,6 @@ await test.step('When I enter the "Date of death" to today’s date', async () = }); await test.step('And the "Cause of death" to Neoplasm', async () => { - await page.locator('text=Neoplasm').waitFor({ state: 'visible' }); await page.locator('text=Neoplasm').click(); }); From 6c294b02cc917ad794e5809767adac0a9a18a1be Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Sat, 21 Dec 2024 06:28:49 +0530 Subject: [PATCH 42/45] Update e2e/specs/mark-patient-deceased.spec.ts Co-authored-by: Jayasanka Weerasinghe <33048395+jayasanka-sack@users.noreply.github.com> --- e2e/specs/mark-patient-deceased.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 575a803537..4f4bd8c894 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -45,7 +45,7 @@ await test.step('And the "Cause of death" to Neoplasm', async () => { await page.locator('text=Neoplasm').click(); }); -await test.step('And click "Save and close"', async () => { +await test.step('And I click "Save and close"', async () => { await saveAndCloseButton().click(); }); From 035173945b74f0d20b0fce30645a08023f54885b Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Sat, 21 Dec 2024 06:29:02 +0530 Subject: [PATCH 43/45] Update e2e/specs/mark-patient-deceased.spec.ts Co-authored-by: Jayasanka Weerasinghe <33048395+jayasanka-sack@users.noreply.github.com> --- e2e/specs/mark-patient-deceased.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 4f4bd8c894..ea15636214 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -46,7 +46,7 @@ await test.step('And the "Cause of death" to Neoplasm', async () => { }); await test.step('And I click "Save and close"', async () => { - await saveAndCloseButton().click(); + await page.getByRole('button', { name: /save and close/i }).click(); }); await test.step('Then I should see a “deceased” patient tag in the patient banner', async () => { From 2f265286b97e217a51d544f887b92f8f50e09fa6 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Sat, 21 Dec 2024 06:30:14 +0530 Subject: [PATCH 44/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index ea15636214..3d9f2e1c96 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -18,8 +18,6 @@ test('Mark a patient as deceased', async ({ page }) => { const deathDetailsForm = () => page.locator('form'); const dateOfDeathInput = () => page.getByPlaceholder(/dd\/mm\/yyyy/i); const saveAndCloseButton = () => page.getByRole('button', { name: /save and close/i }); - 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); @@ -53,7 +51,7 @@ await test.step('And I click "Save and close"', async () => { const deceasedTagLocator = page.locator( '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' ); - await expect(deceasedTagLocator).toBeVisible({ timeout: 70000 }); + await expect(deceasedTagLocator).toBeVisible({ timeout: 10000 }); }); }); From 85075744aa13d1e0d84a1f10216877ea36e59864 Mon Sep 17 00:00:00 2001 From: Viraj Wathsala Gunasinghe Date: Sat, 21 Dec 2024 06:52:14 +0530 Subject: [PATCH 45/45] Update mark-patient-deceased.spec.ts --- e2e/specs/mark-patient-deceased.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/specs/mark-patient-deceased.spec.ts b/e2e/specs/mark-patient-deceased.spec.ts index 3d9f2e1c96..2db44069bd 100644 --- a/e2e/specs/mark-patient-deceased.spec.ts +++ b/e2e/specs/mark-patient-deceased.spec.ts @@ -51,7 +51,7 @@ await test.step('And I click "Save and close"', async () => { const deceasedTagLocator = page.locator( '[data-extension-id="deceased-patient-tag"] span[title="Deceased"]' ); - await expect(deceasedTagLocator).toBeVisible({ timeout: 10000 }); + await expect(deceasedTagLocator).toBeVisible(); }); });