Skip to content

Commit

Permalink
feat(EMS-3345): no PDF - application submission - XLSX - exporter bus…
Browse files Browse the repository at this point in the history
…iness (#2471)

* feat(EMS-3345): no pdf - application submission - XLSX - exporter business

* feat(EMS-3345): fix linting issue

* feat(EMS-3345): no pdf - application submission - XLSX - exporter business - code/test improvements

* feat(EMS-3345): fix linting issues

* feat(EMS-3345): revert package.json change

* feat(EMS-3345): fix/update unit tests

* feat(EMS-3345): address todo comment

* feat(EMS-3345): no pdf - application submission - XLSX - exporter company sic/date ordering

* feat(EMS-3345): no pdf - application submission - XLSX - code/test improvements

* feat(EMS-3345): no pdf - application submission - XLSX - code improvements
  • Loading branch information
ttbarnes authored May 29, 2024
1 parent a67483c commit 30756c8
Show file tree
Hide file tree
Showing 75 changed files with 2,165 additions and 991 deletions.
340 changes: 193 additions & 147 deletions e2e-tests/commands/api/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion e2e-tests/commands/insurance/complete-business-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
* completeBusinessSection
* Complete the "business" section
* @param {Boolean} viaTaskList: Start the "business" section from the task list.
* @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.
* @param {Boolean} hasCreditControlProcess: Flag whether to submit "yes" or "no" radio input in the "credit control" form.
* @param {Boolean} submitCheckYourAnswers: Click policy "check your answers" submit button
*/
const completeBusinessSection = ({
viaTaskList,
differentTradingName = false,
differentTradingAddress = false,
hasCreditControlProcess = false,
submitCheckYourAnswers = false,
}) => {
cy.startYourBusinessSection({ viaTaskList });

cy.completeAndSubmitCompanyDetails({ differentTradingAddress });
cy.completeAndSubmitCompanyDetails({ differentTradingName, differentTradingAddress });

if (differentTradingAddress) {
cy.completeAndSubmitAlternativeTradingAddressForm({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { POLICY_TYPE } = APPLICATION;
* completePrepareApplicationMultiplePolicyType
* Runs through the full prepare your application journey for multiple policy type
* @param {Object} Object with flags on how to complete specific parts of the application
* @param {Boolean} differentTradingName: Should submit "yes" to "have a different trading name" in the "company details" form. Defaults to false.
* @param {Boolean} differentTradingAddress: Should submit "yes" to "trade from a different address" in the "company details" form. Defaults to false.
* @param {Boolean} hasCreditControlProcess: Flag whether to submit "yes" or "no" radio input in the "credit control" form. Defaults to false.
* @param {Boolean} hasConnectionToBuyer: Should submit "yes" to "have connection to buyer" radio.
Expand All @@ -29,6 +30,7 @@ const { POLICY_TYPE } = APPLICATION;
* @param {Boolean} submitCheckYourAnswers: Should click each section's "check your answers" submit button.
*/
const completePrepareApplicationMultiplePolicyType = ({
differentTradingName = false,
differentTradingAddress = false,
hasCreditControlProcess = false,
hasConnectionToBuyer = false,
Expand All @@ -52,6 +54,7 @@ const completePrepareApplicationMultiplePolicyType = ({
submitCheckYourAnswers = true,
}) => {
cy.completeBusinessSection({
differentTradingName,
differentTradingAddress,
hasCreditControlProcess,
submitCheckYourAnswers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { POLICY_TYPE } = FIELD_VALUES;
* completePrepareYourApplicationSectionSingle
* Runs through the full prepare your application journey for a single policy type
* @param {Object} Object with flags on how to complete specific parts of the application
* @param {Boolean} differentTradingName: Should submit "yes" to "have a different trading name" in the "company details" form. Defaults to false.
* @param {Boolean} differentTradingAddress: Should submit "yes" to "trade from a different address" in the "company details" form. Defaults to false.
* @param {Boolean} hasCreditControlProcess: Flag whether to submit "yes" or "no" radio input in the "credit control" form. Defaults to false.
* @param {Boolean} hasConnectionToBuyer: Should submit "yes" to "have connection to buyer" radio.
Expand All @@ -29,6 +30,7 @@ const { POLICY_TYPE } = FIELD_VALUES;
* @param {Boolean} submitCheckYourAnswers: Should click each section's "check your answers" submit button.
*/
const completePrepareApplicationSinglePolicyType = ({
differentTradingName = false,
differentTradingAddress = false,
hasCreditControlProcess = false,
hasConnectionToBuyer,
Expand All @@ -52,6 +54,7 @@ const completePrepareApplicationSinglePolicyType = ({
submitCheckYourAnswers = true,
}) => {
cy.completeBusinessSection({
differentTradingName,
differentTradingAddress,
hasCreditControlProcess,
submitCheckYourAnswers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import completeSignInAndGoToApplication from './account/complete-sign-in-and-go-
* @return {String} Application reference number
*/
const completeSignInAndSubmitAnApplication = ({
differentTradingName = false,
differentTradingAddress = false,
policyType = APPLICATION.POLICY_TYPE.SINGLE,
exporterHasTradedWithBuyer,
Expand All @@ -48,6 +49,7 @@ const completeSignInAndSubmitAnApplication = ({
completeSignInAndGoToApplication({ totalContractValueOverThreshold }).then(({ referenceNumber }) => {
if (policyType === APPLICATION.POLICY_TYPE.MULTIPLE) {
cy.completePrepareApplicationMultiplePolicyType({
differentTradingName,
differentTradingAddress,
exporterHasTradedWithBuyer,
policyValueOverMvpMaximum,
Expand All @@ -66,6 +68,7 @@ const completeSignInAndSubmitAnApplication = ({
});
} else {
cy.completePrepareApplicationSinglePolicyType({
differentTradingName,
differentTradingAddress,
exporterHasTradedWithBuyer,
policyValueOverMvpMaximum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* @param {Boolean} withQuestionMark: Add a question mark to the expected text.
*/
const assertCopyWithCurrencyName = ({
expectedCopy, currencyName, selector, withQuestionMark = false,
expectedCopy,
currencyName,
selector,
withQuestionMark = false,
}) => {
let expected = `${expectedCopy} ${currencyName}`;

Expand Down
1 change: 1 addition & 0 deletions e2e-tests/constants/field-ids/insurance/business/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const EXPORTER_BUSINESS = {
},
ALTERNATIVE_TRADING_ADDRESS: {
FULL_ADDRESS: 'fullAddress',
FULL_ADDRESS_DOT_NOTATION: 'alternativeTrading.fullAddress',
},
NATURE_OF_YOUR_BUSINESS: {
GOODS_OR_SERVICES: 'goodsOrServicesSupplied',
Expand Down
11 changes: 9 additions & 2 deletions e2e-tests/content-strings/fields/insurance/business/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { FORM_TITLES } from '../../../form-titles';
const {
EXPORTER_BUSINESS: {
YOUR_COMPANY: {
TRADING_ADDRESS, HAS_DIFFERENT_TRADING_NAME, DIFFERENT_TRADING_NAME, PHONE_NUMBER, WEBSITE,
TRADING_ADDRESS,
HAS_DIFFERENT_TRADING_NAME,
DIFFERENT_TRADING_NAME,
PHONE_NUMBER,
WEBSITE,
},
ALTERNATIVE_TRADING_ADDRESS: { FULL_ADDRESS },
NATURE_OF_YOUR_BUSINESS: { GOODS_OR_SERVICES, YEARS_EXPORTING, EMPLOYEES_UK },
Expand All @@ -18,7 +22,10 @@ const {

const {
YOUR_BUSINESS: {
COMPANY_DETAILS, NATURE_OF_BUSINESS, TURNOVER, CREDIT_CONTROL,
COMPANY_DETAILS,
NATURE_OF_BUSINESS,
TURNOVER,
CREDIT_CONTROL,
},
} = FORM_TITLES;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Single policy type with a different trading address and broker - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingAddress: true,
usingBroker: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Multiple policy type, different trading address - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingAddress: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Single policy type with a different trading name, address and broker - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingName: true,
differentTradingAddress: true,
usingBroker: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Multiple policy type, different trading name and address - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingName: true,
differentTradingAddress: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Single policy type with a different trading name and broker - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingName: true,
usingBroker: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { APPLICATION } from '../../../../../../constants';

context(
'Insurance - submit an application - Multiple policy type, different trading name - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentTradingName: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
context(
'Insurance - submit an application - Single policy type with a different trading address and broker - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
differentTradingAddress: true,
usingBroker: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
context(
'Insurance - submit an application - Single policy type, different trading address - As an Exporter, I want to submit my completed credit insurance application, So that UKEF can process and make a decision on my application',
() => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({ differentTradingAddress: true }).then((refNumber) => {
referenceNumber = refNumber;
});
});

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

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

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

0 comments on commit 30756c8

Please sign in to comment.