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-3344): no PDF - application submission - XLSX - buyer #2495

Merged
merged 33 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f73873b
feat(EMS-3345): no pdf - application submission - XLSX - exporter bus…
ttbarnes May 23, 2024
991bb19
Merge branch 'main-application-no-pdf' into feat/EMS-3345
ttbarnes May 23, 2024
9c303fc
feat(EMS-3345): fix linting issue
ttbarnes May 24, 2024
ada64f0
feat(EMS-3345): no pdf - application submission - XLSX - exporter bus…
ttbarnes May 24, 2024
6a3a085
Merge branch 'main-application-no-pdf' into feat/EMS-3345
ttbarnes May 24, 2024
dd1ad5d
feat(EMS-3345): fix linting issues
ttbarnes May 24, 2024
505e6d8
feat(EMS-3345): revert package.json change
ttbarnes May 24, 2024
ca152f2
feat(EMS-3345): fix/update unit tests
ttbarnes May 24, 2024
da41e74
feat(EMS-3345): address todo comment
ttbarnes May 24, 2024
4fe072a
Merge branch 'main-application-no-pdf' into feat/EMS-3345
ttbarnes May 24, 2024
3061cdf
feat(EMS-3345): no pdf - application submission - XLSX - exporter com…
ttbarnes May 24, 2024
8871b84
feat(EMS-3345): no pdf - application submission - XLSX - code/test im…
ttbarnes May 28, 2024
344e496
feat(EMS-3345): no pdf - application submission - XLSX - code improve…
ttbarnes May 28, 2024
5ab21eb
feat(EMS-3345): no pdf - application submission - XLSX - improve e2e …
ttbarnes May 28, 2024
d89c6f8
feat(EMS-3344): no pdf - application submission - XLSX - your buyer
ttbarnes May 29, 2024
dafa15d
Merge branch 'main-application-no-pdf' into feat/EMS-3344
ttbarnes May 29, 2024
c605d24
feat(EMS-3344): no pdf - application submission - XLSX - improve e2e …
ttbarnes May 29, 2024
35c545c
feat(EMS-3344): no pdf - application submission - XLSX - unit tests
ttbarnes May 30, 2024
aeb2319
feat(EMS-3344): revert commented code, address todo comments
ttbarnes May 30, 2024
29a30c2
feat(EMS-3344): no pdf - application submission - XLSX - improve test…
ttbarnes May 30, 2024
6896560
chore(helpers): transform api mapYesNoField helper to have object str…
ttbarnes May 30, 2024
ab29744
chore(tests): fix linting issues
ttbarnes May 30, 2024
29c8c7f
feat(EMS-3344): address todo comments
ttbarnes May 30, 2024
e12f369
feat(EMS-3344): fix/update e2e test
ttbarnes May 30, 2024
857524b
chore(tests): split up application submission e2e tests
ttbarnes May 30, 2024
232cd0e
chore(EMS-3344): remove commented code
ttbarnes May 30, 2024
9e5b395
chore(tests): fix/revert some test.yml changes
ttbarnes May 30, 2024
7887528
feat(EMS-3344): fix typo
ttbarnes May 30, 2024
426d597
feat(EMS-3344): fix typo
ttbarnes May 31, 2024
6a5d1e4
feat(EMS-3344): improve e2e test descriptions
ttbarnes Jun 1, 2024
c12f98a
chore(tests): fix failing date test
ttbarnes Jun 3, 2024
6b560a1
feat(EMS-3344): no pdf - application submission - XLSX - fix indexing…
ttbarnes Jun 3, 2024
43b7aeb
feat(EMS-3344): unit test improvement
ttbarnes Jun 4, 2024
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
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,19 @@ jobs:
"account/sign-in/**/*.spec.js",
"account/sign-out/**/*.spec.js",
"account/suspended/**/*.spec.js",
"application-submission/*.spec.js",
"application-submission/multiple-policy-type/**/*.spec.js",
"application-submission/single-policy-type/**/*.spec.js",
"application-submission/multiple-policy-type/*.spec.js",
"application-submission/multiple-policy-type/business-conditions/*.spec.js",
"application-submission/multiple-policy-type/buyer-conditions/*.spec.js",
"application-submission/multiple-policy-type/buyer-conditions/traded-with-buyer/*.spec.js",
"application-submission/multiple-policy-type/export-contract-conditions/*.spec.js",
"application-submission/multiple-policy-type/policy-conditions/*.spec.js",

"application-submission/single-policy-type/*.spec.js",
"application-submission/single-policy-type/business-conditions/*.spec.js",
"application-submission/single-policy-type/buyer-conditions/*.spec.js",
"application-submission/single-policy-type/buyer-conditions/traded-with-buyer/*.spec.js",
"application-submission/single-policy-type/export-contract-conditions/*.spec.js",
"application-submission/single-policy-type/policy-conditions/*.spec.js",
"cannot-skip-flow/**/*.spec.js",
"check-your-answers/export-contract/*.spec.js",
"check-your-answers/export-contract/change-your-answers/about-goods-or-services/*.spec.js",
Expand Down
26 changes: 9 additions & 17 deletions e2e-tests/commands/insurance/assert-currency-form-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { checkAutocompleteInput } from '../../shared-test-assertions';
import { DZA } from '../../fixtures/countries';
import partials from '../../partials';

const { CURRENCY: { CURRENCY_CODE, ALTERNATIVE_CURRENCY_CODE } } = INSURANCE_FIELD_IDS;
const {
CURRENCY: { CURRENCY_CODE, ALTERNATIVE_CURRENCY_CODE },
} = INSURANCE_FIELD_IDS;

/**
* returns field for currency/alternative currency
Expand Down Expand Up @@ -107,8 +109,7 @@ const assertCurrencyFormFields = ({
checkAutocompleteInput.rendersMultipleResults(autoCompleteField(alternativeCurrencyFieldId), 'Be');

const expectedValue = `${NON_STANDARD_CURRENCY_NAME} (${NON_STANDARD_CURRENCY_CODE})`;
checkAutocompleteInput
.allowsUserToRemoveCountryAndSearchAgain(alternativeCurrencyFieldId, DZA.NAME, NON_STANDARD_CURRENCY_NAME, expectedValue);
checkAutocompleteInput.allowsUserToRemoveCountryAndSearchAgain(alternativeCurrencyFieldId, DZA.NAME, NON_STANDARD_CURRENCY_NAME, expectedValue);
},
rendersAlternativeCurrencyValidationError: ({ errorIndex = 0 }) => {
cy.clickAlternativeCurrencyRadioOption();
Expand All @@ -119,15 +120,9 @@ const assertCurrencyFormFields = ({

cy.assertRadioOptionIsChecked(option.input());

cy.checkText(
partials.errorSummaryListItems().eq(errorIndex),
errors[alternativeCurrencyFieldId].IS_EMPTY,
);
cy.checkText(partials.errorSummaryListItems().eq(errorIndex), errors[alternativeCurrencyFieldId].IS_EMPTY);

cy.checkText(
fieldSelector(alternativeCurrencyFieldId).errorMessage(),
`Error: ${errors[alternativeCurrencyFieldId].IS_EMPTY}`,
);
cy.checkText(fieldSelector(alternativeCurrencyFieldId).errorMessage(), `Error: ${errors[alternativeCurrencyFieldId].IS_EMPTY}`);
},
submitRadioAndAssertUrl: ({ currency, url, completeNonCurrencyFields }) => {
if (completeNonCurrencyFields) {
Expand Down Expand Up @@ -156,12 +151,9 @@ const assertCurrencyFormFields = ({
cy.assertRadioOptionIsChecked(option.input());
},
submitAlternativeCurrencyAndAssertUrl: (url) => {
cy.clickAlternativeCurrencyRadioOption();

// search for currency
cy.autocompleteKeyboardInput(alternativeCurrencyFieldId, NON_STANDARD_CURRENCY_NAME);

cy.clickSubmitButton();
cy.clickAlternativeCurrencyRadioAndSubmitCurrency({
fieldId: alternativeCurrencyFieldId,
});

cy.url().should('include', url);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NON_STANDARD_CURRENCY_CODE } from '../../fixtures/currencies';
import { radios } from '../../pages/shared';
import { INSURANCE_FIELD_IDS } from '../../constants/field-ids/insurance';

const { CURRENCY_CODE, ALTERNATIVE_CURRENCY_CODE } = INSURANCE_FIELD_IDS.CURRENCY;
const { CURRENCY_CODE } = INSURANCE_FIELD_IDS.CURRENCY;

/**
* completeAndSubmitAlternativeCurrencyForm
Expand All @@ -23,14 +22,7 @@ const completeAndSubmitAlternativeCurrencyForm = ({ isoCode, alternativeCurrency
if (alternativeCurrency) {
cy.clickProvideAlternativeCurrencyLink();

/**
* clicks alternativeCurrency radio option
* enters alternative currency into input
* submits form
*/
cy.clickAlternativeCurrencyRadioOption();
cy.autocompleteKeyboardInput(ALTERNATIVE_CURRENCY_CODE, NON_STANDARD_CURRENCY_CODE);
cy.clickSubmitButton();
cy.clickAlternativeCurrencyRadioAndSubmitCurrency({});
}
};

Expand Down
18 changes: 16 additions & 2 deletions e2e-tests/commands/insurance/complete-buyer-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
* completeBuyerSection
* Complete the "Buyer" section
* @param {Boolean} viaTaskList: Start the "buyer" section from the task list.
* @param {Boolean} alternativeCurrency: Should submit an "alternative currency". Defaults to false.
* @param {Boolean} hasConnectionToBuyer: Should submit "yes" to "have connection to buyer" radio. Defaults to "no".
* @param {Boolean} exporterHasTradedWithBuyer: Submit "yes" to "have traded with buyer before" in the "working with buyer" form.
* @param {Boolean} outstandingPayments: Exporter has outstanding payments with the buyer
* @param {Boolean} failedToPay: Buyer has failed to pay the exporter on the time
* @param {Boolean} fullyPopulatedBuyerTradingHistory: Submit all possible optional "buyer trading history" form fields.
* @param {Boolean} hasHadCreditInsuranceCover: Submit "yes" to if export "has held credit insurance cover on the buyer in the past"
* @param {Boolean} exporterHasBuyerFinancialAccounts: Submit "yes" to "have traded with buyer before" in the "working with buyer" form.
Expand All @@ -12,8 +15,11 @@
*/
const completeBuyerSection = ({
viaTaskList = true,
alternativeCurrency = false,
hasConnectionToBuyer = false,
exporterHasTradedWithBuyer = false,
outstandingPayments = false,
failedToPay = false,
fullyPopulatedBuyerTradingHistory = false,
hasHadCreditInsuranceCover = false,
exporterHasBuyerFinancialAccounts = false,
Expand All @@ -27,9 +33,17 @@ const completeBuyerSection = ({
cy.completeAndSubmitTradedWithBuyerForm({ exporterHasTradedWithBuyer });

if (exporterHasTradedWithBuyer) {
cy.clickYesRadioInput();

if (alternativeCurrency) {
cy.clickProvideAlternativeCurrencyLink();

cy.clickAlternativeCurrencyRadioAndSubmitCurrency({});
}

cy.completeAndSubmitTradingHistoryWithBuyerForm({
outstandingPayments: fullyPopulatedBuyerTradingHistory,
failedToPay: fullyPopulatedBuyerTradingHistory,
outstandingPayments: outstandingPayments || fullyPopulatedBuyerTradingHistory,
failedToPay: failedToPay || fullyPopulatedBuyerTradingHistory,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { radios, field } from '../../pages/shared';
import application from '../../fixtures/application';

const {
CURRENCY: { CURRENCY_CODE, ALTERNATIVE_CURRENCY_CODE },
CURRENCY: { CURRENCY_CODE },
POLICY: {
CONTRACT_POLICY: {
REQUESTED_START_DATE,
Expand All @@ -20,11 +20,7 @@ const {
* @param {Boolean} alternativeCurrency: Select the "alternative currency" option
* @param {Boolean} chooseCurrency: Whether to choose a currency or not
*/
const completeMultipleContractPolicyForm = ({
isoCode = application.POLICY[POLICY_CURRENCY_CODE],
alternativeCurrency = false,
chooseCurrency = true,
}) => {
const completeMultipleContractPolicyForm = ({ isoCode = application.POLICY[POLICY_CURRENCY_CODE], alternativeCurrency = false, chooseCurrency = true }) => {
cy.keyboardInput(field(REQUESTED_START_DATE).dayInput(), application.POLICY[REQUESTED_START_DATE].day);
cy.keyboardInput(field(REQUESTED_START_DATE).monthInput(), application.POLICY[REQUESTED_START_DATE].month);
cy.keyboardInput(field(REQUESTED_START_DATE).yearInput(), application.POLICY[REQUESTED_START_DATE].year);
Expand All @@ -33,9 +29,9 @@ const completeMultipleContractPolicyForm = ({

if (chooseCurrency) {
if (alternativeCurrency) {
cy.clickAlternativeCurrencyRadioOption();

cy.autocompleteKeyboardInput(ALTERNATIVE_CURRENCY_CODE, isoCode);
cy.clickAlternativeCurrencyRadioAndCompleteCurrency({
currency: isoCode,
});
} else {
radios(CURRENCY_CODE, isoCode).option.label().click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ 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} alternativeBuyerCurrency: Should submit an "alternative currency" in the buyer section. Defaults to false.
* @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.
* @param {Boolean} exporterHasTradedWithBuyer: Should submit "yes" to "have traded with buyer before" in the "working with buyer" 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} fullyPopulatedBuyerTradingHistory: Submit all possible optional "buyer trading history" form fields.
* @param {Boolean} hasHadCreditInsuranceCover: Submit "yes" to if export "has held credit insurance cover on the buyer in the past".
* @param {Boolean} exporterHasBuyerFinancialAccounts: Should submit "yes" to the "have buyer financial accounts" form.
Expand All @@ -30,11 +33,14 @@ const { POLICY_TYPE } = APPLICATION;
* @param {Boolean} submitCheckYourAnswers: Should click each section's "check your answers" submit button.
*/
const completePrepareApplicationMultiplePolicyType = ({
alternativeBuyerCurrency = false,
differentTradingName = false,
differentTradingAddress = false,
hasCreditControlProcess = false,
hasConnectionToBuyer = false,
exporterHasTradedWithBuyer = false,
buyerOutstandingPayments = false,
buyerFailedToPayOnTime = false,
fullyPopulatedBuyerTradingHistory = false,
hasHadCreditInsuranceCover = false,
exporterHasBuyerFinancialAccounts = false,
Expand All @@ -61,8 +67,11 @@ const completePrepareApplicationMultiplePolicyType = ({
});

cy.completeBuyerSection({
alternativeCurrency: alternativeBuyerCurrency,
hasConnectionToBuyer,
exporterHasTradedWithBuyer,
outstandingPayments: buyerOutstandingPayments,
failedToPay: buyerFailedToPayOnTime,
fullyPopulatedBuyerTradingHistory,
hasHadCreditInsuranceCover,
exporterHasBuyerFinancialAccounts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ 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} alternativeBuyerCurrency: Should submit an "alternative currency" in the buyer section. Defaults to false.
* @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.
* @param {Boolean} exporterHasTradedWithBuyer: Should submit "yes" to "have traded with buyer before" in the "working with buyer" 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} fullyPopulatedBuyerTradingHistory: Submit all possible optional "buyer trading history" form fields.
* @param {Boolean} hasHadCreditInsuranceCover: Submit "yes" to if export "has held credit insurance cover on the buyer in the past".
* @param {Boolean} exporterHasBuyerFinancialAccounts: Should submit "yes" to the "have buyer financial accounts" form.
Expand All @@ -30,11 +33,14 @@ const { POLICY_TYPE } = FIELD_VALUES;
* @param {Boolean} submitCheckYourAnswers: Should click each section's "check your answers" submit button.
*/
const completePrepareApplicationSinglePolicyType = ({
alternativeBuyerCurrency = false,
differentTradingName = false,
differentTradingAddress = false,
hasCreditControlProcess = false,
hasConnectionToBuyer,
exporterHasTradedWithBuyer,
buyerOutstandingPayments = false,
buyerFailedToPayOnTime = false,
fullyPopulatedBuyerTradingHistory,
hasHadCreditInsuranceCover,
exporterHasBuyerFinancialAccounts,
Expand All @@ -61,8 +67,11 @@ const completePrepareApplicationSinglePolicyType = ({
});

cy.completeBuyerSection({
alternativeCurrency: alternativeBuyerCurrency,
hasConnectionToBuyer,
exporterHasTradedWithBuyer,
outstandingPayments: buyerOutstandingPayments,
failedToPay: buyerFailedToPayOnTime,
fullyPopulatedBuyerTradingHistory,
hasHadCreditInsuranceCover,
exporterHasBuyerFinancialAccounts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import completeSignInAndGoToApplication from './account/complete-sign-in-and-go-
* 3) Complete and submit all declarations forms
* 4) Get and return the application reference number from the URL for consumption in the tests
* @param {Object} Object with flags on how to complete specific parts of the application
* - alternativeBuyerCurrency: Should submit an "alternative currency" in the buyer section. Defaults to false.
* - differentTradingAddress: Should submit "yes" to "trade from a different address" in the "your business - company details" form. Defaults to false.
* - policyType: Type of policy. Defaults to "single"
* - exporterHasTradedWithBuyer: Should submit "yes" to "have traded with buyer before" in the "working with buyer" form. Defaults to "yes".
Expand All @@ -23,10 +24,16 @@ import completeSignInAndGoToApplication from './account/complete-sign-in-and-go-
* - isUsingAgent: Should submit "yes" to "using an agent" form.
* - agentIsCharging: Should submit "yes" to "agent is charging" in the "agent details" form.
* - agentChargeMethodFixedSum: Agent charge method is "fixed sum"
* - agentChargeMethodPercentage: Agent charge method is "percentage"
* - hasConnectionToBuyer: Should submit "yes" to "have connection to buyer" radio.
* - buyerOutstandingPayments: Exporter has outstanding payments with the buyer
* - buyerFailedToPayOnTime: Buyer has failed to pay the exporter on the time
* - fullyPopulatedBuyerTradingHistory: Submit all possible optional "buyer trading history" form fields.
* - hasHadCreditInsuranceCover: Submit "yes" to if export "has held credit insurance cover on the buyer in the past".
* - exporterHasBuyerFinancialAccounts: Should submit "yes" to the "have buyer financial accounts" form.
* @return {String} Application reference number
*/
const completeSignInAndSubmitAnApplication = ({
alternativeBuyerCurrency = false,
differentTradingName = false,
differentTradingAddress = false,
policyType = APPLICATION.POLICY_TYPE.SINGLE,
Expand All @@ -44,11 +51,17 @@ const completeSignInAndSubmitAnApplication = ({
agentIsCharging = false,
agentChargeMethodFixedSum = false,
agentChargeMethodPercentage = false,
agentChargeMethod,
hasConnectionToBuyer = false,
buyerOutstandingPayments = false,
buyerFailedToPayOnTime = false,
fullyPopulatedBuyerTradingHistory = false,
hasHadCreditInsuranceCover = false,
exporterHasBuyerFinancialAccounts = false,
}) => {
completeSignInAndGoToApplication({ totalContractValueOverThreshold }).then(({ referenceNumber }) => {
if (policyType === APPLICATION.POLICY_TYPE.MULTIPLE) {
cy.completePrepareApplicationMultiplePolicyType({
alternativeBuyerCurrency,
differentTradingName,
differentTradingAddress,
exporterHasTradedWithBuyer,
Expand All @@ -64,10 +77,16 @@ const completeSignInAndSubmitAnApplication = ({
agentIsCharging,
agentChargeMethodFixedSum,
agentChargeMethodPercentage,
agentChargeMethod,
hasConnectionToBuyer,
buyerOutstandingPayments,
buyerFailedToPayOnTime,
fullyPopulatedBuyerTradingHistory,
hasHadCreditInsuranceCover,
exporterHasBuyerFinancialAccounts,
});
} else {
cy.completePrepareApplicationSinglePolicyType({
alternativeBuyerCurrency,
differentTradingName,
differentTradingAddress,
exporterHasTradedWithBuyer,
Expand All @@ -82,7 +101,12 @@ const completeSignInAndSubmitAnApplication = ({
isUsingAgent,
agentChargeMethodFixedSum,
agentChargeMethodPercentage,
agentChargeMethod,
hasConnectionToBuyer,
buyerOutstandingPayments,
buyerFailedToPayOnTime,
fullyPopulatedBuyerTradingHistory,
hasHadCreditInsuranceCover,
exporterHasBuyerFinancialAccounts,
});
}
cy.completeAndSubmitCheckYourAnswers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { radios, field } from '../../pages/shared';
import application from '../../fixtures/application';

const {
CURRENCY: { CURRENCY_CODE, ALTERNATIVE_CURRENCY_CODE },
CURRENCY: { CURRENCY_CODE },
POLICY: {
CONTRACT_POLICY: {
REQUESTED_START_DATE,
Expand All @@ -20,11 +20,7 @@ const {
* @param {Boolean} alternativeCurrency: Select the "alternative currency" option
* @param {Boolean} chooseCurrency: Whether to choose a currency or not
*/
const completeSingleContractPolicyForm = ({
isoCode = application.POLICY[POLICY_CURRENCY_CODE],
alternativeCurrency = false,
chooseCurrency = true,
}) => {
const completeSingleContractPolicyForm = ({ isoCode = application.POLICY[POLICY_CURRENCY_CODE], alternativeCurrency = false, chooseCurrency = true }) => {
cy.keyboardInput(field(REQUESTED_START_DATE).dayInput(), application.POLICY[REQUESTED_START_DATE].day);
cy.keyboardInput(field(REQUESTED_START_DATE).monthInput(), application.POLICY[REQUESTED_START_DATE].month);
cy.keyboardInput(field(REQUESTED_START_DATE).yearInput(), application.POLICY[REQUESTED_START_DATE].year);
Expand All @@ -37,7 +33,7 @@ const completeSingleContractPolicyForm = ({
if (alternativeCurrency) {
cy.clickAlternativeCurrencyRadioOption();

cy.autocompleteKeyboardInput(ALTERNATIVE_CURRENCY_CODE, isoCode);
cy.completeAlternativeCurrencyField({ currency: isoCode });
} else {
radios(CURRENCY_CODE, isoCode).option.label().click();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* clickAlternativeCurrencyRadioAndCompleteCurrency
* Click an "alternative currency" radio and complete the "currency" field.
* @param {String} fieldId: Field ID
* @param {String} currency: Currency
*/
const clickAlternativeCurrencyRadioAndCompleteCurrency = ({ fieldId, currency }) => {
cy.clickAlternativeCurrencyRadioOption();

cy.completeAlternativeCurrencyField({ fieldId, currency });
};

export default clickAlternativeCurrencyRadioAndCompleteCurrency;
Loading
Loading