From 059ce941652bdfc7936b115dffef344f257af120 Mon Sep 17 00:00:00 2001 From: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:54:10 +0000 Subject: [PATCH] CIV-15745 Fix payload for non carm response (#5027) * fix payload for non carm response * fix payload for carm response * fix date logic for test setup --- e2e/api/steps_LRspec.js | 2 +- e2e/api/steps_LRspecCui.js | 2 +- e2e/api/steps_LRspecSmall.js | 10 +- .../events/cui/defendantResponseCui.js | 30 ---- .../events/defendantResponseSpecSmall.js | 139 +++++++++++++++++- e2e/helpers/carmHelper.js | 8 +- e2e/helpers/mintiHelper.js | 6 +- .../lrspec/api_1v1_spec_small_test.js | 6 +- 8 files changed, 154 insertions(+), 49 deletions(-) diff --git a/e2e/api/steps_LRspec.js b/e2e/api/steps_LRspec.js index 0dd3ebaf7d..5f659fed13 100644 --- a/e2e/api/steps_LRspec.js +++ b/e2e/api/steps_LRspec.js @@ -857,7 +857,7 @@ module.exports = { await adjustCaseSubmittedDateForCarm(caseId, carmEnabled); const isMintiToggleEnabled = await checkMintiToggleEnabled(); - await adjustCaseSubmittedDateForMinti(caseId, (isMintiToggleEnabled && isMintiCase)); + await adjustCaseSubmittedDateForMinti(caseId, (isMintiToggleEnabled && isMintiCase), carmEnabled); return caseId; }, diff --git a/e2e/api/steps_LRspecCui.js b/e2e/api/steps_LRspecCui.js index 46924acb54..1dabfbb9fa 100644 --- a/e2e/api/steps_LRspecCui.js +++ b/e2e/api/steps_LRspecCui.js @@ -168,7 +168,7 @@ module.exports = { await adjustCaseSubmittedDateForCarm(caseId, carmEnabled); if (isMintiCase) { const isMintiToggleEnabled = await checkMintiToggleEnabled(); - await adjustCaseSubmittedDateForMinti(caseId, (isMintiToggleEnabled && isMintiCase)); + await adjustCaseSubmittedDateForMinti(caseId, (isMintiToggleEnabled && isMintiCase), carmEnabled); } return caseId; }, diff --git a/e2e/api/steps_LRspecSmall.js b/e2e/api/steps_LRspecSmall.js index 9309ac1204..742ebb4066 100644 --- a/e2e/api/steps_LRspecSmall.js +++ b/e2e/api/steps_LRspecSmall.js @@ -43,6 +43,7 @@ const data = { CREATE_CLAIM_HEARINGS: (scenario, pbaV3) => claimDataHearings.createClaim(scenario, pbaV3), DEFENDANT_RESPONSE: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpecSmall.js').respondToClaim(response, camundaEvent), DEFENDANT_RESPONSE_JUDICIAL_REFERRAL: () => require('../fixtures/events/defendantResponseSpecSmall.js').respondToClaimForJudicialReferral(), + DEFENDANT_RESPONSE_FULL_DEFENCE_CARM: () => require('../fixtures/events/defendantResponseSpecSmall.js').respondToClaimForCarm(), DEFENDANT_RESPONSE_1v2: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec1v2.js').respondToClaim(response, camundaEvent), DEFENDANT_RESPONSE2_1V2_2ND_DEF: (response) => require('../fixtures/events/defendantResponseSpecSmall.js').respondToClaim2(response), CLAIMANT_RESPONSE: (hasAgreedFreeMediation, carmEnabled) => require('../fixtures/events/claimantResponseSpecSmall.js').claimantResponse(hasAgreedFreeMediation, carmEnabled), @@ -70,7 +71,8 @@ const eventData = { PART_ADMISSION_PBAv3: data.DEFENDANT_RESPONSE('FULL_ADMISSION', 'CREATE_CLAIM_SPEC_AFTER_PAYMENT'), COUNTER_CLAIM: data.DEFENDANT_RESPONSE('COUNTER_CLAIM'), COUNTER_CLAIM_PBAv3: data.DEFENDANT_RESPONSE('COUNTER_CLAIM', 'CREATE_CLAIM_SPEC_AFTER_PAYMENT'), - FULL_DEFENCE_JUDICIAL_REFERRAL: data.DEFENDANT_RESPONSE_JUDICIAL_REFERRAL() + FULL_DEFENCE_JUDICIAL_REFERRAL: data.DEFENDANT_RESPONSE_JUDICIAL_REFERRAL(), + FULL_DEFENCE_CARM: data.DEFENDANT_RESPONSE_FULL_DEFENCE_CARM() }, ONE_V_TWO: { FULL_ADMISSION: data.DEFENDANT_RESPONSE_1v2('FULL_ADMISSION'), @@ -186,7 +188,7 @@ module.exports = function (){ return apiRequest.taskActionByUser(user, taskId, 'complete'); }, - defendantResponse: async (user, response = 'FULL_DEFENCE', scenario = 'ONE_V_ONE', judicialReferral = false) => { + defendantResponse: async (user, response = 'FULL_DEFENCE', scenario = 'ONE_V_ONE', judicialReferral = false, carmEnabled = false) => { await apiRequest.setupTokens(user); const pbaV3 = await checkToggleEnabled(PBAv3); @@ -210,6 +212,10 @@ module.exports = function (){ } } + if (carmEnabled) { + defendantResponseData = eventData['defendantResponses'][scenario]['FULL_DEFENCE_CARM']; + } + caseData = returnedCaseData; caseData = await addFlagsToFixture(caseData); diff --git a/e2e/fixtures/events/cui/defendantResponseCui.js b/e2e/fixtures/events/cui/defendantResponseCui.js index 953ec74b0a..b321a878c7 100644 --- a/e2e/fixtures/events/cui/defendantResponseCui.js +++ b/e2e/fixtures/events/cui/defendantResponseCui.js @@ -234,36 +234,6 @@ module.exports = { }, respondent1ResponseLanguage: 'ENGLISH', }, - respondent1LiPResponseCarm: { - isMediationPhoneCorrect: 'No', - alternativeMediationTelephone: '01632960001', - isMediationEmailCorrect: 'No', - alternativeMediationEmail: 'test@test.com', - hasUnavailabilityNextThreeMonths: 'Yes', - unavailableDatesForMediation: [ - { - id: '8f76a758-733b-42c0-95b9-69b3ee2b7e6a', - value: { - who: 'defendant', - date: '2024-01-01', - fromDate: '2024-01-01', - unavailableDateType: 'SINGLE_DATE' - } - }, - { - id: '38abd745-a52f-4ec1-86a9-2e2457b2f28b', - value: { - who: 'defendant', - date: '2024-03-13', - toDate: '2024-03-23', - fromDate: '2024-03-13', - unavailableDateType: 'DATE_RANGE' - } - } - ], - isMediationContactNameCorrect: 'No', - alternativeMediationContactPerson: 'aaa' - }, detailsOfWhyDoesYouDisputeTheClaim: 'Testreason', specClaimResponseTimelineList: 'MANUAL', specResponseTimelineOfEvents: [], diff --git a/e2e/fixtures/events/defendantResponseSpecSmall.js b/e2e/fixtures/events/defendantResponseSpecSmall.js index 16ca6c5762..1e22a02564 100644 --- a/e2e/fixtures/events/defendantResponseSpecSmall.js +++ b/e2e/fixtures/events/defendantResponseSpecSmall.js @@ -1,4 +1,4 @@ -const {listElement, element} = require('../../api/dataHelper'); +const {listElement, element, date} = require('../../api/dataHelper'); const config = require('../../config.js'); module.exports = { respondToClaim: (response = 'FULL_DEFENCE', camundaEvent = 'CREATE_CLAIM_SPEC') => { @@ -352,6 +352,143 @@ module.exports = { }; }, + respondToClaimForCarm: () => { + return { + userInput: { + ResponseConfirmNameAddress: { + specAoSApplicantCorrespondenceAddressRequired: 'Yes', + }, + ResponseConfirmDetails: { + specAoSRespondentCorrespondenceAddressRequired: 'Yes' + }, + RespondentResponseTypeSpec: { + respondent1ClaimResponseTypeForSpec: 'FULL_DEFENCE' + }, + defenceRoute: { + defenceRouteRequired: 'DISPUTES_THE_CLAIM' + }, + Upload: { + detailsOfWhyDoesYouDisputeTheClaim: 'details' + }, + HowToAddTimeline: { + specClaimResponseTimelineList: 'MANUAL' + }, + MediationContactInformation:{ + resp1MediationContactInfo: { + firstName:'John', + lastName: 'Maverick', + emailAddress:'john@doemail.com', + telephoneNumber:'07111111111' + } + }, + MediationAvailability: { + resp1MediationAvailability: { + isMediationUnavailablityExists: 'Yes', + unavailableDatesForMediation: [ + element({ + unavailableDateType: 'SINGLE_DATE', + date: date(10) + }), + element({ + unavailableDateType: 'SINGLE_DATE', + date: date(55) + }), + element({ + fromDate: date(30), + toDate: date(35), + unavailableDateType: 'DATE_RANGE', + }), + element({ + fromDate: date(40), + toDate: date(45), + unavailableDateType: 'DATE_RANGE', + }) + ] + } + }, + SmallClaimExperts: { + respondent1DQExperts: { + expertRequired: 'Yes', + expertReportsSent: 'NOT_OBTAINED', + jointExpertSuitable: 'Yes', + details: [ + element({ + firstName: 'John', + lastName: 'Doe', + emailAddress: 'john@doemail.com', + phoneNumber: '07111111111', + fieldOfExpertise: 'None', + whyRequired: 'Testing', + estimatedCost: '10000' + }) + ] + } + }, + SmallClaimWitnesses: { + respondent1DQWitnessesSmallClaim: { + witnessesToAppear: 'Yes', + details: [ + element({ + firstName: 'Witness', + lastName: 'One', + emailAddress: 'witness@email.com', + phoneNumber: '07116778998', + reasonForWitness: 'None' + }) + ] + } + }, + Language: { + respondent1DQLanguage: { + court: 'ENGLISH', + documents: 'ENGLISH' + } + }, + SmallClaimHearing: { + respondent1DQHearingSmallClaim: { + unavailableDatesRequired: 'No' + }, + SmallClaimHearingInterpreterRequired: 'No' + }, + RequestedCourtLocationLRspec: { + respondToCourtLocation: { + responseCourtLocations: { + list_items: [ + listElement(config.defendantSelectedCourt) + ], + value: listElement(config.defendantSelectedCourt) + }, + reasonForHearingAtSpecificCourt: 'Reasons' + } + }, + HearingSupport: { + respondent1DQHearingSupport: { + supportRequirements: 'Yes', + supportRequirementsAdditional: 'Sir John Doe: Step free wheelchair access' + } + }, + VulnerabilityQuestions: { + respondent1DQVulnerabilityQuestions: { + vulnerabilityAdjustmentsRequired: 'No' + } + }, + StatementOfTruth: { + uiStatementOfTruth: { + name: 'name', + role: 'role' + } + } + }, + midEventData: { + StatementOfTruth: { + respondent1DQHearing: { + unavailableDatesRequired: 'No' + } + } + } + }; + }, + respondToClaim2: (response = 'FULL_DEFENCE') => { const responseData = { userInput: { diff --git a/e2e/helpers/carmHelper.js b/e2e/helpers/carmHelper.js index 5efb9d1411..f3edea17cf 100644 --- a/e2e/helpers/carmHelper.js +++ b/e2e/helpers/carmHelper.js @@ -4,13 +4,7 @@ const testingSupport = require('./../api/testingSupport'); module.exports = { adjustCaseSubmittedDateForCarm: async (caseId, carmEnabled = false, isMintiEnabled = false) => { - if (carmEnabled) { - console.log('carm enabled, updating submitted date'); - await apiRequest.setupTokens(config.systemupdate); - const submittedDate = {'submittedDate':'2024-11-10T15:59:50'}; - await testingSupport.updateCaseData(caseId, submittedDate); - console.log('submitted date update to after carm date'); - } else if (!carmEnabled && !isMintiEnabled) { + if (!carmEnabled && !isMintiEnabled) { console.log('carm not enabled, minti not enabled updating submitted date'); await apiRequest.setupTokens(config.systemupdate); const submittedDate = {'submittedDate':'2024-10-10T15:59:50'}; diff --git a/e2e/helpers/mintiHelper.js b/e2e/helpers/mintiHelper.js index d1341ecba6..6c855d8edb 100644 --- a/e2e/helpers/mintiHelper.js +++ b/e2e/helpers/mintiHelper.js @@ -52,17 +52,17 @@ module.exports = { caseData.valid.References.submittedDate = '2025-02-20T15:59:50'; return caseData; }, - adjustCaseSubmittedDateForMinti: async (caseId, isMintiEnabled = false) => { + adjustCaseSubmittedDateForMinti: async (caseId, isMintiEnabled = false, isCarmEnabled = false) => { if (isMintiEnabled) { console.log('multi Intermediate track is enabled'); await apiRequest.setupTokens(config.systemupdate); const submittedDate = {'submittedDate':'2025-02-20T15:59:50'}; await testingSupport.updateCaseData(caseId, submittedDate); console.log('submitted date update to after multi Intermediate track live date'); - } else { + } else if (!isMintiEnabled && !isCarmEnabled) { console.log('multi Intermediate track not enabled, updating submitted date'); await apiRequest.setupTokens(config.systemupdate); - const submittedDate = {'submittedDate':'2022-05-10T15:59:50'}; + const submittedDate = {'submittedDate':'2024-10-28T15:59:50'}; await testingSupport.updateCaseData(caseId, submittedDate); console.log('submitted date update to before multi Intermediate track live date'); } diff --git a/e2e/tests/api_tests/lrspec/api_1v1_spec_small_test.js b/e2e/tests/api_tests/lrspec/api_1v1_spec_small_test.js index 5601a320c1..a4db047710 100644 --- a/e2e/tests/api_tests/lrspec/api_1v1_spec_small_test.js +++ b/e2e/tests/api_tests/lrspec/api_1v1_spec_small_test.js @@ -1,5 +1,3 @@ - - const config = require('../../../config.js'); const {checkCarmToggleEnabled} = require('../../../api/testingSupport'); @@ -32,8 +30,8 @@ Scenario('1v1 COUNTER_CLAIM claimant and defendant response small claim', async Scenario('1v1 FULL_DEFENCE claimant and defendant response small claim - CARM enabled', async ({I, api_spec_small}) => { if (await checkCarmToggleEnabled()) { - await api_spec_small.createClaimWithRepresentedRespondent(config.applicantSolicitorUser); - await api_spec_small.defendantResponse(config.defendantSolicitorUser, 'FULL_DEFENCE'); + await api_spec_small.createClaimWithRepresentedRespondent(config.applicantSolicitorUser, 'ONE_V_ONE', false, true); + await api_spec_small.defendantResponse(config.defendantSolicitorUser, 'FULL_DEFENCE', 'ONE_V_ONE', false, true); await api_spec_small.claimantResponse(config.applicantSolicitorUser, true, 'No', true); await api_spec_small.manageContactInformation(config.adminUser, true); }