generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmentalHealthPage.ts
47 lines (42 loc) · 1.78 KB
/
mentalHealthPage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Cas2v2Application as Application } from '@approved-premises/api'
import ApplyPage from '../../applyPage'
import paths from '../../../../../server/paths/apply'
import { pageIsActiveInNavigation, fieldIsOptional } from '../utils'
import { nameOrPlaceholderCopy } from '../../../../../server/utils/utils'
export default class MentalHealthPage extends ApplyPage {
constructor(private readonly application: Application) {
super(
`Mental health needs for ${nameOrPlaceholderCopy(application.person)}`,
application,
'health-needs',
'mental-health',
)
pageIsActiveInNavigation('Mental health')
}
static visit(application: Application): void {
cy.visit(
paths.applications.pages.show({
id: application.id,
task: 'health-needs',
page: 'mental-health',
}),
)
}
describeNeeds = (): void => {
this.checkRadioByNameAndValue('hasMentalHealthNeeds', 'yes')
this.getTextInputByIdAndEnterDetails('needsDetail', 'Has depression')
this.getTextInputByIdAndEnterDetails('needsPresentation', 'Erratic behaviour')
}
describeEngagement = (): void => {
this.checkRadioByNameAndValue('isEngagedWithCommunity', 'yes')
this.getTextInputByIdAndEnterDetails('servicesDetail', 'Attend the The Well Clinic')
this.checkRadioByNameAndValue('isEngagedWithServicesInCustody', 'yes')
this.checkRadioByNameAndValue('areIntendingToEngageWithServicesAfterCustody', 'yes')
}
describeMedication = (): void => {
this.checkRadioByNameAndValue('canManageMedication', 'no')
this.getTextInputByIdAndEnterDetails('medicationIssues', 'Sometimes fails to take pills')
fieldIsOptional('cantManageMedicationNotes')
this.getTextInputByIdAndEnterDetails('cantManageMedicationNotes', 'struggles because x, y and z')
}
}