Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(EMS-3668-69-73-74): eligibility - Party to consortium and Member of a group #2832

Merged
merged 12 commits into from
Jul 30, 2024
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ jobs:
'eligibility/end-buyer/**/*.spec.js',
'eligibility/exporter-location/**/*.spec.js',
'eligibility/have-an-account/**/*.spec.js',
'eligibility/member-of-a-group/**/*.spec.js',
'eligibility/no-companies-house-number/**/*.spec.js',
'eligibility/party-to-consortium/**/*.spec.js',
'eligibility/total-value-insured/**/*.spec.js',
'eligibility/uk-goods-or-services/**/*.spec.js',
'export-contract/about-goods-or-services/**/*.spec.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const completeAndSubmitAllInsuranceEligibilityAnswers = ({ companyNumber = COMPA
cy.completeCoverPeriodForm({});
cy.completeUkGoodsAndServicesForm();
cy.completeEndBuyerForm();
cy.completePartyToConsortiumForm();
cy.completeMemberOfAGroupForm();
};

export default completeAndSubmitAllInsuranceEligibilityAnswers;
8 changes: 8 additions & 0 deletions e2e-tests/commands/insurance/eligibility/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ export const completeEndBuyerForm = () => {
selectRadioAndSubmit(FIELD_VALUES.NO);
};

export const completePartyToConsortiumForm = () => {
selectRadioAndSubmit(FIELD_VALUES.NO);
};

export const completeMemberOfAGroupForm = () => {
selectRadioAndSubmit(FIELD_VALUES.NO);
};

export const submitCheckYourAnswers = () => {
cy.clickSubmitButton();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ const submitAnswersFromExporterLocationHappyPath = ({ assertAuthenticatedHeader

checkAuthHeader(assertAuthenticatedHeader);

cy.completePartyToConsortiumForm();

checkAuthHeader(assertAuthenticatedHeader);

cy.completeMemberOfAGroupForm();

checkAuthHeader(assertAuthenticatedHeader);

cy.submitCheckYourAnswers();

checkAuthHeader(assertAuthenticatedHeader);
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/commands/shared-commands/eligibility/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
completeCoverPeriodForm,
completeUkGoodsAndServicesForm,
completeEndBuyerForm,
completeMemberOfAGroupForm,
completePartyToConsortiumForm,
submitCheckYourAnswers,
completeEligibleToApplyOnlineForm,
completeAccountToApplyOnlineForm,
Expand All @@ -22,6 +24,8 @@ Cypress.Commands.add('completeAndSubmitTotalValueInsuredForm', completeAndSubmit
Cypress.Commands.add('completeCoverPeriodForm', completeCoverPeriodForm);
Cypress.Commands.add('completeUkGoodsAndServicesForm', completeUkGoodsAndServicesForm);
Cypress.Commands.add('completeEndBuyerForm', completeEndBuyerForm);
Cypress.Commands.add('completePartyToConsortiumForm', completePartyToConsortiumForm);
Cypress.Commands.add('completeMemberOfAGroupForm', completeMemberOfAGroupForm);
Cypress.Commands.add('submitCheckYourAnswers', submitCheckYourAnswers);
Cypress.Commands.add('completeEligibleToApplyOnlineForm', completeEligibleToApplyOnlineForm);
Cypress.Commands.add('completeAccountToApplyOnlineForm', completeAccountToApplyOnlineForm);
Expand Down
2 changes: 2 additions & 0 deletions e2e-tests/constants/field-ids/insurance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const INSURANCE_FIELD_IDS = {
HAS_END_BUYER: 'hasEndBuyer',
HAVE_AN_ACCOUNT: 'haveAnAccount',
HAS_REVIEWED_ELIGIBILITY: 'hasReviewedEligibility',
IS_PARTY_TO_CONSORTIUM: 'isPartyToConsortium',
IS_MEMBER_OF_A_GROUP: 'isMemberOfAGroup',
},
...SHARED_FIELD_IDS,
CURRENCY: {
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/constants/routes/insurance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export const INSURANCE_ROUTES = {
HAVE_AN_ACCOUNT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/do-you-have-an-account`,
NEED_TO_START_AGAIN: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/need-to-start-again`,
CONTRACT_TOO_SHORT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/contract-too-short`,
PARTY_TO_CONSORTIUM: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium`,
PARTY_TO_CONSORTIUM_CHANGE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium/change`,
MEMBER_OF_A_GROUP: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/member-of-a-group`,
MEMBER_OF_A_GROUP_CHANGE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/member-of-a-group/change`,
},
PAGE_NOT_FOUND: `${INSURANCE_ROOT}/page-not-found`,
NO_ACCESS_TO_APPLICATION: `${INSURANCE_ROOT}/no-access-to-application`,
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/content-strings/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ export const ERROR_MESSAGES = {
[FIELD_IDS.INSURANCE.ELIGIBILITY.HAVE_AN_ACCOUNT]: {
IS_EMPTY: 'Select if you have a UK Export Finance account',
},
[FIELD_IDS.INSURANCE.ELIGIBILITY.IS_PARTY_TO_CONSORTIUM]: {
IS_EMPTY: 'Select if you are or will be party to any consortium in connection to the export contract',
},
[FIELD_IDS.INSURANCE.ELIGIBILITY.IS_MEMBER_OF_A_GROUP]: {
IS_EMPTY: 'Select if you are a member of a group that was involved with the negotiating or obtaining the export contract',
},
},
EXPORTER_BUSINESS: {
[FIELD_IDS.INSURANCE.EXPORTER_BUSINESS.YOUR_COMPANY.HAS_DIFFERENT_TRADING_NAME]: {
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/content-strings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export * from './fields';
export * from './form-titles';
export * from './header';
export * from './links';
export * from './member-of-a-group-description';
export * from './phase-banner';
export * from './private-market-why-description';
export * from './product';
Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/content-strings/member-of-a-group-description.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const MEMBER_OF_A_GROUP_DESCRIPTION = {
INTRO: 'What counts as a member of a group?',
DESCRIPTION:
'For this purpose, a company or organisation is a member of a group if, directly or indirectly, it controls or is controlled by another company or organisation either through majority voting share ownership or equivalent or by virtue of contractual arrangements of any kind.',
};
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,12 @@ export const CONTRACT_TOO_SHORT = {
TEXT: `to learn more about your options. If you have any questions, get in touch with our team at ${UKEF_CONTACT_DETAILS.EMAIL.UNDERWRITING}.`,
},
};

export const PARTY_TO_CONSORTIUM = {
PAGE_TITLE: 'Are you, or will you be a party to any consortium in connection with the performance or financing of any part of the export contract(s)?',
};

export const MEMBER_OF_A_GROUP = {
PAGE_TITLE:
'Are you are a member of a group of which another member has, or is intended to have, a material part in negotiating or obtaining the export contract(s)?',
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import checkSummaryList from '../../../../../../commands/insurance/check-your-an
const CONTENT_STRINGS = PAGES.INSURANCE.ELIGIBILITY.CHECK_YOUR_ANSWERS;

const {
ELIGIBILITY: { END_BUYER, CHECK_YOUR_ANSWERS, ELIGIBLE_TO_APPLY_ONLINE },
ELIGIBILITY: { MEMBER_OF_A_GROUP, CHECK_YOUR_ANSWERS, ELIGIBLE_TO_APPLY_ONLINE },
} = INSURANCE_ROUTES;

const {
Expand Down Expand Up @@ -42,7 +42,7 @@ context(
cy.corePageChecks({
pageTitle: CONTENT_STRINGS.PAGE_TITLE,
currentHref: CHECK_YOUR_ANSWERS,
backLink: END_BUYER,
backLink: MEMBER_OF_A_GROUP,
assertAuthenticatedHeader: false,
submitButtonCopy: BUTTONS.CONFIRM_AND_CONTINUE,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { body } from '../../../../../../pages/shared';
import { insurance } from '../../../../../../pages';
import { PAGES } from '../../../../../../content-strings';
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';
import { completeAndSubmitBuyerCountryForm } from '../../../../../../commands/forms';

const CONTENT_STRINGS = PAGES.INSURANCE.ELIGIBILITY.ELIGIBLE_TO_APPLY_ONLINE;

Expand All @@ -18,18 +17,8 @@ context(
let url;

before(() => {
cy.navigateToCheckIfEligibleUrl();
cy.completeCheckIfEligibleForm();

cy.completeExporterLocationForm();
cy.completeCompaniesHouseNumberForm();
cy.completeAndSubmitCompaniesHouseSearchForm({});
cy.completeEligibilityCompanyDetailsForm();
completeAndSubmitBuyerCountryForm({});
cy.completeAndSubmitTotalValueInsuredForm({});
cy.completeCoverPeriodForm({});
cy.completeUkGoodsAndServicesForm();
cy.completeEndBuyerForm();
cy.completeAndSubmitAllInsuranceEligibilityAnswers({});

cy.submitCheckYourAnswers();

url = `${baseUrl}${ELIGIBLE_TO_APPLY_ONLINE}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
} = INSURANCE_FIELD_IDS;

const {
ELIGIBILITY: { END_BUYER, UK_GOODS_OR_SERVICES, CHECK_YOUR_ANSWERS, CANNOT_APPLY_MULTIPLE_RISKS },
ELIGIBILITY: { END_BUYER, UK_GOODS_OR_SERVICES, PARTY_TO_CONSORTIUM, CANNOT_APPLY_MULTIPLE_RISKS },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');
Expand Down Expand Up @@ -124,8 +124,8 @@ context(
cy.clickSubmitButton();
});

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

cy.assertUrl(expectedUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { yesRadio, noRadio } from '../../../../../../pages/shared';
import partials from '../../../../../../partials/insurance';
import { PAGES, MEMBER_OF_A_GROUP_DESCRIPTION, ERROR_MESSAGES } from '../../../../../../content-strings';
import { FIELD_VALUES } from '../../../../../../constants';
import { INSURANCE_FIELD_IDS } from '../../../../../../constants/field-ids/insurance';
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';
import { completeAndSubmitBuyerCountryForm } from '../../../../../../commands/forms';

const { memberOfAGroup } = partials;

const CONTENT_STRINGS = PAGES.INSURANCE.ELIGIBILITY.MEMBER_OF_A_GROUP;

const {
ELIGIBILITY: { IS_MEMBER_OF_A_GROUP: FIELD_ID },
} = INSURANCE_FIELD_IDS;

const {
ELIGIBILITY: { PARTY_TO_CONSORTIUM, MEMBER_OF_A_GROUP, CHECK_YOUR_ANSWERS, LONG_TERM_COVER },
} = INSURANCE_ROUTES;

const baseUrl = Cypress.config('baseUrl');

context(
'Insurance - Member of a group page - As a legal adviser, I want to know whether an Exporter was a member of a Group when they procured the export contract So that I know whether other parties are involved in the obtaining of the export contract',
() => {
const url = `${baseUrl}${MEMBER_OF_A_GROUP}`;

before(() => {
cy.navigateToCheckIfEligibleUrl();
cy.completeCheckIfEligibleForm();
cy.completeExporterLocationForm();
cy.completeCompaniesHouseNumberForm();
cy.completeAndSubmitCompaniesHouseSearchForm({});
cy.completeEligibilityCompanyDetailsForm();
completeAndSubmitBuyerCountryForm({});
cy.completeAndSubmitTotalValueInsuredForm({});
cy.completeCoverPeriodForm({});
cy.completeUkGoodsAndServicesForm();
cy.completeEndBuyerForm();
cy.completePartyToConsortiumForm();

cy.assertUrl(url);
});

beforeEach(() => {
cy.saveSession();
});

it('renders core page elements', () => {
cy.corePageChecks({
pageTitle: CONTENT_STRINGS.PAGE_TITLE,
currentHref: MEMBER_OF_A_GROUP,
backLink: PARTY_TO_CONSORTIUM,
assertAuthenticatedHeader: false,
});
});

describe('page tests', () => {
beforeEach(() => {
cy.navigateToUrl(url);
});

it('renders `yes` radio button', () => {
yesRadio().input().should('exist');

cy.checkText(yesRadio().label(), FIELD_VALUES.YES);
});

it('renders `no` radio button', () => {
cy.checkText(noRadio().label(), FIELD_VALUES.NO);

cy.checkRadioInputNoAriaLabel(CONTENT_STRINGS.PAGE_TITLE);
});

describe(`expandable details - ${MEMBER_OF_A_GROUP_DESCRIPTION.INTRO}`, () => {
it('renders summary text', () => {
cy.checkText(memberOfAGroup.summary(), MEMBER_OF_A_GROUP_DESCRIPTION.INTRO);

memberOfAGroup.details().should('not.have.attr', 'open');
});

describe('when clicking the summary text', () => {
it('should expand the collapsed `details` content', () => {
memberOfAGroup.summary().click();
memberOfAGroup.details().should('have.attr', 'open');

cy.checkText(memberOfAGroup.description(), MEMBER_OF_A_GROUP_DESCRIPTION.DESCRIPTION);
});
});
});
});

describe('when submitting an empty form', () => {
beforeEach(() => {
cy.navigateToUrl(url);
});

it('should render validation errors', () => {
const expectedErrorsCount = 1;

cy.submitAndAssertRadioErrors({
field: yesRadio(FIELD_ID),
expectedErrorsCount,
expectedErrorMessage: ERROR_MESSAGES.INSURANCE.ELIGIBILITY[FIELD_ID].IS_EMPTY,
});
});
});

describe('when submitting the answer as `No`', () => {
beforeEach(() => {
cy.navigateToUrl(url);

cy.clickNoRadioInput();
cy.clickSubmitButton();
});

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

cy.assertUrl(expectedUrl);
});

describe('when going back to the page', () => {
it('should have the originally submitted answer selected', () => {
cy.clickBackLink();

cy.assertNoRadioOptionIsChecked();
});
});
});

describe('when submitting the answer as `yes`', () => {
beforeEach(() => {
cy.navigateToUrl(url);

cy.clickYesRadioInput();
cy.clickSubmitButton();
});

it(`should redirect to ${LONG_TERM_COVER}`, () => {
ttbarnes marked this conversation as resolved.
Show resolved Hide resolved
const expectedUrl = `${baseUrl}${LONG_TERM_COVER}`;

cy.assertUrl(expectedUrl);
});
});
},
);
Loading
Loading