Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8397: Added more test coverage for phase 3 input field validations #151

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions frontend/tests/e2e/tests/groupmember/AddDependentTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,63 @@ test('Check invalid formats validation', async (t) => {
.contains(ERROR_MESSAGE)
})

test('Check max length validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(AddDependentPage.groupNumberInput, '62431099')
.typeText(AddDependentPage.phnInput, '93971055755')
.typeText(AddDependentPage.dependentPhnInput, '93971055756')
// When I click the submit button
.click(AddDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, Group Member's PHN, Dependent's PHN
.expect(AddDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(1).textContent)
.contains(INVALID_GROUP_MEMBER_PHN_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check alphanumeric validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with alphanumeric format
.typeText(AddDependentPage.groupNumberInput, '62431AA')
.typeText(AddDependentPage.phnInput, '93971055bc')
.typeText(AddDependentPage.dependentPhnInput, '93fg105575')
// When I click the submit button
.click(AddDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, Group Member's PHN, Dependent's PHN
.expect(AddDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(1).textContent)
.contains(INVALID_GROUP_MEMBER_PHN_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check special char validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with special char
.typeText(AddDependentPage.groupNumberInput, '6243@#$')
.typeText(AddDependentPage.phnInput, '93971^&*bc')
.typeText(AddDependentPage.dependentPhnInput, '93*&10557@')
// When I click the submit button
.click(AddDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, Group Member's PHN, Dependent's PHN
.expect(AddDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(1).textContent)
.contains(INVALID_GROUP_MEMBER_PHN_ERROR_MESSAGE)
.expect(AddDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check properly filled form passes validation', async (t) => {
await t
// Given I have a form filled out with data
Expand Down
3 changes: 2 additions & 1 deletion frontend/tests/e2e/tests/groupmember/AddGroupMemberTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ test('Check properly filled form passes validation', async (t) => {
.contains(SUCCESS_MESSAGE)
})

test('Check PHN, Group Number format validation', async (t) => {
test('Check PHN, Group Number, Department format validation', async (t) => {
await t
// Given the page is filled out correctly
.typeText(AddGroupMember.groupNumberInput, '6007109')
.typeText(AddGroupMember.departmentNumberInput, 'A1234')
.click(AddGroupMember.coverageEffectiveDateInput)
.click(AddGroupMember.divSelectedDate)
.click(AddGroupMember.phnInput)
Expand Down
57 changes: 57 additions & 0 deletions frontend/tests/e2e/tests/groupmember/CancelDependentTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,63 @@ test('Check invalid formats validation', async (t) => {
.contains(ERROR_MESSAGE)
})

test('Check max length validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(CancelDependent.phnInput, '93971055755')
.typeText(CancelDependent.dependentPhnInput, '93971055755')
.typeText(CancelDependent.groupNumberInput, '123333333')
// When I click the submit button
.click(CancelDependent.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelDependent.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(2).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check alphanumeric validation', async (t) => {
await t
// Given I enter PHN, Dependent PHN, Group Number, and Cancel dates with alphanumeric
.typeText(CancelDependent.phnInput, '939710557A')
.typeText(CancelDependent.dependentPhnInput, '9A97105575')
.typeText(CancelDependent.groupNumberInput, '123AAA')
// When I click the submit button
.click(CancelDependent.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelDependent.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(2).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check special character validation', async (t) => {
await t
// Given I enter PHN, Dependent PHN, Group Number, and Cancel dates with special chars
.typeText(CancelDependent.phnInput, '93971055$%')
.typeText(CancelDependent.dependentPhnInput, '93971055#$')
.typeText(CancelDependent.groupNumberInput, '123@#')
// When I click the submit button
.click(CancelDependent.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelDependent.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(CancelDependent.errorText.nth(2).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check properly filled form passes validation', async (t) => {
await t
// Given I have a form filled out with data
Expand Down
48 changes: 48 additions & 0 deletions frontend/tests/e2e/tests/groupmember/CancelGroupMemberTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,54 @@ test('Check invalid formats validation', async (t) => {
.contains(ERROR_MESSAGE)
})

test('Check maxlength validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(CancelGroupMember.phnInput, '93971055755')
.typeText(CancelGroupMember.groupNumberInput, '63371099')
// When I click the submit button
.click(CancelGroupMember.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelGroupMember.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelGroupMember.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check alphanmeric validation', async (t) => {
await t
// Given I enter PHN, Group Number, and Cancel dates with alphanumeric format
.typeText(CancelGroupMember.phnInput, 'A397105575')
.typeText(CancelGroupMember.groupNumberInput, '633710B')
// When I click the submit button
.click(CancelGroupMember.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelGroupMember.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelGroupMember.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check special characters validation', async (t) => {
await t
// Given I enter PHN, Group Number, and Cancel dates with special chars
.typeText(CancelGroupMember.phnInput, '@#$%^&*()!')
.typeText(CancelGroupMember.groupNumberInput, '^&^&^&^')
// When I click the submit button
.click(CancelGroupMember.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats
.expect(CancelGroupMember.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(CancelGroupMember.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check properly filled form passes validation', async (t) => {
await t
// Given I have a form filled out with data
Expand Down
48 changes: 48 additions & 0 deletions frontend/tests/e2e/tests/maintenance/ExtendCancelDateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,54 @@ test('Check invalid phn, groupNumber format validation', async (t) => {
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check max length validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(ExtendCancelDatePage.phnInput, '98732516933')
.typeText(ExtendCancelDatePage.groupNumberInput, '48419044')
// When I click the submit button
.click(ExtendCancelDatePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check alphanumeric validation', async (t) => {
await t
// Given a PHN entered with an alphanueric format
.typeText(ExtendCancelDatePage.phnInput, '98732516AA')
.typeText(ExtendCancelDatePage.groupNumberInput, '48abc04')
// When I click the submit button
.click(ExtendCancelDatePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check special char validation', async (t) => {
await t
// Given a PHN entered with an special char
.typeText(ExtendCancelDatePage.phnInput, '98732516#$')
.typeText(ExtendCancelDatePage.groupNumberInput, '48^&*04')
// When I click the submit button
.click(ExtendCancelDatePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ExtendCancelDatePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check properly filled form passes validation and validate results, dates cannot be equal', async (t) => {
await t
.typeText(ExtendCancelDatePage.groupNumberInput, '4841904')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,54 @@ test('Check invalid phn, groupNumber format validation', async (t) => {
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check max length validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(ReinstateCancelledCoveragePage.phnInput, '93319269199')
.typeText(ReinstateCancelledCoveragePage.groupNumberInput, '63371099')
// When I click the submit button
.click(ReinstateCancelledCoveragePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check alphanumeric validation', async (t) => {
await t
// Given a PHN entered with a alphanumeric format
.typeText(ReinstateCancelledCoveragePage.phnInput, 'A331926919')
.typeText(ReinstateCancelledCoveragePage.groupNumberInput, 'Abc7109')
// When I click the submit button
.click(ReinstateCancelledCoveragePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check special char validation', async (t) => {
await t
// Given a PHN entered with special char
.typeText(ReinstateCancelledCoveragePage.phnInput, '%331926919')
.typeText(ReinstateCancelledCoveragePage.groupNumberInput, '%^&7109')
// When I click the submit button
.click(ReinstateCancelledCoveragePage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the PHN format
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateCancelledCoveragePage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
})

test('Check properly filled form passes validation and validate results, subscriber not covered', async (t) => {
await t
// Given the page is filled out correctly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,63 @@ test('Check invalid formats validation', async (t) => {
.contains(ERROR_MESSAGE)
})

test('Check max length validation', async (t) => {
await t
// Given I enter Group Number, Group Member's PHN, Dependent's PHN with more than allowed length
.typeText(ReinstateOverAgeDependentPage.groupNumberInput, '63371099')
.typeText(ReinstateOverAgeDependentPage.phnInput, '93878074840')
.typeText(ReinstateOverAgeDependentPage.dependentPhnInput, '93878074841')
// When I click the submit button
.click(ReinstateOverAgeDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, PHN, Dependent's PHN
.expect(ReinstateOverAgeDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check alphanumeric validation', async (t) => {
await t
// Given I enter Group Number, PHN, Dependent's PHN with alphanumeric format
.typeText(ReinstateOverAgeDependentPage.groupNumberInput, '633710A')
.typeText(ReinstateOverAgeDependentPage.phnInput, '9bc7807484')
.typeText(ReinstateOverAgeDependentPage.dependentPhnInput, '9387807aa4')
// When I click the submit button
.click(ReinstateOverAgeDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, PHN, Dependent's PHN
.expect(ReinstateOverAgeDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check special characters validation', async (t) => {
await t
// Given I enter Group Number, PHN, Dependent's PHN with special chars
.typeText(ReinstateOverAgeDependentPage.groupNumberInput, '633710@')
.typeText(ReinstateOverAgeDependentPage.phnInput, '9$%7807484')
.typeText(ReinstateOverAgeDependentPage.dependentPhnInput, '9387807&&4')
// When I click the submit button
.click(ReinstateOverAgeDependentPage.submitButton)
// I expect an error message stating the page had errors and an individual error message for the Group Number, PHN, Dependent's PHN
.expect(ReinstateOverAgeDependentPage.errorText.nth(0).textContent)
.contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(1).textContent)
.contains(INVALID_PHN_ERROR_MESSAGE)
.expect(ReinstateOverAgeDependentPage.errorText.nth(2).textContent)
.contains(INVALID_DEPENDENT_PHN_ERROR_MESSAGE)
.expect(AlertPage.alertBannerText.textContent)
.contains(ERROR_MESSAGE)
})

test('Check properly filled form passes validation', async (t) => {
await t
// Given I have a form filled out with data
Expand Down
Loading