-
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-3520): no pdf - dashboard - policy currency code (#2641)
* fix(EMS-3520): no pdf - dashboard - policy currency code * fix(EMS-3520): no pdf - dashboard - policy currency code * fix(EMS-3520): improve test description * fix(EMS-3520): linting issues * fix(EMS-3520): fix linting issues
- Loading branch information
Showing
9 changed files
with
196 additions
and
18 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
113 changes: 113 additions & 0 deletions
113
...e/cypress/e2e/journeys/dashboard/dashboard-populated-application-non-gbp-currency.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,113 @@ | ||
import dashboardPage from '../../../../../pages/insurance/dashboard'; | ||
import partials from '../../../../../partials'; | ||
import { PAGES } from '../../../../../content-strings'; | ||
import { ROUTES, FIELD_VALUES } from '../../../../../constants'; | ||
import { POLICY as FIELD_IDS } from '../../../../../constants/field-ids/insurance/policy'; | ||
import application from '../../../../../fixtures/application'; | ||
import { NON_STANDARD_CURRENCY_CODE } from '../../../../../fixtures/currencies'; | ||
import formatCurrency from '../../../../../helpers/format-currency'; | ||
|
||
const { table } = dashboardPage; | ||
|
||
const { DASHBOARD } = ROUTES.INSURANCE; | ||
|
||
const CONTENT_STRINGS = PAGES.INSURANCE.DASHBOARD; | ||
|
||
const { TABLE_HEADERS } = CONTENT_STRINGS; | ||
|
||
const { | ||
CONTRACT_POLICY: { | ||
SINGLE: { TOTAL_CONTRACT_VALUE }, | ||
}, | ||
EXPORT_VALUE: { | ||
MULTIPLE: { MAXIMUM_BUYER_WILL_OWE }, | ||
}, | ||
} = FIELD_IDS; | ||
|
||
context('Insurance - Dashboard - populated application - alternative (non GBP) currency', () => { | ||
const baseUrl = Cypress.config('baseUrl'); | ||
let referenceNumber; | ||
let url; | ||
|
||
before(() => { | ||
cy.completeSignInAndGoToApplication({}).then(({ referenceNumber: refNumber }) => { | ||
referenceNumber = refNumber; | ||
|
||
url = `${baseUrl}${DASHBOARD}`; | ||
|
||
partials.header.navigation.applications().click(); | ||
|
||
cy.assertUrl(url); | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.saveSession(); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteApplication(referenceNumber); | ||
}); | ||
|
||
describe('when completing the `policy - tell us about your policy` form - single policy type', () => { | ||
beforeEach(() => { | ||
const policyType = FIELD_VALUES.POLICY_TYPE.SINGLE; | ||
|
||
cy.navigateToUrl(url); | ||
|
||
// go to application | ||
table.body.row(referenceNumber).submittedLink().click(); | ||
|
||
// go to the 'policy' section via task list | ||
cy.startInsurancePolicySection({}); | ||
|
||
// complete the first form - single contract policy | ||
cy.completeAndSubmitPolicyTypeForm({ policyType }); | ||
|
||
// complete and submit the next 2 forms | ||
cy.completeAndSubmitSingleContractPolicyForm({ alternativeCurrency: true, chooseCurrency: true }); | ||
cy.completeAndSubmitTotalContractValueForm({}); | ||
}); | ||
|
||
it(`should render a formatted value of ${TOTAL_CONTRACT_VALUE} in the ${TABLE_HEADERS.VALUE} cell`, () => { | ||
partials.header.navigation.applications().click(); | ||
|
||
const cell = table.body.row(referenceNumber).value(); | ||
|
||
const expected = formatCurrency(application.POLICY[TOTAL_CONTRACT_VALUE], NON_STANDARD_CURRENCY_CODE); | ||
|
||
cy.checkText(cell, expected); | ||
}); | ||
}); | ||
|
||
describe('when completing the `policy - tell us about your policy` form - multiple policy type', () => { | ||
beforeEach(() => { | ||
cy.navigateToUrl(url); | ||
|
||
const policyType = FIELD_VALUES.POLICY_TYPE.MULTIPLE; | ||
|
||
// go to application | ||
table.body.row(referenceNumber).submittedLink().click(); | ||
|
||
// go to the 'policy' section via task list | ||
cy.startInsurancePolicySection({}); | ||
|
||
// complete the first form - single contract policy | ||
cy.completeAndSubmitPolicyTypeForm({ policyType }); | ||
|
||
// complete and submit the next 2 forms | ||
cy.completeAndSubmitMultipleContractPolicyForm({ alternativeCurrency: true, chooseCurrency: true }); | ||
cy.completeAndSubmitExportValueForm({ policyType }); | ||
}); | ||
|
||
it(`should render a formatted value of ${MAXIMUM_BUYER_WILL_OWE} in the ${TABLE_HEADERS.VALUE} cell`, () => { | ||
partials.header.navigation.applications().click(); | ||
|
||
const cell = table.body.row(referenceNumber).value(); | ||
|
||
const expected = formatCurrency(application.POLICY[MAXIMUM_BUYER_WILL_OWE], NON_STANDARD_CURRENCY_CODE); | ||
|
||
cy.checkText(cell, expected); | ||
}); | ||
}); | ||
}); |
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