Skip to content

Commit

Permalink
CIV-14262 2 Defendant LiP Email notification Notice of Discontinuance (
Browse files Browse the repository at this point in the history
…#4658)

* CIV-14262 API test Lip notification Mail

* CIV-14262 Name file changed

* CIV-14262 Fix file name change

---------

Co-authored-by: Azam <[email protected]>
  • Loading branch information
Omaira-Melo-Hmcts and Azam-Hmcts authored Jul 24, 2024
1 parent 0539997 commit 26845d3
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 3 deletions.
4 changes: 2 additions & 2 deletions e2e/api/steps_LRspec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const mediationUnsuccessful = require('../fixtures/events/cui/unsuccessfulMediat
const evidenceUploadApplicant = require('../fixtures/events/evidenceUploadApplicant');
const evidenceUploadRespondent = require('../fixtures/events/evidenceUploadRespondent');
const settleClaim1v1Spec = require('../fixtures/events/settleClaim1v1Spec');
const discontinueClaim2v1Spec = require('../fixtures/events/discontinueClaim2v1Spec');
const discontinueClaimSpec = require('../fixtures/events/discontinueClaimSpec');
const validateDiscontinueClaimClaimantSpec = require('../fixtures/events/validateDiscontinueClaimClaimantSpec');
const {cloneDeep} = require('lodash');
const {adjustCaseSubmittedDateForMinti, getMintiTrackByClaimAmount, assertTrackAfterClaimCreation} = require('../helpers/mintiHelper');
Expand Down Expand Up @@ -85,7 +85,7 @@ const data = {
REFER_JUDGE_DEFENCE_RECEIVED: () => judgmentOnline1v1Spec.referJudgeDefenceReceived(),
SETTLE_CLAIM_MARK_PAID_FULL: (addApplicant2) => settleClaim1v1Spec.settleClaim(addApplicant2),
SETTLE_CLAIM_MARK_PAID_FULL_SELECT_CLAIMANT: (addApplicant2) => settleClaim1v1Spec.claimantDetails(addApplicant2),
DISCONTINUE_CLAIM: (mpScenario) => discontinueClaim2v1Spec.discontinueClaim(mpScenario),
DISCONTINUE_CLAIM: (mpScenario) => discontinueClaimSpec.discontinueClaim(mpScenario),
VALIDATE_DISCONTINUE_CLAIM_CLAIMANT: (permission) => validateDiscontinueClaimClaimantSpec.validateDiscontinueClaimClaimant(permission),
};

Expand Down
45 changes: 44 additions & 1 deletion e2e/api/steps_LRspecCui.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const {PBAv3} = require('../fixtures/featureKeys');
const {adjustCaseSubmittedDateForCarm} = require('../helpers/carmHelper');
const {fetchCaseDetails} = require('./apiRequest');
const lipClaimantResponse = require('../fixtures/events/cui/lipClaimantResponse');
const discontinueClaimSpec = require('../fixtures/events/discontinueClaimSpec');

let caseId, eventName;
let caseData = {};
Expand All @@ -36,7 +37,8 @@ const data = {
CLAIMANT_RESPONSE: (mpScenario, citizenDefendantResponse, freeMediation, carmEnabled) => require('../fixtures/events/claimantResponseSpecCui.js').claimantResponse(mpScenario, citizenDefendantResponse, freeMediation, carmEnabled),
REQUEST_JUDGEMENT: (mpScenario) => require('../fixtures/events/requestJudgementSpecCui.js').response(mpScenario),
INFORM_AGREED_EXTENSION_DATE: () => require('../fixtures/events/informAgreeExtensionDateSpec.js'),
EXTEND_RESPONSE_DEADLINE_DATE: () => require('../fixtures/events/extendResponseDeadline.js')
EXTEND_RESPONSE_DEADLINE_DATE: () => require('../fixtures/events/extendResponseDeadline.js'),
DISCONTINUE_CLAIM: (mpScenario) => discontinueClaimSpec.discontinueClaim(mpScenario),
};

const eventData = {
Expand Down Expand Up @@ -282,6 +284,41 @@ module.exports = {
await waitForFinishedBusinessProcess(caseId);
},

discontinueClaim: async (user, mpScenario) => {
console.log('discontinueClaim for case id ' + caseId);
await apiRequest.setupTokens(user);
eventName = 'DISCONTINUE_CLAIM_CLAIMANT';

let returnedCaseData = await apiRequest.startEvent(eventName, caseId);
delete returnedCaseData['SearchCriteria'];
caseData = returnedCaseData;

assertContainsPopulatedFields(returnedCaseData);

let disposalData = data.DISCONTINUE_CLAIM(mpScenario);
for (let pageId of Object.keys(disposalData.userInput)) {
await assertValidData(disposalData, pageId);
}

if (mpScenario === 'TWO_V_ONE') {
await assertSubmittedEvent('AWAITING_RESPONDENT_ACKNOWLEDGEMENT', {
header: '# We have noted your claim has been partly discontinued and your claim has been updated',
body: ''
}, true);
} else if (mpScenario === 'ONE_V_TWO' || mpScenario === 'ONE_V_ONE_NO_P_NEEDED' ) {
await assertSubmittedEvent('CASE_DISCONTINUED', {
header: '# Your claim has been discontinued',
body: ''
}, true);
} else {
await assertSubmittedEvent('AWAITING_RESPONDENT_ACKNOWLEDGEMENT', {
header: '# Your request is being reviewed',
body: ''
}, true);
}
await waitForFinishedBusinessProcess(caseId);
},

checkUserCaseAccess: async (user, shouldHaveAccess) => {
console.log(`Checking ${user.email} ${shouldHaveAccess ? 'has' : 'does not have'} access to the case.`);
const expectedStatus = shouldHaveAccess ? 200 : 403;
Expand Down Expand Up @@ -473,6 +510,12 @@ const deleteCaseFields = (...caseFields) => {
caseFields.forEach(caseField => delete caseData[caseField]);
};

const assertContainsPopulatedFields = returnedCaseData => {
for (let populatedCaseField of Object.keys(caseData)) {
assert.property(returnedCaseData, populatedCaseField);
}
};

const assertCorrectEventsAreAvailableToUser = async (user, state) => {
console.log(`Asserting user ${user.type} in env ${config.runningEnv} has correct permissions`);
const caseForDisplay = await apiRequest.fetchCaseForDisplay(user, caseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ module.exports = {
};
}
break;
case 'ONE_V_ONE_NO_P_NEEDED': {
data.userInput = {
courtPermission: {
courtPermissionNeeded: 'NO',
courtPermissionNeededChecked: [
'CourtPermissionNeededChecked'
]
},
PermissionGranted: {
isPermissionGranted:'YES',
permissionGrantedComplex:{
permissionGrantedJudge:'test',
permissionGrantedDate:'2023-02-01'
}
},
DiscontinuanceType: {
typeOfDiscontinuance:'FULL_DISCONTINUANCE'
}
};
}
break;
}
return data;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable no-unused-vars */

const config = require('../../../config.js');
const {createAccount, deleteAccount} = require('../../../api/idamHelper');

const claimType = 'SmallClaims';
let caseId;

Feature('CCD 1v1 API test @api-spec-cui @api-nonprod @api-settle-discont');

Before(async () => {
await createAccount(config.defendantCitizenUser2.email, config.defendantCitizenUser2.password);
});

async function prepareClaimLRvLiPExui(api_spec_cui, carmEnabled) {
let expectedEndState = carmEnabled ? 'IN_MEDIATION' : 'JUDICIAL_REFERRAL';
caseId = await api_spec_cui.createSpecifiedClaimWithUnrepresentedRespondent(config.applicantSolicitorUser, 'ONE_V_ONE', claimType, carmEnabled);
await api_spec_cui.performCitizenDefendantResponse(config.defendantCitizenUser2, caseId, claimType, carmEnabled);
await api_spec_cui.claimantResponse(config.applicantSolicitorUser, 'FULL_DEFENCE_CITIZEN_DEFENDANT', 'ONE_V_ONE', 'No', expectedEndState, carmEnabled);
}
Scenario.only('Discontinue claim 1v1 LR v LiP defendant and claimant response - claim created from exui - CARM not enabled', async ({api_spec_cui}) => {
if (['preview', 'demo'].includes(config.runningEnv)) {
let mpScenario = 'ONE_V_ONE_NO_P_NEEDED';
await prepareClaimLRvLiPExui(api_spec_cui, false);
await api_spec_cui.discontinueClaim(config.applicantSolicitorUser, mpScenario);
}
});

AfterSuite(async ({api_spec_cui}) => {
await api_spec_cui.cleanUp();
await deleteAccount(config.defendantCitizenUser2.email);
});

0 comments on commit 26845d3

Please sign in to comment.