Skip to content

Commit

Permalink
add validation tests for applicant first, middle, and last name
Browse files Browse the repository at this point in the history
  • Loading branch information
skylermcnamee-hibc committed Sep 4, 2024
1 parent 518a80d commit af79404
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
14 changes: 14 additions & 0 deletions jha/cypress/e2e/fullApplicationValidations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
// });
Expand Down
32 changes: 32 additions & 0 deletions jha/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
5 changes: 4 additions & 1 deletion jha/src/views/enrolment/PersonalInfoPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<InputComponent label="First name"
id="first-name"
v-model="firstName"
cypressId='first-name'
:maxlength="firstNameMaxLength"
:inputStyle="mediumStyles"
:required="true"
Expand All @@ -34,6 +35,7 @@
id="middle-name"
class="mt-3"
v-model="middleName"
cypressId='middle-name'
:maxlength="middleNameMaxLength"
:inputStyle="mediumStyles"
@blur="handleBlurField(v$.middleName)" />
Expand All @@ -45,6 +47,7 @@
id="last-name"
class="mt-3"
v-model="lastName"
cypressId='last-name'
:required="true"
:maxlength="lastNameMaxLength"
:inputStyle="mediumStyles"
Expand Down Expand Up @@ -670,7 +673,7 @@
</div>
</main>
</PageContent>
<ContinueBar @continue="validateFields()" />
<ContinueBar @continue="validateFields()" cypressId='continue'/>
<Teleport v-if="isInfoCollectionNoticeOpen"
to="#modal-target">
<ConsentModal @close="handleCloseConsentModal"/>
Expand Down

0 comments on commit af79404

Please sign in to comment.