Skip to content

Commit f00f3e7

Browse files
authored
Arn 2380 ready for dev refinement update questions oa victim and oa victim 01 and add back link to victims details page (#657)
1 parent b6b0121 commit f00f3e7

19 files changed

+88
-67
lines changed

app/form/v1_0/fields/offence-analysis.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -173,43 +173,43 @@ class OffenceAnalysisFieldsFactory extends FieldsFactory {
173173
required: true,
174174
})
175175

176-
offenceAnalysisWhoWasTheVictim: FormWizard.Field = {
177-
text: 'Who was the victim?',
176+
offenceAnalysiswhoWasTheOffenceCommittedAgainst: FormWizard.Field = {
177+
text: 'Who was the offence committed against?',
178178
code: 'offence_analysis_who_was_the_victim',
179179
hint: { text: 'Select all that apply.', kind: 'text' },
180180
type: FieldType.CheckBox,
181181
multiple: true,
182-
validate: [{ type: ValidationType.Required, message: 'Select who the victim was' }],
182+
validate: [{ type: ValidationType.Required, message: 'Select who the offence was committed against' }],
183183
options: [
184184
{
185-
text: 'One or more person',
185+
text: 'One or more people',
186186
value: 'ONE_OR_MORE_PERSON',
187187
kind: 'option',
188188
},
189189
{
190190
text: 'Other',
191191
value: 'OTHER',
192192
kind: 'option',
193-
hint: { text: 'For example, the wider community.' },
193+
hint: { text: 'For example, a business or the wider community.' },
194194
},
195195
],
196196
labelClasses: utils.getMediumLabelClassFor(FieldType.CheckBox),
197197
}
198198

199199
offenceAnalysisOtherVictimDetails: FormWizard.Field = FieldsFactory.detailsField({
200-
parentField: this.offenceAnalysisWhoWasTheVictim,
200+
parentField: this.offenceAnalysiswhoWasTheOffenceCommittedAgainst,
201201
dependentValue: 'OTHER',
202202
required: true,
203203
})
204204

205205
offenceAnalysisVictimRelationship: FormWizard.Field = {
206-
text: `What is [subject]'s relationship to the victim?`,
206+
text: 'Who is the victim?',
207207
code: `offence_analysis_victim_relationship`,
208208
type: FieldType.Radio,
209209
validate: [
210210
{
211211
type: ValidationType.Required,
212-
message: 'Select relationship to the victim',
212+
message: 'Select who the victim is',
213213
},
214214
],
215215
options: [
@@ -224,23 +224,23 @@ class OffenceAnalysisFieldsFactory extends FieldsFactory {
224224
kind: 'option',
225225
},
226226
{
227-
text: `Victim's child`,
228-
value: 'CHILD',
227+
text: `[subject]'s parent or step-parent`,
228+
value: 'POP_PARENT_OR_STEP_PARENT',
229229
kind: 'option',
230230
},
231231
{
232-
text: `Victim's partner`,
233-
value: 'PARTNER',
232+
text: `[subject]'s partner`,
233+
value: 'POP_PARTNER',
234234
kind: 'option',
235235
},
236236
{
237-
text: `Victim's ex-partner`,
238-
value: 'EX_PARTNER',
237+
text: `[subject]'s ex-partner`,
238+
value: 'POP_EX_PARTNER',
239239
kind: 'option',
240240
},
241241
{
242-
text: `Victim's parent or step-parent`,
243-
value: 'PARENT_OR_STEP_PARENT',
242+
text: `[subject]'s child or step-child`,
243+
value: 'POP_CHILD_OR_STEP_CHILD',
244244
kind: 'option',
245245
},
246246
{

app/form/v1_0/steps/offence-analysis.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ const sectionConfig: SectionConfig = {
4949
offenceAnalysisFields.offenceAnalysisReason,
5050
offenceAnalysisFields.offenceAnalysisMotivation,
5151
offenceAnalysisFields.otherOffenceMotivationDetails,
52-
offenceAnalysisFields.offenceAnalysisWhoWasTheVictim,
52+
offenceAnalysisFields.offenceAnalysiswhoWasTheOffenceCommittedAgainst,
5353
offenceAnalysisFields.offenceAnalysisOtherVictimDetails,
5454
offenceAnalysisFields.isUserSubmitted(stepUrls.offenceAnalysis),
5555
offenceAnalysisFields.sectionComplete(),
5656
],
5757
navigationOrder: 9,
5858
next: [
5959
{
60-
field: offenceAnalysisFields.offenceAnalysisWhoWasTheVictim.code,
60+
field: offenceAnalysisFields.offenceAnalysiswhoWasTheOffenceCommittedAgainst.code,
6161
op: contains,
6262
value: 'ONE_OR_MORE_PERSON',
6363
next: [

cypress/e2e/v1.0/fixtures/complete-assessment.fixture.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ describe('Generate fixture for complete assessment', () => {
257257
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
258258
.getCheckbox('Thrill seeking')
259259
.clickLabel()
260-
cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel()
261-
cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('¯\\_(ツ)_/¯')
260+
cy.getQuestion('Who was the offence committed against?').getCheckbox('Other').clickLabel()
261+
cy.getQuestion('Who was the offence committed against?')
262+
.getCheckbox('Other')
263+
.getConditionalQuestion()
264+
.enterText('¯\\_(ツ)_/¯')
262265
cy.saveAndContinue()
263266

264267
cy.getQuestion('How many other people were involved with committing the current index offence(s)?')

cypress/e2e/v1.0/journeys/offence-analysis.cy.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ describe('Origin: /offence-analysis', () => {
3333
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3434
.getCheckbox('Thrill seeking')
3535
.clickLabel()
36-
cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel()
37-
cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('Test')
36+
cy.getQuestion('Who was the offence committed against?').getCheckbox('Other').clickLabel()
37+
cy.getQuestion('Who was the offence committed against?')
38+
.getCheckbox('Other')
39+
.getConditionalQuestion()
40+
.enterText('Test')
3841

3942
cy.assertResumeUrlIs(sectionName, destinations.landingPage)
4043
cy.saveAndContinue()
@@ -192,10 +195,10 @@ describe('Origin: /offence-analysis', () => {
192195
})
193196

194197
describe(`Destination: ${destinations.victimCreate}`, () => {
195-
it(`Victim is "One or more person" routes to "${destinations.victimCreate}"`, () => {
198+
it(`Victim is "One or more people" routes to "${destinations.victimCreate}"`, () => {
196199
cy.visitStep(destinations.landingPage)
197200

198-
cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel()
201+
cy.getQuestion('Who was the offence committed against?').getCheckbox('One or more people').clickLabel()
199202

200203
cy.assertResumeUrlIs(sectionName, destinations.landingPage)
201204
cy.saveAndContinue()
@@ -207,7 +210,7 @@ describe('Origin: /offence-analysis', () => {
207210
it(`routes to ${destinations.victimsSummary}`, () => {
208211
cy.visitStep(destinations.victimCreate)
209212

210-
cy.getQuestion("What is Sam's relationship to the victim?").getRadio('A stranger').clickLabel()
213+
cy.getQuestion('Who is the victim?').getRadio('A stranger').clickLabel()
211214
cy.getQuestion("What is the victim's approximate age?").getRadio('0 to 4 years').clickLabel()
212215
cy.getQuestion("What is the victim's sex?").getRadio('Male').clickLabel()
213216
cy.getQuestion("What is the victim's race or ethnicity?").enterText('white{enter}')

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-impact-others-involved.cy.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ describe('/offence-analysis-impact', () => {
3333
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3434
.getCheckbox('Thrill seeking')
3535
.clickLabel()
36-
cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel()
37-
cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('¯\\_(ツ)_/¯')
36+
cy.getQuestion('Who was the offence committed against?').getCheckbox('Other').clickLabel()
37+
cy.getQuestion('Who was the offence committed against?')
38+
.getCheckbox('Other')
39+
.getConditionalQuestion()
40+
.enterText('¯\\_(ツ)_/¯')
3841
cy.saveAndContinue()
3942

4043
cy.getQuestion('How many other people were involved with committing the current index offence(s)?')

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-impact.cy.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ describe('/offence-analysis-impact', () => {
3131
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3232
.getCheckbox('Thrill seeking')
3333
.clickLabel()
34-
cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel()
35-
cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('¯\\_(ツ)_/¯')
34+
cy.getQuestion('Who was the offence committed against?').getCheckbox('Other').clickLabel()
35+
cy.getQuestion('Who was the offence committed against?')
36+
.getCheckbox('Other')
37+
.getConditionalQuestion()
38+
.enterText('¯\\_(ツ)_/¯')
3639
cy.saveAndContinue()
3740

3841
cy.getQuestion('How many other people were involved with committing the current index offence(s)?')

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-involved-parties.cy.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ describe('/offence-analysis-involved-parties', () => {
1717
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
1818
.getCheckbox('Thrill seeking')
1919
.clickLabel()
20-
cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel()
21-
cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('¯\\_(ツ)_/¯')
20+
cy.getQuestion('Who was the offence committed against?').getCheckbox('Other').clickLabel()
21+
cy.getQuestion('Who was the offence committed against?')
22+
.getCheckbox('Other')
23+
.getConditionalQuestion()
24+
.enterText('¯\\_(ツ)_/¯')
2225

2326
cy.saveAndContinue()
2427
cy.assertStepUrlIs(stepUrl)

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-victim-create.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('/offence-analysis-victim/create', () => {
3838
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3939
.getCheckbox('Thrill seeking')
4040
.clickLabel()
41-
cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel()
41+
cy.getQuestion('Who was the offence committed against?').getCheckbox('One or more people').clickLabel()
4242

4343
cy.saveAndContinue()
4444
cy.assertStepUrlIs(createUrl)

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-victim-delete.cy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('/offence-analysis-victim/delete/:entryId', () => {
1414
raceOrEthnicity: 'White - English, Welsh, Scottish, Northern Irish or British',
1515
},
1616
{
17-
relationship: "Victim's ex-partner",
17+
relationship: "Sam's ex-partner",
1818
age: '21 to 25 years',
1919
sex: 'Female',
2020
raceOrEthnicityPartial: 'Any other White background',
@@ -34,7 +34,7 @@ describe('/offence-analysis-victim/delete/:entryId', () => {
3434
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3535
.getCheckbox('Thrill seeking')
3636
.clickLabel()
37-
cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel()
37+
cy.getQuestion('Who was the offence committed against?').getCheckbox('One or more people').clickLabel()
3838

3939
cy.saveAndContinue()
4040

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-victim-details.cy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('/offence-analysis-victim-details', () => {
1414
raceOrEthnicity: 'White - English, Welsh, Scottish, Northern Irish or British',
1515
},
1616
{
17-
relationship: "Victim's ex-partner",
17+
relationship: "Sam's ex-partner",
1818
age: '21 to 25 years',
1919
sex: 'Female',
2020
raceOrEthnicityPartial: 'White - Irish',
@@ -34,7 +34,7 @@ describe('/offence-analysis-victim-details', () => {
3434
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
3535
.getCheckbox('Thrill seeking')
3636
.clickLabel()
37-
cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel()
37+
cy.getQuestion('Who was the offence committed against?').getCheckbox('One or more people').clickLabel()
3838

3939
cy.saveAndContinue()
4040

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis-victim-edit.cy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('/offence-analysis-victim/edit/:entryId', () => {
2626
}
2727

2828
const updated = {
29-
relationship: "Victim's ex-partner",
29+
relationship: "Sam's ex-partner",
3030
age: '21 to 25 years',
3131
sex: 'Female',
3232
raceOrEthnicityPartial: 'Any other White background',
@@ -45,7 +45,7 @@ describe('/offence-analysis-victim/edit/:entryId', () => {
4545
cy.getQuestion('Did the current index offence(s) involve any of the following motivations?')
4646
.getCheckbox('Thrill seeking')
4747
.clickLabel()
48-
cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel()
48+
cy.getQuestion('Who was the offence committed against?').getCheckbox('One or more people').clickLabel()
4949

5050
cy.saveAndContinue()
5151

cypress/e2e/v1.0/pages/offence-analysis/offence-analysis.cy.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ import descriptionOfTheOffence from './questions/descriptionOfTheOffence'
22
import elementsOfTheOffence from './questions/elementsOfTheOffence'
33
import whyDidItHappen from './questions/whyDidItHappen'
44
import motivations from './questions/motivations'
5-
import whoWasTheVictim from './questions/whoWasTheVictim'
5+
import whoWasTheOffenceCommittedAgainst from './questions/whoWasTheOffenceCommittedAgainst'
66

77
describe('/offence-analysis', () => {
88
const stepUrl = '/offence-analysis'
99
const summaryPage = '/offence-analysis-summary'
10-
const questions = [descriptionOfTheOffence, elementsOfTheOffence, whyDidItHappen, motivations, whoWasTheVictim]
10+
const questions = [
11+
descriptionOfTheOffence,
12+
elementsOfTheOffence,
13+
whyDidItHappen,
14+
motivations,
15+
whoWasTheOffenceCommittedAgainst,
16+
]
1117

1218
beforeEach(() => {
1319
cy.createAssessment().enterAssessment()

cypress/e2e/v1.0/pages/offence-analysis/questions/victim/summary.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type VictimDetails = {
88

99
export const assertVictimEntry = (victimNumber: number, victimDetails: VictimDetails) => {
1010
cy.getCollectionEntry('victim', victimNumber).within(() => {
11-
cy.getSummary("What is Sam's relationship to the victim?").getAnswer(victimDetails.relationship)
11+
cy.getSummary('Who is the victim?').getAnswer(victimDetails.relationship)
1212

1313
cy.getSummary("What is the victim's approximate age?").getAnswer(victimDetails.age)
1414

cypress/e2e/v1.0/pages/offence-analysis/questions/victim/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { VictimDetails } from './summary'
22

33
const enterVictimDetailsWith = (victimDetails: VictimDetails) => {
4-
cy.getQuestion("What is Sam's relationship to the victim?").getRadio(victimDetails.relationship).clickLabel()
4+
cy.getQuestion('Who is the victim?').getRadio(victimDetails.relationship).clickLabel()
55
cy.getQuestion("What is the victim's approximate age?").getRadio(victimDetails.age).clickLabel()
66
cy.getQuestion("What is the victim's sex?").getRadio(victimDetails.sex).clickLabel()
77
cy.getQuestion("What is the victim's race or ethnicity?").enterText(`${victimDetails.raceOrEthnicityPartial}{enter}`)

cypress/e2e/v1.0/pages/offence-analysis/questions/victim/victimRelationship.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const question = "What is Sam's relationship to the victim?"
1+
const question = 'Who is the victim?'
22
const options = [
33
'A stranger',
44
'Criminal justice staff',
5-
"Victim's child",
6-
"Victim's partner",
7-
"Victim's ex-partner",
8-
"Victim's parent or step-parent",
5+
"Sam's parent or step-parent",
6+
"Sam's partner",
7+
"Sam's ex-partner",
8+
"Sam's child or step-child",
99
'Other family member',
1010
'Other',
1111
]
@@ -17,7 +17,7 @@ const testCreate = (createUrl: string, editUrl: string, positionNumber: number)
1717

1818
cy.getQuestion(question).isQuestionNumber(positionNumber).hasHint(null).hasRadios(options)
1919
cy.saveAndContinue()
20-
cy.getQuestion(question).hasValidationError('Select relationship to the victim')
20+
cy.getQuestion(question).hasValidationError('Select who the victim is')
2121
cy.checkAccessibility()
2222

2323
cy.assertStepUrlIs(editUrl)

cypress/e2e/v1.0/pages/offence-analysis/questions/whoWasTheVictim.ts cypress/e2e/v1.0/pages/offence-analysis/questions/whoWasTheOffenceCommittedAgainst.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
export default (stepUrl: string, summaryPage: string, positionNumber: number) => {
2-
const question = 'Who was the victim?'
2+
const question = 'Who was the offence committed against?'
33
describe(question, () => {
4-
const options = ['One or more person', 'Other']
4+
const options = ['One or more people', 'Other']
55

66
it(`displays and validates the question`, () => {
77
cy.getQuestion(question).isQuestionNumber(positionNumber).hasHint('Select all that apply.').hasCheckboxes(options)
88

99
cy.saveAndContinue()
1010
cy.assertStepUrlIs(stepUrl)
11-
cy.getQuestion(question).hasValidationError('Select who the victim was')
11+
cy.getQuestion(question).hasValidationError('Select who the offence was committed against')
1212
cy.checkAccessibility()
1313
})
1414

@@ -17,7 +17,7 @@ export default (stepUrl: string, summaryPage: string, positionNumber: number) =>
1717

1818
cy.getQuestion(question)
1919
.getCheckbox(option)
20-
.hasHint('For example, the wider community.')
20+
.hasHint('For example, a business or the wider community.')
2121
.hasConditionalQuestion(false)
2222
.clickLabel()
2323

@@ -50,8 +50,8 @@ export default (stepUrl: string, summaryPage: string, positionNumber: number) =>
5050
cy.getQuestion(question).getCheckbox(option).isChecked().getConditionalQuestion().hasText('some text')
5151
})
5252

53-
it(`no conditional field is displayed for "One or more person"`, () => {
54-
const option = 'One or more person'
53+
it(`no conditional field is displayed for "One or more people"`, () => {
54+
const option = 'One or more people'
5555

5656
cy.getQuestion(question).getCheckbox(option).hasConditionalQuestion(false).clickLabel()
5757

cypress/e2e/v1.0/print-preview.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ describe('assessment print preview', () => {
212212
cy.getSummary('Did the current index offence(s) involve any of the following motivations?')
213213
.getAnswer('Thrill seeking')
214214
.hasNoSecondaryAnswer()
215-
cy.getSummary('Who was the victim?').getAnswer('Other').hasSecondaryAnswer('¯\\_(ツ)_/¯')
215+
cy.getSummary('Who was the offence committed against?').getAnswer('Other').hasSecondaryAnswer('¯\\_(ツ)_/¯')
216216
cy.getSummary('How many other people were involved with committing the current index offence(s)?')
217217
.getAnswer('There was no one else involved')
218218
.hasNoSecondaryAnswer()

cypress/fixtures/complete-assessment.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"metaData": {
3-
"uuid": "b23a14c3-e5f4-41e2-ac0a-f67c4f7eac09",
4-
"createdAt": "2024-11-01T11:23:09.372259",
5-
"versionUuid": "3578614f-ebe8-44b5-b470-8a8be1a2c1ee",
3+
"uuid": "55d794ae-8074-4cfa-8b4e-2f468013166c",
4+
"createdAt": "2024-11-04T10:16:15.372284",
5+
"versionUuid": "ad39d8ba-de54-4c9e-9bca-278d334a935b",
66
"versionNumber": 0,
7-
"versionCreatedAt": "2024-11-01T11:23:09.372455",
8-
"versionUpdatedAt": "2024-11-01T11:24:02.166581",
7+
"versionCreatedAt": "2024-11-04T10:16:15.372495",
8+
"versionUpdatedAt": "2024-11-04T10:17:00.217158",
99
"versionTag": "UNSIGNED",
1010
"formVersion": "1.0"
1111
},
@@ -1162,11 +1162,11 @@
11621162
},
11631163
"offence_analysis_who_was_the_victim": {
11641164
"type": "CHECKBOX",
1165-
"description": "Who was the victim?",
1165+
"description": "Who was the offence committed against?",
11661166
"options": [
11671167
{
11681168
"value": "ONE_OR_MORE_PERSON",
1169-
"text": "One or more person"
1169+
"text": "One or more people"
11701170
},
11711171
{
11721172
"value": "OTHER",

0 commit comments

Comments
 (0)