-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EMS-1027): no PDF - account - sign in - verify email after expiry (
- Loading branch information
Showing
29 changed files
with
577 additions
and
180 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const ACCOUNT = { | ||
MAX_AUTH_RETRIES: 6, | ||
IS_INACTIVE: 'isInactive', | ||
}; |
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
92 changes: 92 additions & 0 deletions
92
...account/create/confirm-email/confirm-email-verification-expired-in-inactive-state.spec.js
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { INSURANCE_ROUTES as ROUTES } from '../../../../../../../constants/routes/insurance'; | ||
import api from '../../../../../../../commands/api'; | ||
import { ACCOUNT } from '../../../../../../../constants'; | ||
|
||
const { IS_INACTIVE } = ACCOUNT; | ||
|
||
const { | ||
START, | ||
ACCOUNT: { | ||
CREATE: { CONFIRM_EMAIL, VERIFY_EMAIL, CONFIRM_EMAIL_RESENT }, | ||
}, | ||
} = ROUTES; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
`Insurance - Account - Create - Confirm email page - expired token and ${IS_INACTIVE} flag set - As an Exporter I want to verify my email address for account creation, So that I can activate my email address and use it to create a digital service account with UKEF`, | ||
() => { | ||
let url; | ||
let account; | ||
|
||
before(() => { | ||
cy.deleteAccount(); | ||
|
||
cy.navigateToUrl(START); | ||
|
||
cy.submitEligibilityAndStartAccountCreation(); | ||
cy.completeAndSubmitCreateAccountForm(); | ||
|
||
url = `${baseUrl}${CONFIRM_EMAIL}`; | ||
|
||
cy.assertUrl(url); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
}); | ||
|
||
describe(`When a verification token has expired and the ${IS_INACTIVE} flag is set and the user navigates to ${VERIFY_EMAIL} with the expired token`, () => { | ||
let updatedAccount; | ||
|
||
beforeEach(async () => { | ||
/** | ||
* Get the account so that we can use the ID | ||
* to update the verification period. | ||
*/ | ||
const accountEmail = Cypress.env('GOV_NOTIFY_EMAIL_RECIPIENT_1'); | ||
|
||
const accountsResponse = await api.getAccountByEmail(accountEmail); | ||
|
||
const [firstAccount] = accountsResponse; | ||
account = firstAccount; | ||
|
||
/** | ||
* Update the account's verification expiry date via the API, | ||
* so that we can mimic missing the verification period. | ||
*/ | ||
const today = new Date(); | ||
const lastMonth = new Date(today.setMonth(today.getMonth() - 1)); | ||
|
||
const updateObj = { | ||
verificationExpiry: lastMonth, | ||
}; | ||
|
||
updatedAccount = await api.updateAccount(account.id, updateObj); | ||
|
||
/** | ||
* Update the account status' isInactive flag via the API, | ||
* so that we can mimic an inactive account. | ||
*/ | ||
const updateStatusObj = { | ||
isInactive: true, | ||
}; | ||
|
||
await api.updateAccountStatus(updatedAccount.status.id, updateStatusObj); | ||
}); | ||
|
||
it(`should redirect to ${CONFIRM_EMAIL_RESENT} when submitting the form`, () => { | ||
const { verificationHash } = updatedAccount; | ||
|
||
const verificationUrl = `${VERIFY_EMAIL}?token=${verificationHash}&id=${account.id}`; | ||
|
||
cy.navigateToUrl(`${baseUrl}${verificationUrl}`); | ||
|
||
cy.clickSubmitButton(); | ||
|
||
const expectedUrl = `${baseUrl}${CONFIRM_EMAIL_RESENT}?id=${account.id}`; | ||
cy.assertUrl(expectedUrl); | ||
}); | ||
}); | ||
}, | ||
); |
92 changes: 0 additions & 92 deletions
92
...e2e/journeys/account/create/confirm-email/confirm-email-verification-expired-link.spec.js
This file was deleted.
Oops, something went wrong.
110 changes: 110 additions & 0 deletions
110
...ress/e2e/journeys/account/create/confirm-email/confirm-email-verification-expired.spec.js
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { PAGES } from '../../../../../../../content-strings'; | ||
import { verifyEmailLinkExpiredPage } from '../../../../../../../pages/insurance/account/create'; | ||
import { INSURANCE_ROUTES as ROUTES } from '../../../../../../../constants/routes/insurance'; | ||
import api from '../../../../../../../commands/api'; | ||
|
||
const CONTENT_STRINGS = PAGES.INSURANCE.ACCOUNT.CREATE.VERIFY_EMAIL_EXPIRED_LINK; | ||
|
||
const { | ||
START, | ||
ACCOUNT: { | ||
CREATE: { | ||
CONFIRM_EMAIL, VERIFY_EMAIL, VERIFY_EMAIL_EXPIRED_LINK, CONFIRM_EMAIL_RESENT, | ||
}, | ||
}, | ||
} = ROUTES; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
'Insurance - Account - Create - Confirm email page - expired token - As an Exporter I want to verify my email address for account creation, So that I can activate my email address and use it to create a digital service account with UKEF', | ||
() => { | ||
let url; | ||
let account; | ||
|
||
before(() => { | ||
cy.deleteAccount(); | ||
|
||
cy.navigateToUrl(START); | ||
|
||
cy.submitEligibilityAndStartAccountCreation(); | ||
cy.completeAndSubmitCreateAccountForm(); | ||
|
||
url = `${baseUrl}${CONFIRM_EMAIL}`; | ||
|
||
cy.assertUrl(url); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
}); | ||
|
||
describe(`When a verification token has expired and the user navigates to ${VERIFY_EMAIL} with the expired token`, () => { | ||
let updatedAccount; | ||
|
||
beforeEach(async () => { | ||
/** | ||
* Get the account so that we can use the ID | ||
* to update the verification period. | ||
*/ | ||
const accountEmail = Cypress.env('GOV_NOTIFY_EMAIL_RECIPIENT_1'); | ||
|
||
const accountsResponse = await api.getAccountByEmail(accountEmail); | ||
|
||
const [firstAccount] = accountsResponse; | ||
account = firstAccount; | ||
|
||
/** | ||
* Update the account's verification expiry date via the API, | ||
* so that we can mimic missing the verification period. | ||
*/ | ||
const today = new Date(); | ||
const lastMonth = new Date(today.setMonth(today.getMonth() - 1)); | ||
|
||
const updateObj = { | ||
verificationExpiry: lastMonth, | ||
}; | ||
|
||
updatedAccount = await api.updateAccount(account.id, updateObj); | ||
}); | ||
|
||
it(`should redirect to ${VERIFY_EMAIL_EXPIRED_LINK} and render core page elements and content`, () => { | ||
const { verificationHash } = updatedAccount; | ||
|
||
const verificationUrl = `${VERIFY_EMAIL}?token=${verificationHash}&id=${account.id}`; | ||
|
||
cy.navigateToUrl(`${baseUrl}${verificationUrl}`); | ||
|
||
const expectedUrl = `${baseUrl}${VERIFY_EMAIL_EXPIRED_LINK}?id=${account.id}`; | ||
|
||
cy.assertUrl(expectedUrl); | ||
|
||
cy.corePageChecks({ | ||
pageTitle: CONTENT_STRINGS.PAGE_TITLE, | ||
currentHref: verificationUrl, | ||
backLink: `${CONFIRM_EMAIL}?id=${account.id}`, | ||
hasAForm: false, | ||
assertAuthenticatedHeader: false, | ||
submitButtonCopy: CONTENT_STRINGS.REQUEST_NEW_LINK.TEXT, | ||
}); | ||
|
||
// assert body content | ||
cy.checkText(verifyEmailLinkExpiredPage.notVerified(), CONTENT_STRINGS.NOT_VERIFIED); | ||
cy.checkText(verifyEmailLinkExpiredPage.canSendNewLink(), CONTENT_STRINGS.CAN_SEND_NEW_LINK); | ||
}); | ||
|
||
it(`should redirect to ${CONFIRM_EMAIL_RESENT} when submitting the form`, () => { | ||
const { verificationHash } = updatedAccount; | ||
|
||
const verificationUrl = `${VERIFY_EMAIL}?token=${verificationHash}&id=${account.id}`; | ||
|
||
cy.navigateToUrl(`${baseUrl}${verificationUrl}`); | ||
|
||
cy.clickSubmitButton(); | ||
|
||
const expectedUrl = `${baseUrl}${CONFIRM_EMAIL_RESENT}?id=${account.id}`; | ||
cy.assertUrl(expectedUrl); | ||
}); | ||
}); | ||
}, | ||
); |
Oops, something went wrong.