Skip to content

Commit

Permalink
style(EMS-3574): problem with service - content iterations (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes authored Jul 16, 2024
1 parent e56a0ec commit 5d71b6a
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { emailLink, emailPrefix } from '../../../pages/shared';
import contactDetails from '../../../partials/contactDetails';
import { CONTACT_DETAILS } from '../../../content-strings';

const { PHONE, EMAIL, OPENING_TIMES } = CONTACT_DETAILS;

/**
* assertContactDetailsContent
* Check contact details content
*/
const assertContactDetailsContent = () => {
cy.checkText(emailPrefix(), `${EMAIL.PREFIX}:`);

cy.checkLink(emailLink(), EMAIL.VALUE, EMAIL.TEXT);

cy.checkText(contactDetails.phone(), `${PHONE.PREFIX}: ${PHONE.VALUE}`);
cy.checkText(contactDetails.openingTimes(), OPENING_TIMES);
};

export default assertContactDetailsContent;
2 changes: 2 additions & 0 deletions e2e-tests/commands/shared-commands/assertions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Cypress.Commands.add('assertSuffix', require('./assert-suffix'));
Cypress.Commands.add('assertTextareaRendering', require('./assert-textarea-rendering'));
Cypress.Commands.add('assertDynamicCharacterCount', require('./assert-dynamic-character-count'));

Cypress.Commands.add('assertContactDetailsContent', require('./assert-contact-details-content'));

Cypress.Commands.add('checkAriaLabel', require('./check-aria-label'));
Cypress.Commands.add('checkClassName', require('./check-class-name'));
Cypress.Commands.add('checkEmailFieldRendering', require('./check-email-field-rendering'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export const UKEF_CONTACT_DETAILS = {
CREDIT_INSURANCE_SUPPORT: 'creditinsurancesupport@ukexportfinance.gov.uk',
UNDERWRITING: 'exipunderwriting@ukexportfinance.gov.uk',
},
PHONE: '+44 (0)207 271 8010',
};
2 changes: 1 addition & 1 deletion e2e-tests/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export * from './percentages-of-cover';
export * from './routes';
export * from './supported-currencies';
export * from './total-contract-value';
export * from './ukef-contact-details';
export * from './contact-details';
export * from './validation';
5 changes: 5 additions & 0 deletions e2e-tests/content-strings/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ export const CONTACT_DETAILS = {
TEXT: UKEF_CONTACT_DETAILS.EMAIL.CREDIT_INSURANCE_SUPPORT,
VALUE: `mailto:${UKEF_CONTACT_DETAILS.EMAIL.CREDIT_INSURANCE_SUPPORT}`,
},
PHONE: {
PREFIX: 'Phone',
VALUE: UKEF_CONTACT_DETAILS.PHONE,
},
OPENING_TIMES: 'Opening times: Monday to Friday, 9am to 5pm (excluding public holidays)',
};
3 changes: 2 additions & 1 deletion e2e-tests/content-strings/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ const CONTACT_US_PAGE = {
};

const PROBLEM_WITH_SERVICE_PAGE = {
PAGE_TITLE: 'Problem with the service',
PAGE_TITLE: 'Sorry, there is a problem with the service',
BODY: 'Contact us if you think this is an error or you cannot continue your application.',
};

const FEEDBACK_PAGE = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { body } from '../../../../pages/shared';
import { PAGES } from '../../../../content-strings';
import { ROUTES } from '../../../../constants';

Expand Down Expand Up @@ -29,4 +30,12 @@ context('Problem with service page - Insurance', () => {
assertCookies: false,
});
});

it('renders body text', () => {
cy.checkText(body(), CONTENT_STRINGS.BODY);
});

it('renders a `contact details` section', () => {
cy.assertContactDetailsContent();
});
});
6 changes: 6 additions & 0 deletions e2e-tests/partials/contactDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const contactDetails = {
phone: () => cy.get('[data-cy="contact-details-phone"]'),
openingTimes: () => cy.get('[data-cy="contact-details-opening-times"]'),
};

export default contactDetails;
4 changes: 3 additions & 1 deletion e2e-tests/partials/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import creditPeriodWithBuyer from './creditPeriodWithBuyer';
import contactDetails from './contactDetails';
import cookieBanner from './cookieBanner';
import creditPeriodWithBuyer from './creditPeriodWithBuyer';
import footer from './footer';
import header from './header';
import insurancePartials from './insurance';
Expand All @@ -10,6 +11,7 @@ import ukGoodsOrServicesCalculateDescription from './ukGoodsOrServicesCalculateD
import ukGoodsOrServicesDescription from './ukGoodsAndServicesDescription';

const partials = {
contactDetails,
cookieBanner,
creditPeriodWithBuyer,
errorSummaryListHeading: () => cy.get('.govuk-error-summary h2'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { body } from '../../../../../pages/shared';
import { PAGES } from '../../../../../content-strings';
import { ROUTES } from '../../../../../constants';

Expand Down Expand Up @@ -29,4 +30,12 @@ context('Problem with service page - Quote', () => {
assertCookies: false,
});
});

it('renders body text', () => {
cy.checkText(body(), CONTENT_STRINGS.BODY);
});

it('renders a `contact details` section', () => {
cy.assertContactDetailsContent();
});
});
1 change: 1 addition & 0 deletions src/ui/server/constants/ukef-contact-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export const UKEF_CONTACT_DETAILS = {
CREDIT_INSURANCE_SUPPORT: 'creditinsurancesupport@ukexportfinance.gov.uk',
UNDERWRITING: 'exipunderwriting@ukexportfinance.gov.uk',
},
PHONE: '+44 (0)207 271 8010',
};
5 changes: 5 additions & 0 deletions src/ui/server/content-strings/contact/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ export const CONTACT_DETAILS = {
TEXT: UKEF_CONTACT_DETAILS.EMAIL.CREDIT_INSURANCE_SUPPORT,
VALUE: `mailto:${UKEF_CONTACT_DETAILS.EMAIL.CREDIT_INSURANCE_SUPPORT}`,
},
PHONE: {
PREFIX: 'Phone',
VALUE: UKEF_CONTACT_DETAILS.PHONE,
},
OPENING_TIMES: 'Opening times: Monday to Friday, 9am to 5pm (excluding public holidays)',
};
4 changes: 3 additions & 1 deletion src/ui/server/content-strings/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ const PAGE_NOT_FOUND_PAGE = {
};

const PROBLEM_WITH_SERVICE_PAGE = {
PAGE_TITLE: 'Problem with the service',
PAGE_TITLE: 'Sorry, there is a problem with the service',
BODY: 'Contact us if you think this is an error or you cannot continue your application.',
CONTACT_DETAILS,
};

const CONTACT_US_PAGE = {
Expand Down
14 changes: 14 additions & 0 deletions src/ui/templates/partials/contact-details.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% set contactDetails = CONTENT_STRINGS.CONTACT_DETAILS %}

{% set EMAIL = contactDetails.EMAIL %}
{% set PHONE = contactDetails.PHONE %}
{% set OPENING_TIMES = contactDetails.OPENING_TIMES %}

<p data-cy="contact-details-email">
<span data-cy="email-prefix">{{ EMAIL.PREFIX }}: </span>
<a class="govuk-link" href="{{ EMAIL.VALUE }}" data-cy="email-link">{{ EMAIL.TEXT }}</a>
</p>

<p data-cy="contact-details-phone">{{ PHONE.PREFIX }}: {{ PHONE.VALUE }}</p>

<p data-cy="contact-details-opening-times">{{ OPENING_TIMES }}</p>
12 changes: 11 additions & 1 deletion src/ui/templates/problem-with-service.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

{% block content %}

<h1 class="govuk-heading-xl" data-cy="{{ DATA_CY.HEADING }}">{{ CONTENT_STRINGS.PAGE_TITLE }}</h1>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">

<h1 class="govuk-heading-xl" data-cy="{{ DATA_CY.HEADING }}">{{ CONTENT_STRINGS.PAGE_TITLE }}</h1>

</div>
</div>

<p class="govuk-body" data-cy="body">{{ CONTENT_STRINGS.BODY }}</p>

{% include "partials/contact-details.njk" %}

{% endblock %}

0 comments on commit 5d71b6a

Please sign in to comment.