Skip to content

Commit

Permalink
feat(DTFS2-7531): bump gov design library (#3684)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes authored Dec 3, 2024
1 parent 4fe6da4 commit 1e25bba
Show file tree
Hide file tree
Showing 101 changed files with 907 additions and 2,157 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ npx cypress run --spec "cypress/e2e/**/my-test.spec.js"

## Cypress configuration ⚙️

Each test suite has its own `cypress.json` configuration file in its root directory. This JSON file contains URLs for the relevant UI and API endpoints.
Each test suite has its own `cypress.config.js` file in its root directory. This JSON file contains URLs for the relevant UI and API endpoints.

Additionally, it includes values for handling timeouts and retries: `pageLoadTimeout` and `retries`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ context('about-buyer', () => {

// prove the errors are on the about-financial page
contractAboutFinancial.visit(deal);
partials.errorSummaryLinks().should('have.length', 2);

partials.errorSummaryLinks().should('have.length', 4);

contractAboutFinancial.expectError('Supply Contract value is required');
contractAboutFinancial.expectError('Supply Contract currency is required');
contractAboutFinancial.expectError('Supply Contract conversion rate is required for non-GBP currencies');
contractAboutFinancial.expectError('Supply Contract conversion date is required for non-GBP currencies');

// fill in value + pick currency=GBP to clear validation warnings
cy.keyboardInput(contractAboutFinancial.supplyContractValue(), '123.45');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,50 @@ context('about-supply-contract', () => {

contractAboutSupplier.visit(deal);
contractAboutSupplier.supplierName().clear();

contractAboutSupplier.nextPage().click();

contractAboutBuyer.nextPage().click();
contractAboutFinancial.preview().click();

partials.errorSummaryLinks().should('have.length', 18);
partials.errorSummaryLinks().should('have.length', 20);

// prove validation of all non-conditional pieces
contractAboutPreview.expectError('Supplier type is required');
contractAboutPreview.expectError('Supplier name is required');
contractAboutPreview.expectError('Supplier address line 1 is required');
contractAboutPreview.expectError('Supplier town is required for non-UK addresses');
contractAboutPreview.expectError('Supplier country is required');
contractAboutPreview.expectError('Supplier correspondence address is required');
contractAboutPreview.expectError('Industry Sector is required');
contractAboutPreview.expectError('Industry Class is required');
contractAboutPreview.expectError('SME type is required');
contractAboutPreview.expectError('Supply Contract Description is required');
contractAboutPreview.expectError('Guarantor/Indemnifier is required');
contractAboutPreview.expectError('Buyer name is required');
contractAboutPreview.expectError('Buyer country is required');
contractAboutPreview.expectError('Buyer address line 1 is required');
contractAboutPreview.expectError('Buyer town is required for non-UK addresses');
contractAboutPreview.expectError('Destination of Goods and Services is required');
contractAboutPreview.expectError('Supply Contract value is required');
contractAboutPreview.expectError('Supply Contract currency is required');
contractAboutPreview.expectError('Supply Contract conversion rate is required for non-GBP currencies');
contractAboutPreview.expectError('Supply Contract conversion date is required for non-GBP currencies');

// prove the errors are on the about-supplier page
contractAboutSupplier.visit(deal);
contractAboutSupplier.expectError('Supplier type is required');
contractAboutSupplier.expectError('Supplier name is required');
contractAboutSupplier.expectError('Supplier address line 1 is required');
contractAboutSupplier.expectError('Supplier town is required for non-UK addresses');
contractAboutSupplier.expectError('Supplier country is required');
contractAboutSupplier.expectError('Supplier correspondence address is required');
contractAboutSupplier.expectError('Industry Sector is required');
contractAboutSupplier.expectError('Industry Class is required');
contractAboutSupplier.expectError('SME type is required');
contractAboutSupplier.expectError('Supplier town is required for non-UK addresses');
contractAboutSupplier.expectError('Supply Contract Description is required');

contractAboutSupplier.expectError('Guarantor/Indemnifier is required');

// switch to UK country
contractAboutSupplier.supplierAddress().country().select('GBR');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ context('Bond Details', () => {

partials.errorSummaryLinks().should('have.length', TOTAL_REQUIRED_FORM_FIELDS);

pages.bondDetails.bondTypeInputErrorMessage().should('be.visible');
pages.bondDetails.facilityStageInputErrorMessage().should('be.visible');
cy.assertText(pages.bondDetails.bondTypeInputErrorMessage(), 'Error: Enter the Bond type');
cy.assertText(pages.bondDetails.facilityStageInputErrorMessage(), 'Error: Enter the Bond stage');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ context('PDC_RECONCILE users can add a payment to a report', () => {

cy.contains('Premium payments').should('exist');

cy.assertText(premiumPaymentsTable.status(FEE_RECORD_ID_ONE), FEE_RECORD_STATUS.MATCH);
cy.assertText(premiumPaymentsTable.status(FEE_RECORD_ID_ONE), 'Match');
});

it('redirects user to premium payments tab with match success notification when taken to match whilst trying to add another payment', () => {
Expand All @@ -172,7 +172,7 @@ context('PDC_RECONCILE users can add a payment to a report', () => {

cy.contains('Premium payments').should('exist');

cy.assertText(premiumPaymentsTable.status(FEE_RECORD_ID_ONE), FEE_RECORD_STATUS.MATCH);
cy.assertText(premiumPaymentsTable.status(FEE_RECORD_ID_ONE), 'Match');

cy.assertText(premiumPaymentsTab.matchSuccessNotificationHeading(), 'Match payment recorded');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can add fee records to existing paymen

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(PAYMENT_ID_ONE).should('contain', 'GBP 450.00');

cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), FEE_RECORD_STATUS.MATCH);
cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), 'Match');
});
});

Expand Down Expand Up @@ -166,7 +166,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can add fee records to existing paymen

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(PAYMENT_ID_ONE).should('contain', 'GBP 450.00');

cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), FEE_RECORD_STATUS.MATCH);
cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), 'Match');
});

it('should display an error message when there are multiple payments to choose from and none have been selected', () => {
Expand All @@ -193,7 +193,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can add fee records to existing paymen

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(PAYMENT_ID_ONE).should('contain', 'GBP 450.00');

cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), FEE_RECORD_STATUS.MATCH);
cy.assertText(pages.utilisationReportPage.premiumPaymentsTab.premiumPaymentsTable.status(FEE_RECORD_ID_ONE), 'Match');
});

describe('when user navigates away', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {

cy.visit(`/utilisation-reports/${report.id}`);

cy.get('strong[data-cy="fee-record-status"]:contains("MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Match")').should('exist');
pages.utilisationReportPage.premiumPaymentsTab.clickPaymentLink(firstPayment.id);

cy.url().should('eq', relative(`${editPaymentUrl}?redirectTab=premium-payments`));
Expand All @@ -119,7 +119,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {
cy.url().should('eq', relative(`/utilisation-reports/${report.id}#premium-payments`));

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(firstPayment.id).should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('exist');
});

it(`allows the user to delete the payment and resets the status to '${FEE_RECORD_STATUS.MATCH}' when the remaining payments match`, () => {
Expand All @@ -139,7 +139,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {

cy.visit(`/utilisation-reports/${report.id}`);

cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('exist');
pages.utilisationReportPage.premiumPaymentsTab.clickPaymentLink(firstPayment.id);

cy.url().should('eq', relative(`${editPaymentUrl}?redirectTab=premium-payments`));
Expand All @@ -154,7 +154,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {
cy.url().should('eq', relative(`/utilisation-reports/${report.id}#premium-payments`));

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(firstPayment.id).should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Match")').should('exist');
});

it(`allows the user to delete the payment and resets the status to '${FEE_RECORD_STATUS.TO_DO}' when all payments are deleted`, () => {
Expand Down Expand Up @@ -184,7 +184,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {
pages.utilisationReportConfirmDeletePaymentPage.clickContinueButton();

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(payment.id).should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("TO DO")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("To do")').should('exist');
});

it(`allows the user to delete all payments from a fee record with reported payments below the tolerance and resets the status to '${FEE_RECORD_STATUS.TO_DO}'`, () => {
Expand Down Expand Up @@ -215,7 +215,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can delete payments`, () => {
pages.utilisationReportConfirmDeletePaymentPage.clickContinueButton();

pages.utilisationReportPage.premiumPaymentsTab.getPaymentLink(payment.id).should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("TO DO")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("To do")').should('exist');
});

function* idGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can edit payments`, () => {

cy.reload();

cy.get('strong[data-cy="fee-record-status"]:contains("MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Match")').should('exist');
pages.utilisationReportPage.premiumPaymentsTab.clickPaymentLink(paymentId);

cy.url().should('eq', relative(`${editPaymentUrl}?redirectTab=premium-payments`));
Expand All @@ -266,7 +266,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can edit payments`, () => {
pages.utilisationReportEditPaymentPage.clickSaveChangesButton();

cy.url().should('eq', relative(`/utilisation-reports/${reportId}#premium-payments`));
cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('exist');
});

it(`should set the fee record status to '${FEE_RECORD_STATUS.MATCH}' if the new amount matches the fee record amount`, () => {
Expand All @@ -279,7 +279,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can edit payments`, () => {

cy.reload();

cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('exist');

pages.utilisationReportPage.premiumPaymentsTab.clickPaymentLink(paymentId);

Expand All @@ -292,8 +292,8 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can edit payments`, () => {
pages.utilisationReportEditPaymentPage.clickSaveChangesButton();

cy.url().should('eq', relative(`/utilisation-reports/${reportId}#premium-payments`));
cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('not.exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Match")').should('exist');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ context('PDC_RECONCILE users can generate keying data', () => {

cy.url().should('eq', relative(`/utilisation-reports/${REPORT_ID}#keying-sheet`));

pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FIRST_FEE_RECORD_ID).should('contain', 'TO DO');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FIRST_FEE_RECORD_ID).should('contain', 'To do');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(SECOND_FEE_RECORD_ID).should('not.exist');

pages.utilisationReportPage.keyingSheetTab.fixedFeeAdjustmentDecrease(FIRST_FEE_RECORD_ID).should('contain', '-');
Expand Down Expand Up @@ -160,8 +160,8 @@ context('PDC_RECONCILE users can generate keying data', () => {

cy.url().should('eq', relative(`/utilisation-reports/${REPORT_ID}#keying-sheet`));

pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FIRST_FEE_RECORD_ID).should('contain', 'TO DO');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(SECOND_FEE_RECORD_ID).should('contain', 'TO DO');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FIRST_FEE_RECORD_ID).should('contain', 'To do');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(SECOND_FEE_RECORD_ID).should('contain', 'To do');

/**
* The principal balance adjustment is simply the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ context('PDC_RECONCILE users can reconcile fee records', () => {
});

it('can mark keying sheet rows as done and to do', () => {
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'TO DO');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'To do');

pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).within(() => cy.get('input[type="checkbox"]').click());
pages.utilisationReportPage.keyingSheetTab.markAsDoneButton().click();
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'DONE');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'Done');

pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).within(() => cy.get('input[type="checkbox"]').click());
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_TWO).within(() => cy.get('input[type="checkbox"]').click());
pages.utilisationReportPage.keyingSheetTab.markAsToDoButton().click();
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'TO DO');
pages.utilisationReportPage.keyingSheetTab.keyingSheetTableRow(FEE_RECORD_ID_ONE).should('contain', 'To do');
});

it('updates report status when all fee records are reconciled and when some are unreconciled', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can remove fees from payments`, () =>

cy.visit(`/utilisation-reports/${reportId}`);

cy.get('strong[data-cy="fee-record-status"]:contains("MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Match")').should('exist');
pages.utilisationReportPage.premiumPaymentsTab.clickPaymentLink(paymentId);

cy.url().should('eq', relative(`${editPaymentUrl}?redirectTab=premium-payments`));
Expand All @@ -186,6 +186,6 @@ context(`${PDC_TEAMS.PDC_RECONCILE} users can remove fees from payments`, () =>
cy.url().should('eq', relative(`${editPaymentUrl}?redirectTab=premium-payments`));

cy.visit(`/utilisation-reports/${reportId}`);
cy.get('strong[data-cy="fee-record-status"]:contains("DOES NOT MATCH")').should('exist');
cy.get('strong[data-cy="fee-record-status"]:contains("Does not match")').should('exist');
});
});
8 changes: 4 additions & 4 deletions gef-ui/component-tests/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ const assertions = (wrapper, html) => ({
expect(wrapper(selector).html()).toBeNull();
},
toBeDisabled: () => {
expect(wrapper(selector).hasClass('govuk-button--disabled')).toEqual(true);
expect(wrapper(selector).hasClass('govuk-button--secondary')).toEqual(false);
expect(wrapper(selector).attr('href')).toBeUndefined();
expect(wrapper(selector).attr('disabled')).toEqual('disabled');
expect(wrapper(selector).attr('aria-disabled')).toEqual('true');
},
toLinkTo: (href, text) => {
expect(wrapper(selector).hasClass('govuk-button--disabled')).toEqual(false);
expect(wrapper(selector).hasClass('govuk-button--secondary')).toEqual(false);
expect(wrapper(selector).attr('href')).toEqual(href);
expect(wrapper(selector).attr('disabled')).toBeUndefined();
expect(wrapper(selector).attr('aria-disabled')).toBeUndefined();
expect(wrapper(selector).text().trim()).toEqual(text);
},
}),
Expand All @@ -37,16 +37,16 @@ const assertions = (wrapper, html) => ({
expect(wrapper(selector).html()).toBeNull();
},
toBeDisabled: () => {
expect(wrapper(selector).hasClass('govuk-button--disabled')).toEqual(true);
expect(wrapper(selector).hasClass('govuk-button--secondary')).toEqual(true);
expect(wrapper(selector).attr('href')).toBeUndefined();
expect(wrapper(selector).attr('disabled')).toEqual('disabled');
expect(wrapper(selector).attr('aria-disabled')).toEqual('true');
},
toLinkTo: (href, text) => {
expect(wrapper(selector).hasClass('govuk-button--disabled')).toEqual(false);
expect(wrapper(selector).hasClass('govuk-button--secondary')).toEqual(true);
expect(wrapper(selector).attr('href')).toEqual(href);
expect(wrapper(selector).attr('disabled')).toBeUndefined();
expect(wrapper(selector).attr('aria-disabled')).toBeUndefined();
expect(wrapper(selector).text().trim()).toEqual(text);
},
}),
Expand Down
4 changes: 2 additions & 2 deletions gef-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"unit-test-ff": "jest --coverage --verbose --config=unit.ff.jest.config.js --passWithNoTests"
},
"dependencies": {
"@ministryofjustice/frontend": "1.8.0",
"@ministryofjustice/frontend": "3.0.2",
"@ukef/dtfs2-common": "1.0.0",
"ajv": "^8.17.1",
"axios": "^1.7.8",
Expand All @@ -57,7 +57,7 @@
"express-session": "1.17.3",
"filesize": "9.0.11",
"form-data": "4.0.0",
"govuk-frontend": "^4.9.0",
"govuk-frontend": "^5.7.1",
"http-errors": "^2.0.0",
"imask": "^6.6.3",
"joi": "^17.13.3",
Expand Down
2 changes: 1 addition & 1 deletion gef-ui/public/css/styles.css

Large diffs are not rendered by default.

Loading

0 comments on commit 1e25bba

Please sign in to comment.