diff --git a/e2e-tests/insurance/cypress/e2e/journeys/check-your-answers/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/check-your-answers/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js index 941a63ccb7..5fd1a590c9 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/check-your-answers/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/check-your-answers/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js @@ -136,7 +136,10 @@ context('Insurance - Change your answers - Policy - Pre-credit period - Change f cy.assertNoRadioOptionIsChecked(); - cy.checkValue(field(CREDIT_PERIOD_WITH_BUYER).textarea(), ''); + cy.checkTextareaValue({ + fieldId: CREDIT_PERIOD_WITH_BUYER, + expectedValue: '', + }); }); }); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services-final-destination-not-known.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services-final-destination-not-known.spec.js index 3422823a8a..972c28340c 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services-final-destination-not-known.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services-final-destination-not-known.spec.js @@ -1,5 +1,4 @@ import { autoCompleteField } from '../../../../../../pages/shared'; -import { aboutGoodsOrServicesPage } from '../../../../../../pages/insurance/export-contract'; import FIELD_IDS from '../../../../../../constants/field-ids/insurance/export-contract'; import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; import application from '../../../../../../fixtures/application'; @@ -67,7 +66,10 @@ context( it('should have the submitted values', () => { cy.navigateToUrl(url); - cy.checkValue(aboutGoodsOrServicesPage[DESCRIPTION].textarea(), application.EXPORT_CONTRACT[DESCRIPTION]); + cy.checkTextareaValue({ + fieldId: DESCRIPTION, + expectedValue: application.EXPORT_CONTRACT[DESCRIPTION], + }); cy.assertNoRadioOptionIsChecked(); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services.spec.js index 219073453a..967e4f42b6 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/about-goods-or-services.spec.js @@ -170,7 +170,10 @@ context( it('should have the submitted values', () => { cy.navigateToUrl(url); - cy.checkValue(aboutGoodsOrServicesPage[DESCRIPTION].textarea(), application.EXPORT_CONTRACT[DESCRIPTION]); + cy.checkTextareaValue({ + fieldId: DESCRIPTION, + expectedValue: application.EXPORT_CONTRACT[DESCRIPTION], + }); cy.assertYesRadioOptionIsChecked(); @@ -203,7 +206,10 @@ context( it('should retain the submitted value when going back to the page', () => { cy.clickBackLink(); - cy.checkValue(descriptionField.textarea(), submittedValue); + cy.checkTextareaValue({ + fieldId: DESCRIPTION, + expectedValue: submittedValue, + }); }); }); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/validation/about-goods-or-services-validation.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/validation/about-goods-or-services-validation.spec.js index 9abe237bc5..22fdadcf7f 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/validation/about-goods-or-services-validation.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/export-contract/about-goods-or-services/validation/about-goods-or-services-validation.spec.js @@ -124,7 +124,10 @@ context('Insurance - Export contract - About goods or services page - form valid includeFinalDestination: true, }); - cy.checkValue(descriptionField.textarea(), descriptionOverMaximum); + cy.checkTextareaValue({ + fieldId: DESCRIPTION, + expectedValue: descriptionOverMaximum, + }); cy.assertYesRadioOptionIsChecked(); @@ -141,7 +144,10 @@ context('Insurance - Export contract - About goods or services page - form valid description: descriptionOverMaximum, }); - cy.checkValue(descriptionField.textarea(), descriptionOverMaximum); + cy.checkTextareaValue({ + fieldId: DESCRIPTION, + expectedValue: descriptionOverMaximum, + }); cy.assertNoRadioOptionIsChecked(); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js index 65f90e672c..b804abf911 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/policy/change-your-answers/pre-credit-period/change-your-answers-pre-credit-period-yes-to-no.spec.js @@ -1,4 +1,4 @@ -import { summaryList, field } from '../../../../../../../pages/shared'; +import { summaryList } from '../../../../../../../pages/shared'; import { FIELD_VALUES } from '../../../../../../../constants'; import { POLICY as POLICY_FIELD_IDS } from '../../../../../../../constants/field-ids/insurance/policy'; import { INSURANCE_ROUTES, INSURANCE_ROOT } from '../../../../../../../constants/routes/insurance'; @@ -104,7 +104,10 @@ context('Insurance - Policy - Change your answers - Pre-credit period - As an ex cy.assertNoRadioOptionIsChecked(); - cy.checkValue(field(CREDIT_PERIOD_WITH_BUYER).textarea(), ''); + cy.checkTextareaValue({ + fieldId: CREDIT_PERIOD_WITH_BUYER, + expectedValue: '', + }); }); }); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/pre-credit-period.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/pre-credit-period.spec.js index af2e0117b2..fedb17c109 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/pre-credit-period.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/pre-credit-period.spec.js @@ -177,7 +177,10 @@ context(`Insurance - Policy - Pre-credit period page - ${story}`, () => { const expectedValue = mockApplication.POLICY[CREDIT_PERIOD_WITH_BUYER]; - cy.checkValue(fieldSelector(CREDIT_PERIOD_WITH_BUYER).textarea(), expectedValue); + cy.checkTextareaValue({ + fieldId: CREDIT_PERIOD_WITH_BUYER, + expectedValue, + }); }); }); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/save-and-back.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/save-and-back.spec.js index 412df78f0c..3b6d18bdbb 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/save-and-back.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/policy/pre-credit-period/save-and-back.spec.js @@ -1,4 +1,3 @@ -import { field as fieldSelector } from '../../../../../../pages/shared'; import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; import { POLICY as POLICY_FIELD_IDS } from '../../../../../../constants/field-ids/insurance/policy'; import { POLICY_FIELDS as FIELDS } from '../../../../../../content-strings/fields/insurance/policy'; @@ -15,8 +14,6 @@ const { [CREDIT_PERIOD_WITH_BUYER]: { MAXIMUM }, } = FIELDS; -const descriptionField = fieldSelector(CREDIT_PERIOD_WITH_BUYER); - const baseUrl = Cypress.config('baseUrl'); context('Insurance - Policy - Pre-credit period page - Save and go back', () => { @@ -109,7 +106,11 @@ context('Insurance - Policy - Pre-credit period page - Save and go back', () => cy.clickSubmitButtonMultipleTimes({ count: 4 }); cy.assertYesRadioOptionIsChecked(); - cy.checkValue(descriptionField.textarea(), ''); + + cy.checkTextareaValue({ + fieldId: CREDIT_PERIOD_WITH_BUYER, + expectedValue: '', + }); }); }); @@ -135,7 +136,11 @@ context('Insurance - Policy - Pre-credit period page - Save and go back', () => cy.clickSubmitButtonMultipleTimes({ count: 4 }); cy.assertYesRadioOptionIsChecked(); - cy.checkValue(descriptionField.textarea(), mockApplication.POLICY[CREDIT_PERIOD_WITH_BUYER]); + + cy.checkTextareaValue({ + fieldId: CREDIT_PERIOD_WITH_BUYER, + expectedValue: mockApplication.POLICY[CREDIT_PERIOD_WITH_BUYER], + }); }); }); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/nature-of-business-page.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/nature-of-business-page.spec.js index 65d9498f63..286690bffa 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/nature-of-business-page.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/nature-of-business-page.spec.js @@ -115,7 +115,11 @@ context( it('should have the submitted values', () => { cy.navigateToUrl(natureOfBusinessUrl); - cy.checkValue(fieldSelector(GOODS_OR_SERVICES).textarea(), application.EXPORTER_BUSINESS[GOODS_OR_SERVICES]); + cy.checkTextareaValue({ + fieldId: GOODS_OR_SERVICES, + expectedValue: application.EXPORTER_BUSINESS[GOODS_OR_SERVICES], + }); + cy.checkValue(fieldSelector(YEARS_EXPORTING).input(), application.EXPORTER_BUSINESS[YEARS_EXPORTING]); cy.checkValue(fieldSelector(EMPLOYEES_UK).input(), application.EXPORTER_BUSINESS[EMPLOYEES_UK]); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/save-and-back.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/save-and-back.spec.js index 19583d05a6..7d25f1bfca 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/save-and-back.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/your-business/nature-of-business/save-and-back.spec.js @@ -76,7 +76,11 @@ context('Insurance - Your business - Nature of your business page - Save and bac // go through 2 business forms. cy.clickSubmitButtonMultipleTimes({ count: 2 }); - cy.checkValue(field(GOODS_OR_SERVICES).textarea(), application.EXPORTER_BUSINESS[GOODS_OR_SERVICES]); + cy.checkTextareaValue({ + fieldId: GOODS_OR_SERVICES, + expectedValue: application.EXPORTER_BUSINESS[GOODS_OR_SERVICES], + }); + cy.checkValue(field(YEARS_EXPORTING).input(), ''); cy.checkValue(field(EMPLOYEES_UK).input(), ''); }); @@ -107,7 +111,11 @@ context('Insurance - Your business - Nature of your business page - Save and bac // company details submit cy.clickSubmitButton(); - cy.checkValue(field(GOODS_OR_SERVICES).textarea(), application.EXPORTER_BUSINESS[GOODS_OR_SERVICES]); + cy.checkTextareaValue({ + fieldId: GOODS_OR_SERVICES, + expectedValue: application.EXPORTER_BUSINESS[GOODS_OR_SERVICES], + }); + cy.checkValue(field(YEARS_EXPORTING).input(), application.EXPORTER_BUSINESS[YEARS_EXPORTING]); cy.checkValue(field(EMPLOYEES_UK).input(), application.EXPORTER_BUSINESS[EMPLOYEES_UK]); });