Skip to content

Commit

Permalink
MAN-363 add description and outcome values activity details page
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Feb 6, 2025
1 parent d2c3f8c commit 1f53fd3
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 11 deletions.
130 changes: 130 additions & 0 deletions integration_tests/e2e/activityLogDetails.cy.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})
3 changes: 3 additions & 0 deletions integration_tests/pages/activityLogDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Page, { PageElement } from './page'

export default class ActivityLogDetailsPage extends Page {}
11 changes: 9 additions & 2 deletions integration_tests/pages/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]')
Expand Down
12 changes: 4 additions & 8 deletions server/views/pages/appointments/_appointment-details.njk
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{{ govukSummaryList({
classes: 'govuk-!-margin-bottom-0' if noMargin else 'govuk-!-margin-bottom-9',
rows: [
{
key: {
html: '<span data-qa="appointmentDescriptionLabel">Description</span>'
},
value: {
text: '<span data-qa="appointmentDescriptionValue">' + appointment.type + '</span>'
}
} if appointment.description,
{
key: { html: '<span data-qa="appointmentRescheduleLabel">Reschedule</span>' },
value: { html: '<span data-qa="appointmentRescheduleValue">Requested by ' + appointment.rescheduledBy | fullName + '</span>'}
Expand All @@ -29,6 +21,10 @@
key: { html: '<span data-qa="typeLabel">Type of appointment</span>' },
value: { html: '<span data-qa="typeValue">' + appointmentType + '</span>' }
},
{
key: { html: '<span data-qa="descriptionLabel">Description</span>' },
value: { html: '<span data-qa="descriptionValue">' + (appointment.description | nl2br | safe) + '</span>' }
} if appointment.description,
{
key: { html: '<span data-qa="locationLabel">Location</span>' },
value: { html: '<span data-qa="locationValue">' + addressToList(appointment.location).join('<br>') | safe + '</span>' }
Expand Down
4 changes: 4 additions & 0 deletions server/views/pages/appointments/_outcome-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
]
}
} if appointment.enforcementAction,
{
key: { html: '<span data-qa="outcomeLabel">Outcome</span>' },
value: { html: '<span data-qa="outcomeValue">' + (appointment.outcome | nl2br | safe) + '</span>' }
} if appointment.outcome,
{
key: { html: '<span data-qa="rarCategoryLabel">RAR activity</span>' },
value: { html: '<span data-qa="rarCategoryValue">' + appointment.rarCategory + '</span>' if appointment.rarCategory else '<span data-qa="rarCategoryValue">No</span>' }
Expand Down
2 changes: 1 addition & 1 deletion server/views/pages/appointments/appointment.njk
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body-s govuk-hint-s">Last updated by {{ lastUpdatedBy(appointment.lastUpdated, appointment.lastUpdatedBy) }}</p>
<p class="govuk-body-s govuk-hint-s" data-qa="appointmentLastUpdated">{{ lastUpdatedBy(appointment.lastUpdated, appointment.lastUpdatedBy) }}</p>
</div>
</div>

Expand Down
12 changes: 12 additions & 0 deletions wiremock/mappings/X000001-activity-log.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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]",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1f53fd3

Please sign in to comment.