generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrainInjuryPage.ts
53 lines (45 loc) · 1.78 KB
/
brainInjuryPage.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
48
49
50
51
52
53
import { Cas2v2Application as Application } from '@approved-premises/api'
import ApplyPage from '../../applyPage'
import paths from '../../../../../server/paths/apply'
import { pageIsActiveInNavigation } from '../utils'
import { nameOrPlaceholderCopy } from '../../../../../server/utils/utils'
export default class BrainInjuryPage extends ApplyPage {
constructor(private readonly application: Application) {
super(
`Brain injury needs for ${nameOrPlaceholderCopy(application.person)}`,
application,
'health-needs',
'brain-injury',
)
pageIsActiveInNavigation('Brain injury')
this.pageHasBrainInjuryGuidance()
}
static visit(application: Application): void {
cy.visit(
paths.applications.pages.show({
id: application.id,
task: 'health-needs',
page: 'brain-injury',
}),
)
}
pageHasBrainInjuryGuidance = (): void => {
cy.get('.guidance').contains('This could be as a result of accident')
}
describeInjuryAndNeeds = (): void => {
this.checkRadioByNameAndValue('hasBrainInjury', 'yes')
this.getTextInputByIdAndEnterDetails('injuryDetail', 'Has frontal lobe damange')
}
describeVulnerability = (): void => {
this.checkRadioByNameAndValue('isVulnerable', 'yes')
this.getTextInputByIdAndEnterDetails('vulnerabilityDetail', 'Medium: can put themselves in danger')
}
describeDifficultiesInteracting = (): void => {
this.checkRadioByNameAndValue('hasDifficultyInteracting', 'yes')
this.getTextInputByIdAndEnterDetails('interactionDetail', 'Can misunderstand situations')
}
describeAdditionalSupportNeeded = (): void => {
this.checkRadioByNameAndValue('requiresAdditionalSupport', 'yes')
this.getTextInputByIdAndEnterDetails('addSupportDetail', 'Requires regular support')
}
}