Skip to content

Commit

Permalink
MAN-333 update int tests for probation history and staff contact pages
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Feb 5, 2025
1 parent 1b4ab2a commit c7c8b35
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 64 deletions.
55 changes: 0 additions & 55 deletions integration_tests/e2e/address-book-professional.cy.ts

This file was deleted.

11 changes: 9 additions & 2 deletions integration_tests/e2e/sentence.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ context('Sentence', () => {

page
.getCardElement('probationHistory', '.govuk-summary-list__key', 2)
.should('contain.text', 'Previous professional contacts')
.should('contain.text', 'Previous staff contacts')

page
.getCardElement('probationHistory', '.govuk-summary-list__value', 1)
Expand All @@ -178,9 +178,16 @@ context('Sentence', () => {
page
.getCardHeader('probationHistory')
.within(() => cy.get('a').invoke('attr', 'href').should('equal', '/case/X000001/sentence/previous-orders'))
page.getCardHeader('probationHistory').within(() => cy.get('a').eq(1).should('contain.text', '3 previous contacts'))
page
.getCardHeader('probationHistory')
.within(() => cy.get('a').eq(1).invoke('attr', 'href').should('equal', '/case/X000001/address-book-professional'))
.within(() =>
cy
.get('a')
.eq(1)
.invoke('attr', 'href')
.should('equal', '/case/X000001/sentence/probation-history/staff-contacts'),
)
})
it('Sentence page is loaded with no active sentence', () => {
cy.visit('/case/X000001/sentence?activeSentence=false')
Expand Down
91 changes: 91 additions & 0 deletions integration_tests/e2e/staffContacts.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import Page from '../pages/page'
import StaffContacts from '../pages/staffContacts'

context('Staff contacts', () => {
it('Staff contacts page is rendered', () => {
cy.visit('/case/X000001/personal-details/staff-contacts')
const page = Page.verifyOnPage(StaffContacts)
cy.get('h2').eq(0).should('contain.text', 'Current contacts')
cy.get('h3').eq(0).should('contain.text', 'Arhsimna Xolfo')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 0, 'Role')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 0, 'Prison Offender Manager (POM)')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 1, 'Phone number')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 1, '07321165373')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 2, 'Email')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 2, '[email protected]')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 3, 'Provider')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 3, 'London')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 4, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 4, 'All London')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 5, 'Team')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 5, 'Unallocated Team (N07)')
page.assertPageElementAtIndexWithin('dl', 0, 'dt', 6, 'Allocated until')
page.assertPageElementAtIndexWithin('dl', 0, 'dd', 6, '22 April 2025')

cy.get('h3').eq(1).should('contain.text', 'Yrhreender Hanandra')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 0, 'Role')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 0, 'Community Offender Manager (COM)')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 1, 'Phone number')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 1, '07321165373')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 2, 'Email')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 2, '[email protected]')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 3, 'Provider')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 3, 'London')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 4, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 4, 'All London')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 5, 'Team')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 5, 'Unallocated Team (N07)')
page.assertPageElementAtIndexWithin('dl', 1, 'dt', 6, 'Allocated until')
page.assertPageElementAtIndexWithin('dl', 1, 'dd', 6, '22 April 2025')

cy.get('h3').eq(2).should('contain.text', 'Iwendeps Yvygsee')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 0, 'Role')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 0, 'Probation practitioner')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 1, 'Phone number')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 1, '07321165373')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 2, 'Email')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 2, '[email protected]')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 3, 'Provider')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 3, 'London')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 4, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 4, 'All London')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 5, 'Team')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 5, 'Unallocated Team (N07)')
page.assertPageElementAtIndexWithin('dl', 2, 'dt', 6, 'Allocated until')
page.assertPageElementAtIndexWithin('dl', 2, 'dd', 6, '22 April 2025')

cy.get('h2').eq(1).should('contain.text', 'Previous contacts')

cy.get('h3').eq(3).should('contain.text', 'Peter Parker')
page.assertPageElementAtIndexWithin('dl', 3, 'dt', 0, 'Phone number')
page.assertPageElementAtIndexWithin('dl', 3, 'dd', 0, '07321165373')
page.assertPageElementAtIndexWithin('dl', 3, 'dt', 1, 'Email')
page.assertPageElementAtIndexWithin('dl', 3, 'dd', 1, '[email protected]')
page.assertPageElementAtIndexWithin('dl', 3, 'dt', 2, 'Provider')
page.assertPageElementAtIndexWithin('dl', 3, 'dd', 2, 'London')
page.assertPageElementAtIndexWithin('dl', 3, 'dt', 3, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 3, 'dd', 3, 'N07 Cluster 1')
page.assertPageElementAtIndexWithin('dl', 3, 'dt', 4, 'Team')
page.assertPageElementAtIndexWithin('dl', 3, 'dd', 4, 'OMU B')

cy.get('h3').eq(4).should('contain.text', 'Bruce Wayne')
page.assertPageElementAtIndexWithin('dl', 4, 'dt', 0, 'Provider')
page.assertPageElementAtIndexWithin('dl', 4, 'dd', 0, 'Leicester')
page.assertPageElementAtIndexWithin('dl', 4, 'dt', 1, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 4, 'dd', 1, 'Leicestershire All')
page.assertPageElementAtIndexWithin('dl', 4, 'dt', 2, 'Team')
page.assertPageElementAtIndexWithin('dl', 4, 'dd', 2, 'OMU B')
page.assertPageElementAtIndexWithin('dl', 4, 'dt', 3, 'Allocated until')
page.assertPageElementAtIndexWithin('dl', 4, 'dd', 3, '30 April 2024')

cy.get('h3').eq(5).should('contain.text', 'Jon Smith')
page.assertPageElementAtIndexWithin('dl', 5, 'dt', 0, 'Provider')
page.assertPageElementAtIndexWithin('dl', 5, 'dd', 0, 'Public Protection Unit')
page.assertPageElementAtIndexWithin('dl', 5, 'dt', 1, 'Probation Delivery Unit (PDU)')
page.assertPageElementAtIndexWithin('dl', 5, 'dd', 1, 'Bradford')
page.assertPageElementAtIndexWithin('dl', 5, 'dt', 2, 'Team')
page.assertPageElementAtIndexWithin('dl', 5, 'dd', 2, 'CPA West Yorkshire')
page.assertPageElementAtIndexWithin('dl', 5, 'dt', 3, 'Allocated until')
page.assertPageElementAtIndexWithin('dl', 5, 'dd', 3, '30 January 2025')
})
})
7 changes: 0 additions & 7 deletions integration_tests/pages/professionalContacts.ts

This file was deleted.

7 changes: 7 additions & 0 deletions integration_tests/pages/staffContacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Page from './page'

export default class StaffContacts extends Page {
constructor() {
super('Staff contacts')
}
}

0 comments on commit c7c8b35

Please sign in to comment.