From af794042e616139911ab9bd312dffa3ebafb6c8e Mon Sep 17 00:00:00 2001 From: Skyler Date: Wed, 4 Sep 2024 16:08:55 -0700 Subject: [PATCH] add validation tests for applicant first, middle, and last name --- .../e2e/fullApplicationValidations.cy.js | 14 ++++++++ jha/cypress/support/commands.js | 32 +++++++++++++++++++ jha/src/views/enrolment/PersonalInfoPage.vue | 5 ++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/jha/cypress/e2e/fullApplicationValidations.cy.js b/jha/cypress/e2e/fullApplicationValidations.cy.js index 0c9a69f..c1ad231 100644 --- a/jha/cypress/e2e/fullApplicationValidations.cy.js +++ b/jha/cypress/e2e/fullApplicationValidations.cy.js @@ -361,6 +361,20 @@ describe("Full application for MSP FPC and SB (validations)", () => { }); }); + it.only('Validates the applicant page (MSP)', () => { + const options = {includeMSP: true, includeFPC: false, includeSB: false} + cy.fillEligibilityQuestionnaire(options); + cy.fillPersonalInfoPage(options); + cy.location().should((loc) => { + expect(loc.pathname).to.eq("/ahdc/spouse-info"); + }); + cy.go("back"); + cy.location().should((loc) => { + expect(loc.pathname).to.eq("/ahdc/personal-info"); + }); + cy.validateApplicant(); + }); + // it('Fills eligibility questionnaire', () => { // cy.fillEligibilityQuestionnaire(options) // }); diff --git a/jha/cypress/support/commands.js b/jha/cypress/support/commands.js index 522c33c..c5d5734 100644 --- a/jha/cypress/support/commands.js +++ b/jha/cypress/support/commands.js @@ -376,3 +376,35 @@ Cypress.Commands.add('fillConsent', (options) => { Cypress.Commands.add('submitApplication', () => { cy.get('div.continue-bar').contains('Submit').click() }) + +Cypress.Commands.add('validateApplicant', () => { + //First name + cy.get('[data-cy=first-name]').clear() + cy.get("[data-cy=continue]").click(); + cy.contains( + "First name is required." + ); + cy.get('[data-cy=first-name]').type("111") + cy.get("[data-cy=continue]").click(); + cy.contains( + "First name must begin with a letter" + ); + cy.get('[data-cy=first-name]').clear() + cy.get('[data-cy=first-name]').type("alex") + //Middle name + cy.get('[data-cy=middle-name]').clear() + cy.get('[data-cy=middle-name]').type("111") + cy.contains( + "Middle name must begin with a letter" + ); + cy.get('[data-cy=middle-name]').clear() + cy.get('[data-cy=middle-name]').type("jaimie") + //Last name + cy.get('[data-cy=last-name]').clear() + cy.get('[data-cy=last-name]').type("111") + cy.contains( + "Last name must begin with a letter" + ); + cy.get('[data-cy=last-name]').clear() + cy.get('[data-cy=last-name]').type("doe") +}) diff --git a/jha/src/views/enrolment/PersonalInfoPage.vue b/jha/src/views/enrolment/PersonalInfoPage.vue index 129a950..6c4e6d5 100644 --- a/jha/src/views/enrolment/PersonalInfoPage.vue +++ b/jha/src/views/enrolment/PersonalInfoPage.vue @@ -18,6 +18,7 @@ @@ -45,6 +47,7 @@ id="last-name" class="mt-3" v-model="lastName" + cypressId='last-name' :required="true" :maxlength="lastNameMaxLength" :inputStyle="mediumStyles" @@ -670,7 +673,7 @@ - +