-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
verified email is used on application as read-only
- Loading branch information
Showing
7 changed files
with
172 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import { | |
createDaycarePlacements, | ||
getApplication, | ||
resetServiceState, | ||
runJobs, | ||
setPersonEmail | ||
} from '../../generated/api-clients' | ||
import CitizenApplicationsPage from '../../pages/citizen/citizen-applications' | ||
|
@@ -31,6 +32,7 @@ import { | |
fullDaycareForm, | ||
minimalDaycareForm | ||
} from '../../utils/application-forms' | ||
import { getVerificationCodeFromEmail } from '../../utils/email' | ||
import { Page } from '../../utils/page' | ||
import { enduserLogin } from '../../utils/user' | ||
|
||
|
@@ -342,4 +344,56 @@ describe('Citizen daycare applications', () => { | |
await editorPage.openSection('contactInfo') | ||
await editorPage.guardianPhoneInput.assertValueEquals('040123456789') | ||
}) | ||
|
||
test('If user has a verified email, that one is used in the application and cannot be changed', async () => { | ||
// given user has a draft application with an email | ||
await header.selectTab('applications') | ||
const editorPage = await applicationsPage.createApplication( | ||
testChild.id, | ||
'DAYCARE' | ||
) | ||
const applicationId = editorPage.getNewApplicationId() | ||
await editorPage.fillData({ | ||
...minimalDaycareForm().form, | ||
contactInfo: { | ||
guardianPhone: testAdult.phone, | ||
guardianEmail: '[email protected]', | ||
noGuardianEmail: false, | ||
otherGuardianAgreementStatus: 'AGREED' | ||
} | ||
}) | ||
await editorPage.saveAsDraftButton.click() | ||
await editorPage.modalOkBtn.click() | ||
|
||
// and given user verifies another email | ||
await header.selectTab('personal-details') | ||
const section = new CitizenPersonalDetailsPage(page).personalDetailsSection | ||
await section.editPersonalData( | ||
{ | ||
preferredName: testAdult.firstName.split(' ')[1], | ||
email: '[email protected]', | ||
phone: testAdult.phone, | ||
backupPhone: testAdult.backupPhone | ||
}, | ||
true | ||
) | ||
await section.unverifiedEmailStatus.waitUntilVisible() | ||
await section.sendVerificationCode.click() | ||
await section.verificationCodeField.waitUntilVisible() | ||
await runJobs({ mockedTime: mockedNow }) | ||
const verificationCode = await getVerificationCodeFromEmail() | ||
expect(verificationCode).toBeTruthy() | ||
await section.verificationCodeField.fill(verificationCode ?? '') | ||
await section.verifyEmail.click() | ||
await section.verifiedEmailStatus.waitUntilVisible() | ||
|
||
// when user goes back to the application | ||
await page.reload() | ||
await header.selectTab('applications') | ||
await applicationsPage.editApplication(applicationId) | ||
|
||
// then the email in the application updates and cannot be edited | ||
await editorPage.openSection('contactInfo') | ||
await editorPage.assertVerifiedReadOnlyEmail('[email protected]') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters