From 1f53fd3c0263ab1cd8fbb6c5302c1e9408d2173d Mon Sep 17 00:00:00 2001 From: Neil Mills Date: Thu, 6 Feb 2025 17:10:48 +0000 Subject: [PATCH 1/3] MAN-363 add description and outcome values activity details page --- .../e2e/activityLogDetails.cy.ts | 130 ++++++++++++++++++ integration_tests/pages/activityLogDetails.ts | 3 + integration_tests/pages/page.ts | 11 +- .../appointments/_appointment-details.njk | 12 +- .../pages/appointments/_outcome-details.njk | 4 + .../views/pages/appointments/appointment.njk | 2 +- wiremock/mappings/X000001-activity-log.json | 12 ++ 7 files changed, 163 insertions(+), 11 deletions(-) create mode 100644 integration_tests/e2e/activityLogDetails.cy.ts create mode 100644 integration_tests/pages/activityLogDetails.ts diff --git a/integration_tests/e2e/activityLogDetails.cy.ts b/integration_tests/e2e/activityLogDetails.cy.ts new file mode 100644 index 00000000..1ffed3f6 --- /dev/null +++ b/integration_tests/e2e/activityLogDetails.cy.ts @@ -0,0 +1,130 @@ +import Page from '../pages/page' +import ActivityLogDetailsPage from '../pages/activityLogDetails' + +context('Activity log details', () => { + it('should render a complied appointment', () => { + cy.visit('/case/X000001/activity-log/activity/15') + const page = new ActivityLogDetailsPage() + page.setPageTitle('Office appointment with Terry Jones') + cy.get('[data-qa="appointmentType"]').should('contain.text', 'National standard appointment') + cy.get('[data-qa="complianceTag"]').should('contain.text', 'Complied') + page.getCardHeader('appointmentDetails').should('contain.text', 'Appointment details') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__key', 0) + .should('contain.text', 'Type of appointment') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 0).should('contain.text', 'Previous') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Description') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 1) + .should('contain.text', 'User-generated free text content') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Date') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 2).should('contain.text', 'Friday 22 March') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Time') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 3) + .should('contain.text', '10:15am to 10:30am') + + page.getCardHeader('outcomeDetails').should('contain.text', 'Outcome details') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 0).should('contain.text', 'Complied') + page.getCardElement('outcomeDetails', '.govuk-summary-list__value', 0).should('contain.text', 'Yes') + page.getCardElement('outcomeDetails', '.govuk-summary-list__actions a', 0).should('contain.text', 'Change') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__actions', 0) + .find('a') + .should('have.attr', 'href', '/case/X000001/handoff/delius') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Outcome') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__value', 1) + .should('contain.text', 'User-generated free text content') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 2).should('contain.text', 'RAR activity') + page.getCardElement('outcomeDetails', '.govuk-summary-list__value', 2).should('contain.text', 'No') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Sensitive') + page.getCardElement('outcomeDetails', '.govuk-summary-list__value', 3).should('contain.text', 'No') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 4).should('contain.text', 'Notes') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__value', 4) + .should('contain.text', 'Turned up and was very apologetic') + + cy.get('[data-qa="appointmentLastUpdated"]').should('contain.text', 'Last updated by Paul Smith on 20 Mar 2023') + }) + it('should render an appointment without an outcome', () => { + cy.visit('/case/X000001/activity-log/activity/16') + const page = new ActivityLogDetailsPage() + page.setPageTitle('Office appointment with Terry Jones') + cy.get('[data-qa="appointmentType"]').should('contain.text', 'National standard appointment') + cy.get('.note-panel').find('.govuk-warning-text__text').should('contain.text', 'Outcome not recorded') + cy.get('.note-panel') + .find('a') + .should('contain.text', 'Record an outcome') + .should('have.attr', 'href', '/case/X000001/handoff/delius') + page.getCardHeader('appointmentDetails').should('contain.text', 'Appointment details') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__key', 0) + .should('contain.text', 'Type of appointment') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 0).should('contain.text', 'Previous') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Date') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 1) + .should('contain.text', 'Wednesday 21 February') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Time') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 2) + .should('contain.text', '10:15am to 10:30am') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 3).should('contain.text', 'RAR activity') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 3).should('contain.text', 'Not known') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 4).should('contain.text', 'Appointment notes') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 4).should('contain.text', 'Some notes') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 5).should('contain.text', 'Sensitive') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 5).should('contain.text', 'No') + page.getCardHeader('outcomeDetails').should('not.exist') + }) + it('should render a non complied appointment', () => { + cy.visit('/case/X000001/activity-log/activity/13') + const page = new ActivityLogDetailsPage() + page.setPageTitle('Video call with Paulie Walnuts') + cy.get('[data-qa="complianceTag"]').should('contain.text', 'Unacceptable absence') + cy.get('.note-panel').find('.govuk-warning-text__text').should('contain.text', 'Absent and waiting for evidence') + cy.get('.note-panel') + .find('a') + .should('contain.text', 'Change outcome') + .should('have.attr', 'href', '/change-outcome/X000001/13') + page.getCardHeader('appointmentDetails').should('contain.text', 'Appointment details') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__key', 0) + .should('contain.text', 'Type of appointment') + page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 0).should('contain.text', 'Previous') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Description') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 1) + .should('contain.text', 'User-generated free text content') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Date') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 2) + .should('contain.text', 'Sunday 12 February') + page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Time') + page + .getCardElement('appointmentDetails', '.govuk-summary-list__value', 3) + .should('contain.text', '10:15am to 10:30am') + + page.getCardHeader('outcomeDetails').should('contain.text', 'Outcome details') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 0).should('contain.text', 'Complied') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__value', 0) + .should('contain.text', 'Unacceptable absence') + page.getCardElement('outcomeDetails', '.govuk-summary-list__actions a', 0).should('contain.text', 'Change') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__actions', 0) + .find('a') + .should('have.attr', 'href', '/case/X000001/handoff/delius') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Outcome') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__value', 1) + .should('contain.text', 'User-generated free text content') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Sensitive') + page.getCardElement('outcomeDetails', '.govuk-summary-list__value', 2).should('contain.text', 'No') + page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Notes') + page + .getCardElement('outcomeDetails', '.govuk-summary-list__value', 3) + .should('contain.text', 'Stuart did not attend this appointment') + }) +}) diff --git a/integration_tests/pages/activityLogDetails.ts b/integration_tests/pages/activityLogDetails.ts new file mode 100644 index 00000000..b806a59d --- /dev/null +++ b/integration_tests/pages/activityLogDetails.ts @@ -0,0 +1,3 @@ +import Page, { PageElement } from './page' + +export default class ActivityLogDetailsPage extends Page {} diff --git a/integration_tests/pages/page.ts b/integration_tests/pages/page.ts index 5b8808a0..976347a6 100644 --- a/integration_tests/pages/page.ts +++ b/integration_tests/pages/page.ts @@ -5,14 +5,21 @@ export default abstract class Page { return new constructor() } - constructor(private readonly title: string) { - this.checkOnPage() + constructor(private title?: string) { + if (this.title) { + this.checkOnPage() + } } checkOnPage(): void { cy.get('[data-qa=pageHeading]').contains(this.title) } + setPageTitle = (title: string) => { + this.title = title + this.checkOnPage() + } + signOut = (): PageElement => cy.get('[data-qa=signOut]') manageDetails = (): PageElement => cy.get('[data-qa=manageDetails]') diff --git a/server/views/pages/appointments/_appointment-details.njk b/server/views/pages/appointments/_appointment-details.njk index d629d104..33d7d3ab 100644 --- a/server/views/pages/appointments/_appointment-details.njk +++ b/server/views/pages/appointments/_appointment-details.njk @@ -1,14 +1,6 @@ {{ govukSummaryList({ classes: 'govuk-!-margin-bottom-0' if noMargin else 'govuk-!-margin-bottom-9', rows: [ - { - key: { - html: 'Description' - }, - value: { - text: '' + appointment.type + '' - } - } if appointment.description, { key: { html: 'Reschedule' }, value: { html: 'Requested by ' + appointment.rescheduledBy | fullName + ''} @@ -29,6 +21,10 @@ key: { html: 'Type of appointment' }, value: { html: '' + appointmentType + '' } }, + { + key: { html: 'Description' }, + value: { html: '' + (appointment.description | nl2br | safe) + '' } + } if appointment.description, { key: { html: 'Location' }, value: { html: '' + addressToList(appointment.location).join('
') | safe + '
' } diff --git a/server/views/pages/appointments/_outcome-details.njk b/server/views/pages/appointments/_outcome-details.njk index a03d54d2..e6acc2f5 100644 --- a/server/views/pages/appointments/_outcome-details.njk +++ b/server/views/pages/appointments/_outcome-details.njk @@ -73,6 +73,10 @@ ] } } if appointment.enforcementAction, + { + key: { html: 'Outcome' }, + value: { html: '' + (appointment.outcome | nl2br | safe) + '' } + } if appointment.outcome, { key: { html: 'RAR activity' }, value: { html: '' + appointment.rarCategory + '' if appointment.rarCategory else 'No' } diff --git a/server/views/pages/appointments/appointment.njk b/server/views/pages/appointments/appointment.njk index fbeeee89..34a11bd6 100644 --- a/server/views/pages/appointments/appointment.njk +++ b/server/views/pages/appointments/appointment.njk @@ -119,7 +119,7 @@
-

Last updated by {{ lastUpdatedBy(appointment.lastUpdated, appointment.lastUpdatedBy) }}

+

{{ lastUpdatedBy(appointment.lastUpdated, appointment.lastUpdatedBy) }}

diff --git a/wiremock/mappings/X000001-activity-log.json b/wiremock/mappings/X000001-activity-log.json index f22e7892..ca961e86 100644 --- a/wiremock/mappings/X000001-activity-log.json +++ b/wiremock/mappings/X000001-activity-log.json @@ -812,6 +812,7 @@ "appointment": { "id": 11, "type": "Phone call", + "description": "", "startDateTime": "2044-12-22T09:15:00.382936Z[Europe/London]", "endDateTime": "2044-12-22T09:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", @@ -858,6 +859,7 @@ "appointment": { "id": 12, "type": "Video call", + "description": "", "action": "Warning letter sent", "startDateTime": "2045-03-22T10:15:00.382936Z[Europe/London]", "endDateTime": "2045-03-22T10:30:00.382936Z[Europe/London]", @@ -901,11 +903,13 @@ "appointment": { "id": 13, "type": "Video call", + "description": "User-generated free text content", "startDateTime": "2023-02-12T10:15:00.382936Z[Europe/London]", "endDateTime": "2023-02-12T10:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", "isSensitive": false, "hasOutcome": true, + "outcome": "User-generated free text content", "acceptableAbsence": false, "wasAbsent": true, "complied": false, @@ -947,6 +951,7 @@ "appointment": { "id": 14, "type": "Phone call", + "description": "", "startDateTime": "2024-03-22T08:15:00.382936Z[Europe/London]", "endDateTime": "2024-03-22T08:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", @@ -993,11 +998,13 @@ "appointment": { "id": 15, "type": "Office appointment", + "description": "User-generated free text content", "startDateTime": "2024-03-22T10:15:00.382936Z[Europe/London]", "endDateTime": "2024-03-22T10:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", "isSensitive": false, "hasOutcome": true, + "outcome": "User-generated free text content", "isAppointment": true, "didTheyComply": true, "isNationalStandard": true, @@ -1037,6 +1044,7 @@ "appointment": { "id": 16, "type": "Office appointment", + "description": "", "startDateTime": "2024-02-21T10:15:00.382936Z[Europe/London]", "endDateTime": "2024-02-21T10:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", @@ -1083,11 +1091,13 @@ "appointment": { "id": 17, "type": "Planned appointment", + "description": "", "startDateTime": "2024-03-26T10:15:00.382936Z[Europe/London]", "endDateTime": "2024-03-26T10:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", "isSensitive": false, "hasOutcome": true, + "outcome": "User-generated free text content", "wasAbsent": true, "isAppointment": true, "isNationalStandard": true, @@ -1128,12 +1138,14 @@ "appointment": { "id": 18, "type": "Initial appointment", + "description": "User-generated free text content", "isInitial": true, "startDateTime": "2024-03-25T10:15:00.382936Z[Europe/London]", "endDateTime": "2024-03-25T10:30:00.382936Z[Europe/London]", "rarToolKit": "Choices and Changes", "isSensitive": false, "hasOutcome": true, + "outcome": "User-generated free text content", "wasAbsent": false, "isAppointment": true, "isNationalStandard": true, From f184788c23e05bac620a3ef84a95a9db15e3a84f Mon Sep 17 00:00:00 2001 From: Neil Mills Date: Thu, 6 Feb 2025 17:35:07 +0000 Subject: [PATCH 2/3] MAN-363 remove assertion from int test spec --- .../e2e/activityLogDetails.cy.ts | 49 ------------------- 1 file changed, 49 deletions(-) diff --git a/integration_tests/e2e/activityLogDetails.cy.ts b/integration_tests/e2e/activityLogDetails.cy.ts index 1ffed3f6..d5ab1239 100644 --- a/integration_tests/e2e/activityLogDetails.cy.ts +++ b/integration_tests/e2e/activityLogDetails.cy.ts @@ -78,53 +78,4 @@ context('Activity log details', () => { page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 5).should('contain.text', 'No') page.getCardHeader('outcomeDetails').should('not.exist') }) - it('should render a non complied appointment', () => { - cy.visit('/case/X000001/activity-log/activity/13') - const page = new ActivityLogDetailsPage() - page.setPageTitle('Video call with Paulie Walnuts') - cy.get('[data-qa="complianceTag"]').should('contain.text', 'Unacceptable absence') - cy.get('.note-panel').find('.govuk-warning-text__text').should('contain.text', 'Absent and waiting for evidence') - cy.get('.note-panel') - .find('a') - .should('contain.text', 'Change outcome') - .should('have.attr', 'href', '/change-outcome/X000001/13') - page.getCardHeader('appointmentDetails').should('contain.text', 'Appointment details') - page - .getCardElement('appointmentDetails', '.govuk-summary-list__key', 0) - .should('contain.text', 'Type of appointment') - page.getCardElement('appointmentDetails', '.govuk-summary-list__value', 0).should('contain.text', 'Previous') - page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Description') - page - .getCardElement('appointmentDetails', '.govuk-summary-list__value', 1) - .should('contain.text', 'User-generated free text content') - page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Date') - page - .getCardElement('appointmentDetails', '.govuk-summary-list__value', 2) - .should('contain.text', 'Sunday 12 February') - page.getCardElement('appointmentDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Time') - page - .getCardElement('appointmentDetails', '.govuk-summary-list__value', 3) - .should('contain.text', '10:15am to 10:30am') - - page.getCardHeader('outcomeDetails').should('contain.text', 'Outcome details') - page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 0).should('contain.text', 'Complied') - page - .getCardElement('outcomeDetails', '.govuk-summary-list__value', 0) - .should('contain.text', 'Unacceptable absence') - page.getCardElement('outcomeDetails', '.govuk-summary-list__actions a', 0).should('contain.text', 'Change') - page - .getCardElement('outcomeDetails', '.govuk-summary-list__actions', 0) - .find('a') - .should('have.attr', 'href', '/case/X000001/handoff/delius') - page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 1).should('contain.text', 'Outcome') - page - .getCardElement('outcomeDetails', '.govuk-summary-list__value', 1) - .should('contain.text', 'User-generated free text content') - page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 2).should('contain.text', 'Sensitive') - page.getCardElement('outcomeDetails', '.govuk-summary-list__value', 2).should('contain.text', 'No') - page.getCardElement('outcomeDetails', '.govuk-summary-list__key', 3).should('contain.text', 'Notes') - page - .getCardElement('outcomeDetails', '.govuk-summary-list__value', 3) - .should('contain.text', 'Stuart did not attend this appointment') - }) }) From 69f30c2fb411c9749fd0b6fb5995a1bfdcd62d74 Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Fri, 7 Feb 2025 16:57:58 +0000 Subject: [PATCH 3/3] MAN-363 apply review comments --- integration_tests/e2e/activityLogDetails.cy.ts | 1 - integration_tests/pages/activityLogDetails.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/integration_tests/e2e/activityLogDetails.cy.ts b/integration_tests/e2e/activityLogDetails.cy.ts index d5ab1239..b78b610a 100644 --- a/integration_tests/e2e/activityLogDetails.cy.ts +++ b/integration_tests/e2e/activityLogDetails.cy.ts @@ -1,4 +1,3 @@ -import Page from '../pages/page' import ActivityLogDetailsPage from '../pages/activityLogDetails' context('Activity log details', () => { diff --git a/integration_tests/pages/activityLogDetails.ts b/integration_tests/pages/activityLogDetails.ts index b806a59d..125c9a65 100644 --- a/integration_tests/pages/activityLogDetails.ts +++ b/integration_tests/pages/activityLogDetails.ts @@ -1,3 +1,3 @@ -import Page, { PageElement } from './page' +import Page from './page' export default class ActivityLogDetailsPage extends Page {}