-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DTFS2-7498): refactor amendments E2E tests
- Loading branch information
1 parent
515a1b2
commit ddb0bf7
Showing
16 changed files
with
598 additions
and
190 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
e2e-tests/gef/cypress/e2e/pages/amendments/bank-review-date.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,12 @@ | ||
const bankReviewDate = { | ||
bankReviewDateDay: () => cy.get('[data-cy="bank-review-date-day"]'), | ||
bankReviewDateMonth: () => cy.get('[data-cy="bank-review-date-month"]'), | ||
bankReviewDateYear: () => cy.get('[data-cy="bank-review-date-year"]'), | ||
errorSummary: () => cy.get('[data-cy="error-summary"]'), | ||
bankReviewDateInlineError: () => cy.get('[data-cy="bank-review-date-inline-error"]'), | ||
pageHeading: () => cy.get('[data-cy="page-heading"]'), | ||
backLink: () => cy.get('[data-cy="back-link"]'), | ||
cancelLink: () => cy.get('[data-cy="cancel-link"]'), | ||
}; | ||
|
||
module.exports = bankReviewDate; |
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
139 changes: 139 additions & 0 deletions
139
...journeys/portal/amendments/journeys/change-both-cover-end-date-and-facility-value.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,139 @@ | ||
import relative from '../../../../relativeURL'; | ||
import MOCK_USERS from '../../../../../../../e2e-fixtures/portal-users.fixture'; | ||
import { MOCK_APPLICATION_AIN_DRAFT } from '../../../../../../../e2e-fixtures/gef/mocks/mock-deals'; | ||
import { anIssuedCashFacility } from '../../../../../../../e2e-fixtures/mock-gef-facilities'; | ||
import { applicationPreview } from '../../../../../../../gef/cypress/e2e/pages'; | ||
import whatDoYouNeedToChange from '../../../../../../../gef/cypress/e2e/pages/amendments/what-do-you-need-to-change'; | ||
import coverEndDate from '../../../../../../../gef/cypress/e2e/pages/amendments/cover-end-date'; | ||
import doYouHaveAFacilityEndDate from '../../../../../../../gef/cypress/e2e/pages/amendments/do-you-have-a-facility-end-date'; | ||
import facilityEndDate from '../../../../../../../gef/cypress/e2e/pages/amendments/facility-end-date'; | ||
import eligibility from '../../../../../../../gef/cypress/e2e/pages/amendments/eligibility'; | ||
import facilityValue from '../../../../../../../gef/cypress/e2e/pages/amendments/facility-value'; | ||
|
||
const { BANK1_MAKER1 } = MOCK_USERS; | ||
|
||
context('Amendments - Change both cover end date and facility value - full journey', () => { | ||
/** | ||
* @type {string} | ||
*/ | ||
let dealId; | ||
|
||
/** | ||
* @type {string} | ||
*/ | ||
let facilityId; | ||
/** | ||
* @type {string} | ||
*/ | ||
let amendmentId; | ||
/** | ||
* @type {Date} | ||
*/ | ||
const mockFacility = anIssuedCashFacility({ facilityEndDateEnabled: true }); | ||
|
||
before(() => { | ||
cy.insertOneGefDeal(MOCK_APPLICATION_AIN_DRAFT, BANK1_MAKER1).then((insertedDeal) => { | ||
dealId = insertedDeal._id; | ||
|
||
cy.updateGefDeal(dealId, MOCK_APPLICATION_AIN_DRAFT, BANK1_MAKER1); | ||
|
||
cy.createGefFacilities(dealId, [mockFacility], BANK1_MAKER1).then((createdFacility) => { | ||
facilityId = createdFacility.details._id; | ||
cy.makerLoginSubmitGefDealForReview(insertedDeal); | ||
cy.checkerLoginSubmitGefDealToUkef(insertedDeal); | ||
|
||
cy.clearSessionCookies(); | ||
cy.login(BANK1_MAKER1); | ||
cy.saveSession(); | ||
cy.visit(relative(`/gef/application-details/${dealId}`)); | ||
|
||
applicationPreview.makeAChangeButton(facilityId).click(); | ||
|
||
cy.url().then((url) => { | ||
const urlSplit = url.split('/'); | ||
|
||
amendmentId = urlSplit[9]; | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
cy.clearCookies(); | ||
cy.clearSessionCookies(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.clearSessionCookies(); | ||
cy.login(BANK1_MAKER1); | ||
}); | ||
|
||
it('should navigate through the journey correctly', () => { | ||
cy.visit(relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/what-do-you-need-to-change`)); | ||
|
||
whatDoYouNeedToChange.coverEndDateCheckbox().should('not.be.checked'); | ||
whatDoYouNeedToChange.facilityValueCheckbox().should('not.be.checked'); | ||
whatDoYouNeedToChange.pageHeading().contains('What do you need to change?'); | ||
whatDoYouNeedToChange.backLink(); | ||
whatDoYouNeedToChange.warning().contains('Check your records for the most up-to-date values'); | ||
|
||
whatDoYouNeedToChange.coverEndDateCheckbox().click(); | ||
whatDoYouNeedToChange.facilityValueCheckbox().click(); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/cover-end-date`)); | ||
|
||
coverEndDate.pageHeading().contains('New cover end date'); | ||
coverEndDate.backLink(); | ||
|
||
cy.completeDateFormFields({ idPrefix: 'cover-end-date' }); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/do-you-have-a-facility-end-date`)); | ||
|
||
doYouHaveAFacilityEndDate.noRadioButton().should('not.be.checked'); | ||
doYouHaveAFacilityEndDate.yesRadioButton().should('not.be.checked'); | ||
doYouHaveAFacilityEndDate.pageHeading().contains('Do you have a facility end date?'); | ||
doYouHaveAFacilityEndDate.backLink(); | ||
|
||
doYouHaveAFacilityEndDate.yesRadioButton().click(); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/facility-end-date`)); | ||
|
||
facilityEndDate.pageHeading().contains('Facility end date'); | ||
facilityEndDate.backLink(); | ||
|
||
cy.completeDateFormFields({ idPrefix: 'facility-end-date' }); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/facility-value`)); | ||
|
||
facilityValue.pageHeading().contains('New facility value'); | ||
facilityValue.backLink(); | ||
facilityValue.facilityValuePrefix().contains('£'); | ||
|
||
cy.keyboardInput(facilityValue.facilityValue(), '10000'); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/eligibility`)); | ||
|
||
eligibility.pageHeading().contains('Eligibility'); | ||
eligibility.backLink(); | ||
|
||
eligibility.allTrueRadioButtons().should('not.be.checked'); | ||
eligibility.allFalseRadioButtons().should('not.be.checked'); | ||
|
||
eligibility.criterionRadiosText(1).contains('The Facility is not an Affected Facility'); | ||
eligibility.criterionRadiosText(2).contains('Neither the Exporter, nor its UK Parent Obligor is an Affected Person'); | ||
|
||
eligibility.allTrueRadioButtons().click({ multiple: true }); | ||
cy.clickContinueButton(); | ||
|
||
cy.url().should('eq', relative(`/gef/application-details/${dealId}/facilities/${facilityId}/amendments/${amendmentId}/effective-date`)); | ||
|
||
// TODO DTFS2-7524: add steps for effective from date | ||
|
||
// TODO DTFS2-7519: add steps for check your answer page | ||
}); | ||
}); |
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
Oops, something went wrong.