From 3557f94f65e2f60b7f914f04ac8e91c30fbfa8c8 Mon Sep 17 00:00:00 2001 From: Siyasanga Date: Thu, 14 Nov 2024 18:01:26 +0200 Subject: [PATCH] refactor: retain original formatName functionility 4 other places There were some screens that were not using the new customised formatName() so the refactor to formatName broke thier e2e tests, the temporary solution is to add a new function formatNameWithFirstNameFirst() which uses the old logic until the screen are updated https://github.com/opencrvs/opencrvs-core/issues/6830 --- e2e/helpers.ts | 4 ++++ .../correction-birth/correct-birth-record-1.spec.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 737d54059..c283ff4c0 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -292,6 +292,10 @@ export const formatName = (name: PersonOrName) => { return joinValuesWith([name.familyName, name.firstNames]) } +export const formatNameWithFirstNameFirst = (name: PersonOrName) => { + return joinValuesWith([name.firstNames, name.familyName]) +} + export const drawSignature = async (page: Page) => { const canvas = page.locator('#informantSignature_modal canvas') const rect = await canvas.boundingBox() diff --git a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts index e3c2be7a7..7805ef591 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts @@ -6,6 +6,7 @@ import { formatDateTo_ddMMMMyyyy, formatDateTo_yyyyMMdd, formatName, + formatNameWithFirstNameFirst, getAction, getLocationNameFromFhirId, getToken, @@ -712,8 +713,8 @@ test.describe('1. Correct record - 1', () => { await expect( page.getByText( 'Full name (Child)' + - formatName(declaration.child.name[0]) + - formatName(updatedChildDetails) + formatNameWithFirstNameFirst(declaration.child.name[0]) + + formatNameWithFirstNameFirst(updatedChildDetails) ) ).toBeVisible() @@ -768,7 +769,9 @@ test.describe('1. Correct record - 1', () => { ).toBeVisible() await expect( - page.getByText(formatName(declaration.mother.name[0])) + page.getByText( + formatNameWithFirstNameFirst(declaration.mother.name[0]) + ) ).toBeVisible() await expect(page.getByText('Verified')).toBeVisible() await expect(