From 57ec7c9cc674c7a77e07ad84a54b02db342a52b7 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Fri, 27 Sep 2024 15:55:00 +0100 Subject: [PATCH 1/4] split reason for referral into reason for referral and further information on the make a referral journey --- server/models/draftReferral.ts | 1 + .../reasonForReferralForm.ts | 8 ++- .../reasonForReferralPresenter.ts | 11 ++- .../reasonForReferralView.ts | 72 ++++++++++--------- server/utils/errorMessages.ts | 5 +- .../views/makeAReferral/reasonForReferral.njk | 1 + 6 files changed, 63 insertions(+), 35 deletions(-) diff --git a/server/models/draftReferral.ts b/server/models/draftReferral.ts index b1ce94dba..dd2636031 100644 --- a/server/models/draftReferral.ts +++ b/server/models/draftReferral.ts @@ -50,6 +50,7 @@ export interface ReferralFields { ppLocationType: string | null allocatedCommunityPP: boolean | null reasonForReferral: string | null + reasonForReferralFurtherInformation: string | null reasonForReferralCreationBeforeAllocation: string | null } diff --git a/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.ts b/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.ts index f14c81fb0..6f6a6b055 100644 --- a/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.ts +++ b/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.ts @@ -27,13 +27,19 @@ export default class ReasonForReferralForm { return { paramsForUpdate: { reasonForReferral: this.request.body['reason-for-referral'], + reasonForReferralFurtherInformation: this.request.body['reason-for-referral-further-information'], }, error: null, } } static get validations(): ValidationChain[] { - return [body('reason-for-referral').notEmpty().withMessage(errorMessages.reasonForReferral.empty)] + return [ + body('reason-for-referral').notEmpty().withMessage(errorMessages.reasonForReferral.empty), + body('reason-for-referral-further-information') + .notEmpty() + .withMessage(errorMessages.reasonForReferralFurtherInformation.empty), + ] } private error(validationResult: Result): FormValidationError | null { diff --git a/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.ts b/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.ts index d45cbbe7a..7f333211e 100644 --- a/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.ts +++ b/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.ts @@ -20,7 +20,12 @@ export default class ReasonForReferralPresenter { title: `Provide the reason for this referral and further information for the service provider`, } - readonly errorMessage = PresenterUtils.errorMessage(this.error, 'reason-for-referral') + readonly reasonForReferralErrorMessage = PresenterUtils.errorMessage(this.error, 'reason-for-referral') + + readonly reasonForReferralFurtherInformationErrorMessage = PresenterUtils.errorMessage( + this.error, + 'reason-for-referral-further-information' + ) readonly errorSummary = PresenterUtils.errorSummary(this.error, { fieldOrder: ['reason-for-referral'], @@ -30,6 +35,10 @@ export default class ReasonForReferralPresenter { readonly fields = { reasonForReferral: this.utils.stringValue(this.referral.reasonForReferral, 'reason-for-referral'), + reasonForReferralFurtherInformation: this.utils.stringValue( + this.referral.reasonForReferralFurtherInformation, + 'reason-for-referral-further-information' + ), } private get determinBackUpLink(): string { diff --git a/server/routes/makeAReferral/reason-for-referral/reasonForReferralView.ts b/server/routes/makeAReferral/reason-for-referral/reasonForReferralView.ts index 9bc78ca77..2b09b1b95 100644 --- a/server/routes/makeAReferral/reason-for-referral/reasonForReferralView.ts +++ b/server/routes/makeAReferral/reason-for-referral/reasonForReferralView.ts @@ -13,64 +13,71 @@ export default class ReasonForReferralView { id: 'reason-for-referral', name: 'reason-for-referral', value: this.presenter.fields.reasonForReferral, - errorMessage: ViewUtils.govukErrorMessage(this.presenter.errorMessage), + errorMessage: ViewUtils.govukErrorMessage(this.presenter.reasonForReferralErrorMessage), label: {}, - hint: this.renderHints, + hint: this.renderReasonForReferralHints, } } - get renderHints(): HintArgs { + get renderReasonForReferralHints(): HintArgs { const { referral } = this.presenter const preReleaseWithCom = referral.personCurrentLocationType === CurrentLocationType.custody && referral.isReferralReleasingIn12Weeks === null - const community = - referral.personCurrentLocationType === CurrentLocationType.community && - referral.isReferralReleasingIn12Weeks === null + // const community = + // referral.personCurrentLocationType === CurrentLocationType.community && + // referral.isReferralReleasingIn12Weeks === null const unallocatedPreRelease = referral.isReferralReleasingIn12Weeks if (preReleaseWithCom || unallocatedPreRelease) { return { - html: `

Reason for the referral:

+ html: `

Referral Details:

-

Further information could include:

- `, } } - if (community) { - return { - html: `

Reason for the referral:

+ // Community or prison + return { + html: `

Referral Details:

-

Further information could include:

- `, - } } + } + + private get reasonForReferralFurtherInformationArgs(): TextareaArgs { + return { + id: 'reason-for-referral-further-information', + name: 'reason-for-referral-further-information', + value: this.presenter.fields.reasonForReferralFurtherInformation, + errorMessage: ViewUtils.govukErrorMessage(this.presenter.reasonForReferralFurtherInformationErrorMessage), + label: {}, + hint: this.renderFurtherInformationHints, + } + } + + get renderFurtherInformationHints(): HintArgs { return { - html: `

Reason for the referral:

+ html: `

Further information about ${this.presenter.referral.serviceUser?.firstName}:

`, } @@ -83,6 +90,7 @@ export default class ReasonForReferralView { presenter: this.presenter, errorSummaryArgs: this.errorSummaryArgs, reasonForReferralArgs: this.reasonForReferralArgs, + reasonForReferralFurtherInformationArgs: this.reasonForReferralFurtherInformationArgs, backLinkArgs: { href: this.presenter.backLinkUrl }, suppressServiceUserBanner: true, }, diff --git a/server/utils/errorMessages.ts b/server/utils/errorMessages.ts index 6ae249dbf..eb3615843 100644 --- a/server/utils/errorMessages.ts +++ b/server/utils/errorMessages.ts @@ -334,7 +334,10 @@ export default { }, }, reasonForReferral: { - empty: 'Enter reason for the referral and any further information', + empty: 'Enter reason for the referral and referral details', + }, + reasonForReferralFurtherInformation: { + empty: 'Enter any further information', }, probationPractitionerName: { empty: 'Enter probation practitioner name', diff --git a/server/views/makeAReferral/reasonForReferral.njk b/server/views/makeAReferral/reasonForReferral.njk index d486d27f2..76e981aa7 100644 --- a/server/views/makeAReferral/reasonForReferral.njk +++ b/server/views/makeAReferral/reasonForReferral.njk @@ -30,6 +30,7 @@ {% endif %} {{ govukTextarea(reasonForReferralArgs) }} + {{ govukTextarea(reasonForReferralFurtherInformationArgs) }} {{ govukButton({ text: "Save and continue", preventDoubleClick: true }) }} From ca6a0516ed34932e3a15a21f5ab5d94c7ecbec8a Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Mon, 30 Sep 2024 15:12:43 +0100 Subject: [PATCH 2/4] update check details and referral details page with new fields --- .../checkAllReferralInformationPresenter.ts | 15 ++++++++++++++- .../reasonForReferralPresenter.test.ts | 6 ++++-- server/routes/shared/showReferralPresenter.ts | 10 +++++++++- server/services/interventionsService.test.ts | 1 + testutils/factories/draftReferral.ts | 1 + testutils/factories/sentReferral.ts | 1 + 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/server/routes/makeAReferral/check-all-referral-information/checkAllReferralInformationPresenter.ts b/server/routes/makeAReferral/check-all-referral-information/checkAllReferralInformationPresenter.ts index d315109f4..835274f66 100644 --- a/server/routes/makeAReferral/check-all-referral-information/checkAllReferralInformationPresenter.ts +++ b/server/routes/makeAReferral/check-all-referral-information/checkAllReferralInformationPresenter.ts @@ -524,10 +524,15 @@ export default class CheckAllReferralInformationPresenter { if (!isCohortIntervention) { summaries.push({ - key: 'Reason for referral and further information for the service provider', + key: 'Reason for referral and referral details', lines: [this.determineFurtherInformation(this.referral)], changeLink: `/referrals/${this.referral.id}/reason-for-referral?amendPPDetails=true`, }) + summaries.push({ + key: 'Further Information for the service provider', + lines: [this.determineReasonForReferralFurtherInformation(this.referral)], + changeLink: `/referrals/${this.referral.id}/reason-for-referral?amendPPDetails=true`, + }) } summaries.push( { @@ -629,6 +634,14 @@ export default class CheckAllReferralInformationPresenter { return 'None' } + private determineReasonForReferralFurtherInformation(referral: DraftReferral) { + if (referral.reasonForReferralFurtherInformation !== null) { + return referral.reasonForReferralFurtherInformation! + } + + return 'None' + } + private get dateOfBirthWithShortMonth() { if (this.referral.serviceUser.dateOfBirth === null) { return '' diff --git a/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.test.ts b/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.test.ts index ce5dd2bca..109175e08 100644 --- a/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.test.ts +++ b/server/routes/makeAReferral/reason-for-referral/reasonForReferralPresenter.test.ts @@ -32,7 +32,7 @@ describe('ReasonForReferralPresenter', () => { it('returns null', () => { const presenter = new ReasonForReferralPresenter(referral) - expect(presenter.errorMessage).toBeNull() + expect(presenter.reasonForReferralErrorMessage).toBeNull() }) }) @@ -48,7 +48,9 @@ describe('ReasonForReferralPresenter', () => { ], }) - expect(presenter.errorMessage).toEqual('Enter reason for the referral and any further information') + expect(presenter.reasonForReferralErrorMessage).toEqual( + 'Enter reason for the referral and any further information' + ) }) }) }) diff --git a/server/routes/shared/showReferralPresenter.ts b/server/routes/shared/showReferralPresenter.ts index a783855b8..d9ac1cfdb 100644 --- a/server/routes/shared/showReferralPresenter.ts +++ b/server/routes/shared/showReferralPresenter.ts @@ -394,13 +394,21 @@ export default class ShowReferralPresenter { const extraInfoText = this.userType === 'service-provider' ? '' : ' for the service provider' items.push({ - key: `Reason for the referral and further information${extraInfoText}`, + key: `Reason for referral and referral details`, lines: [this.sentReferral.referral.reasonForReferral || this.sentReferral.referral.furtherInformation || 'N/A'], changeLink: this.userType === 'probation-practitioner' ? `/probation-practitioner/referrals/${this.sentReferral.id}/amend-reason-for-referral` : undefined, }) + items.push({ + key: `Further information${extraInfoText}`, + lines: [this.sentReferral.referral.reasonForReferralFurtherInformation || 'N/A'], + // changeLink: + // this.userType === 'probation-practitioner' + // ? `/probation-practitioner/referrals/${this.sentReferral.id}/amend-reason-for-referral` + // : undefined, + }) const complexityLevel = this.getReferralComplexityLevelForServiceCategory(serviceCategory) items.push({ key: 'Complexity level', diff --git a/server/services/interventionsService.test.ts b/server/services/interventionsService.test.ts index 5e28a1161..49c2f651a 100644 --- a/server/services/interventionsService.test.ts +++ b/server/services/interventionsService.test.ts @@ -1580,6 +1580,7 @@ pactWith({ consumer: 'Interventions UI', provider: 'Interventions Service' }, pr ppLocationType: null, allocatedCommunityPP: true, reasonForReferral: 'for crs', + reasonForReferralFurtherInformation: 'more info', reasonForReferralCreationBeforeAllocation: 'for quick assessment', }, } diff --git a/testutils/factories/draftReferral.ts b/testutils/factories/draftReferral.ts index f7342814b..2ff6ac125 100644 --- a/testutils/factories/draftReferral.ts +++ b/testutils/factories/draftReferral.ts @@ -297,6 +297,7 @@ export default DraftReferralFactory.define(({ sequence }) => ({ ppLocationType: null, allocatedCommunityPP: null, reasonForReferral: null, + reasonForReferralFurtherInformation: null, withdrawalState: null, reasonForReferralCreationBeforeAllocation: null, })) diff --git a/testutils/factories/sentReferral.ts b/testutils/factories/sentReferral.ts index c7eb21561..4543f7c58 100644 --- a/testutils/factories/sentReferral.ts +++ b/testutils/factories/sentReferral.ts @@ -77,6 +77,7 @@ const exampleReferralFields = () => { ppLocationType: null, allocatedCommunityPP: true, reasonForReferral: 'For crs', + reasonForReferralFurtherInformation: 'more info', reasonForReferralCreationBeforeAllocation: 'for quick assessment', } } From 497d629628324f9cd62a1de2d52cea2f56579414 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Mon, 30 Sep 2024 15:44:29 +0100 Subject: [PATCH 3/4] unit tests --- .../amendReasonForReferralForm.test.ts | 2 +- .../reasonForReferralForm.test.ts | 4 +- .../shared/showReferralPresenter.test.ts | 47 ++++++++++++++++--- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/server/routes/amendAReferral/reason-for-referral/amendReasonForReferralForm.test.ts b/server/routes/amendAReferral/reason-for-referral/amendReasonForReferralForm.test.ts index 40ff6435b..1abed8148 100644 --- a/server/routes/amendAReferral/reason-for-referral/amendReasonForReferralForm.test.ts +++ b/server/routes/amendAReferral/reason-for-referral/amendReasonForReferralForm.test.ts @@ -25,7 +25,7 @@ describe(AmendReasonForReferralForm, () => { expect(data.error?.errors).toContainEqual({ errorSummaryLinkedField: 'amend-reason-for-referral', formFields: ['amend-reason-for-referral'], - message: 'Enter reason for the referral and any further information', + message: 'Enter reason for the referral and referral details', }) }) }) diff --git a/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.test.ts b/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.test.ts index b3a9f53f9..15d8c0092 100644 --- a/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.test.ts +++ b/server/routes/makeAReferral/reason-for-referral/reasonForReferralForm.test.ts @@ -7,10 +7,12 @@ describe(ReasonForReferralForm, () => { it('returns a paramsForUpdate with the reasonForReferral', async () => { const request = TestUtils.createRequest({ 'reason-for-referral': 'To refer him to CRS', + 'reason-for-referral-further-information': 'more info', }) const data = await new ReasonForReferralForm(request).data() expect(data.paramsForUpdate?.reasonForReferral).toEqual('To refer him to CRS') + expect(data.paramsForUpdate?.reasonForReferralFurtherInformation).toEqual('more info') }) }) }) @@ -24,7 +26,7 @@ describe(ReasonForReferralForm, () => { expect(data.error?.errors).toContainEqual({ errorSummaryLinkedField: 'reason-for-referral', formFields: ['reason-for-referral'], - message: 'Enter reason for the referral and any further information', + message: 'Enter reason for the referral and referral details', }) }) }) diff --git a/server/routes/shared/showReferralPresenter.test.ts b/server/routes/shared/showReferralPresenter.test.ts index 2156eedec..75d9d839b 100644 --- a/server/routes/shared/showReferralPresenter.test.ts +++ b/server/routes/shared/showReferralPresenter.test.ts @@ -1670,10 +1670,15 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information', + key: 'Reason for referral and referral details', lines: ['For crs'], changeLink: undefined, }, + { + key: 'Further information', + lines: ['more info'], + // changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, + }, { key: 'Complexity level', lines: [ @@ -1718,10 +1723,15 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information for the service provider', + key: 'Reason for referral and referral details', lines: ['For crs'], changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, }, + { + key: 'Further information for the service provider', + lines: ['more info'], + // changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, + }, expect.objectContaining({ key: 'Complexity level', }), @@ -1759,10 +1769,15 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information for the service provider', + key: 'Reason for referral and referral details', lines: ['For crs'], changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, }, + { + key: 'Further information for the service provider', + lines: ['more info'], + // changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, + }, expect.objectContaining({ key: 'Complexity level', }), @@ -1800,9 +1815,13 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information', + key: 'Reason for referral and referral details', lines: ['For crs'], }, + { + key: 'Further information', + lines: ['more info'], + }, expect.objectContaining({ key: 'Complexity level', }), @@ -1843,10 +1862,15 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information for the service provider', + key: 'Reason for referral and referral details', lines: ['For crs'], changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, }, + { + key: 'Further information for the service provider', + lines: ['more info'], + // changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, + }, { key: 'Complexity level', lines: [ @@ -1888,10 +1912,15 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information for the service provider', + key: 'Reason for referral and referral details', lines: ['For crs'], changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, }, + { + key: 'Further information for the service provider', + lines: ['more info'], + // changeLink: `/probation-practitioner/referrals/${referral.id}/amend-reason-for-referral`, + }, { key: 'Complexity level', lines: [ @@ -1937,9 +1966,13 @@ describe(ShowReferralPresenter, () => { }) ).toEqual([ { - key: 'Reason for the referral and further information', + key: 'Reason for referral and referral details', lines: ['For crs'], }, + { + key: 'Further information', + lines: ['more info'], + }, { key: 'Complexity level', lines: [ From 9b85e174fae6be5521fd01eefe33228c05716bb0 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Wed, 2 Oct 2024 09:59:48 +0100 Subject: [PATCH 4/4] integration test fixes --- integration_tests/integration/amend-referral.cy.js | 13 +++++-------- .../probationPractitionerReferrals.cy.js | 2 +- integration_tests/integration/referral.cy.js | 8 +++++--- .../integration/referralUnAllocatedCom.cy.js | 13 ++++++++----- integration_tests/integration/updatePPDetails.cy.js | 5 +++-- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/integration_tests/integration/amend-referral.cy.js b/integration_tests/integration/amend-referral.cy.js index 2a59f3114..160b6b7ad 100644 --- a/integration_tests/integration/amend-referral.cy.js +++ b/integration_tests/integration/amend-referral.cy.js @@ -393,7 +393,7 @@ context('Amend a referral', () => { .last() .children() .should('contain', 'Desired outcomes') - .find('#change-link-2') + .find('#change-link-3') .click() cy.location('pathname').should( @@ -415,7 +415,7 @@ context('Amend a referral', () => { .children() .should('contain', 'Complexity level') .should('contain', 'Desired outcomes') - .find('#change-link-2') + .find('#change-link-3') .click() cy.location('pathname').should( @@ -757,10 +757,7 @@ context('Amend a referral', () => { it('takes the pp to the form when clicking the change link in the details page', () => { cy.login(`/probation-practitioner/referrals/${sentReferral.id}/details`) - cy.contains( - '.govuk-summary-list__key', - 'Reason for the referral and further information for the service provider' - ) + cy.contains('.govuk-summary-list__key', 'Reason for referral and referral details') .next() .next() .contains('Change') @@ -802,10 +799,10 @@ context('Amend a referral', () => { cy.get('textarea[name="amend-reason-for-referral"]').clear() cy.contains('Save and continue').click() - cy.contains('There is a problem').next().contains('Enter reason for the referral and any further information') + cy.contains('There is a problem').next().contains('Enter reason for the referral and referral details') cy.get('textarea[name="amend-reason-for-referral"]') .prev() - .contains('Enter reason for the referral and any further information') + .contains('Enter reason for the referral and referral details') }) }) }) diff --git a/integration_tests/integration/probationPractitionerReferrals.cy.js b/integration_tests/integration/probationPractitionerReferrals.cy.js index 0e7ddba69..f2e8b9b10 100644 --- a/integration_tests/integration/probationPractitionerReferrals.cy.js +++ b/integration_tests/integration/probationPractitionerReferrals.cy.js @@ -985,7 +985,7 @@ describe('Probation practitioner referrals dashboard', () => { .children() .should('contain', 'Complexity level') .should('contain', 'Desired outcomes') - .find('#change-link-2') + .find('#change-link-3') .click() cy.location('pathname').should( diff --git a/integration_tests/integration/referral.cy.js b/integration_tests/integration/referral.cy.js index a562358a6..b58fda342 100644 --- a/integration_tests/integration/referral.cy.js +++ b/integration_tests/integration/referral.cy.js @@ -448,7 +448,8 @@ describe('Referral form', () => { cy.contains('Save and continue').click() cy.visit(`/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some information about Alex') + cy.get('#reason-for-referral').type('Some information about Alex') + cy.get('#reason-for-referral-further-information').type('Some information about Alex') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) @@ -560,7 +561,7 @@ describe('Referral form', () => { .next() .contains('Change') .should('have.attr', 'href', `/referrals/${draftReferral.id}/completion-deadline`) - cy.contains('Reason for referral and further information for the service provider') + cy.contains('Reason for referral and referral details') .next() .should('contain', 'Some information about Alex') .next() @@ -1171,7 +1172,8 @@ describe('Referral form', () => { cy.location('pathname').should('equal', `/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some information about Alex') + cy.get('#reason-for-referral').type('Some information about Alex') + cy.get('#reason-for-referral-further-information').type('Some information about Alex') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) diff --git a/integration_tests/integration/referralUnAllocatedCom.cy.js b/integration_tests/integration/referralUnAllocatedCom.cy.js index 38a540e21..70d1ca8ed 100644 --- a/integration_tests/integration/referralUnAllocatedCom.cy.js +++ b/integration_tests/integration/referralUnAllocatedCom.cy.js @@ -534,7 +534,8 @@ describe('Referral form', () => { cy.contains('Save and continue').click() cy.visit(`/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some information about Alex') + cy.get('#reason-for-referral').type('Some information about Alex') + cy.get('#reason-for-referral-further-information').type('Some information about Alex') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) @@ -713,7 +714,7 @@ describe('Referral form', () => { .next() .contains('Change') .should('have.attr', 'href', `/referrals/${draftReferral.id}/completion-deadline`) - cy.contains('Reason for referral and further information for the service provider') + cy.contains('Reason for referral and referral details') .next() .should('contain', 'Some information about Alex') .next() @@ -1162,7 +1163,8 @@ describe('Referral form', () => { cy.contains('Save and continue').click() cy.visit(`/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some reason') + cy.get('#reason-for-referral').type('Some reason') + cy.get('#reason-for-referral-further-information').type('Some reason') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) @@ -1323,7 +1325,7 @@ describe('Referral form', () => { .next() .contains('Change') .should('have.attr', 'href', `/referrals/${draftReferral.id}/completion-deadline`) - cy.contains('Reason for referral and further information for the service provider') + cy.contains('Reason for referral and referral details') .next() .should('contain', 'Some information about Alex') .next() @@ -1917,7 +1919,8 @@ describe('Referral form', () => { cy.location('pathname').should('equal', `/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some information about Alex') + cy.get('#reason-for-referral').type('Some information about Alex') + cy.get('#reason-for-referral-further-information').type('Some information about Alex') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) diff --git a/integration_tests/integration/updatePPDetails.cy.js b/integration_tests/integration/updatePPDetails.cy.js index 65a165851..6a1bd2eb5 100644 --- a/integration_tests/integration/updatePPDetails.cy.js +++ b/integration_tests/integration/updatePPDetails.cy.js @@ -632,7 +632,8 @@ describe('Referral form', () => { cy.contains('Save and continue').click() cy.visit(`/referrals/${draftReferral.id}/reason-for-referral`) cy.get('h1').contains('Provide the reason for this referral and further information for the service provider') - cy.get('textarea').type('Some information about Alex') + cy.get('#reason-for-referral').type('Some information about Alex') + cy.get('#reason-for-referral-further-information').type('Some information about Alex') // stub completed draft referral to mark section as completed cy.stubGetDraftReferral(draftReferral.id, completedDraftReferral) @@ -834,7 +835,7 @@ describe('Referral form', () => { .next() .contains('Change') .should('have.attr', 'href', `/referrals/${draftReferral.id}/completion-deadline`) - cy.contains('Reason for referral and further information for the service provider') + cy.contains('Reason for referral and referral details') .next() .should('contain', 'Some reason') .next()