From 9408cc2b564d6a06f245f7126da2d977b6ec233c Mon Sep 17 00:00:00 2001 From: jamil314 Date: Wed, 12 Jun 2024 23:34:34 +0600 Subject: [PATCH] amend: accept / reject correction --- .../correction/correct-record-1.spec.ts | 157 ++++++++++++++++- .../correction/correct-record-2.spec.ts | 156 ++++++++++++++++- .../correction/correct-record-3.spec.ts | 158 +++++++++++++++++- .../correction/correct-record-4.spec.ts | 21 ++- .../correction/correct-record-5.spec.ts | 18 +- .../correction/correct-record-6.spec.ts | 19 ++- .../correction/correct-record-7.spec.ts | 19 ++- .../correction/correct-record-8.spec.ts | 22 ++- .../correction/correct-record-9.spec.ts | 22 ++- 9 files changed, 523 insertions(+), 69 deletions(-) diff --git a/e2e/testcases/applications/correction/correct-record-1.spec.ts b/e2e/testcases/applications/correction/correct-record-1.spec.ts index 144f036b3..bb29b537a 100644 --- a/e2e/testcases/applications/correction/correct-record-1.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-1.spec.ts @@ -774,11 +774,158 @@ test.describe('1. Correct record - 1', () => { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // updatedChildDetails.firstNames + ' ' + updatedChildDetails.familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + }) + + test.describe('1.2.6 Correction Approval', async () => { + test.beforeAll(async ({ browser }) => { + await page.close() + page = await browser.newPage() + + await login(page, 'k.mweene', 'test') + await createPIN(page) + }) + + test('1.2.6.1 Record audit by local registrar', async () => { + await page.getByPlaceholder('Search for a tracking ID').fill(trackingId) + await page.getByPlaceholder('Search for a tracking ID').press('Enter') + await page.locator('#ListItemAction-0-icon').click() + await page.getByRole('button', { name: 'Assign', exact: true }).click() + + await page.locator('#name_0').click() + }) + + test('1.2.6.2 Correction review', async () => { + await page.getByRole('button', { name: 'Review', exact: true }).click() + + /* + * Expected result: should show + * - Submitter + * - Requested by + * - Reason for request + * - Comments + * - Original vs correction + */ + + await expect( + page.getByText('Submitter' + 'Felix Katongo') + ).toBeVisible() + + await expect( + page.getByText( + 'Requested by' + + declaration.mother.name[0].firstNames + + ' ' + + declaration.mother.name[0].familyName + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Reason for request' + + 'Myself or an agent made a mistake (Clerical error)' + ) + ).toBeVisible() + await expect( + page.getByText( + 'Comments' + declaration.registration.registrationNumber + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Full name (Child)' + + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + + updatedChildDetails.firstNames + + ' ' + + updatedChildDetails.familyName + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Sex (Child)' + + declaration.child.gender + + updatedChildDetails.gender + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Date of birth (Child)' + + format(parseISO(declaration.child.birthDate), 'dd MMMM yyyy') + + format(parseISO(updatedChildDetails.birthDate), 'dd MMMM yyyy') + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Place of delivery (Child)' + + 'Health Institution' + + childBirthLocationName + + 'Health Institution' + + updatedChildDetails.placeOfBirth + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Attendant at birth (Child)' + + declaration.attendantAtBirth + + updatedChildDetails.attendantAtBirth + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Type of birth (Child)' + + declaration.birthType + + updatedChildDetails.typeOfBirth + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Weight at birth (Child)' + + declaration.weightAtBirth + + updatedChildDetails.weightAtBirth + ) + ).toBeVisible() + }) + + test('1.2.6.3 Approve correction', async () => { + await page.getByRole('button', { name: 'Approve', exact: true }).click() + await page.getByRole('button', { name: 'Confirm', exact: true }).click() + + /* + * Expected result: should + * - be navigated to ready to print tab + * - include the updated declaration in this tab + */ + expect(page.url().includes('registration-home/print')) + await expect(page.locator('#navigation_outbox')).not.toContainText( + '1', + { + timeout: 1000 * 30 + } + ) + + await expect( + page.getByText( + updatedChildDetails.firstNames + + ' ' + + updatedChildDetails.familyName + ) + ).toBeVisible() + }) }) }) }) diff --git a/e2e/testcases/applications/correction/correct-record-2.spec.ts b/e2e/testcases/applications/correction/correct-record-2.spec.ts index b9606ce77..9343767c3 100644 --- a/e2e/testcases/applications/correction/correct-record-2.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-2.spec.ts @@ -800,10 +800,156 @@ test.describe.serial(' Correct record - 2', () => { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // updatedInformantDetails.firstNames + ' ' + updatedInformantDetails.familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + }) + test.describe('2.8 Correction Approval', async () => { + test.beforeAll(async ({ browser }) => { + await page.close() + + page = await browser.newPage() + + await login(page, 'k.mweene', 'test') + await createPIN(page) + }) + + test('2.8.1 Record audit by local registrar', async () => { + await page.getByPlaceholder('Search for a tracking ID').fill(trackingId) + await page.getByPlaceholder('Search for a tracking ID').press('Enter') + await page.locator('#ListItemAction-0-icon').click() + await page.getByRole('button', { name: 'Assign', exact: true }).click() + + await page.locator('#name_0').click() + }) + + test('2.8.2 Correction review', async () => { + await page.getByRole('button', { name: 'Review', exact: true }).click() + + /* + * Expected result: should show + * - Submitter + * - Requested by + * - Reason for request + * - Comments + * - Original vs correction + */ + + await expect(page.getByText('Submitter' + 'Felix Katongo')).toBeVisible() + + await expect( + page.getByText( + 'Requested by' + + declaration.father.name[0].firstNames + + ' ' + + declaration.father.name[0].familyName + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Reason for request' + + 'Informant provided incorrect information (Material error)' + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Relationship to child (Informant)' + + declaration.informant.relationship + + updatedInformantDetails.relationship + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Full name (informant)' + + declaration.informant.name[0].firstNames + + ' ' + + declaration.informant.name[0].familyName + + updatedInformantDetails.firstNames + + ' ' + + updatedInformantDetails.familyName + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Date of birth (informant)' + + format(parseISO(declaration.informant.birthDate), 'dd MMMM yyyy') + + format(parseISO(updatedInformantDetails.birthDate), 'dd MMMM yyyy') + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Nationality (Informant)Farajaland' + + updatedInformantDetails.nationality + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Type of ID (Informant)National ID' + updatedInformantDetails.idType + ) + ).toBeVisible() + await expect( + page.getByText('ID Number (Informant)-' + updatedInformantDetails.id) + ).toBeVisible() + + await expect( + page.getByText( + 'Usual place of residence (Informant)FarajalandCentralIbombo-' + + declaration.informant.address[0].city + + declaration.informant.address[0].line[2] + + declaration.informant.address[0].line[1] + + declaration.informant.address[0].line[0] + + declaration.informant.address[0].postalCode + + 'Farajaland' + + updatedInformantDetails.address.province + + updatedInformantDetails.address.district + + updatedInformantDetails.address.town + + updatedInformantDetails.address.residentialArea + + updatedInformantDetails.address.street + + updatedInformantDetails.address.number + + updatedInformantDetails.address.zipCode + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Email (Informant)' + + declaration.registration.contactEmail + + updatedInformantDetails.email + ) + ).toBeVisible() + }) + + test('2.8.3 Approve correction', async () => { + await page.getByRole('button', { name: 'Approve', exact: true }).click() + await page.getByRole('button', { name: 'Confirm', exact: true }).click() + + /* + * Expected result: should + * - be navigated to ready to print tab + * - include the updated declaration in this tab + */ + expect(page.url().includes('registration-home/print')) + await expect(page.locator('#navigation_outbox')).not.toContainText('1', { + timeout: 1000 * 30 + }) + + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + }) }) }) diff --git a/e2e/testcases/applications/correction/correct-record-3.spec.ts b/e2e/testcases/applications/correction/correct-record-3.spec.ts index 7a1544baa..c5081d6f0 100644 --- a/e2e/testcases/applications/correction/correct-record-3.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-3.spec.ts @@ -822,10 +822,158 @@ test.describe.serial(' Correct record - 3', () => { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // updatedMotherDetails.firstNames + ' ' + updatedMotherDetails.familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + }) + + test.describe('3.8 Correction Approval', async () => { + test.beforeAll(async ({ browser }) => { + await page.close() + + page = await browser.newPage() + + await login(page, 'k.mweene', 'test') + await createPIN(page) + }) + + test('3.8.1 Record audit by local registrar', async () => { + await page.getByPlaceholder('Search for a tracking ID').fill(trackingId) + await page.getByPlaceholder('Search for a tracking ID').press('Enter') + await page.locator('#ListItemAction-0-icon').click() + await page.getByRole('button', { name: 'Assign', exact: true }).click() + + await page.locator('#name_0').click() + }) + + test('3.8.2 Correction review', async () => { + await page.getByRole('button', { name: 'Review', exact: true }).click() + + /* + * Expected result: should show + * - Submitter + * - Requested by + * - Reason for request + * - Comments + * - Original vs correction + */ + + await expect(page.getByText('Submitter' + 'Felix Katongo')).toBeVisible() + + await expect( + page.getByText( + 'Requested by' + + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + await expect( + page.getByText( + 'Reason for request' + + 'Informant did not provide this information (Material omission)' + ) + ).toBeVisible() + + await expect( + page.getByText('Comments' + declaration.registration.registrationNumber) + ).toBeVisible() + + await expect( + page.getByText( + 'Full name (mother)' + + declaration.mother.name[0].firstNames + + ' ' + + declaration.mother.name[0].familyName + + updatedMotherDetails.firstNames + + ' ' + + updatedMotherDetails.familyName + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Date of birth (mother)' + + format(parseISO(declaration.mother.birthDate), 'dd MMMM yyyy') + + format(parseISO(updatedMotherDetails.birthDate), 'dd MMMM yyyy') + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Nationality (Mother)Farajaland' + updatedMotherDetails.nationality + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Type of ID (Mother)National ID' + updatedMotherDetails.idType + ) + ).toBeVisible() + await expect( + page.getByText('ID Number (Mother)-' + updatedMotherDetails.id) + ).toBeVisible() + + await expect( + page.getByText( + 'Usual place of residence (Mother)FarajalandCentralIbombo-' + + declaration.mother.address[0].city + + declaration.mother.address[0].line[2] + + declaration.mother.address[0].line[1] + + declaration.mother.address[0].line[0] + + declaration.mother.address[0].postalCode + + 'Farajaland' + + updatedMotherDetails.address.province + + updatedMotherDetails.address.district + + updatedMotherDetails.address.town + + updatedMotherDetails.address.residentialArea + + updatedMotherDetails.address.street + + updatedMotherDetails.address.number + + updatedMotherDetails.address.zipCode + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Marital status (Mother)' + + declaration.mother.maritalStatus + + updatedMotherDetails.maritalStatus + ) + ).toBeVisible() + + await expect( + page.getByText( + 'Level of education (Mother)No schooling' + + updatedMotherDetails.educationLevel + ) + ).toBeVisible() + }) + + test('3.8.3 Approve correction', async () => { + await page.getByRole('button', { name: 'Approve', exact: true }).click() + await page.getByRole('button', { name: 'Confirm', exact: true }).click() + + /* + * Expected result: should + * - be navigated to ready to print tab + * - include the updated declaration in this tab + */ + expect(page.url().includes('registration-home/print')) + await expect(page.locator('#navigation_outbox')).not.toContainText('1', { + timeout: 1000 * 30 + }) + + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() + }) }) }) diff --git a/e2e/testcases/applications/correction/correct-record-4.spec.ts b/e2e/testcases/applications/correction/correct-record-4.spec.ts index e1e219112..a0a451490 100644 --- a/e2e/testcases/applications/correction/correct-record-4.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-4.spec.ts @@ -594,6 +594,7 @@ test.describe.serial(' Correct record - 4', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('supportingDocuments')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -623,6 +624,7 @@ test.describe.serial(' Correct record - 4', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('reason')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -751,22 +753,23 @@ test.describe.serial(' Correct record - 4', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() + /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) }) diff --git a/e2e/testcases/applications/correction/correct-record-5.spec.ts b/e2e/testcases/applications/correction/correct-record-5.spec.ts index 6a0e81132..9d7bdcb29 100644 --- a/e2e/testcases/applications/correction/correct-record-5.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-5.spec.ts @@ -600,22 +600,22 @@ test.describe.serial(' Correct record - 5', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) }) diff --git a/e2e/testcases/applications/correction/correct-record-6.spec.ts b/e2e/testcases/applications/correction/correct-record-6.spec.ts index 88d01b727..ea7abcce1 100644 --- a/e2e/testcases/applications/correction/correct-record-6.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-6.spec.ts @@ -775,22 +775,23 @@ test.describe.serial(' Correct record - 6', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() + /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) }) diff --git a/e2e/testcases/applications/correction/correct-record-7.spec.ts b/e2e/testcases/applications/correction/correct-record-7.spec.ts index 5d15e8494..44dfcf321 100644 --- a/e2e/testcases/applications/correction/correct-record-7.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-7.spec.ts @@ -766,22 +766,23 @@ test.describe.serial(' Correct record - 7', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() + /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) }) diff --git a/e2e/testcases/applications/correction/correct-record-8.spec.ts b/e2e/testcases/applications/correction/correct-record-8.spec.ts index 789cea040..76fcea73b 100644 --- a/e2e/testcases/applications/correction/correct-record-8.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-8.spec.ts @@ -117,6 +117,7 @@ test.describe.serial(' Correct record - 8', () => { await page.getByRole('button', { name: 'Verified' }).click() expect(page.url().includes('correction')) + expect(page.url().includes('review')) }) @@ -593,6 +594,7 @@ test.describe.serial(' Correct record - 8', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('supportingDocuments')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -617,6 +619,7 @@ test.describe.serial(' Correct record - 8', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('reason')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -738,22 +741,23 @@ test.describe.serial(' Correct record - 8', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) + await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) }) diff --git a/e2e/testcases/applications/correction/correct-record-9.spec.ts b/e2e/testcases/applications/correction/correct-record-9.spec.ts index 31c13c60a..8fe54a1e2 100644 --- a/e2e/testcases/applications/correction/correct-record-9.spec.ts +++ b/e2e/testcases/applications/correction/correct-record-9.spec.ts @@ -156,6 +156,7 @@ test.describe.serial(' Correct record - 9', () => { * - should directly navigate to review page */ expect(page.url().includes('correction')) + expect(page.url().includes('review')) }) @@ -632,6 +633,7 @@ test.describe.serial(' Correct record - 9', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('supportingDocuments')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -652,6 +654,7 @@ test.describe.serial(' Correct record - 9', () => { * - continue button is disabled */ expect(page.url().includes('correction')) + expect(page.url().includes('reason')) await expect(page.getByRole('button', { name: 'Continue' })).toBeDisabled() @@ -775,22 +778,23 @@ test.describe.serial(' Correct record - 9', () => { */ await page.getByRole('button', { name: 'Make correction' }).click() + await page.getByRole('button', { name: 'Ready to print' }).click() + /* * Expected result: should - * - be navigated to ready for review tab + * - be navigated to ready to print tab * - include the declaration in this tab */ - expect(page.url().includes('registration-home/readyForReview')) await expect(page.locator('#navigation_outbox')).not.toContainText('1', { timeout: 1000 * 30 }) - // await expect( - // page.getByText( - // declaration.child.name[0].firstNames + - // ' ' + - // declaration.child.name[0].familyName - // ) - // ).toBeVisible() + await expect( + page.getByText( + declaration.child.name[0].firstNames + + ' ' + + declaration.child.name[0].familyName + ) + ).toBeVisible() }) })