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-3676): eligibility - Check your answers - Member of group and party to consortium #2852

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

## [2.23.0](https://github.com/UK-Export-Finance/exip/compare/v2.22.0...v2.23.0) (2024-07-30)


### Features

* **EMS-3660:** export contract - how was contract awarded - UI setup ([#2837](https://github.com/UK-Export-Finance/exip/issues/2837)) ([5884388](https://github.com/UK-Export-Finance/exip/commit/58843888123744b0272abd9d15a53946ce5ac96f))
- **EMS-3660:** export contract - how was contract awarded - UI setup ([#2837](https://github.com/UK-Export-Finance/exip/issues/2837)) ([5884388](https://github.com/UK-Export-Finance/exip/commit/58843888123744b0272abd9d15a53946ce5ac96f))

## [2.22.0](https://github.com/UK-Export-Finance/exip/compare/v2.21.0...v2.22.0) (2024-07-30)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const {
VALID_EXPORTER_LOCATION,
HAS_COMPANIES_HOUSE_NUMBER,
HAS_END_BUYER,
IS_MEMBER_OF_A_GROUP,
IS_PARTY_TO_CONSORTIUM,
} = FIELD_IDS.INSURANCE.ELIGIBILITY;

const { COMPANY_NAME } = FIELD_IDS.INSURANCE.COMPANIES_HOUSE;
Expand Down Expand Up @@ -100,6 +102,22 @@ const checkYourAnswersEligibilitySummaryList = {
const { expectedKey, expectedChangeLinkText } = getSummaryListField(fieldId, FIELDS);
const expectedValue = FIELD_VALUES.NO;

cy.assertSummaryListRow(summaryList, fieldId, expectedKey, expectedValue, expectedChangeLinkText);
},
[IS_MEMBER_OF_A_GROUP]: () => {
const fieldId = IS_MEMBER_OF_A_GROUP;

const { expectedKey, expectedChangeLinkText } = getSummaryListField(fieldId, FIELDS);
const expectedValue = FIELD_VALUES.NO;

cy.assertSummaryListRow(summaryList, fieldId, expectedKey, expectedValue, expectedChangeLinkText);
},
[IS_PARTY_TO_CONSORTIUM]: () => {
const fieldId = IS_PARTY_TO_CONSORTIUM;

const { expectedKey, expectedChangeLinkText } = getSummaryListField(fieldId, FIELDS);
const expectedValue = FIELD_VALUES.NO;

cy.assertSummaryListRow(summaryList, fieldId, expectedKey, expectedValue, expectedChangeLinkText);
},
};
Expand Down
12 changes: 12 additions & 0 deletions e2e-tests/content-strings/fields/insurance/eligibility/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const {
TOTAL_CONTRACT_VALUE: TOTAL_CONTRACT_VALUE_FIELD_ID,
HAS_END_BUYER,
HAS_COMPANIES_HOUSE_NUMBER,
IS_PARTY_TO_CONSORTIUM,
IS_MEMBER_OF_A_GROUP,
} = FIELD_IDS.INSURANCE.ELIGIBILITY;

const { COMPANY_NAME } = FIELD_IDS.INSURANCE.COMPANIES_HOUSE;
Expand Down Expand Up @@ -92,4 +94,14 @@ export const FIELDS_ELIGIBILITY = {
BELOW: `Below ${THRESHOLD}`,
},
},
[IS_PARTY_TO_CONSORTIUM]: {
SUMMARY: {
TITLE: 'Is a consortium involved?',
},
},
[IS_MEMBER_OF_A_GROUP]: {
SUMMARY: {
TITLE: 'Are you a member of a group?',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';
import { INSURANCE_FIELD_IDS } from '../../../../../../constants/field-ids/insurance';
import { summaryList } from '../../../../../../pages/shared';

const { IS_MEMBER_OF_A_GROUP } = INSURANCE_FIELD_IDS.ELIGIBILITY;

const {
ELIGIBILITY: { MEMBER_OF_A_GROUP_CHANGE, CHECK_YOUR_ANSWERS, LONG_TERM_COVER },
} = INSURANCE_ROUTES;

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

context(
'Insurance - Eligibility - Change your answers - Party to consortium - As an exporter, I want to change my answers to the eligibility party to consortium section',
() => {
const url = `${baseUrl}${CHECK_YOUR_ANSWERS}`;

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

cy.completeAndSubmitAllInsuranceEligibilityAnswers({});

cy.assertUrl(url);
});

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

const fieldId = IS_MEMBER_OF_A_GROUP;

describe('when clicking the `change` link', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();
});

it(`should redirect to ${MEMBER_OF_A_GROUP_CHANGE}`, () => {
cy.assertChangeAnswersPageUrl({ route: MEMBER_OF_A_GROUP_CHANGE, fieldId, isInsuranceEligibility: true });
});

it(`should have the "no" radio selected`, () => {
cy.assertNoRadioOptionIsChecked();
});
});

describe('form submission without changing the answer', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();

cy.clickSubmitButton();
});

it(`should redirect to ${CHECK_YOUR_ANSWERS}`, () => {
cy.assertChangeAnswersPageUrl({ route: CHECK_YOUR_ANSWERS, fieldId, isInsuranceEligibility: true });
});
});

describe('form submission with a new answer', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();

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

it(`should redirect to ${LONG_TERM_COVER}`, () => {
cy.assertChangeAnswersPageUrl({ route: LONG_TERM_COVER, fieldId, isInsuranceEligibility: true });
});
Zainzzkk marked this conversation as resolved.
Show resolved Hide resolved
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';
import { INSURANCE_FIELD_IDS } from '../../../../../../constants/field-ids/insurance';
import { summaryList } from '../../../../../../pages/shared';

const { IS_PARTY_TO_CONSORTIUM } = INSURANCE_FIELD_IDS.ELIGIBILITY;

const {
ELIGIBILITY: { PARTY_TO_CONSORTIUM_CHANGE, CHECK_YOUR_ANSWERS, LONG_TERM_COVER },
} = INSURANCE_ROUTES;

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

context(
'Insurance - Eligibility - Change your answers - Party to consortium - As an exporter, I want to change my answers to the eligibility party to consortium section',
() => {
const url = `${baseUrl}${CHECK_YOUR_ANSWERS}`;

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

cy.completeAndSubmitAllInsuranceEligibilityAnswers({});

cy.assertUrl(url);
});

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

const fieldId = IS_PARTY_TO_CONSORTIUM;

describe('when clicking the `change` link', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();
});

it(`should redirect to ${PARTY_TO_CONSORTIUM_CHANGE}`, () => {
cy.assertChangeAnswersPageUrl({ route: PARTY_TO_CONSORTIUM_CHANGE, fieldId, isInsuranceEligibility: true });
});

it(`should have the "no" radio selected`, () => {
cy.assertNoRadioOptionIsChecked();
});
});

describe('form submission without changing the answer', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();

cy.clickSubmitButton();
});

it(`should redirect to ${CHECK_YOUR_ANSWERS}`, () => {
cy.assertChangeAnswersPageUrl({ route: CHECK_YOUR_ANSWERS, fieldId, isInsuranceEligibility: true });
});
});

describe('form submission with a new answer', () => {
beforeEach(() => {
cy.navigateToUrl(url);

summaryList.field(fieldId).changeLink().click();

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

it(`should redirect to ${LONG_TERM_COVER}`, () => {
cy.assertChangeAnswersPageUrl({ route: LONG_TERM_COVER, fieldId, isInsuranceEligibility: true });
});
Zainzzkk marked this conversation as resolved.
Show resolved Hide resolved
});
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const {
VALID_EXPORTER_LOCATION,
HAS_COMPANIES_HOUSE_NUMBER,
HAS_END_BUYER,
IS_PARTY_TO_CONSORTIUM,
IS_MEMBER_OF_A_GROUP,
} = INSURANCE_FIELD_IDS.ELIGIBILITY;

const { COMPANY_NAME } = INSURANCE_FIELD_IDS.COMPANIES_HOUSE;
Expand Down Expand Up @@ -92,6 +94,14 @@ context(
checkSummaryList[HAS_END_BUYER]();
});

it(`should render a ${IS_PARTY_TO_CONSORTIUM} summary list row`, () => {
checkSummaryList[IS_PARTY_TO_CONSORTIUM]();
});

it(`should render a ${IS_MEMBER_OF_A_GROUP} summary list row`, () => {
checkSummaryList[IS_MEMBER_OF_A_GROUP]();
});

describe('form submission', () => {
it(`should redirect to ${ELIGIBLE_TO_APPLY_ONLINE}`, () => {
cy.clickSubmitButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { BUYER_COUNTRY, HAS_MINIMUM_UK_GOODS_OR_SERVICES } = INSURANCE_FIELD_IDS.

const { COVER_PERIOD: COVER_PERIOD_FIELD_ID, HAS_COMPANIES_HOUSE_NUMBER, COMPANIES_HOUSE_NUMBER, VALID_EXPORTER_LOCATION } = INSURANCE_FIELD_IDS.ELIGIBILITY;

const { TOTAL_CONTRACT_VALUE: TOTAL_CONTRACT_VALUE_FIELD_ID, HAS_END_BUYER } = INSURANCE_FIELD_IDS.ELIGIBILITY;
const { TOTAL_CONTRACT_VALUE: TOTAL_CONTRACT_VALUE_FIELD_ID, HAS_END_BUYER, IS_MEMBER_OF_A_GROUP, IS_PARTY_TO_CONSORTIUM } = INSURANCE_FIELD_IDS.ELIGIBILITY;

const { COMPANY_NAME } = INSURANCE_FIELD_IDS.COMPANIES_HOUSE;

Expand Down Expand Up @@ -88,4 +88,14 @@ export const FIELDS_ELIGIBILITY = {
BELOW: `Below ${THRESHOLD}`,
},
},
[IS_PARTY_TO_CONSORTIUM]: {
SUMMARY: {
TITLE: 'Is a consortium involved?',
},
},
[IS_MEMBER_OF_A_GROUP]: {
SUMMARY: {
TITLE: 'Are you a member of a group?',
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const {
VALID_EXPORTER_LOCATION,
TOTAL_CONTRACT_VALUE,
HAS_END_BUYER,
IS_PARTY_TO_CONSORTIUM,
IS_MEMBER_OF_A_GROUP,
} = FIELD_IDS;

const { COMPANY_NUMBER, COMPANY_NAME } = COMPANIES_HOUSE;
Expand All @@ -34,6 +36,8 @@ const {
COVER_PERIOD_CHANGE,
UK_GOODS_OR_SERVICES_CHANGE,
END_BUYER_CHANGE,
PARTY_TO_CONSORTIUM_CHANGE,
MEMBER_OF_A_GROUP_CHANGE,
},
} = INSURANCE_ROUTES;

Expand Down Expand Up @@ -162,6 +166,38 @@ describe('server/helpers/summary-lists/eligibility/eligibility-fields', () => {
},
mapYesNoField(mockAnswers[HAS_END_BUYER]),
),
fieldGroupItem(
{
field: getFieldById(FIELDS_ELIGIBILITY, IS_PARTY_TO_CONSORTIUM),
data: mockAnswers,
href: generateChangeLink(
PARTY_TO_CONSORTIUM_CHANGE,
checkAndChangeLink,
`#${IS_PARTY_TO_CONSORTIUM}-label`,
referenceNumber,
isCheckAndChange,
isEligibility,
),
renderChangeLink: true,
},
mapYesNoField(mockAnswers[IS_PARTY_TO_CONSORTIUM]),
),
fieldGroupItem(
{
field: getFieldById(FIELDS_ELIGIBILITY, IS_MEMBER_OF_A_GROUP),
data: mockAnswers,
href: generateChangeLink(
MEMBER_OF_A_GROUP_CHANGE,
checkAndChangeLink,
`#${IS_MEMBER_OF_A_GROUP}-label`,
referenceNumber,
isCheckAndChange,
isEligibility,
),
renderChangeLink: true,
},
mapYesNoField(mockAnswers[IS_MEMBER_OF_A_GROUP]),
),
];

it('should return fields and values from the submitted data/mockAnswers', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const {
VALID_EXPORTER_LOCATION,
TOTAL_CONTRACT_VALUE,
HAS_END_BUYER,
IS_PARTY_TO_CONSORTIUM,
IS_MEMBER_OF_A_GROUP,
} = FIELD_IDS;

const { COMPANY_NUMBER, COMPANY_NAME } = COMPANIES_HOUSE;
Expand All @@ -33,6 +35,8 @@ const {
COVER_PERIOD_CHANGE,
UK_GOODS_OR_SERVICES_CHANGE,
END_BUYER_CHANGE,
PARTY_TO_CONSORTIUM_CHANGE,
MEMBER_OF_A_GROUP_CHANGE,
},
} = INSURANCE_ROUTES;

Expand Down Expand Up @@ -177,6 +181,38 @@ const generateEligibilityFields = (answers: InsuranceEligibility) => {
},
mapYesNoField(answers[HAS_END_BUYER]),
),
fieldGroupItem(
{
field: getFieldById(FIELDS_ELIGIBILITY, IS_PARTY_TO_CONSORTIUM),
data: answers,
href: generateChangeLink(
PARTY_TO_CONSORTIUM_CHANGE,
checkAndChangeLink,
`#${IS_PARTY_TO_CONSORTIUM}-label`,
referenceNumber,
isCheckAndChange,
isInsuranceEligibility,
),
renderChangeLink: true,
},
mapYesNoField(answers[IS_PARTY_TO_CONSORTIUM]),
),
fieldGroupItem(
{
field: getFieldById(FIELDS_ELIGIBILITY, IS_MEMBER_OF_A_GROUP),
data: answers,
href: generateChangeLink(
MEMBER_OF_A_GROUP_CHANGE,
checkAndChangeLink,
`#${IS_MEMBER_OF_A_GROUP}-label`,
referenceNumber,
isCheckAndChange,
isInsuranceEligibility,
),
renderChangeLink: true,
},
mapYesNoField(answers[IS_MEMBER_OF_A_GROUP]),
),
] as Array<SummaryListItemData>;

return fields;
Expand Down
Loading
Loading