Skip to content

Commit

Permalink
Merge branch 'main-iterations' into feat/EMS-3877
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes committed Oct 2, 2024
2 parents 98e84ec + 1a59d47 commit 6455407
Show file tree
Hide file tree
Showing 103 changed files with 830 additions and 306 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,8 @@ jobs:
'export-contract/agent-details/**/*.spec.js',
'export-contract/agent-service/**/*.spec.js',
'export-contract/agent-charges/**/*.spec.js',
# TODO: EMS-3828 - renable
# 'export-contract/currency-of-agent-charges/*.spec.js',
'export-contract/currency-of-agent-charges/*.spec.js',
'export-contract/how-much-the-agent-is-charging/**/*.spec.js',
'export-contract/change-your-answers/about-goods-or-services/*.spec.js',
'export-contract/change-your-answers/agent/*.spec.js',
'export-contract/change-your-answers/agent-charges/*.spec.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ const { CURRENCY_CODE } = INSURANCE_FIELD_IDS.CURRENCY;
* if alternativeCurrency true, then enters alternative currency and submits alternative currency form
* @param {String} isoCode: isoCode for radio selection.
* @param {Boolean} alternativeCurrency: If alternative currency should be entered.
* @param {Boolean} clickAlternativeCurrencyLink: if the "Alternative currency" link should be clicked.
*/
const completeAndSubmitAlternativeCurrencyForm = ({ isoCode, alternativeCurrency, clickAlternativeCurrencyLink = true }) => {
const completeAndSubmitAlternativeCurrencyForm = ({ isoCode, alternativeCurrency = true }) => {
if (isoCode) {
if (clickAlternativeCurrencyLink) {
cy.clickProvideAlternativeCurrencyLink();
}

radios(CURRENCY_CODE, isoCode).option.label().click();
cy.clickSubmitButton();
}

if (alternativeCurrency) {
if (clickAlternativeCurrencyLink) {
cy.clickProvideAlternativeCurrencyLink();
}

cy.clickAlternativeCurrencyRadioAndSubmitCurrency({ currency: isoCode });
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* completeAndSubmitHowMuchTheAgentIsChargingForm
* Complete and submit the "How much the agent is charging" form
* @param {String} fixedSumAmount: Fixed sum amount
*/
const completeAndSubmitHowMuchTheAgentIsChargingForm = ({ fixedSumAmount }) => {
cy.completeHowMuchTheAgentIsChargingForm({ fixedSumAmount });

cy.clickSubmitButton();
};

export default completeAndSubmitHowMuchTheAgentIsChargingForm;
3 changes: 1 addition & 2 deletions e2e-tests/commands/insurance/complete-business-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const completeBusinessSection = ({
hasCreditControlProcess = false,
submitCheckYourAnswers = false,
alternativeCurrencyTurnover = false,
clickAlternativeCurrencyLink,
}) => {
cy.startYourBusinessSection({ viaTaskList });

Expand All @@ -26,7 +25,7 @@ const completeBusinessSection = ({
}

cy.completeAndSubmitNatureOfYourBusiness();
cy.completeAndSubmitAlternativeCurrencyForm({ alternativeCurrency: alternativeCurrencyTurnover, clickAlternativeCurrencyLink });
cy.completeAndSubmitAlternativeCurrencyForm({ alternativeCurrency: alternativeCurrencyTurnover });
cy.completeAndSubmitTurnoverForm();
cy.completeAndSubmitCreditControlForm({ hasCreditControlProcess });

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/commands/insurance/complete-buyer-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const completeBuyerSection = ({
cy.completeAndSubmitTradingHistoryWithBuyerForm({ outstandingPayments: outstandingPayments || fullyPopulatedBuyerTradingHistory });

if (outstandingPayments || fullyPopulatedBuyerTradingHistory) {
cy.completeAndSubmitAlternativeCurrencyForm({ clickAlternativeCurrencyLink: false });
cy.completeAndSubmitAlternativeCurrencyForm({});
cy.completeAndSubmitOutstandingOrOverduePaymentsForm({ outstandingPayments });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const completeExportContractSection = ({
if (agentChargeMethodFixedSum) {
cy.completeAndSubmitAlternativeCurrencyForm({ alternativeCurrency });

cy.completeAndSubmitHowMuchIsTheAgentChargingForm({
cy.completeAndSubmitHowMuchTheAgentIsChargingForm({
fixedSumAmount: agentChargeFixedSumAmount,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ const {
} = FIELD_IDS;

/**
* completeAndSubmitHowMuchIsTheAgentChargingForm
* Complete and submit the "How much is the agent charging" form
* completeHowMuchTheAgentIsChargingForm
* Complete the "How much the agent is charging" form
* @param {String} fixedSumAmount: Fixed sum amount
*/
const completeAndSubmitHowMuchIsTheAgentChargingForm = ({ fixedSumAmount = application.EXPORT_CONTRACT.AGENT_CHARGES[FIXED_SUM_AMOUNT] }) => {
const completeHowMuchTheAgentIsChargingForm = ({ fixedSumAmount = application.EXPORT_CONTRACT.AGENT_CHARGES[FIXED_SUM_AMOUNT] }) => {
cy.keyboardInput(field(FIXED_SUM_AMOUNT).input(), fixedSumAmount);

cy.clickSubmitButton();
};

export default completeAndSubmitHowMuchIsTheAgentChargingForm;
export default completeHowMuchTheAgentIsChargingForm;
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,13 @@ const completePrepareApplicationMultiplePolicyType = ({
totalContractValueOverThreshold = false,
submitCheckYourAnswers = true,
usingBroker = false,
clickAlternativeCurrencyLink,
}) => {
cy.completeBusinessSection({
differentTradingName,
differentTradingAddress,
hasCreditControlProcess,
submitCheckYourAnswers,
alternativeCurrencyTurnover,
clickAlternativeCurrencyLink,
});

cy.completeBuyerSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,13 @@ const completePrepareApplicationSinglePolicyType = ({
totalContractValueOverThreshold = false,
submitCheckYourAnswers = true,
usingBroker = false,
clickAlternativeCurrencyLink = true,
}) => {
cy.completeBusinessSection({
differentTradingName,
differentTradingAddress,
hasCreditControlProcess,
submitCheckYourAnswers,
alternativeCurrencyTurnover,
clickAlternativeCurrencyLink,
});

cy.completeBuyerSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const completeSignInAndSubmitAnApplication = ({
policyValueOverMvpMaximum = false,
totalContractValueOverThreshold = false,
usingBroker = false,
clickAlternativeCurrencyLink = true,
}) => {
completeSignInAndGoToApplication({
companyNumber,
Expand Down Expand Up @@ -114,7 +113,6 @@ const completeSignInAndSubmitAnApplication = ({
referenceNumber,
totalContractValueOverThreshold,
usingBroker,
clickAlternativeCurrencyLink,
});
} else {
cy.completePrepareApplicationSinglePolicyType({
Expand Down Expand Up @@ -147,7 +145,6 @@ const completeSignInAndSubmitAnApplication = ({
referenceNumber,
totalContractValueOverThreshold,
usingBroker,
clickAlternativeCurrencyLink,
});
}
cy.completeAndSubmitCheckYourAnswers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const completeAndSubmitExportContractForms = ({
steps = [
...steps,
{ name: 'currencyOfAgentCharges', action: () => cy.completeAndSubmitAlternativeCurrencyForm({}) },
{ name: 'howMuchAgentIsCharging', action: () => cy.completeAndSubmitHowMuchIsTheAgentChargingForm({ fixedSumAmount }) },
{ name: 'howMuchAgentIsCharging', action: () => cy.completeAndSubmitHowMuchTheAgentIsChargingForm({ fixedSumAmount }) },
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* completes your buyer forms up to the specified form to stop at
* eg, when 'connectionWithTheBuyer' is passed, it will complete all forms up to and including 'connectionWithTheBuyer'
* @param {Boolean} alternativeCurrency: If alternative currency should be entered.
* @param {Boolean} clickAlternativeCurrencyLink: if the "Alternative currency" link should be clicked.
* @param {Boolean} exporterHasTradedWithBuyer: whether the exporter has traded with the buyer
* @param {Boolean} failedToPay: whether the buyer has failed to pay the exporter
* @param {String} formToStopAt: the form to stop at
Expand All @@ -16,7 +15,6 @@
*/
const completeAndSubmitYourBuyerForms = ({
alternativeCurrency,
clickAlternativeCurrencyLink,
exporterHasTradedWithBuyer,
failedToPay,
formToStopAt,
Expand Down Expand Up @@ -48,7 +46,7 @@ const completeAndSubmitYourBuyerForms = ({
if (outstandingPayments) {
steps.push({
name: 'currencyOfLatePayments',
action: () => cy.completeAndSubmitAlternativeCurrencyForm({ isoCode, alternativeCurrency, clickAlternativeCurrencyLink }),
action: () => cy.completeAndSubmitAlternativeCurrencyForm({ isoCode, alternativeCurrency }),
});
steps.push({ name: 'outstandingOrOverduePayments', action: () => cy.completeAndSubmitOutstandingOrOverduePaymentsForm({ outstandingPayments }) });
}
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion e2e-tests/commands/shared-commands/click-events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Cypress.Commands.add('clickSignInButtonLink', require('./click-sign-in-button-li
Cypress.Commands.add('clickSignInResetPasswordLink', require('./click-sign-in-reset-password-link'));
Cypress.Commands.add('clickYesRadioInput', require('./click-yes-radio-input'));

Cypress.Commands.add('clickProvideAlternativeCurrencyLink', require('./click-provide-alternative-currency-link'));
Cypress.Commands.add('clickAlternativeCurrencyRadioOption', require('./click-alternative-currency-radio-option'));

Cypress.Commands.add('clickFooterAccessibilityStatementLink', require('./click-footer-accessibility-statement-link'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
* Complete and submit an "alternative currency" field
* @param {String} fieldId: Field ID
* @param {String} currency: Currency
* @param {Boolean} viaSaveAndBack: Flag whether to submit the form via the "save and back" button.
*/
const clickAlternativeCurrencyRadioAndSubmitCurrency = ({ fieldId, currency }) => {
const clickAlternativeCurrencyRadioAndSubmitCurrency = ({ fieldId, currency, viaSaveAndBack }) => {
cy.clickAlternativeCurrencyRadioAndCompleteCurrency({ fieldId, currency });

cy.clickSubmitButton();
if (viaSaveAndBack) {
cy.clickSaveAndBackButton();
} else {
cy.clickSubmitButton();
}
};

export default clickAlternativeCurrencyRadioAndSubmitCurrency;
10 changes: 5 additions & 5 deletions e2e-tests/constants/routes/insurance/export-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AGENT_DETAILS_ROOT = `${ROOT}/agent-details`;
const AGENT_SERVICE_ROOT = `${ROOT}/agent-service`;
const AGENT_CHARGES_ROOT = `${ROOT}/agent-charges`;
const AGENT_CHARGES_CURRENCY_ROOT = `${ROOT}/currency-of-agents-charge`;
const HOW_MUCH_IS_THE_AGENT_CHARGING_ROOT = `${ROOT}/how-much-is-the-agent-charging`;
const HOW_MUCH_THE_AGENT_IS_CHARGING_ROOT = `${ROOT}/how-much-the-agent-is-charging`;

export const EXPORT_CONTRACT = {
ROOT,
Expand Down Expand Up @@ -53,9 +53,9 @@ export const EXPORT_CONTRACT = {
AGENT_CHARGES_CURRENCY: AGENT_CHARGES_CURRENCY_ROOT,
AGENT_CHARGES_CURRENCY_CHANGE: `${AGENT_CHARGES_CURRENCY_ROOT}/change`,
AGENT_CHARGES_CURRENCY_CHECK_AND_CHANGE: `${AGENT_CHARGES_CURRENCY_ROOT}/check-and-change`,
HOW_MUCH_IS_THE_AGENT_CHARGING_SAVE_AND_BACK: `${HOW_MUCH_IS_THE_AGENT_CHARGING_ROOT}/save-and-go-back`,
HOW_MUCH_IS_THE_AGENT_CHARGING: HOW_MUCH_IS_THE_AGENT_CHARGING_ROOT,
HOW_MUCH_IS_THE_AGENT_CHARGING_CHANGE: `${HOW_MUCH_IS_THE_AGENT_CHARGING_ROOT}/change`,
HOW_MUCH_IS_THE_AGENT_CHARGING_CHECK_AND_CHANGE: `${HOW_MUCH_IS_THE_AGENT_CHARGING_ROOT}/check-and-change`,
HOW_MUCH_THE_AGENT_IS_CHARGING_SAVE_AND_BACK: `${HOW_MUCH_THE_AGENT_IS_CHARGING_ROOT}/save-and-go-back`,
HOW_MUCH_THE_AGENT_IS_CHARGING: HOW_MUCH_THE_AGENT_IS_CHARGING_ROOT,
HOW_MUCH_THE_AGENT_IS_CHARGING_CHANGE: `${HOW_MUCH_THE_AGENT_IS_CHARGING_ROOT}/change`,
HOW_MUCH_THE_AGENT_IS_CHARGING_CHECK_AND_CHANGE: `${HOW_MUCH_THE_AGENT_IS_CHARGING_ROOT}/check-and-change`,
CHECK_YOUR_ANSWERS: `${ROOT}/check-your-answers`,
};
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const AGENT_CHARGES_CURRENCY = {
PAGE_TITLE: 'What currency is the agent charging you in?',
};

const HOW_MUCH_IS_THE_AGENT_CHARGING = {
const HOW_MUCH_THE_AGENT_IS_CHARGING = {
...SHARED,
PAGE_TITLE: 'How much is the agent charging in',
};
Expand All @@ -88,6 +88,6 @@ module.exports = {
AGENT_SERVICE,
AGENT_CHARGES,
AGENT_CHARGES_CURRENCY,
HOW_MUCH_IS_THE_AGENT_CHARGING,
HOW_MUCH_THE_AGENT_IS_CHARGING,
CHECK_YOUR_ANSWERS,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ context('Insurance - submit an application - Multiple policy - fully populated b
differentTradingAddress: true,
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
usingBroker: true,
clickAlternativeCurrencyLink: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ context(
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
alternativeCurrencyTurnover: true,
clickAlternativeCurrencyLink: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { APPLICATION } from '../../../../../../../constants';

// TODO: EMS-3828 - renable
context.skip('Insurance - submit an application - Multiple policy type, using an agent, fixed sum method, alternative currency', () => {
context('Insurance - submit an application - Multiple policy type, using an agent, fixed sum method, alternative currency', () => {
let referenceNumber;

before(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ context('Insurance - submit an application - Single policy - fully populated bus
differentTradingName: true,
differentTradingAddress: true,
usingBroker: true,
clickAlternativeCurrencyLink: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ context(
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({ alternativeCurrencyTurnover: true, clickAlternativeCurrencyLink: false }).then((refNumber) => {
cy.completeSignInAndSubmitAnApplication({ alternativeCurrencyTurnover: true }).then((refNumber) => {
referenceNumber = refNumber;
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
// TODO: EMS-3828 - renable
context.skip(
'Insurance - submit an application - Single policy type, attempted private market cover, using an agent, agent is charging - fixed sum method',
() => {
let referenceNumber;
context('Insurance - submit an application - Single policy type, attempted private market cover, using an agent, agent is charging - fixed sum method', () => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
totalContractValueOverThreshold: true,
attemptedPrivateMarketCover: true,
isUsingAgent: true,
agentIsCharging: true,
agentChargeMethodFixedSum: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
before(() => {
cy.completeSignInAndSubmitAnApplication({
totalContractValueOverThreshold: true,
attemptedPrivateMarketCover: true,
isUsingAgent: true,
agentIsCharging: true,
agentChargeMethodFixedSum: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});

it('should render in a `submitted` state in the dashboard', () => {
cy.assertDashboardApplicationSubmitted(referenceNumber);
});
},
);
it('should render in a `submitted` state in the dashboard', () => {
cy.assertDashboardApplicationSubmitted(referenceNumber);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// TODO: EMS-3828 - renable
context.skip('Insurance - submit an application - Single policy type, using an agent, fixed sum method, alternative currency', () => {
context('Insurance - submit an application - Single policy type, using an agent, fixed sum method, alternative currency', () => {
let referenceNumber;

before(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const fieldId = FIXED_SUM_AMOUNT;

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

// TODO: EMS-3828 - renable
context.skip(
context(
`Insurance - Change your answers - Export contract - Summary list - Agent charges - ${FIXED_SUM_AMOUNT} - As an exporter, I want to change my answers to an alternative currency`,
() => {
let referenceNumber;
Expand Down
Loading

0 comments on commit 6455407

Please sign in to comment.