-
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.
fix(EMS-3234): no PDF - Export contract - Fixed sum amount - decimal …
…number data saving (#2653) * feat(EMS-3234): fixed decimal issue by changing sql field type and transforming number * feat(EMS-3234): fixed check your answers and tests * feat(EMS-3234): lint fix * fix(EMS-3234): code and test improvements --------- Co-authored-by: Zain Kassam <zkassam@ukexportfinance.gov.uk>
- Loading branch information
Showing
31 changed files
with
508 additions
and
55 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
63 changes: 63 additions & 0 deletions
63
...ummary-list-fully-populated-with-agent-charges-fixed-sum-decimals-multiple-policy.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,63 @@ | ||
import partials from '../../../../../../../partials'; | ||
import { INSURANCE_ROUTES } from '../../../../../../../constants/routes/insurance'; | ||
import { assertFullyPopulatedExportContractSummaryListRows } from '../../../../../../../shared-test-assertions'; | ||
|
||
const { | ||
ROOT: INSURANCE_ROOT, | ||
CHECK_YOUR_ANSWERS: { EXPORT_CONTRACT }, | ||
} = INSURANCE_ROUTES; | ||
|
||
const { taskList } = partials.insurancePartials; | ||
|
||
const task = taskList.submitApplication.tasks.checkAnswers; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
'Insurance - Change your answers - Export contract - Summary list - total contract value threshold, private insurance attempt, using an agent, agent is charging - fixed sum method with decimal places - multiple policy', | ||
() => { | ||
let referenceNumber; | ||
let url; | ||
|
||
const fixedSumAmount = '1000.50'; | ||
|
||
before(() => { | ||
cy.completeSignInAndGoToApplication({ totalContractValueOverThreshold: true }).then(({ referenceNumber: refNumber }) => { | ||
referenceNumber = refNumber; | ||
|
||
cy.completePrepareApplicationMultiplePolicyType({ | ||
referenceNumber, | ||
totalContractValueOverThreshold: true, | ||
attemptedPrivateMarketCover: true, | ||
isUsingAgent: true, | ||
agentIsCharging: true, | ||
agentChargeMethodFixedSum: true, | ||
finalDestinationKnown: true, | ||
agentChargeFixedSumAmount: fixedSumAmount, | ||
}); | ||
|
||
task.link().click(); | ||
|
||
// To get past previous "Check your answers" pages | ||
cy.completeAndSubmitMultipleCheckYourAnswers({ count: 3 }); | ||
|
||
url = `${baseUrl}${INSURANCE_ROOT}/${referenceNumber}${EXPORT_CONTRACT}`; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
|
||
cy.navigateToUrl(url); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteApplication(referenceNumber); | ||
}); | ||
|
||
assertFullyPopulatedExportContractSummaryListRows({ | ||
agentChargeMethodFixedSum: true, | ||
agentChargeFixedSumAmount: fixedSumAmount, | ||
}); | ||
}, | ||
); |
63 changes: 63 additions & 0 deletions
63
...k-your-answers-summary-list-fully-populated-with-agent-charges-fixed-sum-decimals.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,63 @@ | ||
import partials from '../../../../../../../partials'; | ||
import { INSURANCE_ROUTES } from '../../../../../../../constants/routes/insurance'; | ||
import { assertFullyPopulatedExportContractSummaryListRows } from '../../../../../../../shared-test-assertions'; | ||
|
||
const { | ||
ROOT: INSURANCE_ROOT, | ||
CHECK_YOUR_ANSWERS: { EXPORT_CONTRACT }, | ||
} = INSURANCE_ROUTES; | ||
|
||
const { taskList } = partials.insurancePartials; | ||
|
||
const task = taskList.submitApplication.tasks.checkAnswers; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context( | ||
'Insurance - Change your answers - Export contract - Summary list - total contract value threshold, private insurance attempt, using an agent, agent is chraging - fixed sum method with decimal places', | ||
() => { | ||
let referenceNumber; | ||
let url; | ||
|
||
const fixedSumAmount = '1000.50'; | ||
|
||
before(() => { | ||
cy.completeSignInAndGoToApplication({ totalContractValueOverThreshold: true }).then(({ referenceNumber: refNumber }) => { | ||
referenceNumber = refNumber; | ||
|
||
cy.completePrepareApplicationSinglePolicyType({ | ||
referenceNumber, | ||
totalContractValueOverThreshold: true, | ||
attemptedPrivateMarketCover: true, | ||
isUsingAgent: true, | ||
agentIsCharging: true, | ||
agentChargeMethodFixedSum: true, | ||
finalDestinationKnown: true, | ||
agentChargeFixedSumAmount: fixedSumAmount, | ||
}); | ||
|
||
task.link().click(); | ||
|
||
// To get past previous "Check your answers" pages | ||
cy.completeAndSubmitMultipleCheckYourAnswers({ count: 3 }); | ||
|
||
url = `${baseUrl}${INSURANCE_ROOT}/${referenceNumber}${EXPORT_CONTRACT}`; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
|
||
cy.navigateToUrl(url); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteApplication(referenceNumber); | ||
}); | ||
|
||
assertFullyPopulatedExportContractSummaryListRows({ | ||
agentChargeMethodFixedSum: true, | ||
agentChargeFixedSumAmount: fixedSumAmount, | ||
}); | ||
}, | ||
); |
76 changes: 76 additions & 0 deletions
76
.../journeys/export-contract/agent-charges/agent-charges-fixed-sum-amount-as-decimal.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_IDS from '../../../../../../constants/field-ids/insurance/export-contract'; | ||
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; | ||
|
||
const { | ||
ROOT, | ||
EXPORT_CONTRACT: { AGENT_CHARGES, CHECK_YOUR_ANSWERS }, | ||
} = INSURANCE_ROUTES; | ||
|
||
const { | ||
AGENT_CHARGES: { METHOD, FIXED_SUM }, | ||
} = FIELD_IDS; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context('Insurance - Export contract - Agent charges page - Fixed sum amount as decimal', () => { | ||
let referenceNumber; | ||
let url; | ||
let checkYourAnswersUrl; | ||
|
||
before(() => { | ||
cy.completeSignInAndGoToApplication({}).then(({ referenceNumber: refNumber }) => { | ||
referenceNumber = refNumber; | ||
|
||
// go to the page we want to test. | ||
cy.startInsuranceExportContractSection({}); | ||
cy.completeAndSubmitAboutGoodsOrServicesForm({}); | ||
cy.completeAndSubmitHowYouWillGetPaidForm({}); | ||
cy.completeAndSubmitAgentForm({ isUsingAgent: true }); | ||
cy.completeAndSubmitAgentDetailsForm({}); | ||
cy.completeAndSubmitAgentServiceForm({ agentIsCharging: true }); | ||
|
||
url = `${baseUrl}${ROOT}/${referenceNumber}${AGENT_CHARGES}`; | ||
checkYourAnswersUrl = `${baseUrl}${ROOT}/${referenceNumber}${CHECK_YOUR_ANSWERS}`; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteApplication(referenceNumber); | ||
}); | ||
|
||
describe('form submission', () => { | ||
beforeEach(() => { | ||
cy.navigateToUrl(url); | ||
}); | ||
|
||
describe(`when submitting with ${METHOD} as ${FIXED_SUM} as a decimal number`, () => { | ||
const fixedSumAmount = '100.54'; | ||
|
||
it(`should redirect to ${CHECK_YOUR_ANSWERS}`, () => { | ||
cy.completeAndSubmitAgentChargesForm({ fixedSumMethod: true, fixedSumAmount }); | ||
|
||
cy.assertUrl(checkYourAnswersUrl); | ||
}); | ||
|
||
it('should update the `export contract` task status to `completed`', () => { | ||
cy.navigateToAllSectionsUrl(referenceNumber); | ||
|
||
cy.checkTaskExportContractStatusIsComplete(); | ||
}); | ||
|
||
describe('when going back to the page', () => { | ||
beforeEach(() => { | ||
cy.navigateToUrl(url); | ||
}); | ||
|
||
it('should have the submitted values', () => { | ||
cy.assertAgentChargesFieldValues({ fixedSumMethod: true, expectedFixedSumAmount: fixedSumAmount }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.