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-3709-3710): export contract - how the contract was awarded - check your answers #2895

Merged
merged 12 commits into from
Aug 6, 2024
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ jobs:
'check-your-answers/export-contract/change-your-answers/about-goods-or-services/*.spec.js',
'check-your-answers/export-contract/change-your-answers/agent/*.spec.js',
'check-your-answers/export-contract/change-your-answers/agent-charges/*.spec.js',
'check-your-answers/export-contract/change-your-answers/how-the-contract-was-awarded/*.spec.js',
'check-your-answers/export-contract/change-your-answers/agent-service/*.spec.js',
'check-your-answers/export-contract/change-your-answers/how-will-you-get-paid/*.spec.js',
'check-your-answers/export-contract/change-your-answers/private-market/*.spec.js',
Expand Down Expand Up @@ -285,6 +286,7 @@ jobs:
'export-contract/change-your-answers/agent/*.spec.js',
'export-contract/change-your-answers/agent-charges/*.spec.js',
'export-contract/change-your-answers/agent-service/*.spec.js',
'export-contract/change-your-answers/how-the-contract-was-awarded/*.spec.js',
'export-contract/change-your-answers/how-will-you-get-paid/*.spec.js',
'export-contract/change-your-answers/private-market/*.spec.js',
'export-contract/check-your-answers/**/*.spec.js',
Expand Down
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

## [2.32.0](https://github.com/UK-Export-Finance/exip/compare/v2.31.0...v2.32.0) (2024-08-05)


### Features

* **EMS-3662:** export contract - how was contract awarded - save and back ([#2892](https://github.com/UK-Export-Finance/exip/issues/2892)) ([8003b9d](https://github.com/UK-Export-Finance/exip/commit/8003b9d66fda8fb75d26877c9fccb9e9c3e753c1))
- **EMS-3662:** export contract - how was contract awarded - save and back ([#2892](https://github.com/UK-Export-Finance/exip/issues/2892)) ([8003b9d](https://github.com/UK-Export-Finance/exip/commit/8003b9d66fda8fb75d26877c9fccb9e9c3e753c1))

## [2.31.0](https://github.com/UK-Export-Finance/exip/compare/v2.30.0...v2.31.0) (2024-08-05)


### Features

* **EMS-3685:** added xlsx for 2 new eligibility fields ([#2884](https://github.com/UK-Export-Finance/exip/issues/2884)) ([3878733](https://github.com/UK-Export-Finance/exip/commit/3878733d3235e38fc20e02e5f0b8d43492990974))
- **EMS-3685:** added xlsx for 2 new eligibility fields ([#2884](https://github.com/UK-Export-Finance/exip/issues/2884)) ([3878733](https://github.com/UK-Export-Finance/exip/commit/3878733d3235e38fc20e02e5f0b8d43492990974))

## [2.30.0](https://github.com/UK-Export-Finance/exip/compare/v2.29.0...v2.30.0) (2024-08-02)

Expand Down
10 changes: 10 additions & 0 deletions e2e-tests/commands/insurance/check-export-contract-summary-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import application from '../../fixtures/application';
import COUNTRIES from '../../fixtures/countries';

const {
HOW_WAS_THE_CONTRACT_AWARDED: { AWARD_METHOD },
ABOUT_GOODS_OR_SERVICES: { DESCRIPTION, FINAL_DESTINATION },
HOW_WILL_YOU_GET_PAID: { PAYMENT_TERMS_DESCRIPTION },
PRIVATE_MARKET: { ATTEMPTED, DECLINED_DESCRIPTION },
Expand All @@ -17,11 +18,20 @@ const {
AGENT_CHARGES: { FIXED_SUM_AMOUNT, FIXED_SUM_CURRENCY_CODE, PERCENTAGE_CHARGE, PAYABLE_COUNTRY_CODE },
} = FIELD_IDS;

const { OPEN_TENDER } = FIELDS.HOW_WAS_THE_CONTRACT_AWARDED[AWARD_METHOD].OPTIONS;

/**
* checkExportContractSummaryList
* "export contract" summary list assertions.
*/
const checkExportContractSummaryList = {
[AWARD_METHOD]: ({ expectedValue = OPEN_TENDER.TEXT }) => {
const fieldId = AWARD_METHOD;

const { expectedKey, expectedChangeLinkText } = getSummaryListField(fieldId, FIELDS.HOW_WAS_THE_CONTRACT_AWARDED);

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

Expand Down
18 changes: 16 additions & 2 deletions e2e-tests/commands/insurance/complete-export-contract-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
* @param {Boolean} agentChargeMethodPercentage: Agent charge method is "percentage"
* @param {Boolean} alternativeCurrency: Should submit an "alternative currency". Defaults to false.
* @param {Boolean} attemptedPrivateMarketCover: Has attempted to insure through the private market
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as "other"
* @param {Boolean} contractAwardedCompetitiveBidding: "How was the contract awarded" method as COMPETITIVE_BIDDING
* @param {Boolean} contractAwardedDirectAward: "How was the contract awarded" method as DIRECT_AWARD
* @param {Boolean} contractAwardedNegotiatedContract: "How was the contract awarded" method as NEGOTIATED_CONTRACT
* @param {Boolean} contractAwardedOpenTender: "How was the contract awarded" method as OPEN_TENDER
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as OTHER
* @param {Boolean} finalDestinationKnown: "Final destination known"
* @param {Boolean} isUsingAgent: Exporter is using an agent
* @param {Boolean} submitCheckYourAnswers: Click export contract "check your answers" submit button
Expand All @@ -21,6 +25,10 @@ const completeExportContractSection = ({
agentChargeMethodPercentage = false,
alternativeCurrency = false,
attemptedPrivateMarketCover = false,
contractAwardedCompetitiveBidding = false,
Zainzzkk marked this conversation as resolved.
Show resolved Hide resolved
contractAwardedDirectAward = false,
contractAwardedNegotiatedContract = false,
contractAwardedOpenTender = true,
contractAwardedOtherMethod = false,
finalDestinationKnown,
isUsingAgent = false,
Expand All @@ -30,7 +38,13 @@ const completeExportContractSection = ({
}) => {
cy.startInsuranceExportContractSection({ viaTaskList });

cy.completeAndSubmitHowWasTheContractAwardedForm({ otherMethod: contractAwardedOtherMethod });
cy.completeAndSubmitHowWasTheContractAwardedForm({
openTender: contractAwardedOpenTender,
negotiatedContract: contractAwardedNegotiatedContract,
directAward: contractAwardedDirectAward,
competitiveBidding: contractAwardedCompetitiveBidding,
otherMethod: contractAwardedOtherMethod,
});

cy.completeAndSubmitAboutGoodsOrServicesForm({ finalDestinationKnown });
cy.completeAndSubmitHowYouWillGetPaidForm({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const { POLICY_TYPE } = APPLICATION;
* @param {Boolean} attemptedPrivateMarketCover: Should submit "yes" to "attempted to insure through the private market" form.
* @param {Boolean} buyerOutstandingPayments: Exporter has outstanding payments with the buyer.
* @param {Boolean} buyerFailedToPayOnTime: Buyer has failed to pay the exporter on the time.
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as "other"
* @param {Boolean} contractAwardedCompetitiveBidding: "How was the contract awarded" method as COMPETITIVE_BIDDING
* @param {Boolean} contractAwardedDirectAward: "How was the contract awarded" method as DIRECT_AWARD
* @param {Boolean} contractAwardedNegotiatedContract: "How was the contract awarded" method as NEGOTIATED_CONTRACT
* @param {Boolean} contractAwardedOpenTender: "How was the contract awarded" method as OPEN_TENDER
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as OTHER
* @param {Boolean} differentPolicyContact: Should submit an application with a different policy contact to the owner.
* @param {Boolean} differentTradingName: Should submit "yes" to "have a different trading name" in the "company details" form.
* @param {Boolean} differentTradingAddress: Should submit "yes" to "trade from a different address" in the "company details" form.
Expand Down Expand Up @@ -50,6 +54,10 @@ const completePrepareApplicationMultiplePolicyType = ({
attemptedPrivateMarketCover = false,
buyerOutstandingPayments = false,
buyerFailedToPayOnTime = false,
contractAwardedCompetitiveBidding = false,
contractAwardedDirectAward = false,
contractAwardedNegotiatedContract = false,
contractAwardedOpenTender = true,
contractAwardedOtherMethod = false,
differentPolicyContact = false,
differentTradingName = false,
Expand Down Expand Up @@ -112,6 +120,10 @@ const completePrepareApplicationMultiplePolicyType = ({
agentChargeMethodPercentage,
alternativeCurrency: alternativeCurrencyExportContract,
attemptedPrivateMarketCover,
contractAwardedCompetitiveBidding,
contractAwardedDirectAward,
contractAwardedNegotiatedContract,
contractAwardedOpenTender,
contractAwardedOtherMethod,
finalDestinationKnown,
isUsingAgent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const { POLICY_TYPE } = FIELD_VALUES;
* @param {Boolean} attemptedPrivateMarketCover: Should submit "yes" to "attempted to insure through the private market" form.
* @param {Boolean} buyerOutstandingPayments: Exporter has outstanding payments with the buyer.
* @param {Boolean} buyerFailedToPayOnTime: Buyer has failed to pay the exporter on the time.
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as "other"
* @param {Boolean} contractAwardedCompetitiveBidding: "How was the contract awarded" method as COMPETITIVE_BIDDING
* @param {Boolean} contractAwardedDirectAward: "How was the contract awarded" method as DIRECT_AWARD
* @param {Boolean} contractAwardedNegotiatedContract: "How was the contract awarded" method as NEGOTIATED_CONTRACT
* @param {Boolean} contractAwardedOpenTender: "How was the contract awarded" method as OPEN_TENDER
* @param {Boolean} contractAwardedOtherMethod: "How was the contract awarded" method as OTHER
* @param {Boolean} differentPolicyContact: Should submit an application with a different policy contact to the owner.
* @param {Boolean} differentTradingName: Should submit "yes" to "have a different trading name" in the "company details" form.
* @param {Boolean} differentTradingAddress: Should submit "yes" to "trade from a different address" in the "company details" form.
Expand Down Expand Up @@ -50,6 +54,10 @@ const completePrepareApplicationSinglePolicyType = ({
attemptedPrivateMarketCover = false,
buyerOutstandingPayments = false,
buyerFailedToPayOnTime = false,
contractAwardedCompetitiveBidding = false,
contractAwardedDirectAward = false,
contractAwardedNegotiatedContract = false,
contractAwardedOpenTender = true,
contractAwardedOtherMethod = false,
differentPolicyContact = false,
differentTradingName = false,
Expand Down Expand Up @@ -112,6 +120,10 @@ const completePrepareApplicationSinglePolicyType = ({
agentChargeMethodPercentage,
alternativeCurrency: alternativeCurrencyExportContract,
attemptedPrivateMarketCover,
contractAwardedOpenTender,
contractAwardedCompetitiveBidding,
contractAwardedDirectAward,
contractAwardedNegotiatedContract,
contractAwardedOtherMethod,
finalDestinationKnown,
isUsingAgent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export const EXPORT_CONTRACT_FIELDS = {
TEXT: OTHER.VALUE,
},
},
SUMMARY: {
TITLE: 'How was the contract awarded',
FORM_TITLE: EXPORT_CONTRACT_FORM_TITLES.ABOUT_THE_EXPORT,
},
},
[OTHER_AWARD_METHOD]: {
MAXIMUM: MAXIMUM_CHARACTERS.EXPORT_CONTRACT.OTHER_AWARD_METHOD,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { summaryList, radios, field } from '../../../../../../../../pages/shared';
import partials from '../../../../../../../../partials';
import FIELD_IDS from '../../../../../../../../constants/field-ids/insurance/export-contract';
import { INSURANCE_ROUTES } from '../../../../../../../../constants/routes/insurance';
import { EXPORT_CONTRACT_FIELDS as FIELDS } from '../../../../../../../../content-strings/fields/insurance/export-contract';

const {
ROOT,
CHECK_YOUR_ANSWERS: { EXPORT_CONTRACT },
} = INSURANCE_ROUTES;

const {
HOW_WAS_THE_CONTRACT_AWARDED: { AWARD_METHOD: FIELD_ID, OTHER_AWARD_METHOD },
} = FIELD_IDS;

const { DIRECT_AWARD, OTHER } = FIELDS.HOW_WAS_THE_CONTRACT_AWARDED[FIELD_ID].OPTIONS;

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

const { taskList } = partials.insurancePartials;

const task = taskList.submitApplication.tasks.checkAnswers;

context(
`Insurance - Export contract - Change your answers - How the contract was awarded - Changing from ${OTHER.TEXT} to ${DIRECT_AWARD.TEXT} and back to ${OTHER.TEXT}`,
() => {
let referenceNumber;
let url;

before(() => {
cy.completeSignInAndGoToApplication({}).then(({ referenceNumber: refNumber }) => {
referenceNumber = refNumber;

cy.completePrepareApplicationSinglePolicyType({
referenceNumber,
contractAwardedOtherMethod: true,
});

task.link().click();

// To get past previous "Check your answers" pages
cy.completeAndSubmitMultipleCheckYourAnswers({ count: 3 });

url = `${baseUrl}${ROOT}/${referenceNumber}${EXPORT_CONTRACT}`;

cy.assertUrl(url);
});
});

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

after(() => {
cy.deleteApplication(referenceNumber);
});

describe(FIELD_ID, () => {
describe(`after changing the answer from ${OTHER.TEXT} to ${DIRECT_AWARD.TEXT} and back to ${OTHER.TEXT}`, () => {
beforeEach(() => {
cy.navigateToUrl(url);

// select DIRECT_AWARD
summaryList.field(FIELD_ID).changeLink().click();
cy.completeAndSubmitHowWasTheContractAwardedForm({ directAward: true });

// select OTHER
summaryList.field(FIELD_ID).changeLink().click();
const selector = radios(OTHER.ID).option;
selector.label().click();
});

it(`should have no value for ${OTHER_AWARD_METHOD} text input`, () => {
cy.checkValue(field(OTHER_AWARD_METHOD), '');
});
});
});
},
);
Loading
Loading