From 86282e1dbb77e69fa5c4f0a8504ba8de1550497d Mon Sep 17 00:00:00 2001 From: Skyler Date: Tue, 16 Jul 2024 12:54:50 -0700 Subject: [PATCH] migrate cypress tests over to cypress folder --- jha/cypress/e2e/.eslintrc.js | 12 + jha/cypress/e2e/FPC.cy.js | 48 +++ jha/cypress/e2e/MSP.cy.js | 44 +++ jha/cypress/e2e/SB.cy.js | 48 +++ jha/cypress/e2e/fullApplication.cy.js | 52 +++ .../e2e/fullApplicationValidations.cy.js | 69 ++++ jha/cypress/fixtures/fpcStandaloneRequest.js | 62 ++++ jha/cypress/fixtures/fullApplication.js | 238 +++++++++++++ jha/cypress/fixtures/mspStandaloneRequest.js | 203 +++++++++++ jha/cypress/fixtures/sample.pdf | Bin 0 -> 2830 bytes jha/cypress/fixtures/sbStandaloneRequest.js | 109 ++++++ jha/cypress/support/commands.js | 331 ++++++++++++++++++ jha/cypress/support/e2e.js | 54 +++ jha/cypress/support/helpers.js | 32 ++ 14 files changed, 1302 insertions(+) create mode 100644 jha/cypress/e2e/.eslintrc.js create mode 100644 jha/cypress/e2e/FPC.cy.js create mode 100644 jha/cypress/e2e/MSP.cy.js create mode 100644 jha/cypress/e2e/SB.cy.js create mode 100644 jha/cypress/e2e/fullApplication.cy.js create mode 100644 jha/cypress/e2e/fullApplicationValidations.cy.js create mode 100644 jha/cypress/fixtures/fpcStandaloneRequest.js create mode 100644 jha/cypress/fixtures/fullApplication.js create mode 100644 jha/cypress/fixtures/mspStandaloneRequest.js create mode 100644 jha/cypress/fixtures/sample.pdf create mode 100644 jha/cypress/fixtures/sbStandaloneRequest.js create mode 100644 jha/cypress/support/commands.js create mode 100644 jha/cypress/support/e2e.js create mode 100644 jha/cypress/support/helpers.js diff --git a/jha/cypress/e2e/.eslintrc.js b/jha/cypress/e2e/.eslintrc.js new file mode 100644 index 00000000..72e6bbff --- /dev/null +++ b/jha/cypress/e2e/.eslintrc.js @@ -0,0 +1,12 @@ +module.exports = { + plugins: [ + 'cypress' + ], + env: { + mocha: true, + 'cypress/globals': true + }, + rules: { + strict: 'off' + } +} diff --git a/jha/cypress/e2e/FPC.cy.js b/jha/cypress/e2e/FPC.cy.js new file mode 100644 index 00000000..a6c6ebf3 --- /dev/null +++ b/jha/cypress/e2e/FPC.cy.js @@ -0,0 +1,48 @@ +import { generateRequestObject } from '../fixtures/fpcStandaloneRequest'; +import { removeUniqueFields } from '../support/helpers'; + +describe('FPC only application', () => { + const options = { includeFPC: true } + it('Fills eligibility questionnaire', () => { + cy.fillEligibilityQuestionnaire(options) + }) + + it('Accepts valid information for the personal-info page', () => { + cy.fillPersonalInfoPage(options) + }); + + it('Accepts valid information for the spouse page', () => { + cy.fillSpousePage(options) + }); + + it('Accepts valid information for the child page', () => { + cy.fillChildPage(options) + }) + + it('Accepts valid information for the FPC info page', () => { + cy.fillFPCInfoPage() + }) + + it('Accepts valid information for the contact info page', () => { + cy.fillMailingAddress() + }); + + it('Displays the phone number with contact information', () => { + cy.contains('(555) 555-5555') + cy.continue(); + }) + + it('Submits with the expected payload', () => { + cy.fillConsent(options); + cy.submitApplication(); + cy.wait('@submitApplication') + .then(interception => { + expect(removeUniqueFields(interception.request.body)).to.deep.equal(removeUniqueFields(generateRequestObject())) + }); + }); + + it('Redirects user to confirmation page when successful', () => { + cy.url().should('include', 'submission'); + cy.contains('Confirmation of submission') + }); +}); diff --git a/jha/cypress/e2e/MSP.cy.js b/jha/cypress/e2e/MSP.cy.js new file mode 100644 index 00000000..0bb1ef7a --- /dev/null +++ b/jha/cypress/e2e/MSP.cy.js @@ -0,0 +1,44 @@ +import { generateRequestObject } from '../fixtures/mspStandaloneRequest.js'; +import { removeUniqueFields } from '../support/helpers'; + +describe('MSP only application', () => { + const options = {includeMSP: true} + it('Fills eligibility questionnaire', () => { + cy.fillEligibilityQuestionnaire(options) + }); + + it('Accepts valid information for the personal-info page', () => { + cy.fillPersonalInfoPage(options) + }); + + it('Accepts valid information for the spouse page', () => { + cy.fillSpousePage(options) + }); + + it('Accepts valid information for the child page', () => { + cy.fillChildPage(options) + }); + + it('Accepts valid information for the contact info page', () => { + cy.fillResidentialAddress() + }); + + it('Displays the phone number with contact information', () => { + cy.contains('(555) 555-5555') + cy.continue(); + }); + + it('submits form with expected payload', () => { + cy.fillConsent(options) + cy.submitApplication() + cy.wait('@submitApplication') + .then(interception => { + expect(removeUniqueFields(interception.request.body)).to.deep.equal(removeUniqueFields(generateRequestObject())) + }) + }); + + it('Redirects user to confirmation page when successful', () => { + cy.url().should('include', 'submission'); + cy.contains('Confirmation of submission') + }); +}); diff --git a/jha/cypress/e2e/SB.cy.js b/jha/cypress/e2e/SB.cy.js new file mode 100644 index 00000000..f9108ab2 --- /dev/null +++ b/jha/cypress/e2e/SB.cy.js @@ -0,0 +1,48 @@ +import { generateRequestObject } from '../fixtures/sbStandaloneRequest.js'; +import { removeUniqueFields } from '../support/helpers'; + +describe('SB only application', () => { + const options = {includeSB: true} + it('Fills eligibility questionnaire', () => { + cy.fillEligibilityQuestionnaire(options) + }); + + it('Accepts valid information for the personal-info page', () => { + cy.fillPersonalInfoPage(options) + }); + + it('Accepts valid information for the spouse page', () => { + cy.fillSpousePage(options) + }); + + it('Accepts valid information for the supplemental benefits information page', () => { + cy.fillSBInfoPage(options) + }); + + it('Accepts valid information for the documents page', () => { + cy.fillDocumentsPage() + }); + + it('Accepts valid information for the contact info page', () => { + cy.fillMailingAddress() + }); + + it('Displays the phone number with contact information', () => { + cy.contains('(555) 555-5555') + cy.continue(); + }); + + it('submits form with expected payload', () => { + cy.fillConsent(options) + cy.submitApplication() + cy.wait('@submitApplication') + .then(interception => { + expect(removeUniqueFields(interception.request.body)).to.deep.equal(removeUniqueFields(generateRequestObject())) + }) + }); + + it('Redirects user to confirmation page when successful', () => { + cy.url().should('include', 'submission'); + cy.contains('Confirmation of submission') + }); +}); diff --git a/jha/cypress/e2e/fullApplication.cy.js b/jha/cypress/e2e/fullApplication.cy.js new file mode 100644 index 00000000..6209db2a --- /dev/null +++ b/jha/cypress/e2e/fullApplication.cy.js @@ -0,0 +1,52 @@ +import { generateRequestObject } from '../fixtures/fullApplication.js'; +import { removeUniqueFields } from '../support/helpers'; + +describe('Full application for MSP FPC and SB', () => { + const options = {includeMSP: true, includeFPC: false, includeSB: true} + it('Fills eligibility questionnaire', () => { + cy.fillEligibilityQuestionnaire(options) + }); + + it('Accepts valid information for the personal-info page', () => { + cy.fillPersonalInfoPage(options) + }); + + it('Accepts valid information for the spouse page', () => { + cy.fillSpousePage(options) + }); + + it('Accepts valid information for the child page', () => { + cy.fillChildPage(options) + }); + + it('Accepts valid information for the supplemental benefits information page', () => { + cy.fillSBInfoPage(options) + }); + + it('Accepts valid information for the documents page', () => { + cy.fillDocumentsPage() + }); + + it('Accepts valid information for the contact info page', () => { + cy.fillResidentialAddress() + }); + + it('Displays the phone number with contact information', () => { + cy.contains('(555) 555-5555') + cy.continue(); + }); + + it('submits form with expected payload', () => { + cy.fillConsent(options) + cy.submitApplication() + cy.wait('@submitApplication') + .then(interception => { + expect(removeUniqueFields(interception.request.body)).to.deep.equal(removeUniqueFields(generateRequestObject())) + }) + }); + + it('Redirects user to confirmation page when successful', () => { + cy.url().should('include', 'submission'); + cy.contains('Confirmation of submission') + }); +}); diff --git a/jha/cypress/e2e/fullApplicationValidations.cy.js b/jha/cypress/e2e/fullApplicationValidations.cy.js new file mode 100644 index 00000000..555fca0b --- /dev/null +++ b/jha/cypress/e2e/fullApplicationValidations.cy.js @@ -0,0 +1,69 @@ +// import { generateRequestObject } from '../fixtures/fullApplication.js'; +// import { removeUniqueFields } from '../helpers'; + +describe('Full application for MSP FPC and SB', () => { + // const options = {includeMSP: true, includeFPC: false, includeSB: true} + it('Navigates the MSP Elibility page', () => { + const eligibilityError = "Please complete the questionnaire to continue."; + cy.visit("/msp-eligibility"); + cy.location().should((loc) => { + expect(loc.pathname).to.eq("/ahdc/msp-eligibility"); + }); + cy.get("[data-cy=apply-msp-yes]").click({ + force: true, + }); + cy.get("[data-cy=continue]").click(); + cy.contains(eligibilityError); + cy.get("[data-cy=live-in-bc-no]").click({ + force: true, + }); + cy.contains("you may not be eligible for MSP or related income-based programs."); + }); + + // it('Fills eligibility questionnaire', () => { + // cy.fillEligibilityQuestionnaire(options) + // }); + + // it('Accepts valid information for the personal-info page', () => { + // cy.fillPersonalInfoPage(options) + // }); + + // it('Accepts valid information for the spouse page', () => { + // cy.fillSpousePage(options) + // }); + + // it('Accepts valid information for the child page', () => { + // cy.fillChildPage(options) + // }); + + // it('Accepts valid information for the supplemental benefits information page', () => { + // cy.fillSBInfoPage(options) + // }); + + // it('Accepts valid information for the documents page', () => { + // cy.fillDocumentsPage() + // }); + + // it('Accepts valid information for the contact info page', () => { + // cy.fillResidentialAddress() + // }); + + // it('Displays the phone number with contact information', () => { + // cy.contains('(555) 555-5555') + // cy.continue(); + // }); + + // it('submits form with expected payload', () => { + // cy.fillConsent(options) + // cy.submitApplication() + // cy.wait('@submitApplication') + // .then(interception => { + // expect(removeUniqueFields(interception.request.body)).to.deep.equal(removeUniqueFields(generateRequestObject())) + // }) + // }); + + // it('Redirects user to confirmation page when successful', () => { + // cy.url().should('include', 'submission'); + // cy.contains('Confirmation of submission') + // }); +}); diff --git a/jha/cypress/fixtures/fpcStandaloneRequest.js b/jha/cypress/fixtures/fpcStandaloneRequest.js new file mode 100644 index 00000000..602013cc --- /dev/null +++ b/jha/cypress/fixtures/fpcStandaloneRequest.js @@ -0,0 +1,62 @@ +import { formatISODate } from 'common-lib-vue'; + +export const generateRequestObject = () => { + const currentDate = new Date(); + + return { + "firstName": "alex", + "secondName": "jaimie", + "lastName": "doe", + "sin": "238795439", + "phn": "9999999998", + "gender": null, + "birthDate": "2000-01-01", + "telephone": "5555555555", + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada", + "authorizedByApplicant": "Y", + "powerOfAttorney": "N", + "spousePowerOfAttorney": "N", + "authorizedBySpouse": "Y", + "spouse": { + "firstName": "sarah", + "secondName": "jaimie", + "lastName": "doe", + "gender": null, + "birthDate": "1990-06-20", + "telephone": "5555555555", + "sin": "195544135", + "phn": "9348671676" + }, + "fairPharmaCare": { + "uuid": "1f630383-be09-4bbf-b980-a516ce6ffb6f", + "clientName": null, + "processDate": formatISODate(currentDate), + "accountHolderNetIncome": "20000", + "accountHolderRDSP": "2000", + "spouseNetIncome": "20000", + "spouseRDSP": "2000", + "spousePostalCode": "V8P1A1", + "persons": [ + { + "givenName": "ralph", + "surname": "wiggum", + "postalCode": "V8P1A1", + "perType": "2", + "dateOfBirth": "2019-02-01", + "phn": "9344507929" + } + ], + "attachments": [], + "familyNumber": null, + "deductibleAmount": null, + "annualMaximumAmount": null, + "copayPercentage": null + } + } +} \ No newline at end of file diff --git a/jha/cypress/fixtures/fullApplication.js b/jha/cypress/fixtures/fullApplication.js new file mode 100644 index 00000000..4285f445 --- /dev/null +++ b/jha/cypress/fixtures/fullApplication.js @@ -0,0 +1,238 @@ +import { formatISODate } from 'common-lib-vue'; + +export const generateRequestObject = () => { + const currentDate = new Date(); + const lastMonthDate = new Date(); + const lastYearDate = new Date(); + lastYearDate.setFullYear(currentDate.getFullYear() - 1); + lastMonthDate.setMonth(currentDate.getMonth() - 1); + + return { + "firstName": "alex", + "secondName": "jaimie", + "lastName": "doe", + "sin": "238795439", + "phn": null, + "gender": "X", + "birthDate": "2000-01-01", + "telephone": "5555555555", + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada", + "authorizedByApplicant": "Y", + "powerOfAttorney": "N", + "spousePowerOfAttorney": "N", + "authorizedBySpouse": "Y", + "spouse": { + "firstName": "sarah", + "secondName": "jaimie", + "lastName": "doe", + "gender": "X", + "birthDate": "1990-06-20", + "telephone": "5555555555", + "sin": "195544135", + "phn": null + }, + "medicalServicesPlan": { + "citizenshipType": "CanadianCitizen", + "hasPreviousCoverage": "Y", + "prevPHN": "9999999998", + "hasLivedInBC": null, + "prevHealthNumber": "111 111 1111", + "recentBCMoveDate": "2001-02-01", + "recentCanadaMoveDate": "2001-02-01", + "isPermanentMove": "Y", + "prevProvinceOrCountry": "Alberta", + "beenOutsideBCMoreThan": "Y", + "departureDate": formatISODate(lastMonthDate), + "returnDate": formatISODate(currentDate), + "familyMemberReason": "vacation", + "destination": "bahamas", + "isFullTimeStudent": "Y", + "isInBCafterStudies": "Y", + "armedDischargeDate": "2010-02-01", + "spouse": { + "citizenshipType": "PermanentResident", + "hasPreviousCoverage": "N", + "prevPHN": null, + "hasLivedInBC": null, + "prevHealthNumber": null, + "recentBCMoveDate": "2015-03-02", + "recentCanadaMoveDate": "2014-03-02", + "isPermanentMove": "Y", + "prevProvinceOrCountry": "Afghanistan", + "beenOutsideBCMoreThan": "N", + "departureDate": null, + "returnDate": null, + "familyMemberReason": null, + "destination": null, + "isFullTimeStudent": null, + "isInBCafterStudies": null, + "armedDischargeDate": null + }, + "children": [ + { + "firstName": "ralph", + "secondName": "j", + "lastName": "wiggum", + "gender": "M", + "birthDate": "2019-02-01", + "citizenshipType": "CanadianCitizen", + "hasPreviousCoverage": "N", + "prevPHN": null, + "hasLivedInBC": "Y", + "prevHealthNumber": null, + "recentBCMoveDate": null, + "recentCanadaMoveDate": null, + "isPermanentMove": "Y", + "prevProvinceOrCountry": null, + "beenOutsideBCMoreThan": "N", + "departureDate": null, + "returnDate": null, + "familyMemberReason": null, + "destination": null, + "isFullTimeStudent": null, + "isInBCafterStudies": null, + "armedDischargeDate": null + } + ], + "mailingAddress": { + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada" + }, + "attachments": [ + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "1", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "2", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "3", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "4", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "5", + "description": "Confirmation of Permanent Residence" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "6", + "description": "Confirmation of Permanent Residence" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "7", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "8", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "9", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "10", + "description": "Canadian birth certificate" + } + ] + }, + "supplementaryBenefits": { + "assistanceYear": formatISODate(currentDate.getFullYear()).toString(), + "taxYear": formatISODate(lastYearDate.getFullYear()).toString(), + "numberOfTaxYears": 0, + "adjustedNetIncome": 41100, + "childDeduction": 3000, + "deductions": 2900, + "disabilityDeduction": 3000, + "sixtyFiveDeduction": 0, + "totalDeductions": 12900, + "totalNetIncome": 54000, + "childCareExpense": 100, + "netIncomeLastYear": 50000, + "numChildren": 1, + "numDisabled": 1, + "spouseIncomeLine236": 4000, + "reportedUCCBenefit": 0, + "spouseDSPAmount": 1000, + "spouseDeduction": 3000, + "applicantAttendantCareExpense": 3000, + "spouseAttendantCareExpense": 0, + "childAttendantCareExpense": 0, + "spouseSixtyFiveDeduction": 0, + "attachments": [ + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "1", + "description": null + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "2", + "description": null + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "3", + "description": "Account holder NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "4", + "description": "Account holder NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "5", + "description": "Spouse NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentOrder": "6", + "description": "Spouse NOA/NOR" + } + ] + } + } +} \ No newline at end of file diff --git a/jha/cypress/fixtures/mspStandaloneRequest.js b/jha/cypress/fixtures/mspStandaloneRequest.js new file mode 100644 index 00000000..72e90277 --- /dev/null +++ b/jha/cypress/fixtures/mspStandaloneRequest.js @@ -0,0 +1,203 @@ +import { formatISODate } from 'common-lib-vue'; + +export const generateRequestObject = () => { + const currentDate = new Date(); + const lastMonthDate = new Date(); + lastMonthDate.setMonth(lastMonthDate.getMonth() - 1); + + return { + "uuid": "412d35d7-8446-4dfa-ac03-d19d3dd2ad03", + "firstName": "alex", + "secondName": "jaimie", + "lastName": "doe", + "sin": null, + "phn": null, + "gender": "X", + "birthDate": "2000-01-01", + "telephone": "5555555555", + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada", + "authorizedByApplicant": "Y", + "authorizedByApplicantDate": "2022-05-17", + "powerOfAttorney": "N", + "spousePowerOfAttorney": "N", + "authorizedBySpouse": "Y", + "spouse": { + "firstName": "sarah", + "secondName": "jaimie", + "lastName": "doe", + "gender": "X", + "birthDate": "1990-06-20", + "telephone": "5555555555", + "sin": null, + "phn": null + }, + "medicalServicesPlan": { + "uuid": "e744361d-335a-4fc8-8f6e-fedf9675a96b", + "citizenshipType": "CanadianCitizen", + "attachmentUuids": [ + "45c86f8d-9e64-4d9b-8326-85349a8080b1", + "c23e0467-8f6c-45ca-b797-4876fbd1843f", + "95d272ee-b5ce-45c2-8dfb-3b0979d86068", + "3984a7ec-7a20-46d1-bfb6-5c986d4bb052" + ], + "hasPreviousCoverage": "Y", + "prevPHN": "9999999998", + "hasLivedInBC": null, + "prevHealthNumber": "111 111 1111", + "recentBCMoveDate": "2001-02-01", + "recentCanadaMoveDate": "2001-02-01", + "isPermanentMove": "Y", + "prevProvinceOrCountry": "Alberta", + "beenOutsideBCMoreThan": "Y", + "departureDate": formatISODate(lastMonthDate), + "returnDate": formatISODate(currentDate), + "familyMemberReason": "vacation", + "destination": "bahamas", + "isFullTimeStudent": "Y", + "isInBCafterStudies": "Y", + "armedDischargeDate": "2010-02-01", + "spouse": { + "citizenshipType": "PermanentResident", + "attachmentUuids": [ + "eedbf9ff-3970-4895-92d2-253dfd9cf767", + "976f4ab1-41e1-4e14-8efc-847b34392db4", + "65ba6bd8-11af-462b-8eb5-6259c0d368d4", + "cc0d7067-c495-434f-aa35-d066af2053f5" + ], + "hasPreviousCoverage": "N", + "prevPHN": null, + "hasLivedInBC": null, + "prevHealthNumber": null, + "recentBCMoveDate": "2015-03-02", + "recentCanadaMoveDate": "2014-03-02", + "isPermanentMove": "Y", + "prevProvinceOrCountry": "Afghanistan", + "beenOutsideBCMoreThan": "N", + "departureDate": null, + "returnDate": null, + "familyMemberReason": null, + "destination": null, + "isFullTimeStudent": null, + "isInBCafterStudies": null, + "armedDischargeDate": null + }, + "children": [ + { + "firstName": "ralph", + "secondName": "j", + "lastName": "wiggum", + "gender": "M", + "birthDate": "2019-02-01", + "citizenshipType": "CanadianCitizen", + "attachmentUuids": [ + "4c502613-0298-4f48-a9aa-23831038e247", + "033350b3-3ff8-483f-9095-aab0af58f44c" + ], + "hasPreviousCoverage": "N", + "prevPHN": null, + "hasLivedInBC": "Y", + "prevHealthNumber": null, + "recentBCMoveDate": null, + "recentCanadaMoveDate": null, + "isPermanentMove": "Y", + "prevProvinceOrCountry": null, + "beenOutsideBCMoreThan": "N", + "departureDate": null, + "returnDate": null, + "familyMemberReason": null, + "destination": null, + "isFullTimeStudent": null, + "isInBCafterStudies": null, + "armedDischargeDate": null + } + ], + "mailingAddress": { + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada" + }, + "attachments": [ + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "95d272ee-b5ce-45c2-8dfb-3b0979d86068", + "attachmentOrder": "1", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "3984a7ec-7a20-46d1-bfb6-5c986d4bb052", + "attachmentOrder": "2", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "45c86f8d-9e64-4d9b-8326-85349a8080b1", + "attachmentOrder": "3", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "c23e0467-8f6c-45ca-b797-4876fbd1843f", + "attachmentOrder": "4", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "65ba6bd8-11af-462b-8eb5-6259c0d368d4", + "attachmentOrder": "5", + "description": "Confirmation of Permanent Residence" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "cc0d7067-c495-434f-aa35-d066af2053f5", + "attachmentOrder": "6", + "description": "Confirmation of Permanent Residence" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "eedbf9ff-3970-4895-92d2-253dfd9cf767", + "attachmentOrder": "7", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "976f4ab1-41e1-4e14-8efc-847b34392db4", + "attachmentOrder": "8", + "description": "Marriage certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "4c502613-0298-4f48-a9aa-23831038e247", + "attachmentOrder": "9", + "description": "Canadian birth certificate" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "033350b3-3ff8-483f-9095-aab0af58f44c", + "attachmentOrder": "10", + "description": "Canadian birth certificate" + } + ] + } + } +} \ No newline at end of file diff --git a/jha/cypress/fixtures/sample.pdf b/jha/cypress/fixtures/sample.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c0e31a076aeb1fa7729e82279943b3504f85338d GIT binary patch literal 2830 zcmd5;-EP}96u#$EoSOg%kdhLuKNm%TIEk^XOA{o|$l$1urA7}G%`-gh0z#{u*ztl%QS<`8GX}hHVSC$ z1#7bpRcRqJ1yrR3rNPc6{H6+9i5xEEbS|`-mS8Ju3MKNA!i6a$Sovfroahu5ZrYbf z$Y~t%wa1;kubKAQ=Lt=Mwosd>USoNma-T;(qRBA&Rz@Q%n4TTOSNCnzYHw71F1>&b zgZ9|!vhOwZ>eU{fA-OMc`Th4>8p!8gxnC!_O6sp|_(!9j!4 zl}rI2*Anp(v6E8TCW$z)#(@?w9K8J>pe)8XYW!;hbAlZxi{j`%A=xgD@m>JvAQ{$i zx+!l~m_<`ypTcJZ@b7hZF-aPQ?eXuN^uL?7r@s%cJHXn!ip%*i%*_h!Ycv4+yhKny zkVPObZIxvdMwJC^EQqpI!qH0D>D+1dx$Ge8QYh?=Y4Q9TxY=LlKA(X{v8k=GuYoxV zbzeBf?vyKQu?=mRpI}SD+lY(UFY12dGL(5vH|f26Pp*%X)OVnw6y0RN{t@%`%+H zQq6RUYqc%x-Dko|I6QmHJumVG9`X#H@aSkehNnViNHu()I11Bz5QX6&1eC8oAFJX% z&>PVZ8B|x~2Z#q<5$8z!x}w1llkSN8@P(Eiz0l$T-}T6Y5TUVSi-*XhS`k48gS4fn tdFze(DqWWB+Te?Dj27AI&pI>6zUm3`FC<{1uysXv><8rF;QVq-{svGq0pkDw literal 0 HcmV?d00001 diff --git a/jha/cypress/fixtures/sbStandaloneRequest.js b/jha/cypress/fixtures/sbStandaloneRequest.js new file mode 100644 index 00000000..21accce8 --- /dev/null +++ b/jha/cypress/fixtures/sbStandaloneRequest.js @@ -0,0 +1,109 @@ +import { formatISODate } from 'common-lib-vue'; + +export const generateRequestObject = () => { + const currentDate = new Date(); + const lastYearDate = new Date(); + lastYearDate.setFullYear(lastYearDate.getFullYear() - 1); + + return { + "firstName": "alex", + "secondName": "jaimie", + "lastName": "doe", + "sin": "238795439", + "phn": "9999999998", + "gender": null, + "birthDate": "2000-01-01", + "telephone": "5555555555", + "addressLine1": "123 fake st.", + "addressLine2": null, + "addressLine3": null, + "city": "duncan", + "postalCode": "V8P1A1", + "provinceOrState": "British Columbia", + "country": "Canada", + "authorizedByApplicant": "Y", + "authorizedByApplicantDate": new Date().toLocaleDateString(), + "powerOfAttorney": "N", + "spousePowerOfAttorney": "N", + "authorizedBySpouse": "Y", + "spouse": { + "firstName": "sarah", + "secondName": "jaimie", + "lastName": "doe", + "gender": null, + "birthDate": "1990-06-20", + "telephone": "5555555555", + "sin": "195544135", + "phn": "9348671676" + }, + "supplementaryBenefits": { + "uuid": "2412695f-3383-416d-90be-e0cfc3127058", + "assistanceYear": formatISODate(currentDate.getFullYear()).toString(), + "taxYear": formatISODate(lastYearDate.getFullYear()).toString(), + "numberOfTaxYears": 0, + "adjustedNetIncome": 8100, + "childDeduction": 36000, + "deductions": 35900, + "disabilityDeduction": 3000, + "sixtyFiveDeduction": 0, + "totalDeductions": 45900, + "totalNetIncome": 54000, + "childCareExpense": 100, + "netIncomeLastYear": 50000, + "numChildren": 12, + "numDisabled": 1, + "spouseIncomeLine236": 4000, + "reportedUCCBenefit": 0, + "spouseDSPAmount": 1000, + "spouseDeduction": 3000, + "applicantAttendantCareExpense": 3000, + "spouseAttendantCareExpense": 0, + "childAttendantCareExpense": 0, + "spouseSixtyFiveDeduction": 0, + "attachments": [ + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "40fdf359-c73d-4712-87d8-364deadc4200", + "attachmentOrder": "1", + "description": null + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "75b7c346-185d-4f4d-a256-90d11eb384b1", + "attachmentOrder": "2", + "description": null + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "aa8b2f14-9ec0-42b6-aafe-2ac11d43685d", + "attachmentOrder": "3", + "description": "Account holder NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "06c3011c-4133-4777-b70d-d34fa6da144e", + "attachmentOrder": "4", + "description": "Account holder NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "bb2eefb6-745d-404a-bc61-26663667d12b", + "attachmentOrder": "5", + "description": "Spouse NOA/NOR" + }, + { + "contentType": "IMAGE_JPEG", + "attachmentDocumentType": "SupportDocument", + "attachmentUuid": "fb72efca-9faf-4376-8830-a66df3199fd2", + "attachmentOrder": "6", + "description": "Spouse NOA/NOR" + } + ] + } + } +} \ No newline at end of file diff --git a/jha/cypress/support/commands.js b/jha/cypress/support/commands.js new file mode 100644 index 00000000..420113b3 --- /dev/null +++ b/jha/cypress/support/commands.js @@ -0,0 +1,331 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add("login", (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This is will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) + +import { padInteger } from './helpers'; +import { SupportDocumentTypes } from '../../src/constants/document-types'; +import { StatusInCanada } from '../../src/constants/immigration-status-types'; +// NOTE: using cy.fixture for the sample pdf multiple times has issues, using dir works better with selectFile +const samplePDF = 'cypress/fixtures/sample.pdf'; +const currentDate = new Date(); +const lastMonthDate = new Date(); +lastMonthDate.setMonth(currentDate.getMonth() - 1); + +const DOCUMENT_WAIT_TIME = 750; + + +Cypress.Commands.add('fillName', (firstName = 'alex', middleName = 'jaimie', lastName = 'doe') => { + cy.get('input#first-name').type(firstName); + cy.get('input#middle-name').type(middleName); + cy.get('input#last-name').type(lastName); +}); + +Cypress.Commands.add('fillIdFields', (phn = '9999999998', sin = '238795439') => { + cy.get('input#personal-health-number').type(phn) + cy.get('input#social-insurance-number').type(sin) +}) + +Cypress.Commands.add('continue', () => { + cy.get('div.continue-bar').contains('Continue').click() +}) + +Cypress.Commands.add("fillPersonalInfoPage", (options) => { + cy.fillName(); + + cy.get('select#birthdate-month').select('0'); + cy.get('input#birthdate-day').type('01'); + cy.get('input#birthdate-year').type('2000'); + + if (!options?.includeMSP) { + cy.fillIdFields(); + } else { + if (options.includeSB || options.includeFPC) { + cy.get('input#social-insurance-number').type('238795439') + } + cy.get('label[for=gender-x]').click(); + + cy.get('select#immigration-status').select(StatusInCanada.Citizen); + cy.get('label[for=-new-to-province]').click(); + cy.get('select#citizen-support-document-type').select(SupportDocumentTypes.CanadianBirthCertificate); + cy.get('label[for=gender-matches-no]').click(); + + cy.get('input#citizenship-support-documents').selectFile(samplePDF, { force: true }); + cy.get('label[for=name-change-yes]').click(); + + cy.get('select#name-change-doc-type').select(SupportDocumentTypes.MarriageCertificate); + cy.get('#name-change-support-documents').selectFile(samplePDF, { force: true }); + + cy.get('label[for=is-moved-to-bc-permanently-yes]').click(); + + cy.get('select#province-of-origin').select('Alberta'); + + cy.get('select#arrival-date-in-bc-month').select('1'); + cy.get('input#arrival-date-in-bc-day').type('01'); + cy.get('input#arrival-date-in-bc-year').type('2001'); + + cy.get('select#arrival-date-in-canada-month').select('1'); + cy.get('input#arrival-date-in-canada-day').type('01'); + cy.get('input#arrival-date-in-canada-year').type('2001'); + + cy.get('input#previous-health-number').type('111 111 1111'); + + cy.get('label[for=outside-bc-12-months-yes]').click(); + cy.get('input#departure-reason').type('vacation'); + cy.get('input#departure-location').type('bahamas'); + + cy.get('select#departure-begin-date-month').select(String(lastMonthDate.getMonth())); + cy.get('input#departure-begin-date-day').type(padInteger(lastMonthDate.getDate())); + cy.get('input#departure-begin-date-year').type(lastMonthDate.getFullYear()); + + cy.get('select#departure-return-date-month').select(String(currentDate.getMonth())); + cy.get('input#departure-return-date-day').type(padInteger(currentDate.getDate())); + cy.get('input#departure-return-date-year').type(currentDate.getFullYear()); + + cy.get('label[for=has-previous-phn-yes]').click(); + cy.get('input#previous-phn').type('9999 999 998'); + + cy.get('label[for=is-released-from-armed-forces-yes]').click(); + + cy.get('select#armed-forces-discharge-date-month').select('1'); + cy.get('input#armed-forces-discharge-date-day').type('01'); + cy.get('input#armed-forces-discharge-date-year').type('2010'); + + cy.get('label[for=is-student-yes]').click(); + cy.get('label[for=will-student-reside-in-bc-yes]').click(); + } + cy.continue(); +}) + +Cypress.Commands.add('fillEligibilityQuestionnaire', (options) => { + cy.visit('/') + + if (!options.includeMSP) { + cy.get('label[for=apply-msp-no]').click(); + } else { + cy.get('label[for=apply-msp-yes]').click(); + cy.get('label[for=live-in-bc-yes]').click(); + cy.get('label[for=away-over-30-no]').click(); + cy.get('label[for=student-minor-refugee-no]').click(); + cy.get('label[for=has-documents-yes]').click(); + } + cy.continue() + + if (!options.includeFPC) { + cy.get('label[for=apply-fpc-no]').click(); + } else { + cy.get('label[for=apply-fpc-yes]').click(); + cy.get('label[for=meets-fpc-criteria-yes]').click(); + cy.get('label[for=has-fpc-info-yes]').click(); + } + cy.continue() + + if (!options.includeSB) { + cy.get('label[for=apply-sb-no]').click(); + } else { + cy.get('label[for=apply-sb-yes]').click(); + cy.get('label[for=meets-sb-criteria-yes]').click(); + cy.get('label[for=has-sb-info-yes]').click(); + } + cy.continue() + + cy.get('input#msp').should('be.disabled') + cy.get('input#msp').should(options.includeMSP ? 'be.checked' : 'not.be.checked') + cy.get('input#fpc').should(options.includeFPC ? 'be.checked' : 'not.be.checked') + cy.get('input#sb').should(options.includeSB ? 'be.checked' : 'not.be.checked') + cy.continue() + + cy.get('input#input-answer').type('aaaaaa'); + cy.get('input#is-terms-accepted').click(); + cy.get('div.modal-footer').contains('Continue').click() + +}) + +Cypress.Commands.add('fillSpousePage', (options) => { + cy.get('label[for=has-spouse-yes]').click(); + cy.fillName('sarah'); + + cy.get('select#birth-date-month').select('5'); + cy.get('input#birth-date-day').type('20') + cy.get('input#birth-date-year').type('1990') + + if (!options?.includeMSP) { + cy.fillIdFields('9348671676', '195544135'); + } else { + + if (options.includeSB || options.includeFPC) { + cy.get('input#social-insurance-number').type('195544135') + } + + cy.get('label[for=spouse-gender-x]').click(); + + cy.get('select#spouse-status').select(StatusInCanada.PermanentResident) + cy.get('label[for=spouse-status-reason-new-to-country]').click(); + cy.get('select#citizen-support-document-type').select(SupportDocumentTypes.PermanentResidentConfirmation); + + cy.get('label[for=spouse-gender-matches-no]').click(); + + cy.get('input#spouse-citizenship-support-documents').selectFile(samplePDF, { force: true }); + cy.get('label[for=name-change-yes]').click(); + cy.get('select#name-change-doc-type').select(SupportDocumentTypes.MarriageCertificate); + + cy.get('input#spouse-name-change-support-documents').selectFile(samplePDF, { force: true }); + + cy.get('label[for=permanent-move-yes]').click(); + + cy.get('select#spouse-country-of-origin').select('Afghanistan'); + + cy.get('select#move-date-month').select('2'); + cy.get('input#move-date-day').type('02'); + cy.get('input#move-date-year').type('2015'); + + cy.get('select#canada-arrival-date-month').select('2'); + cy.get('input#canada-arrival-date-day').type('02'); + cy.get('input#canada-arrival-date-year').type('2014'); + + cy.get('label[for=outside-bc-past-12-no]').click(); + cy.get('label[for=has-previous-bc-health-number-no]').click(); + } + cy.continue() +}) + +Cypress.Commands.add('fillChildPage', (options) => { + cy.get('label[for=has-children-yes]').click() + + + cy.get('input#child-first-name-0').type('ralph') + cy.get('input#child-middle-name-0').type('j') + cy.get('input#child-last-name-0').type('wiggum') + + cy.get('select#child-birth-date-0-month').select('1') + cy.get('input#child-birth-date-0-day').type('01') + cy.get('input#child-birth-date-0-year').type('2019') + + if (options?.includeFPC) { + cy.get('input#personal-health-number-0').type('9344 507 929') + } + + if (options?.includeMSP) { + cy.get('label[for=child-age-range-0-0-18]').click() + + cy.get('label[for=child-gender-0-male]').click() + cy.get('select#child-status-0').select(StatusInCanada.Citizen) + + cy.get('label[for=child-status-reason-0-not-new]').click() + + cy.get('select#citizen-support-document-type-0').select(SupportDocumentTypes.CanadianBirthCertificate) + cy.get('label[for=gender-matches-0-yes]').click() + + cy.get('input#child-citizenship-support-documents-0').selectFile(samplePDF, { force: true }); + + cy.get('label[for=name-change-0-no]').click() + + cy.get('label[for=lived-in-bc-0-yes]').click() + cy.get('label[for=permanent-move-0-yes]').click() + cy.get('label[for=permanent-move-0-yes]').click() + cy.get('label[for=outside-bc-0-no]').click() + + cy.get('label[for=has-bc-health-number-0-no]').click() + cy.get('label[for=been-released-0-no]').click() + } + cy.continue() +}) + +Cypress.Commands.add('fillSBInfoPage', (options) => { + cy.get('label[for=select-noa-year-currentNOAYear').click() + cy.get('input#ah-net-income').type('50000') + cy.get('input#spouse-net-income').type('4000') + + if (!options.includeMSP) { + cy.get('label[for=has-children-yes').click() + cy.get('input#num-children').type('12') + } + + cy.get('input#child-care-expenses').type('200') + + cy.get('label[for=has-disability-credit-yes').click() + cy.get('label[for=selected-disability-credit-recipients-spouse').click() + + cy.get('label[for=has-disability-savings-yes').click() + cy.get('input#disability-savings-plan').type('1000') + + cy.get('label[for=has-attendant-nursing-expenses-yes').click() + cy.get('label[for=selected-attendant-nursing-recipients-ah').click() + + cy.get('input#attendant-nursing-receipts').selectFile(samplePDF, { force: true }); + + // wait for file to fully upload + cy.wait(DOCUMENT_WAIT_TIME); + cy.continue(); +}) + +Cypress.Commands.add('fillDocumentsPage', () => { + cy.get('input#ah-cra-documents').selectFile(samplePDF, { force: true }); + cy.get('input#spouse-cra-documents').selectFile(samplePDF, { force: true }); + cy.wait(DOCUMENT_WAIT_TIME); + cy.continue(); +}); + +Cypress.Commands.add('fillResidentialAddress', () => { + cy.get('input#res-address-line1').type('123 fake st.') + cy.get('input#res-city').type('duncan') + cy.get('input#res-postal-code').type('V8P1A1') + cy.get('input#phone-input').type('555 555 5555') + cy.continue() +}); + +Cypress.Commands.add('fillMailingAddress', () => { + cy.get('input#mail-address-line1').type('123 fake st.') + cy.get('input#mail-city').type('duncan') + cy.get('input#mail-postal-code').type('V8P1A1') + cy.get('input#phone-input').type('555 555 5555') + cy.continue() +}); + +Cypress.Commands.add('fillFPCInfoPage', () => { + cy.get('input#ah-income').type('20000') + cy.get('input#spouse-income').type('20000') + cy.get('input#ah-disability-savings').type('2000') + cy.get('input#spouse-disability-savings').type('2000') + cy.continue() +}) + +Cypress.Commands.add('fillConsent', (options) => { + if (options?.includeMSP) { + cy.get('label[for=msp-ah]').click() + cy.get('label[for=msp-spouse]').click() + } + if (options?.includeFPC) { + cy.get('label[for=fpc-ah]').click() + cy.get('label[for=fpc-spouse]').click() + } + if (options?.includeSB) { + cy.get('label[for=sb-ah]').click() + cy.get('label[for=sb-spouse]').click() + } +}) + +Cypress.Commands.add('submitApplication', () => { + cy.get('div.continue-bar').contains('Submit').click() +}) diff --git a/jha/cypress/support/e2e.js b/jha/cypress/support/e2e.js new file mode 100644 index 00000000..f1c925e2 --- /dev/null +++ b/jha/cypress/support/e2e.js @@ -0,0 +1,54 @@ +// *********************************************************** +// This example support/e2e.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') + +beforeEach(() => { + cy.intercept('POST', '/ahdc/api/jhaIntegration/getDeductibles', { + statusCode: 200, + }) + + cy.intercept('POST', '/ahdc/api/jhaIntegration/forwardCheckEligibility', { + statusCode: 200, + body: { + regStatusCode: '0' + } + }) + + cy.intercept('POST', '/ahdc/api/jhaIntegration/application/**', { statusCode: 200 } ).as('submitApplication') + + cy.intercept('/ahdc/api/jhaIntegration/version', { + statusCode: 200, + }) + + cy.intercept('POST', '/ahdc/api/captcha/verify/captcha', { + statusCode: 200, + body: { + valid: true, + } + }); + + cy.intercept('POST', '/ahdc/api/submit-attachment/**', { + statusCode: 200, + body: { + returnCode: 'success' + } + }) + }) + \ No newline at end of file diff --git a/jha/cypress/support/helpers.js b/jha/cypress/support/helpers.js new file mode 100644 index 00000000..b51f249d --- /dev/null +++ b/jha/cypress/support/helpers.js @@ -0,0 +1,32 @@ +import { cloneDeep } from 'lodash'; + +export const removeUniqueFields = (baseApplicationObj) => { + const applicationObj = cloneDeep(baseApplicationObj); + + delete applicationObj?.uuid; + delete applicationObj?.medicalServicesPlan?.uuid; + delete applicationObj?.fairPharmaCare?.uuid; + delete applicationObj?.supplementaryBenefits?.uuid; + delete applicationObj?.medicalServicesPlan?.attachmentUuids; + delete applicationObj?.medicalServicesPlan?.spouse?.attachmentUuids; + delete applicationObj?.medicalServicesPlan?.children?.attachmentUuids; + delete applicationObj?.authorizedByApplicantDate; + delete applicationObj?.fairPharmaCare?.processDate; + + applicationObj?.medicalServicesPlan?.children?.forEach(child => { + delete child.attachmentUuids + }) + + applicationObj?.medicalServicesPlan?.attachments?.forEach(attachment => { + delete attachment.attachmentUuid + }); + + applicationObj?.supplementaryBenefits?.attachments?.forEach(attachment => { + delete attachment.attachmentUuid + }); + + return applicationObj; +} + +export const padInteger = (int, spaces = 2, padChar = '0') => String(int).padStart(spaces, padChar); +export const formatDate = (date) => `${date.getFullYear()}-${padInteger(date.getMonth())}-${padInteger(date.getDate())}` \ No newline at end of file