Skip to content

Commit 1e8ffbd

Browse files
AlexBuzeaMoLala1madhavi1203
authored andcommitted
HDPI-2381-ASBQuestions-page-implementation (#926)
Co-authored-by: MoLala1 <[email protected]> Co-authored-by: madhavi1203 <[email protected]>
1 parent 3d0c1fd commit 1e8ffbd

File tree

17 files changed

+407
-18
lines changed

17 files changed

+407
-18
lines changed

src/e2eTest/data/page-data/antiSocialBehaviourWales.page.data.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const asbQuestionsWales = {
2+
mainHeader: `Antisocial behaviour and illegal or prohibited conduct`,
3+
cancelLink: `Cancel`,
4+
caseNumberParagraph: `Case number:`,
5+
continueButton: `Continue`,
6+
cymraegToggleLink: `Cymraeg`,
7+
giveDetailsOfAsbHiddenTextLabel: `Give details of the actual or threatened antisocial behaviour`,
8+
giveDetailsOfAsbHiddenTextInput: `Aggression to others`,
9+
giveDetailsOfIllegalHiddenTextLabel: `Give details of the actual or threatened use of the premises for illegal purposes`,
10+
giveDetailsOfIllegalHiddenTextInput: `illegal purposes`,
11+
giveDetailsOfTheOtherHiddenTextLabel: `Give details of the other prohibited conduct`,
12+
giveDetailsOfTheOtherHiddenTextInput: `prohibited conduct`,
13+
hasThereBeenOtherProhibitedQuestion: `Has there been other prohibited conduct?`,
14+
isThereActualOrThreatenedAsbQuestion: `Is there actual or threatened antisocial behaviour?`,
15+
isThereActualIllegalPurposesQuestion: `Is there actual or threatened use of the premises for illegal purposes?`,
16+
makeAClaimCaption: `Make a claim`,
17+
noRadioOption: `No`,
18+
previousButton: `Previous`,
19+
yesRadioOption: `Yes`,
20+
youCanEnterUpToHintText: `You can enter up to 500 characters`,
21+
youllHaveTheOptionToParagraph: `You’ll have the option to upload documents that give more details about the antisocial behaviour or illegal or prohibited conduct you’re describing or evidence of this behaviour later on.`
22+
};

src/e2eTest/data/page-data/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ export * from '@data/page-data/caseList.page.data';
6666
export * from '@data/page-data/caseSummary.page.data';
6767
export * from '@data/page-data/occupationContractOrLicenceDetailsWales.page.data';
6868
export * from '@data/page-data/prohibitedConductStandardContractWales.page.data';
69-
export * from '@data/page-data/antiSocialBehaviourWales.page.data';
69+
export * from '@data/page-data/asbQuestionsWales.page.data';

src/e2eTest/tests/createCaseWales.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { test } from '@playwright/test';
22
import {
33
addressCheckYourAnswers,
44
addressDetails,
5-
antiSocialBehaviourWales,
65
claimantCircumstances,
76
claimantDetailsWales,
87
claimantName,
@@ -24,6 +23,8 @@ import {
2423
rentDetails,
2524
reasonsForPossession,
2625
signInOrCreateAnAccount,
26+
asbQuestionsWales,
27+
noticeDetails,
2728
user,
2829
whatAreYourGroundsForPossessionWales
2930
} from '@data/page-data';
@@ -316,8 +317,11 @@ test.describe('[Create Case - Wales] @regression', async () => {
316317
await performAction('selectYourPossessionGrounds', {
317318
discretionary: [whatAreYourGroundsForPossessionWales.discretionary.rentArrears,whatAreYourGroundsForPossessionWales.discretionary.antiSocialBehaviour],
318319
});
319-
await performValidation('mainHeader', antiSocialBehaviourWales.mainHeader);
320-
await performAction('clickButton', antiSocialBehaviourWales.continue);
320+
await performAction('selectAsbQuestions', {
321+
asbChoice: asbQuestionsWales.yesRadioOption,giveDetailsOfAsb: asbQuestionsWales.giveDetailsOfAsbHiddenTextInput,
322+
illegalPurposesChoice: asbQuestionsWales.yesRadioOption, giveDetailsOfIllegal: asbQuestionsWales.giveDetailsOfIllegalHiddenTextInput,
323+
prohibitedConductChoice: asbQuestionsWales.yesRadioOption, giveDetailsOfTheOther: asbQuestionsWales.giveDetailsOfTheOtherHiddenTextInput
324+
});
321325
await performValidation('mainHeader', preActionProtocol.mainHeader);
322326
await performAction('selectPreActionProtocol', preActionProtocol.yes);
323327
await performAction('selectMediationAndSettlement', {

src/e2eTest/utils/actions/custom-actions/createCaseWales.action.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import {claimantDetailsWales} from '@data/page-data/claimantDetailsWales.page.da
55
import {addressInfo, caseNumber, CreateCaseAction} from "@utils/actions/custom-actions/createCase.action";
66
import {prohibitedConductStandardContractWales} from '@data/page-data/prohibitedConductStandardContractWales.page.data';
77
import {occupationContractOrLicenceDetailsWales} from '@data/page-data/occupationContractOrLicenceDetailsWales.page.data';
8+
import {asbQuestionsWales} from '@data/page-data/asbQuestionsWales.page.data';
89

910
export class CreateCaseWalesAction extends CreateCaseAction implements IAction {
1011
async execute(page: Page, action: string, fieldName: actionData | actionRecord, data?: actionData): Promise<void> {
1112
const actionsMap = new Map<string, () => Promise<void>>([
1213
['selectClaimantDetails', () => this.selectClaimantDetails(fieldName as actionRecord)],
1314
['selectProhibitedConductStandardContract', () => this.selectProhibitedConductStandardContract(fieldName as actionRecord)],
14-
['selectOccupationContractOrLicenceDetails', () => this.selectOccupationContractOrLicenceDetails(fieldName as actionRecord)]
15+
['selectOccupationContractOrLicenceDetails', () => this.selectOccupationContractOrLicenceDetails(fieldName as actionRecord)],
16+
['selectAsbQuestions', () => this.selectAsbQuestions(fieldName as actionRecord)]
1517
]);
1618
const actionToPerform = actionsMap.get(action);
1719
if (!actionToPerform) throw new Error(`No action found for '${action}'`);
@@ -78,4 +80,34 @@ export class CreateCaseWalesAction extends CreateCaseAction implements IAction {
7880
}
7981
await performAction('clickButton', claimantDetailsWales.continue);
8082
}
83+
84+
private async selectAsbQuestions(asbQuestions: actionRecord) {
85+
await performValidation('text', {elementType: 'paragraph', text: 'Case number: ' + caseNumber});
86+
await performValidation('text', {
87+
elementType: 'paragraph',
88+
text: `Property address: ${addressInfo.buildingStreet}, ${addressInfo.townCity}, ${addressInfo.engOrWalPostcode}`
89+
});
90+
await performAction('clickRadioButton', {
91+
question: asbQuestionsWales.isThereActualOrThreatenedAsbQuestion,
92+
option: asbQuestions.asbChoice
93+
});
94+
if (asbQuestions.asbChoice == asbQuestionsWales.yesRadioOption) {
95+
await performAction('inputText', asbQuestionsWales.giveDetailsOfAsbHiddenTextLabel, asbQuestions.giveDetailsOfAsb);
96+
}
97+
await performAction('clickRadioButton', {
98+
question: asbQuestionsWales.isThereActualIllegalPurposesQuestion,
99+
option: asbQuestions.illegalPurposesChoice
100+
});
101+
if (asbQuestions.illegalPurposesChoice === asbQuestionsWales.yesRadioOption) {
102+
await performAction('inputText', asbQuestionsWales.giveDetailsOfIllegalHiddenTextLabel, asbQuestions.giveDetailsOfIllegal);
103+
}
104+
await performAction('clickRadioButton', {
105+
question: asbQuestionsWales.hasThereBeenOtherProhibitedQuestion,
106+
option: asbQuestions.prohibitedConductChoice
107+
});
108+
if (asbQuestions.prohibitedConductChoice === asbQuestionsWales.yesRadioOption) {
109+
await performAction('inputText', asbQuestionsWales.giveDetailsOfTheOtherHiddenTextLabel, asbQuestions.giveDetailsOfTheOther);
110+
}
111+
await performAction('clickButton', asbQuestionsWales.continueButton);
112+
}
81113
}

src/e2eTest/utils/registry/action.registry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export class ActionRegistry {
8383
['clickButtonAndWaitForElement', new ClickButtonAction()],
8484
['selectProhibitedConductStandardContract', new CreateCaseWalesAction()],
8585
['selectOccupationContractOrLicenceDetails', new CreateCaseWalesAction()],
86-
['provideMoreDetailsOfClaim', new CreateCaseAction()]
86+
['provideMoreDetailsOfClaim', new CreateCaseAction()],
87+
['selectAsbQuestions', new CreateCaseWalesAction()]
8788
]);
8889

8990
static getAction(actionName: string): IAction {

src/main/java/uk/gov/hmcts/reform/pcs/ccd/domain/PCSCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.CitizenAccess;
2424
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcement.EnforcementOrder;
2525
import uk.gov.hmcts.reform.pcs.ccd.domain.model.NoRentArrearsReasonForGrounds;
26+
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.ASBQuestionsDetailsWales;
2627
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.DiscretionaryGroundWales;
2728
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.EstateManagementGroundsWales;
2829
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.MandatoryGroundWales;
@@ -769,4 +770,8 @@ public class PCSCase {
769770
@CCD(searchable = false)
770771
private YesOrNo showASBQuestionsPageWales;
771772

773+
@JsonUnwrapped(prefix = "wales")
774+
@CCD
775+
private ASBQuestionsDetailsWales asbQuestionsWales;
776+
772777
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package uk.gov.hmcts.reform.pcs.ccd.domain.wales;
2+
3+
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4+
import com.fasterxml.jackson.databind.annotation.JsonNaming;
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
import uk.gov.hmcts.ccd.sdk.api.CCD;
10+
import uk.gov.hmcts.reform.pcs.ccd.domain.VerticalYesNo;
11+
12+
import static uk.gov.hmcts.ccd.sdk.type.FieldType.TextArea;
13+
14+
@Data
15+
@Builder
16+
@NoArgsConstructor
17+
@AllArgsConstructor
18+
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
19+
public class ASBQuestionsDetailsWales {
20+
21+
@CCD(
22+
searchable = false,
23+
label = "Is there actual or threatened antisocial behaviour?"
24+
)
25+
private VerticalYesNo antisocialBehaviour;
26+
27+
@CCD(
28+
label = "Give details of the actual or threatened antisocial behaviour",
29+
hint = "You can enter up to 500 characters",
30+
typeOverride = TextArea
31+
)
32+
private String antisocialBehaviourDetails;
33+
34+
@CCD(
35+
searchable = false,
36+
label = "Is there actual or threatened use of the premises for illegal purposes?"
37+
)
38+
private VerticalYesNo illegalPurposesUse;
39+
40+
@CCD(
41+
label = "Give details of the actual or threatened use of the premises for illegal purposes",
42+
hint = "You can enter up to 500 characters",
43+
typeOverride = TextArea
44+
)
45+
private String illegalPurposesUseDetails;
46+
47+
@CCD(
48+
searchable = false,
49+
label = "Has there been other prohibited conduct?"
50+
)
51+
private VerticalYesNo otherProhibitedConduct;
52+
53+
@CCD(
54+
label = "Give details of the other prohibited conduct",
55+
hint = "You can enter up to 500 characters",
56+
typeOverride = TextArea
57+
)
58+
private String otherProhibitedConductDetails;
59+
}
60+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package uk.gov.hmcts.reform.pcs.ccd.domain.wales;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
@Data
10+
@Builder
11+
@NoArgsConstructor
12+
@AllArgsConstructor
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
14+
public class ASBQuestionsWales {
15+
16+
private Boolean antisocialBehaviour;
17+
private String antisocialBehaviourDetails;
18+
private Boolean illegalPurposesUse;
19+
private String illegalPurposesUseDetails;
20+
private Boolean otherProhibitedConduct;
21+
private String otherProhibitedConductDetails;
22+
23+
}
24+

src/main/java/uk/gov/hmcts/reform/pcs/ccd/entity/ClaimEntity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.fasterxml.jackson.annotation.JsonBackReference;
44
import com.fasterxml.jackson.annotation.JsonManagedReference;
5+
56
import jakarta.persistence.Entity;
67
import jakarta.persistence.EnumType;
78
import jakarta.persistence.Enumerated;
@@ -20,6 +21,7 @@
2021
import org.hibernate.annotations.JdbcTypeCode;
2122
import org.hibernate.type.SqlTypes;
2223
import uk.gov.hmcts.reform.pcs.ccd.domain.LanguageUsed;
24+
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.ASBQuestionsWales;
2325
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.ProhibitedConductWales;
2426
import uk.gov.hmcts.reform.pcs.ccd.domain.SuspensionOfRightToBuyHousingAct;
2527
import uk.gov.hmcts.reform.pcs.ccd.domain.DemotionOfTenancyHousingAct;
@@ -93,6 +95,9 @@ public class ClaimEntity {
9395
@JdbcTypeCode(SqlTypes.JSON)
9496
private ProhibitedConductWales prohibitedConduct;
9597

98+
@JdbcTypeCode(SqlTypes.JSON)
99+
private ASBQuestionsWales asbQuestions;
100+
96101
public void addParty(PartyEntity party, PartyRole partyRole) {
97102
ClaimPartyEntity claimPartyEntity = ClaimPartyEntity.builder()
98103
.claim(this)

0 commit comments

Comments
 (0)