Skip to content

Commit

Permalink
Merge pull request #3476 from UK-Export-Finance/fix/EMS-4100-quote
Browse files Browse the repository at this point in the history
fix(EMS-4100): country risk logic - quote - no online support
  • Loading branch information
abhi-markan authored Jan 15, 2025
2 parents cfa9d11 + b894451 commit 306fd7b
Show file tree
Hide file tree
Showing 66 changed files with 504 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ jobs:
'/*.spec.js',
'cookies-consent/**/*.spec.js',
'quote/*.spec.js',
'quote/buyer-body/*.spec.js',
'quote/type-of-buyer/*.spec.js',
'quote/buyer-country/*.spec.js',
'quote/cannot-skip-flow/*.spec.js',
'quote/change-your-answers/*.spec.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const completeAndSubmitBuyerCountryForm = ({ countryName = ONLINE_SUPPORT
cy.keyboardInput(autoCompleteField(FIELD_ID).input(), countryName);
const results = autoCompleteField(FIELD_ID).results();
results.first().click();

cy.clickSubmitButton();
};

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/constants/field-ids/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const FIELD_IDS = {
...SHARED,
ELIGIBILITY: {
...SHARED_ELIGIBILITY_FIELD_IDS,
VALID_BUYER_BODY: 'validBuyerBody',
VALID_TYPE_OF_BUYER: 'validBuyerBody',
COUNTRY: 'country',
AMOUNT_CURRENCY: 'amountAndCurrency',
CURRENCY: 'currency',
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/constants/routes/insurance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const INSURANCE_ROUTES = {
CHECK_YOUR_ANSWERS: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/check-your-answers`,
ELIGIBLE_TO_APPLY_ONLINE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/eligible-to-apply-online`,
HAVE_AN_ACCOUNT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/do-you-have-an-account`,
NEED_TO_START_AGAIN: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/need-to-start-again`,
NEED_TO_START_AGAIN_EXIT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/need-to-start-again`,
TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/talk-to-an-export-finance-manager`,
PARTY_TO_CONSORTIUM: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium`,
PARTY_TO_CONSORTIUM_CHANGE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium/change`,
Expand Down
6 changes: 4 additions & 2 deletions e2e-tests/constants/routes/quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const QUOTE_ROUTES = {

ROOT: '/quote',

BUYER_BODY: '/quote/type-of-buyer',
TYPE_OF_BUYER: '/quote/type-of-buyer',

BUYER_COUNTRY: '/quote/buyer-country',
BUYER_COUNTRY_CHANGE: '/quote/buyer-country/change',
Expand All @@ -26,7 +26,9 @@ export const QUOTE_ROUTES = {

GET_A_QUOTE_BY_EMAIL: '/quote/get-quote-by-email',

TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: '/quote/talk-to-an-export-finance-manager',

YOUR_QUOTE: '/quote/your-quote',

NEED_TO_START_AGAIN: '/quote/need-to-start-again',
NEED_TO_START_AGAIN_EXIT: '/quote/need-to-start-again',
};
2 changes: 1 addition & 1 deletion e2e-tests/content-strings/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ERROR_MESSAGES = {
THERE_IS_A_PROBLEM: 'There is a problem',
ELIGIBILITY: {
[FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY]: 'Select where your buyer is based',
[FIELD_IDS.ELIGIBILITY.VALID_BUYER_BODY]: 'Select if your buyer is a government or public sector body',
[FIELD_IDS.ELIGIBILITY.VALID_TYPE_OF_BUYER]: 'Select if your buyer is a government or public sector body',
[FIELD_IDS.ELIGIBILITY.VALID_EXPORTER_LOCATION]: "Select whether you're exporting from a business base in the UK, Channel Islands, Isle of Man or not",
[FIELD_IDS.ELIGIBILITY.HAS_MINIMUM_UK_GOODS_OR_SERVICES]: {
IS_EMPTY: 'Select whether at least 20% of your export contract value is made up from UK goods or services or not',
Expand Down
18 changes: 16 additions & 2 deletions e2e-tests/content-strings/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ const CANNOT_APPLY_EXIT = {
ACTIONS,
};

const TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT = {
PAGE_TITLE: 'Talk to an export finance manager',
INTRO: "We do not normally offer short term cover for the country you've selected.",
CONTACT_EFM: {
INTRO: 'You might still be able to apply for credit insurance through UKEF - contact',
LINK: {
TEXT: 'your nearest export finance manager',
HREF: LINKS.EXTERNAL.EXPORT_FINANCE_MANAGERS,
},
TEXT: `to learn more about your options.`,
},
};

const ACCESSIBILITY_STATEMENT_PAGE = {
PAGE_TITLE: 'Apply for credit insurance - accessibility statement',
HEADING: 'Apply for credit insurance - accessibility statement',
Expand Down Expand Up @@ -165,7 +178,7 @@ const COOKIES_SAVED_PAGE = {
BODY: 'You can change your preferences at any time.',
};

const NEED_TO_START_AGAIN_EXIT = {
const NEED_TO_START_AGAIN_EXIT_EXIT = {
PAGE_TITLE: 'You need to start again',
REASON: 'This is because you have not yet answered all the eligibility questions.',
};
Expand Down Expand Up @@ -218,10 +231,11 @@ const PAGES = {
EXPORTER_LOCATION,
UK_GOODS_OR_SERVICES,
CANNOT_APPLY_EXIT,
TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT,
ACCESSIBILITY_STATEMENT_PAGE,
COOKIES_PAGE,
COOKIES_SAVED_PAGE,
NEED_TO_START_AGAIN_EXIT,
NEED_TO_START_AGAIN_EXIT_EXIT,
PAGE_NOT_FOUND_PAGE,
PROBLEM_WITH_SERVICE_PAGE,
CONTACT_US_PAGE,
Expand Down
10 changes: 4 additions & 6 deletions e2e-tests/content-strings/pages/quote.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LINKS } from '../links';

const BUYER_BODY = {
const TYPE_OF_BUYER = {
PAGE_TITLE: 'Is your buyer a government or public sector body?',
DETAILS: {
INTRO: 'What counts as a government or public sector body?',
Expand Down Expand Up @@ -57,10 +57,8 @@ const CANNOT_APPLY_EXIT = {
const GET_A_QUOTE_BY_EMAIL = {
PAGE_TITLE: 'You need to get a quote by email',
REASON: {
BUYER_BODY: 'We cannot give you a quote online because your buyer is a government or public sector body.',
BUYER_BODY_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.',
BUYER_COUNTRY: 'We cannot give you a quote online because of the country where your buyer is based.',
BUYER_COUNTRY_DESCRIPTION: "We can still give you a quote but may need extra information from you to assess the risks around your buyer's country first.",
TYPE_OF_BUYER: 'We cannot give you a quote online because your buyer is a government or public sector body.',
TYPE_OF_BUYER_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.',
},
ACTION: [
[
Expand Down Expand Up @@ -126,7 +124,7 @@ const YOUR_QUOTE = {
};

const QUOTE = {
BUYER_BODY,
TYPE_OF_BUYER,
POLICY_TYPE,
TELL_US_ABOUT_YOUR_POLICY,
CHECK_YOUR_ANSWERS,
Expand Down
7 changes: 6 additions & 1 deletion e2e-tests/fixtures/countries.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const AGO = {

export const ARG = {
NAME: 'Argentina',
ISO_CODE: 'AGO',
ISO_CODE: 'ARG',
};

export const BLZ = {
Expand Down Expand Up @@ -86,6 +86,11 @@ const NOT_SUPPORTED_4 = NCL;
export const COUNTRY_QUOTE_SUPPORT = {
ONLINE_SUPPORT_1,
NO_ONLINE_SUPPORT_1,
NO_ONLINE_SUPPORT_2,
NO_ONLINE_SUPPORT_3,
NO_ONLINE_SUPPORT_4,
NO_ONLINE_SUPPORT_5,
NO_ONLINE_SUPPORT_6,
NOT_SUPPORTED_1,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

const {
ELIGIBILITY: { BUYER_COUNTRY, NEED_TO_START_AGAIN },
ELIGIBILITY: { BUYER_COUNTRY, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -12,7 +12,7 @@ context('Manually going to the `Buyer country` page via URL without completing t
});

it('should redirect to the `need to start again` exit page', () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

const {
ELIGIBILITY: { COMPANIES_HOUSE_NUMBER, NEED_TO_START_AGAIN },
ELIGIBILITY: { COMPANIES_HOUSE_NUMBER, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -12,7 +12,7 @@ context('Manually going to the `Companies house number` page via URL without com
});

it('should redirect to the `need to start again` exit page', () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ROUTES } from '../../../../../../constants';

const {
INSURANCE: {
ELIGIBILITY: { COVER_PERIOD, NEED_TO_START_AGAIN },
ELIGIBILITY: { COVER_PERIOD, NEED_TO_START_AGAIN_EXIT },
},
} = ROUTES;

Expand All @@ -14,7 +14,7 @@ context('Manually going to the `Cover period` page via URL without completing th
});

it('should redirect to the `need to start again` exit page', () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

const {
ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN },
ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -11,8 +11,8 @@ context('Manually going to the `Eligible to apply online` page via URL without c
cy.navigateToUrl(ELIGIBLE_TO_APPLY_ONLINE);
});

it(`should redirect to ${NEED_TO_START_AGAIN}`, () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
it(`should redirect to ${NEED_TO_START_AGAIN_EXIT}`, () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ROUTES } from '../../../../../../constants';

const {
INSURANCE: {
ELIGIBILITY: { TOTAL_VALUE_INSURED, NEED_TO_START_AGAIN },
ELIGIBILITY: { TOTAL_VALUE_INSURED, NEED_TO_START_AGAIN_EXIT },
},
} = ROUTES;

Expand All @@ -14,7 +14,7 @@ context('Manually going to the `total value insured` page via URL without comple
});

it('should redirect to the `need to start again` exit page', () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

const {
ELIGIBILITY: { UK_GOODS_OR_SERVICES, NEED_TO_START_AGAIN },
ELIGIBILITY: { UK_GOODS_OR_SERVICES, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -12,7 +12,7 @@ context('Manually going to the `UK goods or services` page via URL without compl
});

it('should redirect to the `need to start again` exit page', () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

const {
ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN },
ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -26,8 +26,8 @@ context('Insurance - Eligibility - You are eligible to apply online page - user
cy.deleteAccount();
});

it(`should redirect to ${NEED_TO_START_AGAIN}`, () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
it(`should redirect to ${NEED_TO_START_AGAIN_EXIT}`, () => {
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { needToStartAgainPage } from '../../../../../pages/shared';
import { LINKS, PAGES } from '../../../../../content-strings';
import { INSURANCE_ROUTES } from '../../../../../constants/routes/insurance';

const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT;
const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT_EXIT;

const {
ELIGIBILITY: { BUYER_COUNTRY, EXPORTER_LOCATION, NEED_TO_START_AGAIN },
ELIGIBILITY: { BUYER_COUNTRY, EXPORTER_LOCATION, NEED_TO_START_AGAIN_EXIT },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand All @@ -24,15 +24,15 @@ context('Insurance Eligibility - Need to start again exit page', () => {

cy.navigateToUrl(buyerCountryUrl);

const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`;
const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`;

cy.assertUrl(expectedUrl);
});

it('renders core page elements', () => {
cy.corePageChecks({
pageTitle: CONTENT_STRINGS.PAGE_TITLE,
currentHref: NEED_TO_START_AGAIN,
currentHref: NEED_TO_START_AGAIN_EXIT,
backLink: BUYER_COUNTRY,
assertBackLink: false,
submitButtonCopy: LINKS.START_AGAIN.TEXT,
Expand Down
10 changes: 0 additions & 10 deletions e2e-tests/pages/quote/buyerBody.js

This file was deleted.

10 changes: 10 additions & 0 deletions e2e-tests/pages/quote/typeOfBuyer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const typeOfBuyerPage = {
description: {
summary: () => cy.get('[data-cy="type-of-buyer"] summary'),
details: () => cy.get('[data-cy="type-of-buyer"]'),
body1: () => cy.get('[data-cy="details-body-1"]'),
body2: () => cy.get('[data-cy="details-body-2"]'),
},
};

export default typeOfBuyerPage;

This file was deleted.

Loading

0 comments on commit 306fd7b

Please sign in to comment.