Skip to content

Commit

Permalink
refactor: retain original formatName functionility 4 other places
Browse files Browse the repository at this point in the history
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

opencrvs/opencrvs-core#6830
  • Loading branch information
Siyasanga committed Nov 14, 2024
1 parent 747c1fb commit 3557f94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 6 additions & 3 deletions e2e/testcases/correction-birth/correct-birth-record-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
formatDateTo_ddMMMMyyyy,
formatDateTo_yyyyMMdd,
formatName,
formatNameWithFirstNameFirst,
getAction,
getLocationNameFromFhirId,
getToken,
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 3557f94

Please sign in to comment.