From c3f008f1f6d67b1616823b7f2be80884d855d664 Mon Sep 17 00:00:00 2001 From: Jamil Date: Fri, 20 Dec 2024 15:52:30 +0600 Subject: [PATCH] fix: bump up faker (#1191) * fix: update import from faker * chore: update faker to 9.3.0 * chore: add e2e dir in tsconfig * chore: udpate import from faker in data-generator * fix: use faker.string.numeric * fix: use faker.location instead of faker.address * fix: update faker api calls * fix: import node from node-fetch * fix: type errors in e2e --- e2e/helpers.ts | 1 + ...ct-a-record-from-audit-record-page.spec.ts | 14 ++-- .../birth/1-birth-event-declaration.spec.ts | 14 ++-- ...8-validate-declaration-review-page.spec.ts | 36 ++++----- .../declarations/birth-declaration-1.spec.ts | 16 ++-- .../declarations/birth-declaration-10.spec.ts | 4 +- .../declarations/birth-declaration-2.spec.ts | 40 ++++----- .../declarations/birth-declaration-3.spec.ts | 52 ++++++------ .../declarations/birth-declaration-4.spec.ts | 60 +++++++------- .../declarations/birth-declaration-5.spec.ts | 46 +++++------ .../declarations/birth-declaration-6.spec.ts | 56 ++++++------- .../declarations/birth-declaration-7.spec.ts | 6 +- .../declarations/birth-declaration-9.spec.ts | 4 +- e2e/testcases/birth/helpers.ts | 35 ++++---- .../correct-birth-record-1.spec.ts | 18 ++--- .../correct-birth-record-2.spec.ts | 40 ++++----- .../correct-birth-record-3.spec.ts | 40 ++++----- .../correct-birth-record-4.spec.ts | 30 +++---- .../correct-birth-record-5.spec.ts | 28 +++---- .../correct-birth-record-6.spec.ts | 30 +++---- .../correct-birth-record-7.spec.ts | 30 +++---- .../correct-birth-record-8.spec.ts | 30 +++---- .../correct-birth-record-9.spec.ts | 30 +++---- .../correct-death-record-10.spec.ts | 18 ++--- .../correct-death-record-12.spec.ts | 28 +++---- .../correct-death-record-13.spec.ts | 18 ++--- .../correct-death-record-14.spec.ts | 18 ++--- .../correct-death-record-16.spec.ts | 18 ++--- .../correct-death-record-17.spec.ts | 18 ++--- .../correct-death-record-18.spec.ts | 18 ++--- ...8-validate-declaration-review-page.spec.ts | 38 ++++----- .../declaration/death-declaration-1.spec.ts | 24 +++--- .../declaration/death-declaration-11.spec.ts | 62 +++++++------- .../declaration/death-declaration-2.spec.ts | 32 ++++---- .../declaration/death-declaration-3.spec.ts | 46 +++++------ .../declaration/death-declaration-4.spec.ts | 46 +++++------ .../declaration/death-declaration-5.spec.ts | 48 +++++------ .../declaration/death-declaration-6.spec.ts | 40 ++++----- .../declaration/death-declaration-7.spec.ts | 52 ++++++------ .../declaration/death-declaration-8.spec.ts | 6 +- .../declaration/death-declaration-9.spec.ts | 4 +- e2e/testcases/death/helpers.ts | 25 +++--- package.json | 5 +- src/data-generator/address.ts | 8 +- src/data-generator/declare.ts | 81 ++++++++++--------- src/data-generator/users.ts | 10 +-- tsconfig.json | 12 ++- yarn.lock | 13 ++- 48 files changed, 684 insertions(+), 664 deletions(-) diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 01e835b9a..8f37aa543 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -8,6 +8,7 @@ import { } from './constants' import { format, parseISO } from 'date-fns' import { isArray, random } from 'lodash' +import fetch from 'node-fetch' export async function login(page: Page, username: string, password: string) { const token = await getToken(username, password) diff --git a/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts b/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts index 020040d3c..7d4eecc20 100644 --- a/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts +++ b/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts @@ -6,7 +6,7 @@ import { getToken, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { createDeclaration } from '../birth/helpers' import TEST_DATA_1 from '../birth/data/1-both-mother-and-father.json' import { CREDENTIALS } from '../../constants' @@ -25,8 +25,8 @@ test.describe const token = await getToken('k.mweene', 'test') const res = await createDeclaration(token, { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: TEST_DATA_1['Child details'].Sex.toLowerCase() as 'male' }, informant: { @@ -40,12 +40,12 @@ test.describe ].toUpperCase() as 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } }) expect(res).toStrictEqual({ diff --git a/e2e/testcases/birth/1-birth-event-declaration.spec.ts b/e2e/testcases/birth/1-birth-event-declaration.spec.ts index 99107e4e0..78426dfaf 100644 --- a/e2e/testcases/birth/1-birth-event-declaration.spec.ts +++ b/e2e/testcases/birth/1-birth-event-declaration.spec.ts @@ -3,7 +3,7 @@ import { createPIN, getToken, login } from '../../helpers' import { createDeclaration } from './helpers' import TEST_DATA_1 from './data/1-both-mother-and-father.json' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe('1. Birth event declaration', () => { @@ -569,8 +569,8 @@ test.describe('1. Birth event declaration', () => { const token = await getToken('k.mweene', 'test') const res = await createDeclaration(token, { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: TEST_DATA_1['Child details'].Sex.toLowerCase() as 'male' }, informant: { @@ -584,12 +584,12 @@ test.describe('1. Birth event declaration', () => { ].toUpperCase() as 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } }) expect(res).toStrictEqual({ 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 e1035c0eb..26294d50f 100644 --- a/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts @@ -12,7 +12,7 @@ import { getAction, assignRecord } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe.serial('8. Validate declaration review page', () => { @@ -20,8 +20,8 @@ test.describe.serial('8. Validate declaration review page', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(0, 200) @@ -35,13 +35,13 @@ test.describe.serial('8. Validate declaration review page', () => { informantEmail: faker.internet.email(), mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -52,13 +52,13 @@ test.describe.serial('8. Validate declaration review page', () => { }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: 'Same as mother' @@ -422,8 +422,8 @@ test.describe.serial('8. Validate declaration review page', () => { await page.locator('#child-content #Full').getByText('Change').click() declaration.child.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -612,8 +612,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.10 Change mother's name", async () => { await page.locator('#mother-content #Full').getByText('Change').click() - declaration.mother.name.firstNames = faker.name.firstName('female') - declaration.mother.name.familyName = faker.name.lastName('female') + declaration.mother.name.firstNames = faker.person.firstName('female') + declaration.mother.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.mother.name.firstNames) @@ -695,7 +695,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.14 Change mother's ID", async () => { await page.locator('#mother-content #ID').getByText('Change').click() - declaration.mother.identifier.id = faker.random.numeric(10) + declaration.mother.identifier.id = faker.string.numeric(10) await page .locator('#motherPassport') .fill(declaration.mother.identifier.id) @@ -738,8 +738,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.16 Change father's name", async () => { await page.locator('#father-content #Full').getByText('Change').click() - declaration.father.name.firstNames = faker.name.firstName('male') - declaration.father.name.familyName = faker.name.lastName('male') + declaration.father.name.firstNames = faker.person.firstName('male') + declaration.father.name.familyName = faker.person.lastName('male') await page .locator('#firstNamesEng') .fill(declaration.father.name.firstNames) @@ -821,7 +821,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.20 Change father's ID", async () => { await page.locator('#father-content #ID').getByText('Change').click() - declaration.father.identifier.id = faker.random.numeric(10) + declaration.father.identifier.id = faker.string.numeric(10) await page .locator('#fatherPassport') .fill(declaration.father.identifier.id) @@ -1349,7 +1349,7 @@ test.describe.serial('8. Validate declaration review page', () => { ]) }) - const newFamilyNameForChild = faker.name.lastName('male') + const newFamilyNameForChild = faker.person.lastName('male') test("8.3.2.1 Update child's family name", async () => { await page diff --git a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts index 2ca50b831..6a076a514 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts @@ -12,7 +12,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('1. Birth declaration case - 1', () => { @@ -41,7 +41,7 @@ test.describe.serial('1. Birth declaration case - 1', () => { birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -49,11 +49,11 @@ test.describe.serial('1. Birth declaration case - 1', () => { province: 'Sulaka', district: 'Irundu', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Single', levelOfEducation: 'No schooling' @@ -66,7 +66,7 @@ test.describe.serial('1. Birth declaration case - 1', () => { birthDate: getRandomDate(22, 200), nationality: 'Gabon', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, maritalStatus: 'Single', diff --git a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts index b04099944..ef7a4f7df 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts @@ -9,7 +9,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('10. Birth declaration case - 10', () => { @@ -18,7 +18,7 @@ test.describe.serial('10. Birth declaration case - 10', () => { const declaration = { child: { name: { - firstNames: faker.name.lastName() + firstNames: faker.person.lastName() } }, informantType: 'Father', diff --git a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts index 2834454fd..32fbaeb6f 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('2. Birth declaration case - 2', () => { @@ -21,8 +21,8 @@ test.describe.serial('2. Birth declaration case - 2', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', birthDate: getRandomDate(0, 200) @@ -35,23 +35,23 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Father', informantEmail: faker.internet.email(), mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 21, nationality: 'Fiji', identifier: { - id: faker.random.numeric(12), + id: faker.string.numeric(12), type: 'Passport' }, address: { @@ -59,20 +59,20 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Sulaka', district: 'Irundu', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, maritalStatus: 'Married', levelOfEducation: 'Primary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 25, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(8), + id: faker.string.numeric(8), type: 'Passport' }, maritalStatus: 'Married', @@ -83,11 +83,11 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts index eebf06888..f99b5ea8a 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts @@ -14,7 +14,7 @@ import { uploadImage, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('3. Birth declaration case - 3', () => { @@ -22,8 +22,8 @@ test.describe.serial('3. Birth declaration case - 3', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + '_Peter', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + '_Peter', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -36,19 +36,19 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, informantType: 'Grandfather', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(40, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -56,46 +56,46 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Chuminga', district: 'Ama', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(9), + id: faker.string.numeric(9), type: 'Birth Registration Number' }, address: { country: 'Djibouti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Widowed', levelOfEducation: 'Secondary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Gabon', identifier: { - id: faker.random.numeric(11), + id: faker.string.numeric(11), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', @@ -106,7 +106,7 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts index 7e7cedf46..f216d855e 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('4. Birth declaration case - 4', () => { @@ -21,8 +21,8 @@ test.describe.serial('4. Birth declaration case - 4', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + '-Peter', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + '-Peter', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -35,23 +35,23 @@ test.describe.serial('4. Birth declaration case - 4', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Grandmother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 60, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -59,13 +59,13 @@ test.describe.serial('4. Birth declaration case - 4', () => { province: 'Chuminga', district: 'Ama', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 25, nationality: 'Farajaland', @@ -74,21 +74,21 @@ test.describe.serial('4. Birth declaration case - 4', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Divorced', levelOfEducation: 'Tertiary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Farajaland', @@ -100,13 +100,13 @@ test.describe.serial('4. Birth declaration case - 4', () => { address: { sameAsMother: false, country: 'Grenada', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts index 65bf0a713..1e37bffed 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('5. Birth declaration case - 5', () => { @@ -19,8 +19,8 @@ test.describe.serial('5. Birth declaration case - 5', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + ' the 3rd', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + ' the 3rd', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -33,36 +33,36 @@ test.describe.serial('5. Birth declaration case - 5', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, informantType: 'Brother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 16, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { country: 'Haiti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 25, nationality: 'Farajaland', @@ -71,13 +71,13 @@ test.describe.serial('5. Birth declaration case - 5', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Separated', levelOfEducation: 'Tertiary' diff --git a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts index e834b27f7..112ade170 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('6. Birth declaration case - 6', () => { @@ -19,8 +19,8 @@ test.describe.serial('6. Birth declaration case - 6', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + " O'Neil", - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + " O'Neil", + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -30,20 +30,20 @@ test.describe.serial('6. Birth declaration case - 6', () => { placeOfBirth: 'Other', birthLocation: { country: 'Greenland', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Sister', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 17, nationality: 'Guernsey', @@ -52,19 +52,19 @@ test.describe.serial('6. Birth declaration case - 6', () => { }, address: { country: 'Haiti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 25, nationality: 'Farajaland', @@ -73,13 +73,13 @@ test.describe.serial('6. Birth declaration case - 6', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Separated', levelOfEducation: 'Tertiary' diff --git a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts index e05dd0537..8d8156521 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts @@ -11,7 +11,7 @@ import { uploadImage, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('7. Birth declaration case - 7', () => { @@ -20,8 +20,8 @@ test.describe.serial('7. Birth declaration case - 7', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } }, attendantAtBirth: 'None', diff --git a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts index 9148afeb3..ecd28a25b 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts @@ -9,7 +9,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('9. Birth declaration case - 9', () => { @@ -18,7 +18,7 @@ test.describe.serial('9. Birth declaration case - 9', () => { const declaration = { child: { name: { - familyName: faker.name.lastName() + familyName: faker.person.lastName() } }, informantType: 'Mother', diff --git a/e2e/testcases/birth/helpers.ts b/e2e/testcases/birth/helpers.ts index bd4dd6d76..a2f83fe8c 100644 --- a/e2e/testcases/birth/helpers.ts +++ b/e2e/testcases/birth/helpers.ts @@ -1,6 +1,6 @@ import { GATEWAY_HOST } from '../../constants' import { BirthRegistrationInput } from '../../gateway' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { readFileSync } from 'fs' import uuid from 'uuid' @@ -13,6 +13,7 @@ import { } from './queries' import { random } from 'lodash' import { generateRandomSuffix } from '../../helpers' +import fetch from 'node-fetch' export type BirthDetails = { informant: { @@ -92,7 +93,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { join(__dirname, './data/assets/528KB-random.png') ).toString('base64'), informantType: details.informant.type, - contactPhoneNumber: '0' + faker.random.numeric(9), + contactPhoneNumber: '0' + faker.string.numeric(9), contactEmail: faker.internet.email(), draftId: uuid.v4() }, @@ -120,9 +121,9 @@ export async function createDeclaration(token: string, details: BirthDetails) { type: 'PRIVATE_HOME', address: { line: [ - faker.address.buildingNumber(), - faker.address.streetName(), - faker.address.cityName(), + faker.location.buildingNumber(), + faker.location.street(), + faker.location.city(), '', '', 'URBAN', @@ -141,8 +142,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { locations, details.child.birthLocation?.district || 'Ibombo' ), - city: faker.address.cityName(), - postalCode: faker.address.zipCode() + city: faker.location.city(), + postalCode: faker.location.zipCode() } } : { @@ -166,7 +167,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], @@ -174,9 +175,9 @@ export async function createDeclaration(token: string, details: BirthDetails) { { type: 'PRIMARY_ADDRESS', line: [ - faker.address.buildingNumber(), - faker.address.streetName(), - faker.address.cityName(), + faker.location.buildingNumber(), + faker.location.street(), + faker.location.city(), '', '', 'URBAN', @@ -220,8 +221,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { name: [ { use: 'en', - firstNames: faker.name.findName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } ], birthDate: @@ -233,7 +234,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], @@ -272,8 +273,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { name: [ { use: 'en', - firstNames: faker.name.findName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } ], birthDate: format( @@ -283,7 +284,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], 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 dc5658aaa..86f5cdca8 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts @@ -15,7 +15,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -30,8 +30,8 @@ test.describe('1. Correct record - 1', () => { let trackingId = '' const updatedChildDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', birthDate: format( subDays(new Date(), Math.ceil(10 * Math.random())), @@ -47,8 +47,8 @@ test.describe('1. Correct record - 1', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -58,12 +58,12 @@ test.describe('1. Correct record - 1', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts index 9d717f130..b6bef5121 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -31,24 +31,24 @@ test.describe.serial('Correct record - 2', () => { const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } const updatedChildDetails = { @@ -56,11 +56,11 @@ test.describe.serial('Correct record - 2', () => { birthLocation: { province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -76,8 +76,8 @@ test.describe.serial('Correct record - 2', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -87,12 +87,12 @@ test.describe.serial('Correct record - 2', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings 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 e91bbbb93..5bb865e77 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts @@ -12,7 +12,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -29,21 +29,21 @@ test.describe.serial(' Correct record - 3', () => { let page: Page const updatedMotherDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), age: random(20, 45), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -53,11 +53,11 @@ test.describe.serial(' Correct record - 3', () => { birthLocation: { province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -73,8 +73,8 @@ test.describe.serial(' Correct record - 3', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -84,12 +84,12 @@ test.describe.serial(' Correct record - 3', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts index 86e339be2..2473e4412 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts @@ -14,7 +14,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -31,24 +31,24 @@ test.describe.serial(' Correct record - 4', () => { let page: Page const updatedFatherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -71,8 +71,8 @@ test.describe.serial(' Correct record - 4', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male', placeOfBirth: 'Residential address', birthLocation: { @@ -87,12 +87,12 @@ test.describe.serial(' Correct record - 4', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts index 65a7cd968..0a138ade7 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { BirthDetails, ConvertEnumsToStrings, @@ -30,8 +30,8 @@ test.describe.serial(' Correct record - 5', () => { let page: Page const updatedChildDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', birthDate: format( subDays(new Date(), Math.ceil(10 * Math.random())), @@ -41,11 +41,11 @@ test.describe.serial(' Correct record - 5', () => { birthLocation: { state: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, attendantAtBirth: 'Nurse', typeOfBirth: 'Twin', @@ -65,8 +65,8 @@ test.describe.serial(' Correct record - 5', () => { let token = await getToken('k.mweene', 'test') declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male', placeOfBirth: 'Residential address', birthLocation: { @@ -81,12 +81,12 @@ test.describe.serial(' Correct record - 5', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts index 01d1c2b9b..8efaba603 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 6', () => { let page: Page const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -61,8 +61,8 @@ test.describe.serial(' Correct record - 6', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -72,12 +72,12 @@ test.describe.serial(' Correct record - 6', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings 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 3cbb2f0c5..fc5b1d52f 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -30,21 +30,21 @@ test.describe.serial(' Correct record - 7', () => { let page: Page const updatedMotherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), age: random(20, 45), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -62,8 +62,8 @@ test.describe.serial(' Correct record - 7', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -73,12 +73,12 @@ test.describe.serial(' Correct record - 7', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts index 24eb14351..bc6718b4d 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 8', () => { let page: Page const updatedFatherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -63,8 +63,8 @@ test.describe.serial(' Correct record - 8', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -74,12 +74,12 @@ test.describe.serial(' Correct record - 8', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts index c73b0d924..2e5d5ae7a 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 9', () => { let page: Page const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -61,8 +61,8 @@ test.describe.serial(' Correct record - 9', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -72,12 +72,12 @@ test.describe.serial(' Correct record - 9', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings 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 0f2ac71a5..c19be363a 100644 --- a/e2e/testcases/correction-death/correct-death-record-10.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-10.spec.ts @@ -15,7 +15,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, parseISO } from 'date-fns' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { DeathDeclaration } from '../death/types' @@ -27,21 +27,21 @@ test.describe('10. Correct record - 10', () => { let trackingId = '' const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3' diff --git a/e2e/testcases/correction-death/correct-death-record-12.spec.ts b/e2e/testcases/correction-death/correct-death-record-12.spec.ts index 2c2ca8048..6615b3ebd 100644 --- a/e2e/testcases/correction-death/correct-death-record-12.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-12.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, parseISO, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { @@ -31,26 +31,26 @@ test.describe.serial(' Correct record - 12', () => { const updatedInformantDetails = { type: 'Son', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, country: 'Farajaland', province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -59,11 +59,11 @@ test.describe.serial(' Correct record - 12', () => { deathLocation: { province: 'Chuminga', district: 'Soka', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-13.spec.ts b/e2e/testcases/correction-death/correct-death-record-13.spec.ts index 7cd487ef5..478a46bfe 100644 --- a/e2e/testcases/correction-death/correct-death-record-13.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-13.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { @@ -33,25 +33,25 @@ test.describe.serial(' Correct record - 13', () => { let declarationInput: DeathDeclarationInput const updatedSpouseDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } 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 365bfd748..0c1fab52d 100644 --- a/e2e/testcases/correction-death/correct-death-record-14.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-14.spec.ts @@ -12,7 +12,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' @@ -24,21 +24,21 @@ test.describe.serial(' Correct record - 14', () => { let page: Page const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3', diff --git a/e2e/testcases/correction-death/correct-death-record-16.spec.ts b/e2e/testcases/correction-death/correct-death-record-16.spec.ts index 88f067d93..bcfe6657c 100644 --- a/e2e/testcases/correction-death/correct-death-record-16.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-16.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' @@ -26,26 +26,26 @@ test.describe.serial(' Correct record - 16', () => { let page: Page const updatedInformantDetails = { type: 'Son', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, country: 'Farajaland', province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-17.spec.ts b/e2e/testcases/correction-death/correct-death-record-17.spec.ts index b918e4e3a..f52ae1300 100644 --- a/e2e/testcases/correction-death/correct-death-record-17.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-17.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' @@ -24,25 +24,25 @@ test.describe.serial(' Correct record - 17', () => { let page: Page const updatedSpouseDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } 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 e2323638c..aa0747a73 100644 --- a/e2e/testcases/correction-death/correct-death-record-18.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-18.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' @@ -23,21 +23,21 @@ test.describe.serial(' Correct record - 18', () => { let page: Page const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3' 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 49f4f66c6..0d1899859 100644 --- a/e2e/testcases/death/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/death/8-validate-declaration-review-page.spec.ts @@ -13,7 +13,7 @@ import { getAction, assignRecord } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe.serial('8. Validate declaration review page', () => { @@ -21,14 +21,14 @@ test.describe.serial('8. Validate declaration review page', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(75, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -49,13 +49,13 @@ test.describe.serial('8. Validate declaration review page', () => { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -364,8 +364,8 @@ test.describe.serial('8. Validate declaration review page', () => { .getByText('Change') .click() declaration.deceased.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -448,7 +448,7 @@ test.describe.serial('8. Validate declaration review page', () => { }) test("8.1.2.5 Change deceased's ID", async () => { await page.locator('#deceased-content #ID').getByText('Change').click() - declaration.deceased.identifier.id = faker.random.numeric(10) + declaration.deceased.identifier.id = faker.string.numeric(10) await page .locator('#deceasedPassport') .fill(declaration.deceased.identifier.id) @@ -530,8 +530,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.9 Change spouse's name", async () => { await page.locator('#spouse-content #Full').getByText('Change').click() - declaration.spouse.name.firstNames = faker.name.firstName('female') - declaration.spouse.name.familyName = faker.name.lastName('female') + declaration.spouse.name.firstNames = faker.person.firstName('female') + declaration.spouse.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.spouse.name.firstNames) @@ -602,7 +602,7 @@ test.describe.serial('8. Validate declaration review page', () => { }) test("8.1.2.13 Change spouse's ID", async () => { await page.locator('#spouse-content #ID').getByText('Change').click() - declaration.spouse.identifier.id = faker.random.numeric(10) + declaration.spouse.identifier.id = faker.string.numeric(10) await page .locator('#spousePassport') .fill(declaration.spouse.identifier.id) @@ -897,8 +897,8 @@ test.describe.serial('8. Validate declaration review page', () => { await page.getByRole('button', { name: 'Continue' }).click() declaration.deceased.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -986,7 +986,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.5 Change deceased's ID", async () => { await page.locator('#deceased-content #ID').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.deceased.identifier.id = faker.random.numeric(10) + declaration.deceased.identifier.id = faker.string.numeric(10) await page .locator('#deceasedBirthRegistrationNumber') .fill(declaration.deceased.identifier.id) @@ -1075,8 +1075,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.9 Change spouse's name", async () => { await page.locator('#spouse-content #Full').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.spouse.name.firstNames = faker.name.firstName('female') - declaration.spouse.name.familyName = faker.name.lastName('female') + declaration.spouse.name.firstNames = faker.person.firstName('female') + declaration.spouse.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.spouse.name.firstNames) @@ -1151,7 +1151,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.13 Change spouse's ID", async () => { await page.locator('#spouse-content #ID').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.spouse.identifier.id = faker.random.numeric(10) + declaration.spouse.identifier.id = faker.string.numeric(10) await page .locator('#spouseBirthRegistrationNumber') .fill(declaration.spouse.identifier.id) diff --git a/e2e/testcases/death/declaration/death-declaration-1.spec.ts b/e2e/testcases/death/declaration/death-declaration-1.spec.ts index 579ba5738..d60e9af5e 100644 --- a/e2e/testcases/death/declaration/death-declaration-1.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-1.spec.ts @@ -12,7 +12,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('1. Death declaration case - 1', () => { @@ -20,14 +20,14 @@ test.describe.serial('1. Death declaration case - 1', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(75, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, maritalStatus: 'Single', @@ -37,11 +37,11 @@ test.describe.serial('1. Death declaration case - 1', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('1. Death declaration case - 1', () => { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { diff --git a/e2e/testcases/death/declaration/death-declaration-11.spec.ts b/e2e/testcases/death/declaration/death-declaration-11.spec.ts index 0b069303c..0a58b121e 100644 --- a/e2e/testcases/death/declaration/death-declaration-11.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-11.spec.ts @@ -14,7 +14,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('11. Death declaration case - 11', () => { @@ -22,26 +22,26 @@ test.describe.serial('11. Death declaration case - 11', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Unknown', age: 45, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -58,14 +58,14 @@ test.describe.serial('11. Death declaration case - 11', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 17, birthDate: getRandomDate(5, 200), nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -74,22 +74,22 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -98,7 +98,7 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } @@ -619,8 +619,8 @@ test.describe.serial('11. Death declaration case - 11', () => { .getByText('Change') .click() declaration.informant.name = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') } expect(page.url().includes('informant')).toBeTruthy() await page @@ -689,7 +689,7 @@ test.describe.serial('11. Death declaration case - 11', () => { test("11.1.7.4 Change informant's ID", async () => { await page.locator('#informant-content #ID').getByText('Change').click() expect(page.url().includes('informant')).toBeTruthy() - declaration.informant.identifier.id = faker.random.numeric(10) + declaration.informant.identifier.id = faker.string.numeric(10) await page .locator('#informantBirthRegistrationNumber') .fill(declaration.informant.identifier.id) @@ -713,11 +713,11 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Sulaka', district: 'Afue', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } await page.locator('#statePrimaryInformant').click() await page diff --git a/e2e/testcases/death/declaration/death-declaration-2.spec.ts b/e2e/testcases/death/declaration/death-declaration-2.spec.ts index 5e080faf9..e952d8a36 100644 --- a/e2e/testcases/death/declaration/death-declaration-2.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-2.spec.ts @@ -14,7 +14,7 @@ import { login, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('2. Death declaration case - 2', () => { @@ -22,14 +22,14 @@ test.describe.serial('2. Death declaration case - 2', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', age: 65, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, maritalStatus: 'Married', @@ -38,7 +38,7 @@ test.describe.serial('2. Death declaration case - 2', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, event: { @@ -55,13 +55,13 @@ test.describe.serial('2. Death declaration case - 2', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -70,13 +70,13 @@ test.describe.serial('2. Death declaration case - 2', () => { }, spouse: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 68, nationality: 'Canada', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -85,11 +85,11 @@ test.describe.serial('2. Death declaration case - 2', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-3.spec.ts b/e2e/testcases/death/declaration/death-declaration-3.spec.ts index 888e60ff5..6ab35d4d6 100644 --- a/e2e/testcases/death/declaration/death-declaration-3.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-3.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('3. Death declaration case - 3', () => { @@ -21,26 +21,26 @@ test.describe.serial('3. Death declaration case - 3', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + ' the 2nd', - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male') + ' the 2nd', + familyName: faker.person.lastName('male') }, gender: 'Unknown', age: 45, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('3. Death declaration case - 3', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -72,22 +72,22 @@ test.describe.serial('3. Death declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -96,7 +96,7 @@ test.describe.serial('3. Death declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-4.spec.ts b/e2e/testcases/death/declaration/death-declaration-4.spec.ts index 8bfa9338f..210f5910c 100644 --- a/e2e/testcases/death/declaration/death-declaration-4.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-4.spec.ts @@ -14,7 +14,7 @@ import { login, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('4. Death declaration case - 4', () => { @@ -22,8 +22,8 @@ test.describe.serial('4. Death declaration case - 4', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + '_Nolas', - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + '_Nolas', + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -34,13 +34,13 @@ test.describe.serial('4. Death declaration case - 4', () => { maritalStatus: 'Divorced', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('4. Death declaration case - 4', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -72,13 +72,13 @@ test.describe.serial('4. Death declaration case - 4', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', @@ -88,13 +88,13 @@ test.describe.serial('4. Death declaration case - 4', () => { address: { sameAsDeceased: false, country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-5.spec.ts b/e2e/testcases/death/declaration/death-declaration-5.spec.ts index 43bbf9bca..37a5a621d 100644 --- a/e2e/testcases/death/declaration/death-declaration-5.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-5.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('5. Death declaration case - 5', () => { @@ -21,8 +21,8 @@ test.describe.serial('5. Death declaration case - 5', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + '-Peter', - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + '-Peter', + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -33,13 +33,13 @@ test.describe.serial('5. Death declaration case - 5', () => { maritalStatus: 'Separated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -54,19 +54,19 @@ test.describe.serial('5. Death declaration case - 5', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, informantType: 'Daughter in law', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -76,13 +76,13 @@ test.describe.serial('5. Death declaration case - 5', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-6.spec.ts b/e2e/testcases/death/declaration/death-declaration-6.spec.ts index 6257fb992..2d5a90646 100644 --- a/e2e/testcases/death/declaration/death-declaration-6.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-6.spec.ts @@ -14,7 +14,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('6. Death declaration case - 6', () => { @@ -22,8 +22,8 @@ test.describe.serial('6. Death declaration case - 6', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + " O'Nila", - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + " O'Nila", + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -34,13 +34,13 @@ test.describe.serial('6. Death declaration case - 6', () => { maritalStatus: 'Not stated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -55,15 +55,15 @@ test.describe.serial('6. Death declaration case - 6', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, informantType: 'Mother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -73,13 +73,13 @@ test.describe.serial('6. Death declaration case - 6', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-7.spec.ts b/e2e/testcases/death/declaration/death-declaration-7.spec.ts index f4433803a..f1eb7d7a8 100644 --- a/e2e/testcases/death/declaration/death-declaration-7.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-7.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('7. Death declaration case - 7', () => { @@ -21,8 +21,8 @@ test.describe.serial('7. Death declaration case - 7', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -33,13 +33,13 @@ test.describe.serial('7. Death declaration case - 7', () => { maritalStatus: 'Not stated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -51,21 +51,21 @@ test.describe.serial('7. Death declaration case - 7', () => { place: 'Other', deathLocation: { country: 'Germany', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, informantType: 'Father', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -75,13 +75,13 @@ test.describe.serial('7. Death declaration case - 7', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-8.spec.ts b/e2e/testcases/death/declaration/death-declaration-8.spec.ts index 3e7bf135d..62457236c 100644 --- a/e2e/testcases/death/declaration/death-declaration-8.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-8.spec.ts @@ -10,7 +10,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('8. Death declaration case - 8', () => { @@ -19,8 +19,8 @@ test.describe.serial('8. Death declaration case - 8', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, address: { country: 'Farajaland', diff --git a/e2e/testcases/death/declaration/death-declaration-9.spec.ts b/e2e/testcases/death/declaration/death-declaration-9.spec.ts index de71a3e76..e41bbe485 100644 --- a/e2e/testcases/death/declaration/death-declaration-9.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-9.spec.ts @@ -10,7 +10,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('9. Death declaration case - 9', () => { @@ -19,7 +19,7 @@ test.describe.serial('9. Death declaration case - 9', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + firstNames: faker.person.firstName('male') }, address: { country: 'Farajaland', diff --git a/e2e/testcases/death/helpers.ts b/e2e/testcases/death/helpers.ts index 13e532551..806b6855e 100644 --- a/e2e/testcases/death/helpers.ts +++ b/e2e/testcases/death/helpers.ts @@ -1,6 +1,6 @@ import { GATEWAY_HOST } from '../../constants' import { DeathRegistrationInput } from '../../gateway' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { readFileSync } from 'fs' import uuid from 'uuid' @@ -15,6 +15,7 @@ import { GET_DEATH_REGISTRATION_FOR_REVIEW } from './queries' import { random } from 'lodash' +import fetch from 'node-fetch' export type DeathDeclarationInput = { deceased?: { @@ -35,26 +36,26 @@ export type DeathDeclarationInput = { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + generateRandomSuffix(), - familyName: faker.name.lastName('male') + generateRandomSuffix() + firstNames: faker.person.firstName('male') + generateRandomSuffix(), + familyName: faker.person.lastName('male') + generateRandomSuffix() }, gender: 'male', age: random(50, 100), nationality: 'FAR', identifier: { type: 'NATIONAL_ID', - id: faker.random.numeric(10) + id: faker.string.numeric(10) }, address: { country: 'FAR', province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county() + generateRandomSuffix(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county() + generateRandomSuffix(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -70,13 +71,13 @@ const declaration = { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' }, address: { diff --git a/package.json b/package.json index e9ed98521..6cbdf3c4f 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,13 @@ "@playwright/test": "^1.48.0", "@types/google-libphonenumber": "^7.4.23", "@types/handlebars": "^4.1.0", + "@types/hapi__h2o2": "8.3.3", "@types/hapi__inert": "5.2.1", "@types/inquirer": "^9.0.7", "@types/libsodium-wrappers": "^0.7.10", "@types/minimist": "^1.2.5", "@types/prompts": "^2.4.9", "@types/react-intl": "^3.0.0", - "@types/hapi__h2o2": "8.3.3", "@typescript-eslint/eslint-plugin": "^5.60.1", "@typescript-eslint/parser": "^5.60.1", "eslint": "^8.43.0", @@ -71,7 +71,7 @@ "vitest": "^2.1.2" }, "dependencies": { - "@faker-js/faker": "^7.6.0", + "@faker-js/faker": "^9.3.0", "@hapi/boom": "^9.1.1", "@hapi/h2o2": "^9.1.0", "@hapi/hapi": "^20.0.1", @@ -90,6 +90,7 @@ "@types/node": "^10.12.5", "@types/node-fetch": "^2.6.2", "@types/nodemailer": "^6.4.14", + "@types/uuid": "^10.0.0", "app-module-path": "^2.2.0", "chalk": "^2.4.1", "country-data": "^0.0.31", diff --git a/src/data-generator/address.ts b/src/data-generator/address.ts index c5225e910..981d916f9 100644 --- a/src/data-generator/address.ts +++ b/src/data-generator/address.ts @@ -6,12 +6,12 @@ export function createAddressInput(location: Location, type: string) { country: 'FAR', state: location.partOf.split('/')[1], district: location.id, - city: faker.address.city(), - postalCode: faker.address.zipCode(), + city: faker.location.city(), + postalCode: faker.location.zipCode(), type, line: [ - faker.address.streetAddress(), - faker.address.zipCode(), + faker.location.streetAddress(), + faker.location.zipCode(), 'URBAN', '', '', diff --git a/src/data-generator/declare.ts b/src/data-generator/declare.ts index 2565d342e..92670b8bf 100644 --- a/src/data-generator/declare.ts +++ b/src/data-generator/declare.ts @@ -76,9 +76,9 @@ export async function sendBirthNotification( district: Location, office: Facility ): Promise { - const lastName = faker.name.lastName() - const firstName = faker.name.firstName() - const motherFirstName = faker.name.firstName('female') + const lastName = faker.person.lastName() + const firstName = faker.person.firstName() + const motherFirstName = faker.person.firstName('female') const requestStart = Date.now() const notification = birthNotification({ @@ -89,36 +89,35 @@ export async function sendBirthNotification( gender: sex }, father: { - firstName: faker.name.firstName('male'), + firstName: faker.person.firstName('male'), lastName, - nid: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) - .toString(), + nid: faker.number.bigInt({ min: 1000000000, max: 9999999999 }).toString(), dateOfBirth: sub(birthDate, { years: 20 }).toISOString().split('T')[0] }, mother: { firstName: motherFirstName, lastName, dateOfBirth: sub(birthDate, { years: 20 }).toISOString().split('T')[0], - nid: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) - .toString() + nid: faker.number.bigInt({ min: 1000000000, max: 9999999999 }).toString() }, createdAt: createdAt.toISOString(), address: [ { type: 'PRIMARY_ADDRESS', line: ['12', 'Usual Street', 'Usual Residental Area', '', '', 'URBAN'], - city: faker.address.city(), + city: faker.location.city(), district: district.id, state: district.partOf.split('/')[1], - postalCode: faker.address.zipCode(), + postalCode: faker.location.zipCode(), country: 'FAR' } ], phoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - email: faker.internet.email(motherFirstName, lastName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + email: faker.internet.email({ + firstName: motherFirstName, + lastName: lastName + }), dateOfBirth: birthDate.toISOString().split('T')[0], placeOfBirth: `Location/${facility.id}`, officeLocation: office.partOf, @@ -169,9 +168,9 @@ export function createBirthDeclarationData( base64Attachment: string ): BirthRegistrationInput { const timeFilling = Math.round(100000 + Math.random() * 100000) // 100 - 200 seconds - const familyName = faker.name.lastName() - const firstNames = faker.name.firstName() - const motherFirstName = faker.name.firstName('female') + const familyName = faker.person.lastName() + const firstNames = faker.person.firstName() + const motherFirstName = faker.person.firstName('female') const isLateRegistration = differenceInDays(new Date(), birthDate) > 365 const mother: PersonInput = { @@ -181,8 +180,8 @@ export function createBirthDeclarationData( dateOfMarriage: sub(birthDate, { years: 2 }).toISOString().split('T')[0], identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId } @@ -208,8 +207,11 @@ export function createBirthDeclarationData( informantType: informant.mother, otherInformantType: '', contactPhoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - contactEmail: faker.internet.email(motherFirstName, familyName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + email: faker.internet.email({ + firstName: motherFirstName, + lastName: familyName + }), status: [ { timestamp: sub(declarationTime, { @@ -218,7 +220,7 @@ export function createBirthDeclarationData( timeLoggedMS: timeFilling * 1000 } ], - draftId: faker.datatype.uuid(), + draftId: faker.string.uuid(), attachments: faker.helpers .arrayElements(BIRTH_ATTACHMENTS, NUMBER_OF_ATTACHMENTS_PER_RECORD) .map((attachment) => ({ @@ -268,11 +270,11 @@ export function createBirthDeclarationData( country: 'FAR', state: location.partOf.replace('Location/', ''), district: location.id, - city: faker.address.city(), - postalCode: faker.address.zipCode(), + city: faker.location.city(), + postalCode: faker.location.zipCode(), line: [ - faker.address.streetAddress(), - faker.address.zipCode(), + faker.location.streetAddress(), + faker.location.zipCode(), 'URBAN' ] }, @@ -357,9 +359,9 @@ export async function createDeathDeclaration( facility: Facility, base64Attachment: string ) { - const familyName = faker.name.lastName() - const firstNames = faker.name.firstName() - const spouseFirstName = faker.name.firstName() + const familyName = faker.person.lastName() + const firstNames = faker.person.firstName() + const spouseFirstName = faker.person.firstName() const requestStart = Date.now() @@ -374,8 +376,11 @@ export async function createDeathDeclaration( registration: { informantType: 'SPOUSE', contactPhoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - contactEmail: faker.internet.email(spouseFirstName, familyName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + contactEmail: faker.internet.email({ + firstName: spouseFirstName, + lastName: familyName + }), attachments: faker.helpers .arrayElements(DEATH_ATTACHMENTS, NUMBER_OF_ATTACHMENTS_PER_RECORD) .map((attachment) => ({ @@ -383,7 +388,7 @@ export async function createDeathDeclaration( contentType: 'image/png', data: 'data:image/png;base64,' + base64Attachment })), - draftId: faker.datatype.uuid(), + draftId: faker.string.uuid(), status: [ { timestamp: sub(declarationTime, { @@ -398,14 +403,14 @@ export async function createDeathDeclaration( deceased: { identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId }, { - id: faker.datatype - .number({ min: 100000000, max: 999999999 }) + id: faker.number + .bigInt({ min: 100000000, max: 999999999 }) .toString(), type: identity.socialSecurityNumber } @@ -454,8 +459,8 @@ export async function createDeathDeclaration( nationality: ['FAR'], identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId } diff --git a/src/data-generator/users.ts b/src/data-generator/users.ts index 59c7b093f..84304794b 100644 --- a/src/data-generator/users.ts +++ b/src/data-generator/users.ts @@ -81,8 +81,8 @@ export async function createUser( phoneNumberRegex: string, overrides: Record ) { - const firstName = faker.name.firstName() - const familyName = faker.name.lastName() + const firstName = faker.person.firstName() + const familyName = faker.person.lastName() log('Creating user', firstName, familyName, overrides) const phoneNumberExpander = expand(phoneNumberRegex) @@ -100,15 +100,15 @@ export async function createUser( identifier: [ { system: 'NATIONAL_ID', - value: faker.datatype - .number({ min: 100000000, max: 999999999 }) + value: faker.number + .bigInt({ min: 100000000, max: 999999999 }) .toString() } ], username: firstName.toLocaleLowerCase() + '.' + familyName.toLocaleLowerCase(), mobile: convertToMSISDN(generatedPhoneNumber, countryAlpha3), - email: faker.internet.email(undefined, undefined, 'example.com'), + email: faker.internet.email({ provider: 'example.com' }), primaryOffice: primaryOfficeId, ...overrides } diff --git a/tsconfig.json b/tsconfig.json index 955714f93..beba0ad94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "sourceMap": true, "moduleResolution": "node16", "rootDir": ".", - "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022"], + "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022", "dom"], "forceConsistentCasingInFileNames": true, "esModuleInterop": true, "noImplicitReturns": true, @@ -18,9 +18,15 @@ "noImplicitAny": true, "skipLibCheck": true, "strictNullChecks": true, - "types": ["jest", "fhir", "geojson"] + "types": ["jest", "fhir", "geojson"], + "resolveJsonModule": true }, - "include": ["src/**/*.ts", "infrastructure/environments/**/*.ts", "typings"], + "include": [ + "src/**/*.ts", + "infrastructure/environments/**/*.ts", + "typings", + "e2e/**/*.ts" + ], "exclude": [ "node_modules", "build", diff --git a/yarn.lock b/yarn.lock index 39488e3e8..816461e95 100644 --- a/yarn.lock +++ b/yarn.lock @@ -732,10 +732,10 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@faker-js/faker@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07" - integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw== +"@faker-js/faker@^9.3.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-9.3.0.tgz#ef398dab34c67faaa0e348318c905eae3564fa58" + integrity sha512-r0tJ3ZOkMd9xsu3VRfqlFR6cz0V/jFYRswAIpC+m/DIfAUXq7g8N7wTAlhSANySXYGKzGryfDXwtwsY8TxEIDw== "@formatjs/ecma402-abstract@2.2.3": version "2.2.3" @@ -2324,6 +2324,11 @@ dependencies: "@types/node" "*" +"@types/uuid@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-10.0.0.tgz#e9c07fe50da0f53dc24970cca94d619ff03f6f6d" + integrity sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ== + "@types/wrap-ansi@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd"