From be2b16d7d3a2a643e93ac4720c9df62fe3e4fcc9 Mon Sep 17 00:00:00 2001 From: Jamil Date: Thu, 19 Sep 2024 20:04:35 +0600 Subject: [PATCH] E2e/fix-flakiness (#1128) * fix: wait 500ms before asserting the outbox to be empty * fix: add missing assertion * fix: use age for deceased so declaration will not be marked as duplicate * fix: use age for mother so declaration will not be marked as duplicate * fix: send ageOfIndividual * chore: wait 500ms when changing death date * fix: add await before async function `goToSection()` * fix: use ageOfIndividual in identity verification of mother * fix: assert age of deceased instead of dob * fix: wait 500ms where page loads twice * fix: increase randomness of names * chore: use constant time --------- Co-authored-by: Riku Rouvila --- e2e/helpers.ts | 22 +++++- .../birth/1-birth-event-declaration.spec.ts | 14 +++- .../2-validate-the-child-details-page.spec.ts | 10 +-- ...8-validate-declaration-review-page.spec.ts | 2 +- .../declarations/birth-declaration-1.spec.ts | 2 +- .../declarations/birth-declaration-10.spec.ts | 2 +- .../declarations/birth-declaration-2.spec.ts | 2 +- .../declarations/birth-declaration-3.spec.ts | 4 +- .../declarations/birth-declaration-4.spec.ts | 2 +- .../declarations/birth-declaration-5.spec.ts | 2 +- .../declarations/birth-declaration-6.spec.ts | 2 +- .../declarations/birth-declaration-7.spec.ts | 4 +- .../declarations/birth-declaration-8.spec.ts | 2 +- .../declarations/birth-declaration-9.spec.ts | 2 +- e2e/testcases/birth/helpers.ts | 15 ++-- .../correct-birth-record-1.spec.ts | 4 +- .../correct-birth-record-3.spec.ts | 59 ++++++++------- .../correct-birth-record-7.spec.ts | 41 ++++++----- .../correct-death-record-10.spec.ts | 72 +++++++++++-------- .../correct-death-record-11.spec.ts | 4 +- .../correct-death-record-14.spec.ts | 48 +++++++------ .../correct-death-record-15.spec.ts | 4 +- .../correct-death-record-18.spec.ts | 48 +++++++------ .../death/1-death-event-declaration.spec.ts | 14 +++- ...8-validate-declaration-review-page.spec.ts | 2 +- .../declaration/death-declaration-1.spec.ts | 2 +- .../declaration/death-declaration-10.spec.ts | 2 +- .../declaration/death-declaration-11.spec.ts | 2 +- .../declaration/death-declaration-2.spec.ts | 4 +- .../declaration/death-declaration-3.spec.ts | 2 +- .../declaration/death-declaration-4.spec.ts | 4 +- .../declaration/death-declaration-5.spec.ts | 2 +- .../declaration/death-declaration-6.spec.ts | 2 +- .../declaration/death-declaration-7.spec.ts | 2 +- .../declaration/death-declaration-8.spec.ts | 2 +- .../declaration/death-declaration-9.spec.ts | 2 +- e2e/testcases/death/helpers.ts | 17 +++-- 37 files changed, 255 insertions(+), 171 deletions(-) diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 00f66f528..947a31fc6 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -323,7 +323,27 @@ export const drawSignature = async (page: Page) => { } } -export const expectOutboxToBeEmpty = async (page: Page) => +export const expectOutboxToBeEmpty = async (page: Page) => { + /* + * This is to ensure the following condition is asserted + * after the outbox has the declaration + */ + await page.waitForTimeout(SAFE_INPUT_CHANGE_TIMEOUT_MS) + await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: SAFE_OUTBOX_TIMEOUT_MS }) +} + +// This suffix increases randomness of a name +export const generateRandomSuffix = () => { + const vowels = 'aeiou' + const consonants = 'bcdfghjklmnpqrstvwxyz' + + const randomVowel = vowels.charAt(Math.floor(Math.random() * vowels.length)) + const randomConsonant = consonants.charAt( + Math.floor(Math.random() * consonants.length) + ) + + return randomConsonant + randomVowel +} diff --git a/e2e/testcases/birth/1-birth-event-declaration.spec.ts b/e2e/testcases/birth/1-birth-event-declaration.spec.ts index 3cc02e355..f87ca9cbb 100644 --- a/e2e/testcases/birth/1-birth-event-declaration.spec.ts +++ b/e2e/testcases/birth/1-birth-event-declaration.spec.ts @@ -467,7 +467,12 @@ test.describe('1. Birth event declaration', () => { /* * Expected result: should be navigated to "in-progress" tab but no draft will be saved */ - expect(page.locator('#content-name', { hasText: 'In progress' })) + + await page.waitForTimeout(500) // This page renders twice at first + + await expect( + page.locator('#content-name', { hasText: 'In progress' }) + ).toBeVisible() await expect(page.getByText('0 seconds ago')).toBeHidden() }) }) @@ -529,7 +534,12 @@ test.describe('1. Birth event declaration', () => { /* * Expected result: should be navigated to "in-progress" tab but no draft will be saved */ - expect(page.locator('#content-name', { hasText: 'In progress' })) + + await page.waitForTimeout(500) // This page renders twice at first + + await expect( + page.locator('#content-name', { hasText: 'In progress' }) + ).toBeVisible() await expect(page.getByText('0 seconds ago')).toBeHidden() }) }) diff --git a/e2e/testcases/birth/2-validate-the-child-details-page.spec.ts b/e2e/testcases/birth/2-validate-the-child-details-page.spec.ts index 2b8dc7ca7..976d43c1e 100644 --- a/e2e/testcases/birth/2-validate-the-child-details-page.spec.ts +++ b/e2e/testcases/birth/2-validate-the-child-details-page.spec.ts @@ -100,7 +100,7 @@ test.describe("2. Validate the child's details page", () => { }) test('2.1.3 Enter Field as NULL', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: @@ -137,7 +137,7 @@ test.describe("2. Validate the child's details page", () => { }) test('2.3.2 Set the field as null', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: @@ -203,7 +203,7 @@ test.describe("2. Validate the child's details page", () => { }) test('2.4.4 Set the field as null', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: @@ -272,7 +272,7 @@ test.describe("2. Validate the child's details page", () => { }) test('2.5.4 Set the field as null', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: @@ -288,7 +288,7 @@ test.describe("2. Validate the child's details page", () => { test.describe('2.6 Validate place of delivery field', async () => { test('2.6.1 Keep field as null', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: diff --git a/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts b/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts index f2567a3b0..0986bc61a 100644 --- a/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts @@ -211,7 +211,7 @@ test.describe.serial('8. Validate declaration review page', () => { test.describe('8.1.1 Navigate to declaration preview page', async () => { test('8.1.1.1 Verify information added on previous pages', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should include diff --git a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts index f8aa6f320..25ac99d30 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts @@ -260,7 +260,7 @@ test.describe.serial('1. Birth declaration case - 1', () => { }) test('1.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('1.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts index 33cf356f7..a86b4e18d 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts @@ -80,7 +80,7 @@ test.describe.serial('10. Birth declaration case - 10', () => { }) test('10.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('10.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts index 7a14fba20..11dbc230f 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts @@ -309,7 +309,7 @@ test.describe.serial('2. Birth declaration case - 2', () => { await page.getByRole('button', { name: 'Continue' }).click() }) test('2.1.5 Go To Preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('2.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts index 254370c66..2abcbcef9 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts @@ -374,7 +374,7 @@ test.describe.serial('3. Birth declaration case - 3', () => { test.describe('3.1.5 Add supporting documents', async () => { test('3.1.5.0 Go to supporting documents page', async () => { - goToSection(page, 'documents') + await goToSection(page, 'documents') }) test('3.1.5.1 Upload proof of birth', async () => { @@ -458,7 +458,7 @@ test.describe.serial('3. Birth declaration case - 3', () => { }) test('3.1.6 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('3.1.7 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts index eb735ba22..b43ade9b3 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts @@ -377,7 +377,7 @@ test.describe.serial('4. Birth declaration case - 4', () => { }) test('4.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('4.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts index 3df25109a..65bf0a713 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts @@ -305,7 +305,7 @@ test.describe.serial('5. Birth declaration case - 5', () => { }) test('5.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('5.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts index 516cc683f..e834b27f7 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts @@ -316,7 +316,7 @@ test.describe.serial('6. Birth declaration case - 6', () => { }) test('6.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('6.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts index c357d3d36..d5df0f900 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts @@ -93,7 +93,7 @@ test.describe.serial('7. Birth declaration case - 7', () => { }) test('7.1.5 Add supporting documents', async () => { - goToSection(page, 'documents') + await goToSection(page, 'documents') await uploadImage( page, page.locator('button[name="uploadDocForChildDOB"]') @@ -124,7 +124,7 @@ test.describe.serial('7. Birth declaration case - 7', () => { }) test('7.1.6 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('7.1.7 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-8.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-8.spec.ts index 793322a46..c4e993acf 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-8.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-8.spec.ts @@ -90,7 +90,7 @@ test.describe.serial('8. Birth declaration case - 8', () => { }) test('8.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('8.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts index 824e78d79..536651298 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts @@ -80,7 +80,7 @@ test.describe.serial('9. Birth declaration case - 9', () => { }) test('9.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('9.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/birth/helpers.ts b/e2e/testcases/birth/helpers.ts index 48cefa5d3..d3a38e290 100644 --- a/e2e/testcases/birth/helpers.ts +++ b/e2e/testcases/birth/helpers.ts @@ -11,6 +11,8 @@ import { GET_BIRTH_REGISTRATION_FOR_REVIEW, REGISTER_BIRTH_DECLARATION } from './queries' +import { random } from 'lodash' +import { generateRandomSuffix } from '../../helpers' export type BirthDetails = { informant: { @@ -33,7 +35,7 @@ export type BirthDetails = { mother: { firstNames: string familyName: string - birthDate?: string + age?: number maritalStatus?: 'SINGLE' | 'MARRIED' | 'DIVORCED' | 'WIDOWED' } father: { @@ -98,8 +100,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { name: [ { use: 'en', - firstNames: details.child.firstNames, - familyName: details.child.familyName + firstNames: details.child.firstNames + generateRandomSuffix(), + familyName: details.child.familyName + generateRandomSuffix() } ], gender: details.child.gender, @@ -160,12 +162,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { familyName: details.mother.familyName } ], - birthDate: - details.mother.birthDate || - format( - subYears(new Date(), 16 + Math.ceil(10 * Math.random())), - 'yyyy-MM-dd' - ), + ageOfIndividualInYears: details.mother.age || random(20, 100), nationality: ['FAR'], identifier: [ { 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 f83dd283c..7c1e682a8 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts @@ -202,8 +202,8 @@ test.describe('1. Correct record - 1', () => { ).toBeVisible() await expect( page.getByText( - `Date of Birth: - ${formatDateTo_ddMMMMyyyy(declaration.mother.birthDate)} + `Age: + ${declaration.mother.ageOfIndividualInYears} ` ) ).toBeVisible() diff --git a/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts index 8c8fe0aac..2e80bc2cf 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts @@ -7,6 +7,7 @@ import { formatName, getToken, goBackToReview, + joinValuesWith, login } from '../../helpers' import faker from '@faker-js/faker' @@ -16,8 +17,8 @@ import { fetchDeclaration } from '../birth/helpers' import { BirthDeclaration, BirthInputDetails } from '../birth/types' -import { format, subDays } from 'date-fns' import { CREDENTIALS } from '../../constants' +import { random } from 'lodash' test.describe.serial(' Correct record - 3', () => { let declaration: BirthDeclaration @@ -28,10 +29,7 @@ test.describe.serial(' Correct record - 3', () => { const updatedMotherDetails = { firstNames: faker.name.firstName('female'), familyName: faker.name.firstName('female'), - birthDate: format( - subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), - 'yyyy-MM-dd' - ), + age: random(20, 100), email: faker.internet.email(), nationality: 'Nauru', id: faker.random.numeric(10), @@ -262,26 +260,24 @@ test.describe.serial(' Correct record - 3', () => { ).toBeVisible() }) - test('3.4.2 Change date of birth', async () => { + test('3.4.2 Change age', async () => { await page - .locator('#mother-content #Date') + .locator('#mother-content #Age') .getByRole('button', { name: 'Change', exact: true }) .click() /* * Expected result: should * - redirect to mother's details page - * - focus on mother's date of birth + * - focus on mother's age */ expect(page.url().includes('correction')).toBeTruthy() expect(page.url().includes('mother-view-group')).toBeTruthy() - expect(page.url().includes('#motherBirthDate')).toBeTruthy() + expect(page.url().includes('#ageOfIndividualInYears')).toBeTruthy() - const birthDay = updatedMotherDetails.birthDate.split('-') - - await page.getByPlaceholder('dd').fill(birthDay[2]) - await page.getByPlaceholder('mm').fill(birthDay[1]) - await page.getByPlaceholder('yyyy').fill(birthDay[0]) + await page + .locator('#ageOfIndividualInYears') + .fill(updatedMotherDetails.age.toString()) await page.getByRole('button', { name: 'Back to review' }).click() @@ -296,13 +292,18 @@ test.describe.serial(' Correct record - 3', () => { expect(page.url().includes('review')).toBeTruthy() await expect( - page.locator('#mother-content #Date').getByRole('deletion') - ).toHaveText(formatDateTo_ddMMMMyyyy(declaration.mother.birthDate)) + page.locator('#mother-content #Age').getByRole('deletion') + ).toHaveText( + joinValuesWith( + [declaration.mother.ageOfIndividualInYears, 'years'], + ' ' + ) + ) await expect( page - .locator('#mother-content #Date') - .getByText(formatDateTo_ddMMMMyyyy(updatedMotherDetails.birthDate)) + .locator('#mother-content #Age') + .getByText(joinValuesWith([updatedMotherDetails.age, 'years'], ' ')) ).toBeVisible() }) @@ -773,9 +774,14 @@ test.describe.serial(' Correct record - 3', () => { await expect( page.getByText( - 'Date of birth (mother)' + - formatDateTo_ddMMMMyyyy(declaration.mother.birthDate) + - formatDateTo_ddMMMMyyyy(updatedMotherDetails.birthDate) + joinValuesWith( + [ + 'Age of mother (mother)', + declaration.mother.ageOfIndividualInYears, + updatedMotherDetails.age + ], + '' + ) ) ).toBeVisible() @@ -951,9 +957,14 @@ test.describe.serial(' Correct record - 3', () => { await expect( page.getByText( - 'Date of birth (mother)' + - formatDateTo_ddMMMMyyyy(declaration.mother.birthDate) + - formatDateTo_ddMMMMyyyy(updatedMotherDetails.birthDate) + joinValuesWith( + [ + 'Age of mother (mother)', + declaration.mother.ageOfIndividualInYears, + updatedMotherDetails.age + ], + '' + ) ) ).toBeVisible() diff --git a/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts index 8add51cc1..33f3da87b 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts @@ -3,10 +3,10 @@ import { createPIN, expectAddress, expectOutboxToBeEmpty, - formatDateTo_ddMMMMyyyy, formatName, getToken, goBackToReview, + joinValuesWith, login, uploadImage, uploadImageToSection @@ -18,8 +18,8 @@ import { fetchDeclaration } from '../birth/helpers' import { BirthDeclaration, BirthInputDetails } from '../birth/types' -import { format, subDays } from 'date-fns' import { CREDENTIALS } from '../../constants' +import { random } from 'lodash' test.describe.serial(' Correct record - 7', () => { let declaration: BirthDeclaration @@ -30,10 +30,7 @@ test.describe.serial(' Correct record - 7', () => { const updatedMotherDetails = { firstNames: faker.name.firstName('male'), familyName: faker.name.firstName('male'), - birthDate: format( - subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), - 'yyyy-MM-dd' - ), + age: random(20, 100), email: faker.internet.email(), nationality: 'Nauru', id: faker.random.numeric(10), @@ -175,11 +172,9 @@ test.describe.serial(' Correct record - 7', () => { await page.locator('#firstNamesEng').fill(updatedMotherDetails.firstNames) await page.locator('#familyNameEng').fill(updatedMotherDetails.familyName) - const birthDay = updatedMotherDetails.birthDate.split('-') - - await page.getByPlaceholder('dd').fill(birthDay[2]) - await page.getByPlaceholder('mm').fill(birthDay[1]) - await page.getByPlaceholder('yyyy').fill(birthDay[0]) + await page + .locator('#ageOfIndividualInYears') + .fill(updatedMotherDetails.age.toString()) await page.locator('#nationality').click() await page.getByText(updatedMotherDetails.nationality).click() @@ -261,13 +256,18 @@ test.describe.serial(' Correct record - 7', () => { */ await expect( - page.locator('#mother-content #Date').getByRole('deletion') - ).toHaveText(formatDateTo_ddMMMMyyyy(declaration.mother.birthDate)) + page.locator('#mother-content #Age').getByRole('deletion') + ).toHaveText( + joinValuesWith( + [declaration.mother.ageOfIndividualInYears, 'years'], + ' ' + ) + ) await expect( page - .locator('#mother-content #Date') - .getByText(formatDateTo_ddMMMMyyyy(updatedMotherDetails.birthDate)) + .locator('#mother-content #Age') + .getByText(joinValuesWith([updatedMotherDetails.age, 'years'], ' ')) ).toBeVisible() /* @@ -461,9 +461,14 @@ test.describe.serial(' Correct record - 7', () => { await expect( page.getByText( - 'Date of birth (mother)' + - formatDateTo_ddMMMMyyyy(declaration.mother.birthDate) + - formatDateTo_ddMMMMyyyy(updatedMotherDetails.birthDate) + joinValuesWith( + [ + 'Age of mother (mother)', + declaration.mother.ageOfIndividualInYears, + updatedMotherDetails.age + ], + '' + ) ) ).toBeVisible() diff --git a/e2e/testcases/correction-death/correct-death-record-10.spec.ts b/e2e/testcases/correction-death/correct-death-record-10.spec.ts index 209e54ea0..668708b78 100644 --- a/e2e/testcases/correction-death/correct-death-record-10.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-10.spec.ts @@ -4,20 +4,21 @@ import { expectAddress, expectOutboxToBeEmpty, formatDateTo_ddMMMMyyyy, - formatDateTo_yyyyMMdd, formatName, getToken, goBackToReview, goToSection, + joinValuesWith, login, uploadImage, uploadImageToSection } from '../../helpers' import faker from '@faker-js/faker' -import { format, parseISO, subDays } from 'date-fns' +import { format, parseISO } from 'date-fns' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { DeathDeclaration } from '../death/types' import { CREDENTIALS } from '../../constants' +import { random } from 'lodash' test.describe('10. Correct record - 10', () => { let declaration: DeathDeclaration @@ -27,10 +28,7 @@ test.describe('10. Correct record - 10', () => { firstNames: faker.name.firstName('female'), familyName: faker.name.firstName('female'), gender: 'Female', - birthDate: format( - subDays(new Date(), Math.ceil(50 * Math.random()) + 365 * 25), - 'yyyy-MM-dd' - ), + age: random(20, 100), nationality: 'Canada', id: faker.random.numeric(10), idType: 'Passport', @@ -359,26 +357,24 @@ test.describe('10. Correct record - 10', () => { ).toBeVisible() }) - test('10.2.2.3 Change date of birth', async () => { + test('10.2.2.3 Change age', async () => { await page - .locator('#deceased-content #Date') + .locator('#deceased-content #Age') .getByRole('button', { name: 'Change', exact: true }) .click() /* * Expected result: should * - redirect to deceased's details page - * - focus on deceased's date of birth + * - focus on deceased's age */ expect(page.url().includes('correction')).toBeTruthy() expect(page.url().includes('deceased-view-group')).toBeTruthy() - expect(page.url().includes('#deceasedBirthDate')).toBeTruthy() + expect(page.url().includes('#ageOfIndividualInYears')).toBeTruthy() - const birthDay = updatedDeceasedDetails.birthDate.split('-') - - await page.getByPlaceholder('dd').fill(birthDay[2]) - await page.getByPlaceholder('mm').fill(birthDay[1]) - await page.getByPlaceholder('yyyy').fill(birthDay[0]) + await page + .locator('#ageOfIndividualInYears') + .fill(updatedDeceasedDetails.age.toString()) await page.getByRole('button', { name: 'Back to review' }).click() @@ -393,14 +389,19 @@ test.describe('10. Correct record - 10', () => { expect(page.url().includes('review')).toBeTruthy() await expect( - page.locator('#deceased-content #Date').getByRole('deletion') - ).toHaveText(formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate)) + page.locator('#deceased-content #Age').getByRole('deletion') + ).toHaveText( + joinValuesWith( + [declaration.deceased.ageOfIndividualInYears, 'years'], + ' ' + ) + ) await expect( page - .locator('#deceased-content #Date') + .locator('#deceased-content #Age') .getByText( - formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate) + joinValuesWith([updatedDeceasedDetails.age, 'years'], ' ') ) ).toBeVisible() }) @@ -805,9 +806,14 @@ test.describe('10. Correct record - 10', () => { await expect( page.getByText( - 'Date of birth (Deceased)' + - formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate) + - formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate) + joinValuesWith( + [ + 'Age of deceased (Deceased)', + declaration.deceased.ageOfIndividualInYears, + updatedDeceasedDetails.age + ], + '' + ) ) ).toBeVisible() @@ -971,9 +977,14 @@ test.describe('10. Correct record - 10', () => { await expect( page.getByText( - 'Date of birth (Deceased)' + - formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate) + - formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate) + joinValuesWith( + [ + 'Age of deceased (Deceased)', + declaration.deceased.ageOfIndividualInYears, + updatedDeceasedDetails.age + ], + '' + ) ) ).toBeVisible() @@ -1142,9 +1153,14 @@ test.describe('10. Correct record - 10', () => { await expect( page.getByText( - 'Date of birth (Deceased)' + - formatDateTo_yyyyMMdd(declaration.deceased.birthDate) + - formatDateTo_yyyyMMdd(updatedDeceasedDetails.birthDate) + joinValuesWith( + [ + 'Age of deceased (Deceased)', + declaration.deceased.ageOfIndividualInYears, + updatedDeceasedDetails.age + ], + '' + ) ) ).toBeVisible() diff --git a/e2e/testcases/correction-death/correct-death-record-11.spec.ts b/e2e/testcases/correction-death/correct-death-record-11.spec.ts index 15ef1ef5c..9590c131d 100644 --- a/e2e/testcases/correction-death/correct-death-record-11.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-11.spec.ts @@ -6,6 +6,7 @@ import { formatDateTo_yyyyMMdd, formatName, getToken, + goBackToReview, login } from '../../helpers' import { format, parseISO, subDays } from 'date-fns' @@ -121,8 +122,7 @@ test.describe.serial(' Correct record - 11', () => { await page.getByPlaceholder('mm').fill(date[1]) await page.getByPlaceholder('yyyy').fill(date[0]) - await page.getByRole('button', { name: 'Back to review' }).click() - + await goBackToReview(page) /* * Expected result: should * - redirect to review page diff --git a/e2e/testcases/correction-death/correct-death-record-14.spec.ts b/e2e/testcases/correction-death/correct-death-record-14.spec.ts index aa7a0fef0..fff69a238 100644 --- a/e2e/testcases/correction-death/correct-death-record-14.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-14.spec.ts @@ -7,13 +7,14 @@ import { formatName, getToken, goBackToReview, + joinValuesWith, login } from '../../helpers' import faker from '@faker-js/faker' -import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' +import { random } from 'lodash' test.describe.serial(' Correct record - 14', () => { let declaration: DeathDeclaration @@ -24,10 +25,7 @@ test.describe.serial(' Correct record - 14', () => { firstNames: faker.name.firstName('female'), familyName: faker.name.firstName('female'), gender: 'Female', - birthDate: format( - subDays(new Date(), Math.ceil(50 * Math.random()) + 365 * 25), - 'yyyy-MM-dd' - ), + age: random(20, 100), nationality: 'Canada', id: faker.random.numeric(10), idType: 'Passport', @@ -230,26 +228,24 @@ test.describe.serial(' Correct record - 14', () => { ).toBeVisible() }) - test('10.2.2.3 Change date of birth', async () => { + test('10.2.2.3 Change age', async () => { await page - .locator('#deceased-content #Date') + .locator('#deceased-content #Age') .getByRole('button', { name: 'Change', exact: true }) .click() /* * Expected result: should * - redirect to deceased's details page - * - focus on deceased's date of birth + * - focus on deceased's age */ expect(page.url().includes('correction')).toBeTruthy() expect(page.url().includes('deceased-view-group')).toBeTruthy() - expect(page.url().includes('#deceasedBirthDate')).toBeTruthy() + expect(page.url().includes('#ageOfIndividualInYears')).toBeTruthy() - const birthDay = updatedDeceasedDetails.birthDate.split('-') - - await page.getByPlaceholder('dd').fill(birthDay[2]) - await page.getByPlaceholder('mm').fill(birthDay[1]) - await page.getByPlaceholder('yyyy').fill(birthDay[0]) + await page + .locator('#ageOfIndividualInYears') + .fill(updatedDeceasedDetails.age.toString()) await page.getByRole('button', { name: 'Back to review' }).click() @@ -264,13 +260,18 @@ test.describe.serial(' Correct record - 14', () => { expect(page.url().includes('review')).toBeTruthy() await expect( - page.locator('#deceased-content #Date').getByRole('deletion') - ).toHaveText(formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate)) + page.locator('#deceased-content #Age').getByRole('deletion') + ).toHaveText( + joinValuesWith( + [declaration.deceased.ageOfIndividualInYears, 'years'], + ' ' + ) + ) await expect( page - .locator('#deceased-content #Date') - .getByText(formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate)) + .locator('#deceased-content #Age') + .getByText(joinValuesWith([updatedDeceasedDetails.age, 'years'], ' ')) ).toBeVisible() }) @@ -638,9 +639,14 @@ test.describe.serial(' Correct record - 14', () => { await expect( page.getByText( - 'Date of birth (Deceased)' + - formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate) + - formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate) + joinValuesWith( + [ + 'Age of deceased (Deceased)', + declaration.deceased.ageOfIndividualInYears, + updatedDeceasedDetails.age + ], + '' + ) ) ).toBeVisible() diff --git a/e2e/testcases/correction-death/correct-death-record-15.spec.ts b/e2e/testcases/correction-death/correct-death-record-15.spec.ts index a9ed6c88f..5bc348880 100644 --- a/e2e/testcases/correction-death/correct-death-record-15.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-15.spec.ts @@ -7,6 +7,7 @@ import { formatName, getLocationNameFromFhirId, getToken, + goBackToReview, login } from '../../helpers' import { format, parseISO, subDays } from 'date-fns' @@ -203,8 +204,7 @@ test.describe.serial(' Correct record - 15', () => { await page.getByPlaceholder('mm').fill(date[1]) await page.getByPlaceholder('yyyy').fill(date[0]) - await page.getByRole('button', { name: 'Back to review' }).click() - + await goBackToReview(page) /* * Expected result: should * - redirect to review page diff --git a/e2e/testcases/correction-death/correct-death-record-18.spec.ts b/e2e/testcases/correction-death/correct-death-record-18.spec.ts index da96d96a1..22222c7dd 100644 --- a/e2e/testcases/correction-death/correct-death-record-18.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-18.spec.ts @@ -7,13 +7,14 @@ import { formatName, getToken, goBackToReview, + joinValuesWith, login } from '../../helpers' import faker from '@faker-js/faker' -import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' +import { random } from 'lodash' test.describe.serial(' Correct record - 18', () => { let declaration: DeathDeclaration @@ -24,10 +25,7 @@ test.describe.serial(' Correct record - 18', () => { firstNames: faker.name.firstName('female'), familyName: faker.name.firstName('female'), gender: 'Female', - birthDate: format( - subDays(new Date(), Math.ceil(50 * Math.random()) + 365 * 25), - 'yyyy-MM-dd' - ), + age: random(20, 100), nationality: 'Canada', id: faker.random.numeric(10), idType: 'Passport', @@ -262,26 +260,24 @@ test.describe.serial(' Correct record - 18', () => { ).toBeVisible() }) - test('10.2.2.3 Change date of birth', async () => { + test('10.2.2.3 Change age', async () => { await page - .locator('#deceased-content #Date') + .locator('#deceased-content #Age') .getByRole('button', { name: 'Change', exact: true }) .click() /* * Expected result: should * - redirect to deceased's details page - * - focus on deceased's date of birth + * - focus on deceased's age */ expect(page.url().includes('correction')).toBeTruthy() expect(page.url().includes('deceased-view-group')).toBeTruthy() - expect(page.url().includes('#deceasedBirthDate')).toBeTruthy() + expect(page.url().includes('#ageOfIndividualInYears')).toBeTruthy() - const birthDay = updatedDeceasedDetails.birthDate.split('-') - - await page.getByPlaceholder('dd').fill(birthDay[2]) - await page.getByPlaceholder('mm').fill(birthDay[1]) - await page.getByPlaceholder('yyyy').fill(birthDay[0]) + await page + .locator('#ageOfIndividualInYears') + .fill(updatedDeceasedDetails.age.toString()) await page.getByRole('button', { name: 'Back to review' }).click() @@ -296,13 +292,18 @@ test.describe.serial(' Correct record - 18', () => { expect(page.url().includes('review')).toBeTruthy() await expect( - page.locator('#deceased-content #Date').getByRole('deletion') - ).toHaveText(formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate)) + page.locator('#deceased-content #Age').getByRole('deletion') + ).toHaveText( + joinValuesWith( + [declaration.deceased.ageOfIndividualInYears, 'years'], + ' ' + ) + ) await expect( page - .locator('#deceased-content #Date') - .getByText(formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate)) + .locator('#deceased-content #Age') + .getByText(joinValuesWith([updatedDeceasedDetails.age, 'years'], ' ')) ).toBeVisible() }) @@ -668,9 +669,14 @@ test.describe.serial(' Correct record - 18', () => { await expect( page.getByText( - 'Date of birth (Deceased)' + - formatDateTo_ddMMMMyyyy(declaration.deceased.birthDate) + - formatDateTo_ddMMMMyyyy(updatedDeceasedDetails.birthDate) + joinValuesWith( + [ + 'Age of deceased (Deceased)', + declaration.deceased.ageOfIndividualInYears, + updatedDeceasedDetails.age + ], + '' + ) ) ).toBeVisible() diff --git a/e2e/testcases/death/1-death-event-declaration.spec.ts b/e2e/testcases/death/1-death-event-declaration.spec.ts index 0269ce0da..2e1dab483 100644 --- a/e2e/testcases/death/1-death-event-declaration.spec.ts +++ b/e2e/testcases/death/1-death-event-declaration.spec.ts @@ -447,7 +447,12 @@ test.describe('1. Death event declaration', () => { /* * Expected result: should be navigated to "in-progress" tab but no draft will be saved */ - expect(page.locator('#content-name', { hasText: 'In progress' })) + + await page.waitForTimeout(500) // This page renders twice at first + + await expect( + page.locator('#content-name', { hasText: 'In progress' }) + ).toBeVisible() await expect(page.getByText('0 seconds ago')).toBeHidden() }) }) @@ -509,7 +514,12 @@ test.describe('1. Death event declaration', () => { /* * Expected result: should be navigated to "in-progress" tab but no draft will be saved */ - expect(page.locator('#content-name', { hasText: 'In progress' })) + + await page.waitForTimeout(500) // This page renders twice at first + + await expect( + page.locator('#content-name', { hasText: 'In progress' }) + ).toBeVisible() await expect(page.getByText('0 seconds ago')).toBeHidden() }) }) diff --git a/e2e/testcases/death/8-validate-declaration-review-page.spec.ts b/e2e/testcases/death/8-validate-declaration-review-page.spec.ts index 4b0442d1c..83011bf89 100644 --- a/e2e/testcases/death/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/death/8-validate-declaration-review-page.spec.ts @@ -181,7 +181,7 @@ test.describe.serial('8. Validate declaration review page', () => { test.describe('8.1.1 Navigate to declaration preview page', async () => { test('8.1.1.1 Verify information added on previous pages', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should include diff --git a/e2e/testcases/death/declaration/death-declaration-1.spec.ts b/e2e/testcases/death/declaration/death-declaration-1.spec.ts index 04711a935..c2ac69a78 100644 --- a/e2e/testcases/death/declaration/death-declaration-1.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-1.spec.ts @@ -215,7 +215,7 @@ test.describe.serial('1. Death declaration case - 1', () => { }) test('1.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('1.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-10.spec.ts b/e2e/testcases/death/declaration/death-declaration-10.spec.ts index 78ff45446..85ddc9399 100644 --- a/e2e/testcases/death/declaration/death-declaration-10.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-10.spec.ts @@ -66,7 +66,7 @@ test.describe.serial('10. Death declaration case - 10', () => { }) test('10.1.4 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('10.1.5 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-11.spec.ts b/e2e/testcases/death/declaration/death-declaration-11.spec.ts index e73aead0b..66e455271 100644 --- a/e2e/testcases/death/declaration/death-declaration-11.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-11.spec.ts @@ -318,7 +318,7 @@ test.describe.serial('11. Death declaration case - 11', () => { }) test('11.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('11.1.6 Verify informations in preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-2.spec.ts b/e2e/testcases/death/declaration/death-declaration-2.spec.ts index f4aaf091a..a02133d2b 100644 --- a/e2e/testcases/death/declaration/death-declaration-2.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-2.spec.ts @@ -285,7 +285,7 @@ test.describe.serial('2. Death declaration case - 2', () => { test.describe('2.1.5 Upload supporting document', async () => { test('2.1.5.0 Go To upload supporting document page', async () => { - goToSection(page, 'documents') + await goToSection(page, 'documents') }) test('2.1.5.1 Upload proof for deceased', async () => { @@ -367,7 +367,7 @@ test.describe.serial('2. Death declaration case - 2', () => { }) test('2.1.6 Verify information on preview page', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should include * - Deceased's First Name diff --git a/e2e/testcases/death/declaration/death-declaration-3.spec.ts b/e2e/testcases/death/declaration/death-declaration-3.spec.ts index 861c284ac..9c3470572 100644 --- a/e2e/testcases/death/declaration/death-declaration-3.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-3.spec.ts @@ -314,7 +314,7 @@ test.describe.serial('3. Death declaration case - 3', () => { }) test('3.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('3.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-4.spec.ts b/e2e/testcases/death/declaration/death-declaration-4.spec.ts index 441292c5f..e6c591a7a 100644 --- a/e2e/testcases/death/declaration/death-declaration-4.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-4.spec.ts @@ -311,7 +311,7 @@ test.describe.serial('4. Death declaration case - 4', () => { }) test('4.1.5 Upload supporting document', async () => { - goToSection(page, 'documents') + await goToSection(page, 'documents') const imageUploadSections = [ ['uploadDocForDeceased', 'Birth certificate'], @@ -330,7 +330,7 @@ test.describe.serial('4. Death declaration case - 4', () => { } }) test('4.1.6 Verify information on preview page', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should include * - Deceased's First Name diff --git a/e2e/testcases/death/declaration/death-declaration-5.spec.ts b/e2e/testcases/death/declaration/death-declaration-5.spec.ts index 2e43d1eec..5dfcc78d6 100644 --- a/e2e/testcases/death/declaration/death-declaration-5.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-5.spec.ts @@ -279,7 +279,7 @@ test.describe.serial('5. Death declaration case - 5', () => { }) test('5.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('5.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-6.spec.ts b/e2e/testcases/death/declaration/death-declaration-6.spec.ts index ab0a29ae0..b7998d706 100644 --- a/e2e/testcases/death/declaration/death-declaration-6.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-6.spec.ts @@ -266,7 +266,7 @@ test.describe.serial('6. Death declaration case - 6', () => { }) test('6.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('6.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-7.spec.ts b/e2e/testcases/death/declaration/death-declaration-7.spec.ts index 5294c62a4..f223006a1 100644 --- a/e2e/testcases/death/declaration/death-declaration-7.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-7.spec.ts @@ -281,7 +281,7 @@ test.describe.serial('7. Death declaration case - 7', () => { }) test('7.1.5 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('7.1.6 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-8.spec.ts b/e2e/testcases/death/declaration/death-declaration-8.spec.ts index 01da28ef8..894410767 100644 --- a/e2e/testcases/death/declaration/death-declaration-8.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-8.spec.ts @@ -78,7 +78,7 @@ test.describe.serial('8. Death declaration case - 8', () => { }) test('8.1.4 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('8.1.5 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/declaration/death-declaration-9.spec.ts b/e2e/testcases/death/declaration/death-declaration-9.spec.ts index b6668fb38..063f769f6 100644 --- a/e2e/testcases/death/declaration/death-declaration-9.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-9.spec.ts @@ -75,7 +75,7 @@ test.describe.serial('9. Death declaration case - 9', () => { }) test('9.1.4 Go to preview', async () => { - goToSection(page, 'preview') + await goToSection(page, 'preview') }) test('9.1.5 Verify information on preview page', async () => { diff --git a/e2e/testcases/death/helpers.ts b/e2e/testcases/death/helpers.ts index 7a5d877b5..9960b6014 100644 --- a/e2e/testcases/death/helpers.ts +++ b/e2e/testcases/death/helpers.ts @@ -5,11 +5,16 @@ import faker from '@faker-js/faker' import { readFileSync } from 'fs' import uuid from 'uuid' import { join } from 'path' -import { formatDateObjectTo_yyyyMMdd, getRandomDate } from '../../helpers' +import { + formatDateObjectTo_yyyyMMdd, + generateRandomSuffix, + getRandomDate +} from '../../helpers' import { CREATE_DEATH_REGISTRATION, GET_DEATH_REGISTRATION_FOR_REVIEW } from './queries' +import { random } from 'lodash' export type DeathDeclarationInput = { deceased?: { @@ -30,11 +35,11 @@ export type DeathDeclarationInput = { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.name.firstName('male') + generateRandomSuffix(), + familyName: faker.name.lastName('male') + generateRandomSuffix() }, gender: 'male', - birthDate: getRandomDate(75, 200), + age: random(20, 100), nationality: 'FAR', identifier: { type: 'NATIONAL_ID', @@ -141,9 +146,7 @@ export async function createDeathDeclaration( } ], gender: declaration.deceased.gender as 'male', - birthDate: formatDateObjectTo_yyyyMMdd( - declaration.deceased.birthDate - ), + ageOfIndividualInYears: declaration.deceased.age, nationality: [declaration.deceased.nationality], identifier: [ {