-
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, creation - unverified email…
… enhancements (#2540) * feat(EMS-1027): no pdf - account sign in - resend verification email if unverified * feat(EMS-1027): account creation - resend verification email if exisiting unverified account * feat(EMS-1027): no pdf - account creation - e2e tests * feat(EMS-1027): fix linting issues * feat(EMS-1027): fix linting issues * feat(EMS-1027): fix/update unit tests * feat(EMS-1027): no pdf - account sign in - mark account is inActive=false after generating otp * feat(EMS-1027): no pdf - account creation - render 'account exists' validation errors * feat(EMS-1027): fix typo * feat(EMS-1027): address todo comment * feat(EMS-1027): remove commented code * feat(EMS-1027): fix linting issues * feat(EMS-1027): documentation improvements * feat(EMS-1027): fix/update create an account cypress command
- Loading branch information
Showing
107 changed files
with
1,642 additions
and
804 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
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
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
76 changes: 76 additions & 0 deletions
76
...create-your-details-validation-account-already-exists-unverified-invalid-password.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,76 @@ | ||
import { field as fieldSelector } from '../../../../../../../pages/shared'; | ||
import { ERROR_MESSAGES } from '../../../../../../../content-strings'; | ||
import { INSURANCE_FIELD_IDS } from '../../../../../../../constants/field-ids/insurance'; | ||
import { ACCOUNT as ACCOUNT_ROUTES } from '../../../../../../../constants/routes/insurance/account'; | ||
import mockAccount from '../../../../../../../fixtures/account'; | ||
|
||
const { | ||
CREATE: { YOUR_DETAILS }, | ||
} = ACCOUNT_ROUTES; | ||
|
||
const { | ||
ACCOUNT: { EMAIL, PASSWORD }, | ||
} = INSURANCE_FIELD_IDS; | ||
|
||
const { | ||
INSURANCE: { | ||
ACCOUNT: { | ||
CREATE: { YOUR_DETAILS: YOUR_DETAILS_ERROR_MESSAGES }, | ||
}, | ||
}, | ||
} = ERROR_MESSAGES; | ||
|
||
const invalidPassword = `${mockAccount[PASSWORD]}-invalid`; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
'Insurance - Account - Create - Your details page - Account already exists - unverified - invalid password - As an Exporter, I want the system to verify that the email address that I register against my UKEF digital service account is unique, So that I can be sure that the system does not have multiple digital service accounts with the same email address', | ||
() => { | ||
let url; | ||
|
||
before(() => { | ||
cy.deleteAccount(); | ||
|
||
url = `${baseUrl}${YOUR_DETAILS}`; | ||
|
||
cy.navigateToUrl(url); | ||
|
||
// create an account | ||
cy.completeAndSubmitCreateAccountForm(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
}); | ||
|
||
describe('when trying to create an account with an email that already has an account and the provided password is incorrect', () => { | ||
beforeEach(() => { | ||
cy.navigateToUrl(url); | ||
|
||
cy.completeAndSubmitCreateAccountForm({ | ||
[PASSWORD]: invalidPassword, | ||
}); | ||
}); | ||
|
||
it(`should render an ${EMAIL} validation error`, () => { | ||
cy.submitAndAssertFieldErrors({ | ||
field: fieldSelector(EMAIL), | ||
value: mockAccount[EMAIL], | ||
expectedErrorsCount: 2, | ||
expectedErrorMessage: YOUR_DETAILS_ERROR_MESSAGES[EMAIL].ACCOUNT_ALREADY_EXISTS_INCORRECT, | ||
}); | ||
}); | ||
|
||
it(`should render an ${PASSWORD} validation error`, () => { | ||
cy.submitAndAssertFieldErrors({ | ||
field: fieldSelector(PASSWORD), | ||
value: invalidPassword, | ||
errorIndex: 1, | ||
expectedErrorsCount: 2, | ||
expectedErrorMessage: YOUR_DETAILS_ERROR_MESSAGES[PASSWORD].ACCOUNT_ALREADY_EXISTS_INCORRECT, | ||
}); | ||
}); | ||
}); | ||
}, | ||
); |
60 changes: 60 additions & 0 deletions
60
...t-create-your-details-validation-account-already-exists-unverified-valid-password.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,60 @@ | ||
import { ACCOUNT as ACCOUNT_ROUTES } from '../../../../../../../constants/routes/insurance/account'; | ||
import api from '../../../../../../../commands/api'; | ||
import { createDateOneMonthInThePast } from '../../../../../../../helpers/date'; | ||
|
||
const { | ||
CREATE: { YOUR_DETAILS, CONFIRM_EMAIL }, | ||
} = ACCOUNT_ROUTES; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
'Insurance - Account - Create - Your details page - Account already exists - unverified - valid password - As an Exporter, I want the system to verify that the email address that I register against my UKEF digital service account is unique, So that I can be sure that the system does not have multiple digital service accounts with the same email address', | ||
() => { | ||
const yourDetailsUrl = `${baseUrl}${YOUR_DETAILS}`; | ||
const confirmEmailUrl = `${baseUrl}${CONFIRM_EMAIL}`; | ||
let account; | ||
|
||
before(() => { | ||
cy.deleteAccount(); | ||
|
||
cy.navigateToUrl(yourDetailsUrl); | ||
|
||
// create an account | ||
cy.completeAndSubmitCreateAccountForm(); | ||
}); | ||
|
||
describe('when trying to create an account with an email that already has an account and the provided password is correct', () => { | ||
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 updateObj = { | ||
verificationExpiry: createDateOneMonthInThePast(), | ||
}; | ||
|
||
await api.updateAccount(account.id, updateObj); | ||
}); | ||
|
||
it(`should redirect to ${CONFIRM_EMAIL}`, () => { | ||
cy.navigateToUrl(yourDetailsUrl); | ||
|
||
cy.completeAndSubmitCreateAccountForm(); | ||
|
||
cy.assertUrl(confirmEmailUrl); | ||
}); | ||
}); | ||
}, | ||
); |
Oops, something went wrong.