diff --git a/frontend/src/components/coverage/enrollment/RegistrationConfirmation.vue b/frontend/src/components/coverage/enrollment/RegistrationConfirmation.vue
index 04e4d493..72f6c301 100644
--- a/frontend/src/components/coverage/enrollment/RegistrationConfirmation.vue
+++ b/frontend/src/components/coverage/enrollment/RegistrationConfirmation.vue
@@ -10,6 +10,7 @@
+ {{ addAnotherButtonText }}
@@ -28,6 +29,21 @@ export default {
fullName() {
return formatPersonName(this.resident)
},
+ addAnotherButtonText() {
+ return this.$route.query.pageAction === 'REGISTRATION' || this.$route.name === 'AddVisaResidentWithoutPHN' ? 'Add Another Permit Holder without PHN' : 'Add Another Permit Holder with PHN'
+ },
+ },
+
+ methods: {
+ addAnotherPermitHolder() {
+ if (this.$route.query.pageAction === 'REGISTRATION') {
+ this.$store.commit('alert/dismissAlert')
+ this.$router.replace({ query: null })
+ this.$router.push('/coverage/enrollment/addStudyPermitHolderWithoutPHN')
+ } else {
+ this.$router.go()
+ }
+ },
},
}
diff --git a/frontend/src/util/constants.js b/frontend/src/util/constants.js
index 1fbfb658..8822c640 100644
--- a/frontend/src/util/constants.js
+++ b/frontend/src/util/constants.js
@@ -40,6 +40,7 @@ export const PROVINCES = [
export const IMMIGRATION_CODES = [
{ text: 'Select', value: '' },
{ text: 'Student Authorization', value: 'S' },
+ { text: 'Employment Authorization', value: 'W' },
]
// Prior Residence drop down options
diff --git a/frontend/tests/e2e/tests/enrollment/AddVisaResidentWithPHNTest.js b/frontend/tests/e2e/tests/enrollment/AddVisaResidentWithPHNTest.js
index 4cd1d8ac..785f4056 100644
--- a/frontend/tests/e2e/tests/enrollment/AddVisaResidentWithPHNTest.js
+++ b/frontend/tests/e2e/tests/enrollment/AddVisaResidentWithPHNTest.js
@@ -1,10 +1,9 @@
-import dayjs from 'dayjs'
-
-import { OUTPUT_DATE_FORMAT } from '../../../../src/util/constants'
-import { SITE_UNDER_TEST } from '../../configuration'
-import AlertPage from '../../pages/AlertPage'
import AddVisaResidentWithPHNPage from '../../pages/enrollment/AddVisaResidentWithPHNPage'
+import AlertPage from '../../pages/AlertPage'
+import { OUTPUT_DATE_FORMAT } from '../../../../src/util/constants'
import PersonDetails from '../../pages/enrollment/PersonDetailsPage'
+import { SITE_UNDER_TEST } from '../../configuration'
+import dayjs from 'dayjs'
import { regularAccUser } from '../../roles/roles'
const immigrationCodeOption = AddVisaResidentWithPHNPage.immigrationCodeSelect.find('option')
@@ -31,125 +30,151 @@ const PHONE_NUMBER_VALIDATION_MESSAGE = 'Only numbers 0 to 9 are valid. Phone Nu
const PAGE_TO_TEST = SITE_UNDER_TEST + '/coverage/enrollment/addStudyPermitHolderWithPHN'
-fixture(`AddVisaResidentWithPHN Page`)
-.disablePageCaching `Test AddVisaResidentWithPHN`
- .beforeEach(async t => {
- await t
- .useRole(regularAccUser)
- })
- .page(PAGE_TO_TEST)
+fixture(`AddVisaResidentWithPHN Page`).disablePageCaching`Test AddVisaResidentWithPHN`
+ .beforeEach(async (t) => {
+ await t.useRole(regularAccUser)
+ })
+ .page(PAGE_TO_TEST)
-test('Check required fields validation', async t => {
- await t
- .typeText(PersonDetails.phnInput, '9882807277')
- .click(PersonDetails.submitButton)
- .wait(5000)
- // Given required fields aren't filled out
-
- // When I click the submit button
- .click(AddVisaResidentWithPHNPage.submitButton)
- .wait(1000)
- // I expect an error message stating the page had errors and individual error messages for each required field
- .expect(AlertPage.alertBannerText.textContent).contains(ERROR_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(0).textContent).contains(GROUPNUMBER_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(1).textContent).contains(IMMIGRATION_CODE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(2).textContent).contains(PERMIT_ISSUE_DATE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(3).textContent).contains(PERMIT_EXPIRY_DATE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(4).textContent).contains(RESIDENCE_DATE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(5).textContent).contains(COVERAGE_CANCELLATION_DATE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(6).textContent).contains(HOME_ADDRESS_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(7).textContent).contains(CITY_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(8).textContent).contains(PROVINCE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(9).textContent).contains(POSTAL_CODE_REQUIRED_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(10).textContent).contains(PRIOR_RESIDENCE_REQUIRED_MESSAGE)
+test('Check required fields validation', async (t) => {
+ await t
+ .typeText(PersonDetails.phnInput, '9882807277')
+ .click(PersonDetails.submitButton)
+ .wait(5000)
+ // Given required fields aren't filled out
+
+ // When I click the submit button
+ .click(AddVisaResidentWithPHNPage.submitButton)
+ .wait(1000)
+ // I expect an error message stating the page had errors and individual error messages for each required field
+ .expect(AlertPage.alertBannerText.textContent)
+ .contains(ERROR_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(0).textContent)
+ .contains(GROUPNUMBER_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(1).textContent)
+ .contains(IMMIGRATION_CODE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(2).textContent)
+ .contains(PERMIT_ISSUE_DATE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(3).textContent)
+ .contains(PERMIT_EXPIRY_DATE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(4).textContent)
+ .contains(RESIDENCE_DATE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(5).textContent)
+ .contains(COVERAGE_CANCELLATION_DATE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(6).textContent)
+ .contains(HOME_ADDRESS_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(7).textContent)
+ .contains(CITY_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(8).textContent)
+ .contains(PROVINCE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(9).textContent)
+ .contains(POSTAL_CODE_REQUIRED_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(10).textContent)
+ .contains(PRIOR_RESIDENCE_REQUIRED_MESSAGE)
})
-test('Check properly filled form passes validation', async t => {
- await t
- .typeText(PersonDetails.phnInput, '9882807277')
- .click(PersonDetails.submitButton)
- .wait(5000)
- // Given the page is filled out correctly
- .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '6337109')
- .click(AddVisaResidentWithPHNPage.immigrationCodeSelect)
- .click(immigrationCodeOption.withText("Student Authorization"))
- .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '123456')
- .typeText(AddVisaResidentWithPHNPage.visaIssueDateInput, '20210101')
- .typeText(AddVisaResidentWithPHNPage.visaExpiryDateInput, '20221231')
- .typeText(AddVisaResidentWithPHNPage.residenceDateInput, '20191108')
- .typeText(AddVisaResidentWithPHNPage.coverageEffectiveDateInput, '20210401')
- .typeText(AddVisaResidentWithPHNPage.coverageCancellationDateInput, '20211231')
- .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7802024022')
- .typeText(AddVisaResidentWithPHNPage.address1Input, 'Test 111 ST')
- .typeText(AddVisaResidentWithPHNPage.cityInput, 'VICTORIA')
- .click(AddVisaResidentWithPHNPage.provinceSelect)
- .click(provinceOption.withText('British Columbia'))
- .typeText(AddVisaResidentWithPHNPage.postalCodeInput, 'V8V8V8')
- .click(AddVisaResidentWithPHNPage.priorResidenceCodeInput)
- .click(priorResidenceCodeOption.withText('British Columbia'))
+test('Check properly filled form passes validation', async (t) => {
+ await t
+ .typeText(PersonDetails.phnInput, '9882807277')
+ .click(PersonDetails.submitButton)
+ .wait(5000)
+ // Given the page is filled out correctly
+ .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '6337109')
+ .click(AddVisaResidentWithPHNPage.immigrationCodeSelect)
+ .click(immigrationCodeOption.withText('Employment Authorization'))
+ .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '123456')
+ .typeText(AddVisaResidentWithPHNPage.visaIssueDateInput, '20210101')
+ .typeText(AddVisaResidentWithPHNPage.visaExpiryDateInput, '20221231')
+ .typeText(AddVisaResidentWithPHNPage.residenceDateInput, '20191108')
+ .typeText(AddVisaResidentWithPHNPage.coverageEffectiveDateInput, '20210401')
+ .typeText(AddVisaResidentWithPHNPage.coverageCancellationDateInput, '20211231')
+ .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7802024022')
+ .typeText(AddVisaResidentWithPHNPage.address1Input, 'Test 111 ST')
+ .typeText(AddVisaResidentWithPHNPage.cityInput, 'VICTORIA')
+ .click(AddVisaResidentWithPHNPage.provinceSelect)
+ .click(provinceOption.withText('British Columbia'))
+ .typeText(AddVisaResidentWithPHNPage.postalCodeInput, 'V8V8V8')
+ .click(AddVisaResidentWithPHNPage.priorResidenceCodeInput)
+ .click(priorResidenceCodeOption.withText('British Columbia'))
- // When I click the submit button
- .click(AddVisaResidentWithPHNPage.submitButton)
- // I expect a success message
- .expect(AlertPage.alertBannerText.textContent).contains(SUCCESS_MESSAGE)
+ // When I click the submit button
+ .click(AddVisaResidentWithPHNPage.submitButton)
+ // I expect a success message
+ .expect(AlertPage.alertBannerText.textContent)
+ .contains(SUCCESS_MESSAGE)
})
-test('Check invalid field validation', async t => {
- await t
+test('Check invalid field validation', async (t) => {
+ await t
.typeText(PersonDetails.phnInput, '9882807277')
.click(PersonDetails.submitButton)
- .wait(1000)
- // Given a Group Number entered with an invalid format
- .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '9000444000')
- .typeText(AddVisaResidentWithPHNPage.groupMemberNumberInput, '9000444000')
- .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '9000444^^')
- .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7807777')
- // When I click the submit button
- .click(AddVisaResidentWithPHNPage.submitButton)
- // I expect an error message stating the page had errors and an individual error message for the PHN format
- .expect(AddVisaResidentWithPHNPage.errorText.nth(0).textContent).contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(2).textContent).contains(INVALID_GROUP_MEMBER_NUMBER_ERROR_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(4).textContent).contains(INVALID_DEPARTMENT_NUMBER_VALIDATION_MESSAGE)
- .expect(AddVisaResidentWithPHNPage.errorText.nth(7).textContent).contains(PHONE_NUMBER_VALIDATION_MESSAGE)
- .expect(AlertPage.alertBannerText.textContent).contains(ERROR_MESSAGE)
-
+ .wait(1000)
+ // Given a Group Number entered with an invalid format
+ .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '9000444000')
+ .typeText(AddVisaResidentWithPHNPage.groupMemberNumberInput, '9000444000')
+ .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '9000444^^')
+ .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7807777')
+ // When I click the submit button
+ .click(AddVisaResidentWithPHNPage.submitButton)
+ // I expect an error message stating the page had errors and an individual error message for the PHN format
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(0).textContent)
+ .contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(2).textContent)
+ .contains(INVALID_GROUP_MEMBER_NUMBER_ERROR_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(4).textContent)
+ .contains(INVALID_DEPARTMENT_NUMBER_VALIDATION_MESSAGE)
+ .expect(AddVisaResidentWithPHNPage.errorText.nth(7).textContent)
+ .contains(PHONE_NUMBER_VALIDATION_MESSAGE)
+ .expect(AlertPage.alertBannerText.textContent)
+ .contains(ERROR_MESSAGE)
})
-test('Check clear button clears the form', async t => {
- await t
+test('Check clear button clears the form', async (t) => {
+ await t
.typeText(PersonDetails.phnInput, '9882807277')
.click(PersonDetails.submitButton)
- // Given the page is filled out correctly
- .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '6337109')
- .click(AddVisaResidentWithPHNPage.immigrationCodeSelect)
- .click(immigrationCodeOption.withText("Student Authorization"))
- .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '6337109')
- .typeText(AddVisaResidentWithPHNPage.visaIssueDateInput, '20210101')
- .typeText(AddVisaResidentWithPHNPage.visaExpiryDateInput, '20221231')
- .typeText(AddVisaResidentWithPHNPage.residenceDateInput, '20191108')
- .typeText(AddVisaResidentWithPHNPage.coverageEffectiveDateInput, '20210301')
- .typeText(AddVisaResidentWithPHNPage.coverageCancellationDateInput, '20211231')
- .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7802024022')
- .typeText(AddVisaResidentWithPHNPage.address1Input, 'Test 111 ST')
- .typeText(AddVisaResidentWithPHNPage.cityInput, 'VICTORIA')
- .click(AddVisaResidentWithPHNPage.provinceSelect)
- .click(provinceOption.withText('British Columbia'))
- .typeText(AddVisaResidentWithPHNPage.postalCodeInput, 'V8V8V8')
- .click(AddVisaResidentWithPHNPage.priorResidenceCodeInput)
- .click(priorResidenceCodeOption.withText('British Columbia'))
-
- // When I click the clear button
- .click(AddVisaResidentWithPHNPage.clearButton)
- // I expect the form to be cleared
- .expect(AddVisaResidentWithPHNPage.groupNumberInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.immigrationCodeSelect.value).eql('')
- .expect(AddVisaResidentWithPHNPage.visaIssueDateInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.visaExpiryDateInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.residenceDateInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.coverageEffectiveDateInput.value).eql(dayjs().startOf('month').format(OUTPUT_DATE_FORMAT))
- .expect(AddVisaResidentWithPHNPage.coverageCancellationDateInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.cityInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.provinceSelect.value).eql('')
- .expect(AddVisaResidentWithPHNPage.postalCodeInput.value).eql('')
- .expect(AddVisaResidentWithPHNPage.telephoneInput.value).eql('')
-})
\ No newline at end of file
+ // Given the page is filled out correctly
+ .typeText(AddVisaResidentWithPHNPage.groupNumberInput, '6337109')
+ .click(AddVisaResidentWithPHNPage.immigrationCodeSelect)
+ .click(immigrationCodeOption.withText('Student Authorization'))
+ .typeText(AddVisaResidentWithPHNPage.departmentNumberInput, '6337109')
+ .typeText(AddVisaResidentWithPHNPage.visaIssueDateInput, '20210101')
+ .typeText(AddVisaResidentWithPHNPage.visaExpiryDateInput, '20221231')
+ .typeText(AddVisaResidentWithPHNPage.residenceDateInput, '20191108')
+ .typeText(AddVisaResidentWithPHNPage.coverageEffectiveDateInput, '20210301')
+ .typeText(AddVisaResidentWithPHNPage.coverageCancellationDateInput, '20211231')
+ .typeText(AddVisaResidentWithPHNPage.telephoneInput, '7802024022')
+ .typeText(AddVisaResidentWithPHNPage.address1Input, 'Test 111 ST')
+ .typeText(AddVisaResidentWithPHNPage.cityInput, 'VICTORIA')
+ .click(AddVisaResidentWithPHNPage.provinceSelect)
+ .click(provinceOption.withText('British Columbia'))
+ .typeText(AddVisaResidentWithPHNPage.postalCodeInput, 'V8V8V8')
+ .click(AddVisaResidentWithPHNPage.priorResidenceCodeInput)
+ .click(priorResidenceCodeOption.withText('British Columbia'))
+
+ // When I click the clear button
+ .click(AddVisaResidentWithPHNPage.clearButton)
+ // I expect the form to be cleared
+ .expect(AddVisaResidentWithPHNPage.groupNumberInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.immigrationCodeSelect.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.visaIssueDateInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.visaExpiryDateInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.residenceDateInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.coverageEffectiveDateInput.value)
+ .eql(dayjs().startOf('month').format(OUTPUT_DATE_FORMAT))
+ .expect(AddVisaResidentWithPHNPage.coverageCancellationDateInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.cityInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.provinceSelect.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.postalCodeInput.value)
+ .eql('')
+ .expect(AddVisaResidentWithPHNPage.telephoneInput.value)
+ .eql('')
+})