Skip to content

Commit

Permalink
chore(tests): fix/update checkValue / textarea related e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes committed Oct 10, 2024
1 parent d495621 commit 86bca8b
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const {
* Assert all CONTRACT_COMPLETION_DATE field values are empty.
*/
const assertEmptyContractCompletionDateFieldValues = () => {
cy.checkValue(field(CONTRACT_COMPLETION_DATE).dayInput(), '');
cy.checkValue(field(CONTRACT_COMPLETION_DATE).monthInput(), '');
cy.checkValue(field(CONTRACT_COMPLETION_DATE).yearInput(), '');
field(CONTRACT_COMPLETION_DATE).dayInput().should('have.value', '');
field(CONTRACT_COMPLETION_DATE).monthInput().should('have.value', '');
field(CONTRACT_COMPLETION_DATE).yearInput().should('have.value', '');
};

export default assertEmptyContractCompletionDateFieldValues;
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const {
* Assert all REQUESTED_START_DATE field values are empty.
*/
const assertEmptyRequestedStartDateFieldValues = () => {
cy.checkValue(field(REQUESTED_START_DATE).dayInput(), '');
cy.checkValue(field(REQUESTED_START_DATE).monthInput(), '');
cy.checkValue(field(REQUESTED_START_DATE).yearInput(), '');
field(REQUESTED_START_DATE).dayInput().should('have.value', '');
field(REQUESTED_START_DATE).monthInput().should('have.value', '');
field(REQUESTED_START_DATE).yearInput().should('have.value', '');
};

export default assertEmptyRequestedStartDateFieldValues;
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ context('Insurance - Account - Sign in - Enter code - validation', () => {
expectedErrorMessage,
});

cy.checkValue(field.input(), invalidAccessCode);
cy.checkValue(field.input, invalidAccessCode);
});

describe('when submitting a valid access code', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ context('Insurance - Policy - Change your answers - Policy type - multiple to si
it(`should have empty field values when going back to ${MULTIPLE_CONTRACT_POLICY} and ${MULTIPLE_CONTRACT_POLICY_EXPORT_VALUE}`, () => {
cy.assertEmptyRequestedStartDateFieldValues();

cy.checkValue(field(TOTAL_MONTHS_OF_COVER).input(), '');
cy.checkValue(field(TOTAL_MONTHS_OF_COVER).input, '');

cy.assertCurrencyFormFieldsAreEmpty();

cy.navigateToUrl(exportValueUrl);

cy.checkValue(field(TOTAL_SALES_TO_BUYER).input(), '');
cy.checkValue(field(MAXIMUM_BUYER_WILL_OWE).input(), '');
cy.checkValue(field(TOTAL_SALES_TO_BUYER).input, '');
cy.checkValue(field(MAXIMUM_BUYER_WILL_OWE).input, '');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ context('Insurance - Policy - Change your answers - Policy type - single to mult

cy.navigateToUrl(totalContractValueUrl);

cy.checkValue(field(TOTAL_CONTRACT_VALUE).input(), '');
cy.checkValue(field(REQUESTED_CREDIT_LIMIT).input(), '');
cy.checkValue(field(TOTAL_CONTRACT_VALUE).input, '');
cy.checkValue(field(REQUESTED_CREDIT_LIMIT).input, '');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ context(
it('should have the submitted values', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input(), application.POLICY[TOTAL_SALES_TO_BUYER]);
cy.checkValue(fieldSelector(MAXIMUM_BUYER_WILL_OWE).input(), application.POLICY[MAXIMUM_BUYER_WILL_OWE]);
cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input, application.POLICY[TOTAL_SALES_TO_BUYER]);
cy.checkValue(fieldSelector(MAXIMUM_BUYER_WILL_OWE).input, application.POLICY[MAXIMUM_BUYER_WILL_OWE]);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ context('Insurance - Policy - Multiple contract policy Export value page - Save
});

it('should NOT have saved the submitted value', () => {
cy.checkValue(field.input(), '');
cy.checkValue(field.input, '');
});
});
});
Expand Down Expand Up @@ -124,7 +124,7 @@ context('Insurance - Policy - Multiple contract policy Export value page - Save
});

it('should have the submitted value', () => {
cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input(), application.POLICY[TOTAL_SALES_TO_BUYER]);
cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input, application.POLICY[TOTAL_SALES_TO_BUYER]);
});
});
});
Expand All @@ -143,8 +143,8 @@ context('Insurance - Policy - Multiple contract policy Export value page - Save
});

it('should render all submitted values', () => {
cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input(), application.POLICY[TOTAL_SALES_TO_BUYER]);
cy.checkValue(fieldSelector(MAXIMUM_BUYER_WILL_OWE).input(), application.POLICY[MAXIMUM_BUYER_WILL_OWE]);
cy.checkValue(fieldSelector(TOTAL_SALES_TO_BUYER).input, application.POLICY[TOTAL_SALES_TO_BUYER]);
cy.checkValue(fieldSelector(MAXIMUM_BUYER_WILL_OWE).input, application.POLICY[MAXIMUM_BUYER_WILL_OWE]);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ context('Insurance - Policy - Multiple contract policy page - As an exporter, I
it('should have the submitted values', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(REQUESTED_START_DATE).dayInput(), application.POLICY[REQUESTED_START_DATE].day);
cy.checkValue(fieldSelector(REQUESTED_START_DATE).monthInput(), application.POLICY[REQUESTED_START_DATE].month);
cy.checkValue(fieldSelector(REQUESTED_START_DATE).yearInput(), application.POLICY[REQUESTED_START_DATE].year);
fieldSelector(REQUESTED_START_DATE).dayInput().should('have.value', application.POLICY[REQUESTED_START_DATE].day);
fieldSelector(REQUESTED_START_DATE).monthInput().should('have.value', application.POLICY[REQUESTED_START_DATE].month);
fieldSelector(REQUESTED_START_DATE).yearInput().should('have.value', application.POLICY[REQUESTED_START_DATE].year);

cy.checkValue(fieldSelector(TOTAL_MONTHS_OF_COVER).input(), application.POLICY[TOTAL_MONTHS_OF_COVER]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ context('Insurance - Policy - Single contract policy page - Save and go back', (
cy.startInsurancePolicySection({});
cy.clickSubmitButton();

cy.checkValue(field.dayInput(), '');
cy.checkValue(field.monthInput(), '');
cy.checkValue(field.yearInput(), '');
field.dayInput().should('have.value', '');
field.monthInput().should('have.value', '');
field.yearInput().should('have.value', '');
});
});

Expand Down Expand Up @@ -121,9 +121,9 @@ context('Insurance - Policy - Single contract policy page - Save and go back', (
cy.startInsurancePolicySection({});
cy.clickSubmitButton();

cy.checkValue(field.dayInput(), '1');
cy.checkValue(field.monthInput(), month);
cy.checkValue(field.yearInput(), new Date(futureDate).getFullYear());
field.dayInput().should('have.value', '1');
field.monthInput().should('have.value', month);
field.yearInput().should('have.value', new Date(futureDate).getFullYear());
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ context('Insurance - Policy - Single contract policy page - As an exporter, I wa

cy.navigateToUrl(`${INSURANCE_ROOT}/${referenceNumber}${SINGLE_CONTRACT_POLICY}`);

cy.checkValue(fieldSelector(REQUESTED_START_DATE).dayInput(), application.POLICY[REQUESTED_START_DATE].day);
cy.checkValue(fieldSelector(REQUESTED_START_DATE).monthInput(), application.POLICY[REQUESTED_START_DATE].month);
cy.checkValue(fieldSelector(REQUESTED_START_DATE).yearInput(), application.POLICY[REQUESTED_START_DATE].year);
fieldSelector(REQUESTED_START_DATE).dayInput().should('have.value', application.POLICY[REQUESTED_START_DATE].day);
fieldSelector(REQUESTED_START_DATE).monthInput().should('have.value', application.POLICY[REQUESTED_START_DATE].month);
fieldSelector(REQUESTED_START_DATE).yearInput().should('have.value', application.POLICY[REQUESTED_START_DATE].year);

cy.checkValue(fieldSelector(CONTRACT_COMPLETION_DATE).dayInput(), application.POLICY[CONTRACT_COMPLETION_DATE].day);
cy.checkValue(fieldSelector(CONTRACT_COMPLETION_DATE).monthInput(), application.POLICY[CONTRACT_COMPLETION_DATE].month);
cy.checkValue(fieldSelector(CONTRACT_COMPLETION_DATE).yearInput(), application.POLICY[CONTRACT_COMPLETION_DATE].year);
fieldSelector(CONTRACT_COMPLETION_DATE).dayInput().should('have.value', application.POLICY[CONTRACT_COMPLETION_DATE].day);
fieldSelector(CONTRACT_COMPLETION_DATE).monthInput().should('have.value', application.POLICY[CONTRACT_COMPLETION_DATE].month);
fieldSelector(CONTRACT_COMPLETION_DATE).yearInput().should('have.value', application.POLICY[CONTRACT_COMPLETION_DATE].year);

const isoCode = application.POLICY[POLICY_CURRENCY_CODE];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ context('Insurance - Policy - Single contract policy - Total contract value page
it('should have the submitted values when going back to the page', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE).input(), application.POLICY[TOTAL_CONTRACT_VALUE]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT).input(), '');
cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE), application.POLICY[TOTAL_CONTRACT_VALUE]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT), '');
});
});

Expand All @@ -97,7 +97,7 @@ context('Insurance - Policy - Single contract policy - Total contract value page
it('should have the submitted values when going back to the page', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT).input(), application.POLICY[REQUESTED_CREDIT_LIMIT]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT), application.POLICY[REQUESTED_CREDIT_LIMIT]);
});
});

Expand All @@ -121,8 +121,8 @@ context('Insurance - Policy - Single contract policy - Total contract value page
it('should have the submitted values when going back to the page', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE).input(), application.POLICY[TOTAL_CONTRACT_VALUE]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT).input(), application.POLICY[REQUESTED_CREDIT_LIMIT]);
cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE), application.POLICY[TOTAL_CONTRACT_VALUE]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT), application.POLICY[REQUESTED_CREDIT_LIMIT]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ context(
it('should have the submitted values', () => {
cy.navigateToUrl(url);

cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE).input(), application.POLICY[TOTAL_CONTRACT_VALUE]);
cy.checkValue(fieldSelector(TOTAL_CONTRACT_VALUE), application.POLICY[TOTAL_CONTRACT_VALUE]);

cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT).input(), application.POLICY[REQUESTED_CREDIT_LIMIT]);
cy.checkValue(fieldSelector(REQUESTED_CREDIT_LIMIT), application.POLICY[REQUESTED_CREDIT_LIMIT]);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ context(
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]);
cy.checkValue(fieldSelector(YEARS_EXPORTING), application.EXPORTER_BUSINESS[YEARS_EXPORTING]);
cy.checkValue(fieldSelector(EMPLOYEES_UK), application.EXPORTER_BUSINESS[EMPLOYEES_UK]);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ context('Insurance - Your business - Nature of your business page - Save and bac
expectedValue: application.EXPORTER_BUSINESS[GOODS_OR_SERVICES],
});

cy.checkValue(field(YEARS_EXPORTING).input(), '');
cy.checkValue(field(EMPLOYEES_UK).input(), '');
cy.checkValue(field(YEARS_EXPORTING), '');
cy.checkValue(field(EMPLOYEES_UK), '');
});
});

Expand Down Expand Up @@ -116,8 +116,8 @@ context('Insurance - Your business - Nature of your business page - Save and bac
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]);
cy.checkValue(field(YEARS_EXPORTING), application.EXPORTER_BUSINESS[YEARS_EXPORTING]);
cy.checkValue(field(EMPLOYEES_UK), application.EXPORTER_BUSINESS[EMPLOYEES_UK]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ context('Insurance - Your business - Turnover page - Save and back', () => {
// go through 3 business forms.
cy.clickSubmitButtonMultipleTimes({ count: 3 });

cy.checkValue(field(ESTIMATED_ANNUAL_TURNOVER).input(), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);
cy.checkValue(field(PERCENTAGE_TURNOVER).input(), '');
cy.checkValue(field(ESTIMATED_ANNUAL_TURNOVER), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);
cy.checkValue(field(PERCENTAGE_TURNOVER), '');
});
});

Expand Down Expand Up @@ -105,8 +105,8 @@ context('Insurance - Your business - Turnover page - Save and back', () => {
// go through 2 business forms.
cy.clickSubmitButtonMultipleTimes({ count: 3 });

cy.checkValue(field(ESTIMATED_ANNUAL_TURNOVER).input(), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);
cy.checkValue(field(PERCENTAGE_TURNOVER).input(), application.EXPORTER_BUSINESS[PERCENTAGE_TURNOVER]);
cy.checkValue(field(ESTIMATED_ANNUAL_TURNOVER), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);
cy.checkValue(field(PERCENTAGE_TURNOVER), application.EXPORTER_BUSINESS[PERCENTAGE_TURNOVER]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ context(

cy.checkText(turnoverPage[FINANCIAL_YEAR_END_DATE](), financialYearEnd.expectedValue);

cy.checkValue(fieldSelector(ESTIMATED_ANNUAL_TURNOVER).input(), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);
cy.checkValue(fieldSelector(ESTIMATED_ANNUAL_TURNOVER), application.EXPORTER_BUSINESS[ESTIMATED_ANNUAL_TURNOVER]);

cy.checkValue(fieldSelector(PERCENTAGE_TURNOVER).input(), application.EXPORTER_BUSINESS[PERCENTAGE_TURNOVER]);
cy.checkValue(fieldSelector(PERCENTAGE_TURNOVER), application.EXPORTER_BUSINESS[PERCENTAGE_TURNOVER]);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ context('Tell us about your multiple policy page - as an exporter, I want to pro

const field = fieldSelector(fieldId);

cy.checkValue(field.input().select(1), GBP.isoCode);
cy.checkValue(field.input().select(2), EUR.isoCode);
cy.checkValue(field.input().select(3), USD.isoCode);
cy.checkValue(field.input().select(4), JPY.isoCode);
field.input().select(1).should('have.value', GBP.isoCode);
field.input().select(2).should('have.value', EUR.isoCode);
field.input().select(3).should('have.value', USD.isoCode);
field.input().select(4).should('have.value', JPY.isoCode);
});

it('should render `max amount owed` label and input', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ context('Tell us about your single policy page - as an exporter, I want to provi

const field = fieldSelector(fieldId);

cy.checkValue(field.input().select(1), GBP.isoCode);
cy.checkValue(field.input().select(2), EUR.isoCode);
cy.checkValue(field.input().select(3), USD.isoCode);
cy.checkValue(field.input().select(4), JPY.isoCode);
field.input().select(1).should('have.value', GBP.isoCode);
field.input().select(2).should('have.value', EUR.isoCode);
field.input().select(3).should('have.value', USD.isoCode);
field.input().select(4).should('have.value', JPY.isoCode);
});

it('should render `contract value` label and input', () => {
Expand Down

0 comments on commit 86bca8b

Please sign in to comment.