From 687d33eba4cae01d2f4f0fd232ec485d1cb0fe6e Mon Sep 17 00:00:00 2001 From: m-meulendijks-v1 <107135537+m-meulendijks-v1@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:22:27 +0000 Subject: [PATCH 1/9] CIV-0000 - Shuttered CUI CP Release - DO NOT MERGE UNTIL RELEASE (#5131) CUI CP Release and Shutter Co-authored-by: ss-evoco --- bin/build-release-ccd-definition.sh | 8 ++++++++ ...nonprod.json => AuthorisationCaseEvent-CUI-CP.json} | 0 ...te-CUI-CP-nonprod.json => systemupdate-CUI-CP.json} | 0 ...nonprod.json => AuthorisationCaseField-CUI-CP.json} | 0 ...nonprod.json => AuthorisationCaseState-CUI-CP.json} | 0 ...ents-CUI-CP-nonprod.json => CaseEvents-CUI-CP.json} | 0 ...CUI-CP-nonprod.json => DashboardEvents-CUI-CP.json} | 0 ...-CP-nonprod.json => NotificationEvents-CUI-CP.json} | 0 ...ents-CUI-CP-nonprod.json => UserEvents-CUI-CP.json} | 0 ...-CUI-CP-nonprod.json => WorkAllocation-CUI-CP.json} | 0 ...I-CP-nonprod.json => FeePaymentOutcome-CUI-CP.json} | 0 ...es-CUI-CP-nonprod.json => HelpWithFees-CUI-CP.json} | 0 ...son => WorkAllocationIntegrationFields-CUI-CP.json} | 0 ...Field-CUI-CP-nonprod.json => CaseField-CUI-CP.json} | 0 ...dgeDecisionOnReconsiderationSelect-CUI-CP-prod.json | 10 ---------- ...> JudgeDecisionOnReconsiderationSelect-CUI-CP.json} | 0 ...pe-CUI-CP-nonprod.json => DocumentType-CUI-CP.json} | 0 ...nonprod.json => TranslatedDocumentType-CUI-CP.json} | 0 18 files changed, 8 insertions(+), 10 deletions(-) rename ccd-definition/AuthorisationCaseEvent/{AuthorisationCaseEvent-CUI-CP-nonprod.json => AuthorisationCaseEvent-CUI-CP.json} (100%) rename ccd-definition/AuthorisationCaseEvent/{systemupdate-CUI-CP-nonprod.json => systemupdate-CUI-CP.json} (100%) rename ccd-definition/AuthorisationCaseField/{AuthorisationCaseField-CUI-CP-nonprod.json => AuthorisationCaseField-CUI-CP.json} (100%) rename ccd-definition/AuthorisationCaseState/{AuthorisationCaseState-CUI-CP-nonprod.json => AuthorisationCaseState-CUI-CP.json} (100%) rename ccd-definition/CaseEvent/Camunda/{CaseEvents-CUI-CP-nonprod.json => CaseEvents-CUI-CP.json} (100%) rename ccd-definition/CaseEvent/Camunda/{DashboardEvents-CUI-CP-nonprod.json => DashboardEvents-CUI-CP.json} (100%) rename ccd-definition/CaseEvent/Camunda/{NotificationEvents-CUI-CP-nonprod.json => NotificationEvents-CUI-CP.json} (100%) rename ccd-definition/CaseEvent/User/{UserEvents-CUI-CP-nonprod.json => UserEvents-CUI-CP.json} (100%) rename ccd-definition/CaseEventToComplexTypes/{WorkAllocation-CUI-CP-nonprod.json => WorkAllocation-CUI-CP.json} (100%) rename ccd-definition/CaseEventToFields/{FeePaymentOutcome-CUI-CP-nonprod.json => FeePaymentOutcome-CUI-CP.json} (100%) rename ccd-definition/CaseEventToFields/{HelpWithFees-CUI-CP-nonprod.json => HelpWithFees-CUI-CP.json} (100%) rename ccd-definition/CaseEventToFields/{WorkAllocationIntegrationFields-CUI-CP-nonprod.json => WorkAllocationIntegrationFields-CUI-CP.json} (100%) rename ccd-definition/CaseField/{CaseField-CUI-CP-nonprod.json => CaseField-CUI-CP.json} (100%) delete mode 100644 ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-prod.json rename ccd-definition/ComplexTypes/{JudgeDecisionOnReconsiderationSelect-CUI-CP-nonprod.json => JudgeDecisionOnReconsiderationSelect-CUI-CP.json} (100%) rename ccd-definition/FixedLists/{DocumentType-CUI-CP-nonprod.json => DocumentType-CUI-CP.json} (100%) rename ccd-definition/FixedLists/{TranslatedDocumentType-CUI-CP-nonprod.json => TranslatedDocumentType-CUI-CP.json} (100%) diff --git a/bin/build-release-ccd-definition.sh b/bin/build-release-ccd-definition.sh index 5f10f7ff59..376383cd44 100755 --- a/bin/build-release-ccd-definition.sh +++ b/bin/build-release-ccd-definition.sh @@ -6,6 +6,14 @@ set -eu environment=${1:-prod} activateShutter=${2:-false} +if [ ${environment} == prod ]; then + echo "Running build for ${environment}" + activateShutter=true; +else + echo "Running build for ${environment}" + activateShutter=false; +fi + # if any exclusions are updated here, please also update the exclusions map in e2e/tests/unit/utils/dataProvider.js if [ ${environment} == preview ]; then diff --git a/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-CUI-CP-nonprod.json b/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-CUI-CP.json similarity index 100% rename from ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-CUI-CP-nonprod.json rename to ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-CUI-CP.json diff --git a/ccd-definition/AuthorisationCaseEvent/systemupdate-CUI-CP-nonprod.json b/ccd-definition/AuthorisationCaseEvent/systemupdate-CUI-CP.json similarity index 100% rename from ccd-definition/AuthorisationCaseEvent/systemupdate-CUI-CP-nonprod.json rename to ccd-definition/AuthorisationCaseEvent/systemupdate-CUI-CP.json diff --git a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-CUI-CP-nonprod.json b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-CUI-CP.json similarity index 100% rename from ccd-definition/AuthorisationCaseField/AuthorisationCaseField-CUI-CP-nonprod.json rename to ccd-definition/AuthorisationCaseField/AuthorisationCaseField-CUI-CP.json diff --git a/ccd-definition/AuthorisationCaseState/AuthorisationCaseState-CUI-CP-nonprod.json b/ccd-definition/AuthorisationCaseState/AuthorisationCaseState-CUI-CP.json similarity index 100% rename from ccd-definition/AuthorisationCaseState/AuthorisationCaseState-CUI-CP-nonprod.json rename to ccd-definition/AuthorisationCaseState/AuthorisationCaseState-CUI-CP.json diff --git a/ccd-definition/CaseEvent/Camunda/CaseEvents-CUI-CP-nonprod.json b/ccd-definition/CaseEvent/Camunda/CaseEvents-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEvent/Camunda/CaseEvents-CUI-CP-nonprod.json rename to ccd-definition/CaseEvent/Camunda/CaseEvents-CUI-CP.json diff --git a/ccd-definition/CaseEvent/Camunda/DashboardEvents-CUI-CP-nonprod.json b/ccd-definition/CaseEvent/Camunda/DashboardEvents-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEvent/Camunda/DashboardEvents-CUI-CP-nonprod.json rename to ccd-definition/CaseEvent/Camunda/DashboardEvents-CUI-CP.json diff --git a/ccd-definition/CaseEvent/Camunda/NotificationEvents-CUI-CP-nonprod.json b/ccd-definition/CaseEvent/Camunda/NotificationEvents-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEvent/Camunda/NotificationEvents-CUI-CP-nonprod.json rename to ccd-definition/CaseEvent/Camunda/NotificationEvents-CUI-CP.json diff --git a/ccd-definition/CaseEvent/User/UserEvents-CUI-CP-nonprod.json b/ccd-definition/CaseEvent/User/UserEvents-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEvent/User/UserEvents-CUI-CP-nonprod.json rename to ccd-definition/CaseEvent/User/UserEvents-CUI-CP.json diff --git a/ccd-definition/CaseEventToComplexTypes/WorkAllocation-CUI-CP-nonprod.json b/ccd-definition/CaseEventToComplexTypes/WorkAllocation-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEventToComplexTypes/WorkAllocation-CUI-CP-nonprod.json rename to ccd-definition/CaseEventToComplexTypes/WorkAllocation-CUI-CP.json diff --git a/ccd-definition/CaseEventToFields/FeePaymentOutcome-CUI-CP-nonprod.json b/ccd-definition/CaseEventToFields/FeePaymentOutcome-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEventToFields/FeePaymentOutcome-CUI-CP-nonprod.json rename to ccd-definition/CaseEventToFields/FeePaymentOutcome-CUI-CP.json diff --git a/ccd-definition/CaseEventToFields/HelpWithFees-CUI-CP-nonprod.json b/ccd-definition/CaseEventToFields/HelpWithFees-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEventToFields/HelpWithFees-CUI-CP-nonprod.json rename to ccd-definition/CaseEventToFields/HelpWithFees-CUI-CP.json diff --git a/ccd-definition/CaseEventToFields/WorkAllocationIntegrationFields-CUI-CP-nonprod.json b/ccd-definition/CaseEventToFields/WorkAllocationIntegrationFields-CUI-CP.json similarity index 100% rename from ccd-definition/CaseEventToFields/WorkAllocationIntegrationFields-CUI-CP-nonprod.json rename to ccd-definition/CaseEventToFields/WorkAllocationIntegrationFields-CUI-CP.json diff --git a/ccd-definition/CaseField/CaseField-CUI-CP-nonprod.json b/ccd-definition/CaseField/CaseField-CUI-CP.json similarity index 100% rename from ccd-definition/CaseField/CaseField-CUI-CP-nonprod.json rename to ccd-definition/CaseField/CaseField-CUI-CP.json diff --git a/ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-prod.json b/ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-prod.json deleted file mode 100644 index 709ad2bd55..0000000000 --- a/ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-prod.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "ID": "JudgeDecisionOnReconsiderationSelect", - "ListElementCode": "reasonForReconsiderationLblAmendingTxt", - "ElementLabel": "If you wish to do this you should select \"general order\" from dropdown menu on the right of the screen. This will allow you to make a bespoke order in the case.\n", - "FieldType": "Label", - "SecurityClassification": "Public", - "Searchable": "N" - } -] diff --git a/ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-nonprod.json b/ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP.json similarity index 100% rename from ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP-nonprod.json rename to ccd-definition/ComplexTypes/JudgeDecisionOnReconsiderationSelect-CUI-CP.json diff --git a/ccd-definition/FixedLists/DocumentType-CUI-CP-nonprod.json b/ccd-definition/FixedLists/DocumentType-CUI-CP.json similarity index 100% rename from ccd-definition/FixedLists/DocumentType-CUI-CP-nonprod.json rename to ccd-definition/FixedLists/DocumentType-CUI-CP.json diff --git a/ccd-definition/FixedLists/TranslatedDocumentType-CUI-CP-nonprod.json b/ccd-definition/FixedLists/TranslatedDocumentType-CUI-CP.json similarity index 100% rename from ccd-definition/FixedLists/TranslatedDocumentType-CUI-CP-nonprod.json rename to ccd-definition/FixedLists/TranslatedDocumentType-CUI-CP.json From 4f88193c51eeee53a1c2ec891fbcb9d63f88f9b3 Mon Sep 17 00:00:00 2001 From: ss-evoco <94355434+ss-evoco@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:43:24 +0000 Subject: [PATCH 2/9] CIV-0000 Unshutter Prod (#5138) * Update build-release-ccd-definition.sh * skip tests to unshutter --------- Co-authored-by: Mounika Ammineni --- bin/build-release-ccd-definition.sh | 9 --------- codecept.conf.js | 4 ++-- e2e/tests/ui_tests/smoke_test.js | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/bin/build-release-ccd-definition.sh b/bin/build-release-ccd-definition.sh index 376383cd44..355b462475 100755 --- a/bin/build-release-ccd-definition.sh +++ b/bin/build-release-ccd-definition.sh @@ -6,15 +6,6 @@ set -eu environment=${1:-prod} activateShutter=${2:-false} -if [ ${environment} == prod ]; then - echo "Running build for ${environment}" - activateShutter=true; -else - echo "Running build for ${environment}" - activateShutter=false; -fi - - # if any exclusions are updated here, please also update the exclusions map in e2e/tests/unit/utils/dataProvider.js if [ ${environment} == preview ]; then excludedFilenamePatterns="-e *-prod.json" diff --git a/codecept.conf.js b/codecept.conf.js index eef1b977cd..5dc9f967d4 100644 --- a/codecept.conf.js +++ b/codecept.conf.js @@ -1,7 +1,7 @@ exports.config = { tests: process.env.CCD_UI_TESTS == 'true' ? [ './e2e/tests/ui_tests/*.js', - './e2e/tests/ui_tests/damages/*_test.js', + /* './e2e/tests/ui_tests/damages/*_test.js', './e2e/tests/ui_tests/lrspec/*_test.js', './e2e/tests/ui_tests/damages/nightly/*_test.js', './e2e/tests/ui_tests/noticeofchange/*_test.js', @@ -12,7 +12,7 @@ exports.config = { './e2e/tests/ui_tests/refunds/*_test.js', './e2e/tests/ui_tests/default_judgement/*_test.js', './e2e/tests/ui_tests/hearings/*_test.js', - './e2e/tests/api_tests/lrspec_cui/*_test.js', + './e2e/tests/api_tests/lrspec_cui/*_test.js',*/ ] : [ './e2e/tests/api_tests/*.js', './e2e/tests/api_tests/judgmentOnline/*_test.js', diff --git a/e2e/tests/ui_tests/smoke_test.js b/e2e/tests/ui_tests/smoke_test.js index 2fc6d8ea1a..31de6f49d8 100644 --- a/e2e/tests/ui_tests/smoke_test.js +++ b/e2e/tests/ui_tests/smoke_test.js @@ -2,7 +2,7 @@ const config = require('../../config.js'); Feature('Smoke tests @smoke-tests-unspec'); -Scenario('Sign in as solicitor user', async ({I}) => { +Scenario('Sign in as solicitor user @master-e2e-ft', async ({I}) => { await I.retry(5).login(config.applicantSolicitorUser); await I.retry(5).see('Case list'); }).retry(3); From 76a7c51fc399540fadcbb9a816027e4fd2c1a525 Mon Sep 17 00:00:00 2001 From: mounikahmcts <43175082+mounikahmcts@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:20:19 +0000 Subject: [PATCH 3/9] CIV-0000 Enable FTs on pipelines after unshuttering prod (#5139) Update codecept.conf.js --- codecept.conf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecept.conf.js b/codecept.conf.js index 5dc9f967d4..eef1b977cd 100644 --- a/codecept.conf.js +++ b/codecept.conf.js @@ -1,7 +1,7 @@ exports.config = { tests: process.env.CCD_UI_TESTS == 'true' ? [ './e2e/tests/ui_tests/*.js', - /* './e2e/tests/ui_tests/damages/*_test.js', + './e2e/tests/ui_tests/damages/*_test.js', './e2e/tests/ui_tests/lrspec/*_test.js', './e2e/tests/ui_tests/damages/nightly/*_test.js', './e2e/tests/ui_tests/noticeofchange/*_test.js', @@ -12,7 +12,7 @@ exports.config = { './e2e/tests/ui_tests/refunds/*_test.js', './e2e/tests/ui_tests/default_judgement/*_test.js', './e2e/tests/ui_tests/hearings/*_test.js', - './e2e/tests/api_tests/lrspec_cui/*_test.js',*/ + './e2e/tests/api_tests/lrspec_cui/*_test.js', ] : [ './e2e/tests/api_tests/*.js', './e2e/tests/api_tests/judgmentOnline/*_test.js', From 73d0307956ed4f260140b90387e3fae8e0dc220c Mon Sep 17 00:00:00 2001 From: rishikrsharma Date: Thu, 5 Dec 2024 13:24:48 +0000 Subject: [PATCH 4/9] DTSCCI-1245 remove dummy documents (#5136) * DTSCCI-000 remove dummy evidence document * DTSCCI-000 remove hardcoded doc with dynamic doc * DTSCCI-1245 - Test PR * Update values.preview.template.yaml --------- Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com> --- e2e/api/steps_LRspecCui.js | 19 +++++++++---------- .../events/evidenceUploadApplicant.js | 14 +++++++------- .../events/evidenceUploadRespondent.js | 10 +++++----- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/e2e/api/steps_LRspecCui.js b/e2e/api/steps_LRspecCui.js index 1dabfbb9fa..4cb191c4b5 100644 --- a/e2e/api/steps_LRspecCui.js +++ b/e2e/api/steps_LRspecCui.js @@ -19,7 +19,8 @@ const expectedEvents = require('../fixtures/ccd/expectedEventsLRSpec.js'); const nonProdExpectedEvents = require('../fixtures/ccd/nonProdExpectedEventsLRSpec.js'); const testingSupport = require('./testingSupport'); const {dateNoWeekends, dateNoWeekendsBankHolidayNextDay} = require('./dataHelper'); -const {checkToggleEnabled, checkMintiToggleEnabled} = require('./testingSupport'); +const {checkToggleEnabled, checkMintiToggleEnabled, uploadDocument} = require('./testingSupport'); + const {PBAv3, isJOLive} = require('../fixtures/featureKeys'); const {adjustCaseSubmittedDateForCarm} = require('../helpers/carmHelper'); const {fetchCaseDetails} = require('./apiRequest'); @@ -35,6 +36,7 @@ const lodash = require('lodash'); const createFinalOrder = require('../fixtures/events/finalOrder.js'); const judgeDecisionToReconsiderationRequest = require('../fixtures/events/judgeDecisionOnReconsiderationRequest'); const {adjustCaseSubmittedDateForMinti} = require('../helpers/mintiHelper'); +const { toJSON } = require('lodash/seq'); let caseId, eventName; let caseData = {}; @@ -53,8 +55,8 @@ const data = { CREATE_SDO_FAST_TRACK: (userInput) => sdoTracks.createSDOFastTrackSpec(userInput), HEARING_SCHEDULED: (allocatedTrack) => hearingScheduled.scheduleHearingForTrialReadiness(allocatedTrack), HEARING_SCHEDULED_CUI: (allocatedTrack) => hearingScheduled.scheduleHearingForCui(allocatedTrack), - EVIDENCE_UPLOAD_CLAIMANT: (mpScenario) => evidenceUploadApplicant.createClaimantSmallClaimsEvidenceUpload(mpScenario), - EVIDENCE_UPLOAD_DEFENDANT: (mpScenario) => evidenceUploadRespondent.createDefendantSmallClaimsEvidenceUpload(mpScenario), + EVIDENCE_UPLOAD_CLAIMANT: (mpScenario, document) => evidenceUploadApplicant.createClaimantSmallClaimsEvidenceUpload(document), + EVIDENCE_UPLOAD_DEFENDANT: (mpScenario, document) => evidenceUploadRespondent.createDefendantSmallClaimsEvidenceUpload(document), REQUEST_FOR_RECONSIDERATION: (userType) => requestForReconsideration.createRequestForReconsiderationSpecCitizen(userType), TRIAL_READINESS: (user) => trialReadiness.confirmTrialReady(user), FINAL_ORDERS: (finalOrdersRequestType, dayPlus0, dayPlus7, dayPlus14, dayPlus21) => createFinalOrder.requestFinalOrder(finalOrdersRequestType, dayPlus0, dayPlus7, dayPlus14, dayPlus21), @@ -310,24 +312,21 @@ module.exports = { evidenceUploadApplicant: async (user) => { await apiRequest.setupTokens(user); - - let payload = data.EVIDENCE_UPLOAD_CLAIMANT('ONE_V_ONE'); + const document = await uploadDocument(); + let payload = data.EVIDENCE_UPLOAD_CLAIMANT('ONE_V_ONE', document); caseData = await apiRequest.startEventForCitizen(eventName, caseId, payload); - await waitForFinishedBusinessProcess(caseId); - }, evidenceUploadDefendant: async (user) => { await apiRequest.setupTokens(user); - - let payload = data.EVIDENCE_UPLOAD_DEFENDANT('ONE_V_ONE'); + const document = await uploadDocument(); + let payload = data.EVIDENCE_UPLOAD_DEFENDANT('ONE_V_ONE', document); caseData = await apiRequest.startEventForCitizen(eventName, caseId, payload); await waitForFinishedBusinessProcess(caseId); - }, requestForReconsiderationCitizen: async (user) => { diff --git a/e2e/fixtures/events/evidenceUploadApplicant.js b/e2e/fixtures/events/evidenceUploadApplicant.js index 690bd2d842..f791479e29 100644 --- a/e2e/fixtures/events/evidenceUploadApplicant.js +++ b/e2e/fixtures/events/evidenceUploadApplicant.js @@ -409,7 +409,7 @@ module.exports = { } }, - createClaimantSmallClaimsEvidenceUpload: () => { + createClaimantSmallClaimsEvidenceUpload: (document) => { return { event: 'EVIDENCE_UPLOAD_APPLICANT', caseDataUpdate: { @@ -419,12 +419,12 @@ module.exports = { value: { witnessOptionName: 'John Doe', witnessOptionUploadDate: '2000-02-02T00:00:00.000Z', - witnessOptionDocument: { - document_url: 'http://dm-store:8080/documents/3500cbfa-890b-4741-87bd-62febce88fba', - document_binary_url: 'http://dm-store:8080/documents/3500cbfa-890b-4741-87bd-62febce88fba/binary', - document_filename: 'TestingDoc A.pdf', - document_hash: '4a37221b446b3370b7b7bf16c75a362be0d753c57cb3fc79a01b08561401655b' - }, + witnessOptionDocument: { + document_url: document.document_url, + document_binary_url: document.document_binary_url, + document_filename: document.document_filename, + document_hash: document.document_hash + }, }, createdDatetime: '2024-08-07T08:26:23.000Z' } diff --git a/e2e/fixtures/events/evidenceUploadRespondent.js b/e2e/fixtures/events/evidenceUploadRespondent.js index 9d37f4e81f..ffb360b8fb 100644 --- a/e2e/fixtures/events/evidenceUploadRespondent.js +++ b/e2e/fixtures/events/evidenceUploadRespondent.js @@ -702,7 +702,7 @@ module.exports = { } }, - createDefendantSmallClaimsEvidenceUpload: () => { + createDefendantSmallClaimsEvidenceUpload: (document) => { return { event: 'EVIDENCE_UPLOAD_RESPONDENT', caseDataUpdate: { @@ -713,10 +713,10 @@ module.exports = { witnessOptionName: 'John Doe', witnessOptionUploadDate: '2000-02-02T00:00:00.000Z', witnessOptionDocument: { - document_url: 'http://dm-store:8080/documents/3500cbfa-890b-4741-87bd-62febce88fba', - document_binary_url: 'http://dm-store:8080/documents/3500cbfa-890b-4741-87bd-62febce88fba/binary', - document_filename: 'TestingDoc A.pdf', - document_hash: '4a37221b446b3370b7b7bf16c75a362be0d753c57cb3fc79a01b08561401655b' + document_url: document.document_url, + document_binary_url: document.document_binary_url, + document_filename: document.document_filename, + document_hash: document.document_hash }, }, createdDatetime: '2024-08-07T08:26:23.000Z' From 99b6f380e85ddafb4e8ea46ceb50a5970b48cab0 Mon Sep 17 00:00:00 2001 From: rishikrsharma Date: Fri, 6 Dec 2024 12:23:38 +0000 Subject: [PATCH 5/9] DTSCCI-000 disable test to run in prod (#5143) --- .../api_tests/sdo_R2/api_noise_induced_hearing_loss_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/api_tests/sdo_R2/api_noise_induced_hearing_loss_test.js b/e2e/tests/api_tests/sdo_R2/api_noise_induced_hearing_loss_test.js index 253c9cc2b8..9e7dd5243c 100644 --- a/e2e/tests/api_tests/sdo_R2/api_noise_induced_hearing_loss_test.js +++ b/e2e/tests/api_tests/sdo_R2/api_noise_induced_hearing_loss_test.js @@ -10,7 +10,7 @@ const hearingCenterAdminToBeUsed = config.hearingCenterAdminWithRegionId1; //const hearingCenterAdminToBeUsed = config.hearingCenterAdminLocal; -Feature('Noise Induced Hearing Loss API test - fast claim - unspec @api-unspec @api-tests-1v1 @api-prod @api-r2-sdo'); +Feature('Noise Induced Hearing Loss API test - fast claim - unspec @api-unspec @api-tests-1v1 @api-r2-sdo'); async function prepareClaim(api) { await api.createClaimWithRepresentedRespondent(config.applicantSolicitorUser, mpScenario1v1Nihl, claimAmount); From 01e0ff584b6a07ddf33a0bf831a959010441d619 Mon Sep 17 00:00:00 2001 From: Gareth Lancaster <90632240+Gareth40343@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:01:44 +0000 Subject: [PATCH 6/9] CIV-15392 - Reply to message (#5070) * Added new SEND_AND_REPLY event and auths and implemented the send message flow * Add new messagages tab and message fields * Update SendMessageRecipientOptions.json * Add new messagages tab and message fields * Renamed message subject to headerSubject * Added ROLE_ASSIGNMENT_URL env for civil service pod in preview * Fixed subject not being passed correctly to messages tab * Update AuthorisationCaseField-caseworkerEvents-nonprod.json Removed redundant system update role from message casefield auths * Update SendAndReply-caseWorkerEvents-nonprod.json * Added precondition states to SEND_AND_REPLY event to ensure the event will not be displayed when case is offline * Added the reply journey for the SEND_AND_REPLY event * Removed unecessary caseventtocomplextype field * Fixed role pool names * CIV-15392 - small changes * CIV-15392 - update CIVIL to CIVIL-casenumber * CIV-15392 - fix authorisation for MANAGE_STAY_WA * CIV-15392 - update tab CaseTypeId * CIV-15392 - update RolePool values * CIV-15392 - Rolepool label addition for judges * CIV-15392 - try showing history * CIV-15392 - give Message history a label * CIV-15392 - Update Message reply * CIV-15392 - subject not dependent on choosing other * CIV-15392 - don't hide subjectType * CIV-15392 - fix subject names in metadata object * CIV-15392 - fix fieldshowcondition for subject * CIV-15392 - replace duplicate subject with What is it about * CIV-15392 - move 'What is this message about' down * Update 1_MessageReply-caseworkerEvents-nonprod.json * Update values.preview.template.yaml * CIV-15392 - move from preview to generic template * CIV-15392 - readd authorisation for send and reply option * Update RolePool.json * Update RolePool.json * CIV-15392 - change fixed radio list to fixed list in message object * CIV-15392 - change labels on Messages --------- Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: meulendijksm Co-authored-by: m-meulendijks-v1 <107135537+m-meulendijks-v1@users.noreply.github.com> Co-authored-by: ss-evoco <94355434+ss-evoco@users.noreply.github.com> --- ...ionCaseEvent-caseworkerEvents-nonprod.json | 13 ++ ...ionCaseField-caseworkerEvents-nonprod.json | 117 +++++++++++++++++ .../UserEvents-caseworkerEvents-nonprod.json | 18 +++ ...SendAndReply-caseWorkerEvents-nonprod.json | 58 ++++++++ ...SendAndReply-caseWorkerEvents-nonprod.json | 124 ++++++++++++++++++ .../CaseField-caseworkerEvents-nonprod.json | 100 ++++++++++++++ .../Messages-caseworkerEvents-nonprod.json | 11 ++ ...MessageReply-caseworkerEvents-nonprod.json | 69 ++++++++++ .../Message-caseworkerEvents-nonprod.json | 86 ++++++++++++ ...sageMetadata-caseworkerEvents-nonprod.json | 36 +++++ ccd-definition/FixedLists/RolePool.json | 32 +++++ .../FixedLists/SendAndReplyOptions.json | 14 ++ .../SendMessageRecipientOptions.json | 26 ++++ .../FixedLists/SendMessageSubjectOptions.json | 26 ++++ charts/civil-ccd/values.template.yaml | 1 + 15 files changed, 731 insertions(+) create mode 100644 ccd-definition/CaseEventToComplexTypes/SendAndReply-caseWorkerEvents-nonprod.json create mode 100644 ccd-definition/CaseEventToFields/SendAndReply-caseWorkerEvents-nonprod.json create mode 100644 ccd-definition/CaseTypeTab/Messages-caseworkerEvents-nonprod.json create mode 100644 ccd-definition/ComplexTypes/1_MessageReply-caseworkerEvents-nonprod.json create mode 100644 ccd-definition/ComplexTypes/Message-caseworkerEvents-nonprod.json create mode 100644 ccd-definition/ComplexTypes/SendMessageMetadata-caseworkerEvents-nonprod.json create mode 100644 ccd-definition/FixedLists/RolePool.json create mode 100644 ccd-definition/FixedLists/SendAndReplyOptions.json create mode 100644 ccd-definition/FixedLists/SendMessageRecipientOptions.json create mode 100644 ccd-definition/FixedLists/SendMessageSubjectOptions.json diff --git a/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-caseworkerEvents-nonprod.json b/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-caseworkerEvents-nonprod.json index d58c46c99e..05fb7843a0 100644 --- a/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-caseworkerEvents-nonprod.json +++ b/ccd-definition/AuthorisationCaseEvent/AuthorisationCaseEvent-caseworkerEvents-nonprod.json @@ -90,5 +90,18 @@ "CRUD": "CRU" } ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] } ] diff --git a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-caseworkerEvents-nonprod.json b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-caseworkerEvents-nonprod.json index 7c3b9c7887..2df8466f41 100644 --- a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-caseworkerEvents-nonprod.json +++ b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-caseworkerEvents-nonprod.json @@ -195,8 +195,125 @@ "caseworker-civil-admin", "cui-admin-profile" ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "sendAndReplyOption", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "messagesToReplyTo", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "sendMessageMetadata", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "sendMessageContent", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "sendMessageContextTitle", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], "CRUD": "R" } ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "sendMessageContentTitle", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "R" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "messages", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "messageReplyMetadata", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "messageHistory", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + } + ] } ] diff --git a/ccd-definition/CaseEvent/User/UserEvents-caseworkerEvents-nonprod.json b/ccd-definition/CaseEvent/User/UserEvents-caseworkerEvents-nonprod.json index 035c230384..c55baad3c5 100644 --- a/ccd-definition/CaseEvent/User/UserEvents-caseworkerEvents-nonprod.json +++ b/ccd-definition/CaseEvent/User/UserEvents-caseworkerEvents-nonprod.json @@ -152,6 +152,24 @@ "RetriesTimeoutURLAboutToSubmitEvent": 0, "EventEnablingCondition": "preStayState != \"IN_MEDIATION\"" }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "SEND_AND_REPLY", + "Name": "Send and reply to messages", + "Description": "Send and reply to messages", + "DisplayOrder": 25, + "PreConditionState(s)": "PENDING_CASE_ISSUED;CASE_ISSUED;AWAITING_CASE_DETAILS_NOTIFICATION;AWAITING_RESPONDENT_ACKNOWLEDGEMENT;AWAITING_APPLICANT_INTENTION;CASE_PROGRESSION;All_FINAL_ORDERS_ISSUED;PREPARE_FOR_HEARING_CONDUCT_HEARING;JUDICIAL_REFERRAL;CASE_SETTLED;CLOSED;CASE_DISCONTINUED;HEARING_READINESS;CASE_STAYED", + "PostConditionState": "*", + "SecurityClassification": "Public", + "CallBackURLAboutToStartEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/cases/callbacks/about-to-start", + "CallBackURLAboutToSubmitEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/cases/callbacks/about-to-submit", + "CallBackURLSubmittedEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/cases/callbacks/submitted", + "ShowSummary": "Y", + "ShowEventNotes": "N", + "RetriesTimeoutAboutToStartEvent": 0, + "RetriesTimeoutURLAboutToSubmitEvent": 0, + "Publish": "Y" + }, { "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", "ID": "CONFIRM_ORDER_REVIEW", diff --git a/ccd-definition/CaseEventToComplexTypes/SendAndReply-caseWorkerEvents-nonprod.json b/ccd-definition/CaseEventToComplexTypes/SendAndReply-caseWorkerEvents-nonprod.json new file mode 100644 index 0000000000..151e202bca --- /dev/null +++ b/ccd-definition/CaseEventToComplexTypes/SendAndReply-caseWorkerEvents-nonprod.json @@ -0,0 +1,58 @@ +[ + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageMetadata", + "ListElementCode": "recipientRoleType", + "EventElementLabel": "Who are you sending the message to?", + "FieldDisplayOrder": 1, + "DisplayContext": "MANDATORY" + }, + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageMetadata", + "ListElementCode": "isUrgent", + "EventElementLabel": "Is this urgent?", + "FieldDisplayOrder": 2, + "DisplayContext": "MANDATORY" + }, + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageMetadata", + "ListElementCode": "subjectType", + "EventElementLabel": "What is this message about?", + "FieldDisplayOrder": 3, + "DisplayContext": "MANDATORY" + }, + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageMetadata", + "ListElementCode": "subject", + "EventElementLabel": "Enter the subject", + "FieldShowCondition": "sendMessageMetadata.subjectType = \"*\"", + "FieldDisplayOrder": 4, + "DisplayContext": "MANDATORY" + }, + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messageReplyMetadata", + "ListElementCode": "isUrgent", + "EventElementLabel": "Is this urgent?", + "FieldDisplayOrder": 2, + "DisplayContext": "MANDATORY" + }, + { + "ID": "SendMessageMetadata", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messageReplyMetadata", + "ListElementCode": "messageContent", + "EventElementLabel": "Enter your message", + "EventHintText": "Explain what you're requesting and why. Include any answers and decision you need.", + "FieldDisplayOrder": 3, + "DisplayContext": "MANDATORY" + } +] diff --git a/ccd-definition/CaseEventToFields/SendAndReply-caseWorkerEvents-nonprod.json b/ccd-definition/CaseEventToFields/SendAndReply-caseWorkerEvents-nonprod.json new file mode 100644 index 0000000000..3b755016f9 --- /dev/null +++ b/ccd-definition/CaseEventToFields/SendAndReply-caseWorkerEvents-nonprod.json @@ -0,0 +1,124 @@ +[ + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendAndReplyOption", + "CaseEventFieldLabel": "Do you want to send or reply to a message?", + "PageLabel": " ", + "PageFieldDisplayOrder": 1, + "DisplayContext": "MANDATORY", + "PageID": "sendAndReplyOption", + "PageDisplayOrder": 1, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messagesToReplyTo", + "CaseEventFieldLabel": "Select a message to reply to", + "PageLabel": " ", + "PageFieldDisplayOrder": 2, + "DisplayContext": "MANDATORY", + "PageID": "sendAndReplyOption", + "FieldShowCondition": "sendAndReplyOption=\"REPLY\"", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y", + "CallBackURLMidEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/cases/callbacks/mid/populate-message-history" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageContextTitle", + "PageFieldDisplayOrder": 1, + "DisplayContext": "READONLY", + "PageID": "sendMessageMetadata", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "PageShowCondition": "sendAndReplyOption=\"SEND\"", + "ShowSummaryChangeOption": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageMetadata", + "PageLabel": "Send message", + "PageFieldDisplayOrder": 2, + "DisplayContext": "COMPLEX", + "PageID": "sendMessageMetadata", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageContentTitle", + "PageFieldDisplayOrder": 1, + "DisplayContext": "READONLY", + "PageID": "sendMessageContent", + "PageDisplayOrder": 3, + "PageColumnNumber": 1, + "PageShowCondition": "sendAndReplyOption=\"SEND\"", + "ShowSummaryChangeOption": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "sendMessageContent", + "CaseEventFieldLabel": "Enter your message", + "PageFieldDisplayOrder": 3, + "DisplayContext": "MANDATORY", + "PageID": "sendMessageContent", + "PageDisplayOrder": 3, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "replyToMessageTitle", + "PageFieldDisplayOrder": 1, + "DisplayContext": "READONLY", + "PageID": "replyToMessage", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "PageShowCondition": "sendAndReplyOption=\"REPLY\"", + "ShowSummaryChangeOption": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messageHistory", + "PageFieldDisplayOrder": 2, + "DisplayContext": "READONLY", + "PageID": "replyToMessage", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "FieldShowCondition": "sendAndReplyOption=\"DO NOT SHOW\"", + "ShowSummaryChangeOption": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messageHistoryLabel", + "PageFieldDisplayOrder": 3, + "DisplayContext": "READONLY", + "PageID": "replyToMessage", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SEND_AND_REPLY", + "CaseFieldID": "messageReplyMetadata", + "PageFieldDisplayOrder": 4, + "DisplayContext": "COMPLEX", + "PageID": "replyToMessage", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y" + } +] diff --git a/ccd-definition/CaseField/CaseField-caseworkerEvents-nonprod.json b/ccd-definition/CaseField/CaseField-caseworkerEvents-nonprod.json index 51ce1ad181..6db1f68b60 100644 --- a/ccd-definition/CaseField/CaseField-caseworkerEvents-nonprod.json +++ b/ccd-definition/CaseField/CaseField-caseworkerEvents-nonprod.json @@ -120,5 +120,105 @@ "FieldType": "Label", "SecurityClassification": "Public", "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendAndReplyOption", + "Label": " ", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "SendAndReplyOptionsList", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "messagesToReplyTo", + "Label": " ", + "FieldType": "DynamicList", + "FieldTypeParameter": "Message", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendMessageMetadata", + "Label": " ", + "FieldType": "SendMessageMetadata", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendMessageTitle", + "Label": "## Send a message", + "FieldType": "Label", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendMessageContent", + "Label": " ", + "HintText": "Explain what you're requesting and why. Include any answers and decision you need.", + "FieldType": "TextArea", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendMessageContextTitle", + "Label": "## Send a message", + "FieldType": "Label", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "sendMessageContentTitle", + "Label": "## Send a message", + "FieldType": "Label", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "messages", + "Label": "Messages", + "FieldType": "Collection", + "FieldTypeParameter": "Message", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "replyToMessageTitle", + "Label": "## Reply to a message", + "FieldType": "Label", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "messageReplyMetadata", + "Label": " ", + "FieldType": "MessageReply", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "messageHistory", + "Label": " ", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "messageHistoryLabel", + "Label": "${messageHistory}", + "FieldType": "Label", + "SecurityClassification": "Public", + "Searchable": "N" } ] diff --git a/ccd-definition/CaseTypeTab/Messages-caseworkerEvents-nonprod.json b/ccd-definition/CaseTypeTab/Messages-caseworkerEvents-nonprod.json new file mode 100644 index 0000000000..f36e5f0091 --- /dev/null +++ b/ccd-definition/CaseTypeTab/Messages-caseworkerEvents-nonprod.json @@ -0,0 +1,11 @@ +[ + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "TabID": "Messages", + "TabLabel": "Messages", + "TabDisplayOrder": 99, + "CaseFieldID": "messages", + "TabFieldDisplayOrder": 1, + "DisplayContextParameter": "#TABLE(senderRoleType, recipientRoleType, isUrgent, sentTime, updatedTime, subject)" + } +] diff --git a/ccd-definition/ComplexTypes/1_MessageReply-caseworkerEvents-nonprod.json b/ccd-definition/ComplexTypes/1_MessageReply-caseworkerEvents-nonprod.json new file mode 100644 index 0000000000..f011bccdc1 --- /dev/null +++ b/ccd-definition/ComplexTypes/1_MessageReply-caseworkerEvents-nonprod.json @@ -0,0 +1,69 @@ +[ + { + "ID": "MessageReply", + "ListElementCode": "senderRoleType", + "FieldType": "Text", + "ElementLabel": "From", + "FieldShowCondition": "isUrgent=\"DO NOT SHOW IN UI\"", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "sentTime", + "FieldType": "DateTime", + "ElementLabel": "Date and time sent", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "senderName", + "FieldType": "Text", + "ElementLabel": "Sender's name", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "recipientRoleType", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "RolePool", + "ElementLabel": "Recipient", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "isUrgent", + "FieldType": "YesOrNo", + "ElementLabel": "Urgency", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "subjectType", + "ElementLabel": "What is it about", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "SendMessageSubjectOptionsList", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "subject", + "FieldType": "Text", + "ElementLabel": "Subject", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "MessageReply", + "ListElementCode": "messageContent", + "FieldType": "TextArea", + "ElementLabel": "Message details", + "SecurityClassification": "Public", + "Searchable": "N" + } +] diff --git a/ccd-definition/ComplexTypes/Message-caseworkerEvents-nonprod.json b/ccd-definition/ComplexTypes/Message-caseworkerEvents-nonprod.json new file mode 100644 index 0000000000..2b7d7b8224 --- /dev/null +++ b/ccd-definition/ComplexTypes/Message-caseworkerEvents-nonprod.json @@ -0,0 +1,86 @@ +[ + { + "ID": "Message", + "ListElementCode": "senderRoleType", + "FieldType": "FixedList", + "FieldTypeParameter": "RolePool", + "ElementLabel": "From", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "recipientRoleType", + "FieldType": "FixedList", + "FieldTypeParameter": "RolePool", + "ElementLabel": "To", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "isUrgent", + "FieldType": "YesOrNo", + "ElementLabel": "Urgency", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "sentTime", + "FieldType": "DateTime", + "ElementLabel": "Date and time sent", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "updatedTime", + "FieldType": "DateTime", + "ElementLabel": "Updated time", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "senderName", + "FieldType": "Text", + "ElementLabel": "Sender's name", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "subjectType", + "ElementLabel": "What is it about", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "SendMessageSubjectOptionsList", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "subject", + "FieldType": "Text", + "ElementLabel": "Subject", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "messageContent", + "FieldType": "TextArea", + "ElementLabel": "Message details", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "Message", + "ListElementCode": "history", + "FieldType": "Collection", + "FieldTypeParameter": "MessageReply", + "ElementLabel": "Message history", + "SecurityClassification": "Public", + "Searchable": "N" + } +] diff --git a/ccd-definition/ComplexTypes/SendMessageMetadata-caseworkerEvents-nonprod.json b/ccd-definition/ComplexTypes/SendMessageMetadata-caseworkerEvents-nonprod.json new file mode 100644 index 0000000000..9d6a0b884f --- /dev/null +++ b/ccd-definition/ComplexTypes/SendMessageMetadata-caseworkerEvents-nonprod.json @@ -0,0 +1,36 @@ +[ + { + "ID": "SendMessageMetadata", + "ListElementCode": "recipientRoleType", + "ElementLabel": " ", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "SendMessageRecipientOptionsList", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "SendMessageMetadata", + "ListElementCode": "isUrgent", + "ElementLabel": " ", + "FieldType": "YesOrNo", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "SendMessageMetadata", + "ListElementCode": "subjectType", + "ElementLabel": " ", + "FieldType": "FixedRadioList", + "FieldTypeParameter": "SendMessageSubjectOptionsList", + "SecurityClassification": "Public", + "Searchable": "N" + }, + { + "ID": "SendMessageMetadata", + "ListElementCode": "subject", + "ElementLabel": " ", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "N" + } +] diff --git a/ccd-definition/FixedLists/RolePool.json b/ccd-definition/FixedLists/RolePool.json new file mode 100644 index 0000000000..0afb9e8268 --- /dev/null +++ b/ccd-definition/FixedLists/RolePool.json @@ -0,0 +1,32 @@ +[ + { + "ID": "RolePool", + "ListElementCode": "ADMIN", + "ListElement": "Court Staff", + "DisplayOrder": 1 + }, + { + "ID": "RolePool", + "ListElementCode": "JUDICIAL", + "ListElement": "Judge", + "DisplayOrder": 2 + }, + { + "ID": "RolePool", + "ListElementCode": "JUDICIAL_DISTRICT", + "ListElement": "Judge", + "DisplayOrder": 3 + }, + { + "ID": "RolePool", + "ListElementCode": "JUDICIAL_CIRCUIT", + "ListElement": "Judge", + "DisplayOrder": 4 + }, + { + "ID": "RolePool", + "ListElementCode": "LEGAL_OPERATIONS", + "ListElement": "Legal Advisor", + "DisplayOrder": 5 + } +] diff --git a/ccd-definition/FixedLists/SendAndReplyOptions.json b/ccd-definition/FixedLists/SendAndReplyOptions.json new file mode 100644 index 0000000000..fe655204b6 --- /dev/null +++ b/ccd-definition/FixedLists/SendAndReplyOptions.json @@ -0,0 +1,14 @@ +[ + { + "ID": "SendAndReplyOptionsList", + "ListElementCode": "SEND", + "ListElement": "Send a message", + "DisplayOrder": 1 + }, + { + "ID": "SendAndReplyOptionsList", + "ListElementCode": "REPLY", + "ListElement": "Reply to a message", + "DisplayOrder": 2 + } +] diff --git a/ccd-definition/FixedLists/SendMessageRecipientOptions.json b/ccd-definition/FixedLists/SendMessageRecipientOptions.json new file mode 100644 index 0000000000..aa97fad576 --- /dev/null +++ b/ccd-definition/FixedLists/SendMessageRecipientOptions.json @@ -0,0 +1,26 @@ +[ + { + "ID": "SendMessageRecipientOptionsList", + "ListElementCode": "COURT_STAFF", + "ListElement": "Court staff", + "DisplayOrder": 1 + }, + { + "ID": "SendMessageRecipientOptionsList", + "ListElementCode": "DISTRICT_JUDGE", + "ListElement": "District judge", + "DisplayOrder": 2 + }, + { + "ID": "SendMessageRecipientOptionsList", + "ListElementCode": "CIRCUIT_JUDGE", + "ListElement": "Circuit judge", + "DisplayOrder": 3 + }, + { + "ID": "SendMessageRecipientOptionsList", + "ListElementCode": "LEGAL_ADVISOR", + "ListElement": "Legal advisor", + "DisplayOrder": 4 + } +] diff --git a/ccd-definition/FixedLists/SendMessageSubjectOptions.json b/ccd-definition/FixedLists/SendMessageSubjectOptions.json new file mode 100644 index 0000000000..5b31820205 --- /dev/null +++ b/ccd-definition/FixedLists/SendMessageSubjectOptions.json @@ -0,0 +1,26 @@ +[ + { + "ID": "SendMessageSubjectOptionsList", + "ListElementCode": "APPLICATION", + "ListElement": "An application", + "DisplayOrder": 1 + }, + { + "ID": "SendMessageSubjectOptionsList", + "ListElementCode": "HEARING", + "ListElement": "A hearing", + "DisplayOrder": 2 + }, + { + "ID": "SendMessageSubjectOptionsList", + "ListElementCode": "REVIEW_DOCUMENTS", + "ListElement": "Review submitted documents", + "DisplayOrder": 3 + }, + { + "ID": "SendMessageSubjectOptionsList", + "ListElementCode": "OTHER", + "ListElement": "Other", + "DisplayOrder": 4 + } +] diff --git a/charts/civil-ccd/values.template.yaml b/charts/civil-ccd/values.template.yaml index ab28fd2a1d..3ee2a5441d 100644 --- a/charts/civil-ccd/values.template.yaml +++ b/charts/civil-ccd/values.template.yaml @@ -139,6 +139,7 @@ civil-service: RELEASE_REVISION: "{{ .Release.Revision }}" POLLING_EVENT_EMITTER_ENABLED: false HMC_HEARINGS_SUBSCRIPTION_ENABLED: false + ROLE_ASSIGNMENT_URL: http://am-role-assignment-service-aat.service.core-compute-aat.internal CIVIL_S2S_AUTHORISED_SERVICES: payment_app,ccd_data,civil_service,civil-citizen-ui postgresql: enabled: true From 8f0a14ef7da3e68c5b980a0eca56f6e5e583a9f2 Mon Sep 17 00:00:00 2001 From: kalachandrasekar1 <114995593+kalachandrasekar1@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:18:58 +0000 Subject: [PATCH 7/9] CIV-15997 Set Aside-Add Application Date (#5125) * CIV-15997 changes * CIV-15997 changes * CIV-15997 fieldname updated * CIV-15997 question updated --------- Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> --- .../AuthorisationCaseField-JO-nonprod.json | 9 +++++++++ .../SetAsideJudgment-JO-nonprod.json | 19 +++++++++++++++---- .../CaseField/CaseField-JO-nonprod.json | 9 +++++++++ .../OnlineJudgmentDetails-JO-nonprod.json | 8 ++++++++ e2e/fixtures/events/judgmentOnline1v1Spec.js | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-JO-nonprod.json b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-JO-nonprod.json index 50b482c2ad..7ef7877c94 100644 --- a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-JO-nonprod.json +++ b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-JO-nonprod.json @@ -280,6 +280,15 @@ ], "CRUD": "CRU" }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "joSetAsideApplicationDate", + "UserRoles": [ + "caseworker-civil-admin", + "caseworker-civil-staff" + ], + "CRUD": "CRU" + }, { "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", "CaseFieldID": "joShowRegisteredWithRTLOption", diff --git a/ccd-definition/CaseEventToFields/SetAsideJudgment-JO-nonprod.json b/ccd-definition/CaseEventToFields/SetAsideJudgment-JO-nonprod.json index b7e5158a41..67dc3c5fe8 100644 --- a/ccd-definition/CaseEventToFields/SetAsideJudgment-JO-nonprod.json +++ b/ccd-definition/CaseEventToFields/SetAsideJudgment-JO-nonprod.json @@ -48,13 +48,24 @@ { "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", "CaseEventID": "SET_ASIDE_JUDGMENT", - "CaseFieldID": "joSetAsideOrderType", + "CaseFieldID": "joSetAsideOrderDate", "PageFieldDisplayOrder": 1, "DisplayContext": "MANDATORY", "PageID": "SetAsideOrderType", "PageLabel": "Judgment details", "PageDisplayOrder": 2, "PageColumnNumber": 1, + "ShowSummaryChangeOption": "Y" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseEventID": "SET_ASIDE_JUDGMENT", + "CaseFieldID": "joSetAsideOrderType", + "PageFieldDisplayOrder": 2, + "DisplayContext": "MANDATORY", + "PageID": "SetAsideOrderType", + "PageDisplayOrder": 2, + "PageColumnNumber": 1, "ShowSummaryChangeOption": "Y", "PageShowCondition": "joSetAsideReason=\"JUDGE_ORDER\"", "CallBackURLMidEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/cases/callbacks/mid/validate-set-aside-dates" @@ -62,8 +73,8 @@ { "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", "CaseEventID": "SET_ASIDE_JUDGMENT", - "CaseFieldID": "joSetAsideOrderDate", - "PageFieldDisplayOrder": 2, + "CaseFieldID": "joSetAsideApplicationDate", + "PageFieldDisplayOrder": 3, "DisplayContext": "MANDATORY", "PageID": "SetAsideOrderType", "PageDisplayOrder": 2, @@ -75,7 +86,7 @@ "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", "CaseEventID": "SET_ASIDE_JUDGMENT", "CaseFieldID": "joSetAsideDefenceReceivedDate", - "PageFieldDisplayOrder": 3, + "PageFieldDisplayOrder": 4, "DisplayContext": "MANDATORY", "PageID": "SetAsideOrderType", "PageDisplayOrder": 2, diff --git a/ccd-definition/CaseField/CaseField-JO-nonprod.json b/ccd-definition/CaseField/CaseField-JO-nonprod.json index 4035308058..b888f51688 100644 --- a/ccd-definition/CaseField/CaseField-JO-nonprod.json +++ b/ccd-definition/CaseField/CaseField-JO-nonprod.json @@ -318,5 +318,14 @@ "FieldTypeParameter": "JoJudgment", "SecurityClassification": "Public", "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "joSetAsideApplicationDate", + "Label": "Enter the date of the application to set aside", + "HintText": "For example, 16 04 2021", + "FieldType": "Date", + "SecurityClassification": "Public", + "Searchable": "N" } ] diff --git a/ccd-definition/ComplexTypes/JudgmentOnline/OnlineJudgmentDetails-JO-nonprod.json b/ccd-definition/ComplexTypes/JudgmentOnline/OnlineJudgmentDetails-JO-nonprod.json index 09f71f0f7a..1c701037b1 100644 --- a/ccd-definition/ComplexTypes/JudgmentOnline/OnlineJudgmentDetails-JO-nonprod.json +++ b/ccd-definition/ComplexTypes/JudgmentOnline/OnlineJudgmentDetails-JO-nonprod.json @@ -224,5 +224,13 @@ "FieldType": "InstalmentPaymentDetails", "SecurityClassification": "Public", "Searchable": "N" + }, + { + "ID": "JoJudgment", + "ListElementCode": "setAsideApplicationDate", + "ElementLabel": " ", + "FieldType": "Date", + "SecurityClassification": "Public", + "Searchable": "N" } ] diff --git a/e2e/fixtures/events/judgmentOnline1v1Spec.js b/e2e/fixtures/events/judgmentOnline1v1Spec.js index a1336fad3d..d767a9a6ee 100644 --- a/e2e/fixtures/events/judgmentOnline1v1Spec.js +++ b/e2e/fixtures/events/judgmentOnline1v1Spec.js @@ -211,6 +211,7 @@ module.exports = { setAsideJudgment.userInput = { ...setAsideJudgment.userInput, SetAsideJudgment: { + joSetAsideApplicationDate: '2008-06-06', joSetAsideOrderDate: '2008-06-06', joSetAsideOrderType: setAsideOrderType, joSetAsideReason: setAsideReason From 598dfac1cd1037268f5b9398bc5665fb94ae6737 Mon Sep 17 00:00:00 2001 From: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:12:42 +0000 Subject: [PATCH 8/9] DTSCCI-1289 DTSCCI-1290 DTSCCI-1291 DTSCCI-1292 DTSCCI-1293 (#5147) * add data builders for create claim spec and create claim unspec * update imports * apis for unassign cases, service request, and create claim complete. Retry exui event complete * update * fix nightly dev issue --- .gitignore | 1 + .husky/pre-commit | 4 +- .prettierrc | 2 +- Jenkinsfile_nightly | 3 + .../no-dup-classes.config.mjs | 1 + env.d.ts | 2 + eslint.config.mjs | 14 +- package.json | 5 +- playwright-e2e/base/base-api-steps.ts | 42 ++- playwright-e2e/base/base-data-builder.ts | 3 + playwright-e2e/base/base-exui-steps.ts | 53 ++++ playwright-e2e/base/base-page.ts | 129 +++++++- playwright-e2e/base/base-request.ts | 64 +++- playwright-e2e/base/base-steps.ts | 2 +- playwright-e2e/config/config.ts | 2 + playwright-e2e/config/file-paths.ts | 1 + playwright-e2e/config/preferred-courts.ts | 14 + playwright-e2e/config/users/exui-users.ts | 7 + .../lr-spec/create-claim-spec-data-builder.ts | 43 +++ .../create-claim-spec-data-components.ts | 253 ++++++++++++++++ .../unspec/create-claim-data-builder.ts | 49 ++++ .../unspec/create-claim-data-components.ts | 277 ++++++++++++++++++ ...service-request-data-builder-components.ts | 12 + .../service-request-data-builder.ts | 16 + playwright-e2e/decorators/test-steps.ts | 2 +- playwright-e2e/decorators/truthy-params.ts | 1 - playwright-e2e/enums/case-roles.ts | 7 + playwright-e2e/enums/case-states.ts | 16 + playwright-e2e/enums/claim-track.ts | 8 + playwright-e2e/enums/claim-type.ts | 13 + playwright-e2e/enums/party-type.ts | 8 + playwright-e2e/errors/expect-error.ts | 2 +- playwright-e2e/global/teardown-ci.ts | 2 + playwright-e2e/global/teardown-local.ts | 106 ++++++- playwright-e2e/helpers/axe-cache-helper.ts | 3 + playwright-e2e/helpers/case-data-helper.ts | 86 ++++++ playwright-e2e/helpers/claim-type-helper.ts | 63 ++++ playwright-e2e/helpers/class-method-helper.ts | 4 +- playwright-e2e/helpers/file-system-helper.ts | 19 +- playwright-e2e/helpers/object-helper.ts | 26 ++ playwright-e2e/helpers/request-options.ts | 8 - playwright-e2e/helpers/string-helper.ts | 34 +++ .../helpers/user-assigned-cases-helper.ts | 53 ++++ playwright-e2e/helpers/users-state-helper.ts | 6 +- playwright-e2e/models/api/response-options.ts | 2 +- playwright-e2e/models/ccd/ccd-case-data.ts | 112 +++---- .../create-claim/create-claim-spec.ts | 0 .../create-claim/create-claim.ts | 0 playwright-e2e/models/request-options.ts | 8 - .../create-case-flags-page-factory.ts | 3 + .../case-details/case-details-page.ts | 29 +- .../exui-nav-bar/exui-nav-bar-content.ts | 2 +- .../exui-nav-bar/exui-nav-bar.ts | 7 + .../exui-content.ts} | 0 .../exui-event.ts => exui-page/exui-page.ts} | 13 +- .../certificate-of-service-submit-fragment.ts | 4 +- .../certificate-of-service-fragment.ts | 4 +- .../common/case-filter/case-filter-page.ts | 4 +- .../check-list-spec/checklist-spec-page.ts | 4 +- .../extension-date-spec-page.ts | 4 +- ...agreed-extension-date-confirm-spec-page.ts | 4 +- .../extension-date/extension-date-page.ts | 4 +- ...form-agreed-extension-date-confirm-page.ts | 4 +- .../notify-claim-details-confirm-page.ts | 7 +- .../notify-claim-details-cos-confirm-page.ts | 5 +- ...tify-claim-details-cos-defendant-1-page.ts | 4 +- ...tify-claim-details-cos-defendant-2-page.ts | 4 +- .../notify-claim-details-cos-submit-page.ts | 4 +- .../notify-claim-details-submit-page.ts | 4 +- .../select-defendant-solicitor-page.ts | 4 +- .../upload-documents/upload-documents-page.ts | 4 +- .../access-granted-warning-page.ts | 4 +- .../defendant-solicitor-to-notify-page.ts | 4 +- .../notify-claim-confirm-page.ts | 5 +- .../notify-claim-cos-confirm-page.ts | 4 +- .../notify-claim-cos-defendant-1-page.ts | 4 +- .../notify-claim-cos-defendant-2-page.ts | 4 +- .../notify-claim-cos-submit-page.ts | 4 +- .../notify-claim-submit-page.ts | 4 +- playwright-e2e/pages/idam/login/login-page.ts | 4 +- .../pages/utils/page-cookies-manager.ts | 6 +- .../api/api-steps-fixtures.ts | 29 +- .../api/data-builder-fixtures.ts | 22 ++ .../api/requests-factory-fixtures.ts | 4 +- .../ui/page-expect-fixtures.ts | 39 +++ .../ui/page-factory-fixtures.ts | 7 +- .../ui/ui-steps-fixtures.ts | 39 +-- playwright-e2e/requests/ccd-requests.ts | 98 ++++--- .../requests/civil-service-requests.ts | 103 +++++++ playwright-e2e/requests/idam-requests.ts | 14 +- playwright-e2e/requests/requests-factory.ts | 5 + .../service-auth-provider-requests.ts | 22 +- .../api/api-case-role-assignment-steps.ts | 70 +++++ .../{api-data-setup.ts => api-data-steps.ts} | 0 .../steps/api/api-service-request-steps.ts | 33 +++ playwright-e2e/steps/api/api-user-steps.ts | 2 + .../api-create-claim-spec-steps.ts | 49 ++++ .../create-claim/api-create-claim-steps.ts | 52 ++++ .../create-case-flags-steps.ts | 21 ++ .../steps/ui/exui/exui-dashboard-steps.ts | 8 +- .../claimant-response-spec-steps.ts | 14 +- .../claimant-response-steps.ts | 14 +- .../create-claim/create-claim-spec-steps.ts | 14 +- .../create-claim/create-claim-steps.ts | 14 +- .../defendant-response-spec-steps.ts | 15 +- .../defendant-response-steps.ts | 14 +- .../notify-claim-details-steps.ts | 39 ++- .../solicitor-events/notify-claim-steps.ts | 36 ++- playwright-e2e/tests/Example.spec.ts | 34 +++ playwright-e2e/tests/Login.spec.ts | 10 +- .../tests/bootstrap/auth/user-auth.setup.ts | 18 +- .../case-role-assignment.teardown.ts | 17 ++ playwright.config.ts | 8 +- yarn.lock | 13 +- 114 files changed, 2314 insertions(+), 316 deletions(-) create mode 100644 playwright-e2e/base/base-data-builder.ts create mode 100644 playwright-e2e/base/base-exui-steps.ts create mode 100644 playwright-e2e/config/preferred-courts.ts create mode 100644 playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder.ts create mode 100644 playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-components.ts create mode 100644 playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder.ts create mode 100644 playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-components.ts create mode 100644 playwright-e2e/data-builders/service-request/service-request-data-builder-components.ts create mode 100644 playwright-e2e/data-builders/service-request/service-request-data-builder.ts create mode 100644 playwright-e2e/enums/case-roles.ts create mode 100644 playwright-e2e/enums/case-states.ts create mode 100644 playwright-e2e/enums/claim-track.ts create mode 100644 playwright-e2e/enums/claim-type.ts create mode 100644 playwright-e2e/enums/party-type.ts create mode 100644 playwright-e2e/helpers/claim-type-helper.ts create mode 100644 playwright-e2e/helpers/object-helper.ts delete mode 100644 playwright-e2e/helpers/request-options.ts create mode 100644 playwright-e2e/helpers/string-helper.ts create mode 100644 playwright-e2e/helpers/user-assigned-cases-helper.ts create mode 100644 playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim-spec.ts create mode 100644 playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim.ts delete mode 100644 playwright-e2e/models/request-options.ts create mode 100644 playwright-e2e/pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory.ts rename playwright-e2e/pages/exui/{exui-event/exui-event-content.ts => exui-page/exui-content.ts} (100%) rename playwright-e2e/pages/exui/{exui-event/exui-event.ts => exui-page/exui-page.ts} (89%) create mode 100644 playwright-e2e/playwright-fixtures/api/data-builder-fixtures.ts create mode 100644 playwright-e2e/requests/civil-service-requests.ts create mode 100644 playwright-e2e/steps/api/api-case-role-assignment-steps.ts rename playwright-e2e/steps/api/{api-data-setup.ts => api-data-steps.ts} (100%) create mode 100644 playwright-e2e/steps/api/api-service-request-steps.ts create mode 100644 playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-spec-steps.ts create mode 100644 playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-steps.ts create mode 100644 playwright-e2e/steps/ui/exui/caseworker-events/create-case-flags-steps.ts create mode 100644 playwright-e2e/tests/Example.spec.ts create mode 100644 playwright-e2e/tests/bootstrap/case-role-assignment/case-role-assignment.teardown.ts diff --git a/.gitignore b/.gitignore index eb31f377c0..7d61bd5a01 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,5 @@ allure-report/ playwright-report/ /playwright-e2e/fixtures/.users/ /playwright-e2e/fixtures/.user-cookies/ +/playwright-e2e/fixtures/.user-assigned-cases/ /playwright-e2e/fixtures/data/bankHolidays.json diff --git a/.husky/pre-commit b/.husky/pre-commit index f2b8745189..4d03592cf2 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -10,7 +10,9 @@ GLOB_PATTERNS=( 'playwright-e2e/steps/*.ts' 'playwright-e2e/steps/**/*.ts' 'playwright-e2e/requests/*.ts' - 'playwright-e2e/requests/**/*.ts' + 'playwright-e2e/requests/**/*.ts', + 'playwright-e2e/data-builders/*.ts' + 'playwright-e2e/data-builders/**/*.ts' ) # Get the list of changed files diff --git a/.prettierrc b/.prettierrc index 3589dae1b9..9b3e021836 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ "trailingComma": "all", "overrides": [ { - "files": ["playwright-e2e/tests/**/*.ts", "playwright-e2e/playwright-fixtures/**/*.ts"], + "files": ["playwright-e2e/playwright-fixtures/**/*.ts"], "options": { "arrowParens": "always", "trailingComma": "none", diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly index 43ba45b546..8db1881d04 100644 --- a/Jenkinsfile_nightly +++ b/Jenkinsfile_nightly @@ -5,6 +5,7 @@ properties([ parameters([ string(name: 'ENVIRONMENT', defaultValue: 'aat', description: 'Environment to test'), string(name: 'PLAYWRIGHT_WORKERS', defaultValue: '5', description: 'Number of workers for playwright'), + string(name: 'PLAYWRIGHT_RETRIES', defaultValue: '2', description: 'Number of times playwright will retry tests'), string(name: 'PLAYWRIGHT_RUN_ACCESSIBILITY_TESTS', defaultValue: 'false', description: 'Runs accessibility tests for playwright during test execution'), string(name: 'PLAYWRIGHT_RUN_SETUP', defaultValue: 'true', description: 'Runs setup projects before functional test suite'), string(name: 'FRONTEND_URL', defaultValue: 'https://manage-case.aat.platform.hmcts.net', @@ -79,8 +80,10 @@ def secrets = [ withNightlyPipeline(type, product, component) { env.ENVIRONMENT=params.ENVIRONMENT env.PLAYWRIGHT_WORKERS=params.PLAYWRIGHT_WORKERS + env.PLAYWRIGHT_RETRIES=params.PLAYWRIGHT_RETRIES env.PLAYWRIGHT_RUN_ACCESSIBILITY_TESTS=params.PLAYWRIGHT_RUN_ACCESSIBILITY_TESTS env.PLAYWRIGHT_RUN_SETUP=params.PLAYWRIGHT_RUN_SETUP + env.PLAYWRIGHT_UNASSIGN_CASES = true env.URL=params.FRONTEND_URL env.DM_STORE_URL=params.DM_STORE_URL env.IDAM_WEB_URL=params.IDAM_WEB_URL diff --git a/custom-eslint-configs/no-dup-classes.config.mjs b/custom-eslint-configs/no-dup-classes.config.mjs index 43dfa70db1..56256754e8 100644 --- a/custom-eslint-configs/no-dup-classes.config.mjs +++ b/custom-eslint-configs/no-dup-classes.config.mjs @@ -14,6 +14,7 @@ export default [ 'playwright-e2e/base/**/*.ts', 'playwright-e2e/steps/**/*.ts', 'playwright-e2e/requests/**/*.ts', + 'playwright-e2e/data-builders/**/*.ts', ], rules: { 'customEslintPlugin/no-duplicate-class-names': 'error', diff --git a/env.d.ts b/env.d.ts index c549e65cba..62a21d74ae 100644 --- a/env.d.ts +++ b/env.d.ts @@ -30,6 +30,8 @@ declare global { S2S_SECRET: string; XUI_S2S_SECRET: string; PLAYWRIGHT_RUN_SETUP: string; + PLAYWRIGHT_UNASSIGN_CASES: string; + PLAYWRIGHT_RETRIES: string; } } } diff --git a/eslint.config.mjs b/eslint.config.mjs index 001a827ad2..e3f48671a9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -46,8 +46,8 @@ export default [ }, rules: { 'no-unused-vars': 'off', - 'quotes': ['error', 'single'], - 'semi': ['error', 'always'], + quotes: ['error', 'single'], + semi: ['error', 'always'], 'no-constant-binary-expression': 'off', 'no-prototype-builtins': 'off', }, @@ -57,11 +57,11 @@ export default [ plugins: { customEslintPlugin }, rules: { ...pluginJs.configs.recommended.rules, - 'indent': ['error', 2, { SwitchCase: 1 }], + indent: ['error', 2, { SwitchCase: 1 }], 'linebreak-style': ['error', 'unix'], 'comma-dangle': ['error', 'always-multiline'], - 'quotes': ['error', 'single', { avoidEscape: true }], - 'semi': ['error', 'always'], + quotes: ['error', 'single', { avoidEscape: true }], + semi: ['error', 'always'], 'no-multiple-empty-lines': ['error', { max: 1 }], '@typescript-eslint/no-var-requires': 0, 'no-empty-pattern': 0, @@ -77,10 +77,12 @@ export default [ files: [ 'playwright-e2e/pages/**/*page.ts', 'playwright-e2e/pages/**/*fragment.ts', - 'playwright-e2e/pages/**/*event.ts', 'playwright-e2e/steps/**/*steps.ts', + 'playwright-e2e/data-builders/**/*data-builder.ts', 'playwright-e2e/base/base-page.ts', 'playwright-e2e/base/base-requests.ts', + 'playwright-e2e/base/base-api-steps.ts', + 'playwright-e2e/base/base-exui-steps.ts', ], rules: { 'customEslintPlugin/prefer-step-decorator': 'warn', diff --git a/package.json b/package.json index dd7860a2bc..fb3e54fe78 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,8 @@ "test:playwright-e2e-setup:ci": "./bin/run-commands-series.sh -c \"yarn test:playwright-setup:data:ci\" \"yarn test:playwright-setup:users:ci && yarn test:playwright-setup:users-auth:ci\"", "test:playwright-e2e-nightly:ci": "FUNCTIONAL=true npx playwright test --project e2e-full-functional --no-deps", "test:playwright-teardown:users-auth:ci": "npx playwright test --project users-auth-teardown --pass-with-no-tests --no-deps", - "test:playwright-e2e-teardown:ci": "./bin/run-commands-series.sh -c \"yarn test:playwright-teardown:users-auth:ci\" \"yarn ts-node ./playwright-e2e/global/teardown-ci\"", + "test:playwright-teardown:case-role-assignment:ci": "npx playwright test --project case-role-assignment-teardown --pass-with-no-tests --no-deps", + "test:playwright-e2e-teardown:ci": "./bin/run-commands-series.sh -c \"yarn test:playwright-teardown:case-role-assignment:ci\" \"yarn test:playwright-teardown:users-auth:ci\" \"yarn ts-node ./playwright-e2e/global/teardown-ci\"", "test:playwright-e2e-debug:local": "npx playwright test --project e2e-full-functional --grep @debug", "test:playwright-e2e:local": "npx playwright test --project e2e-full-functional", "test:fullfunctional": "yarn playwright install && MOCHAWESOME_REPORTFILENAME=functional-unspec npx codeceptjs run-workers --suites 2 --grep '@e2e-nightly-prod' --reporter mocha-multi --verbose", @@ -143,7 +144,7 @@ "ts-node": "^10.9.2", "typescript": "5.1.3", "typescript-eslint": "8.0.0", - "uuid": "^3.4.0", + "uuid": "^11.0.3", "webdriverio": "^6.12.1" }, "lint-staged": { diff --git a/playwright-e2e/base/base-api-steps.ts b/playwright-e2e/base/base-api-steps.ts index 55fb4e249b..d8e19df3d4 100644 --- a/playwright-e2e/base/base-api-steps.ts +++ b/playwright-e2e/base/base-api-steps.ts @@ -1,9 +1,14 @@ import BaseSteps from './base-steps'; -import TestData from '../models/test-data'; import RequestsFactory from '../requests/requests-factory'; import User from '../models/user'; import { bankHolidays } from '../config/data'; +import { CCDEvent } from '../models/ccd/ccd-events'; +import ObjectHelper from '../helpers/object-helper'; +import { AllMethodsStep } from '../decorators/test-steps'; +import TestData from '../models/test-data'; +import { civilAdminUser, claimantSolicitorUser } from '../config/users/exui-users'; +@AllMethodsStep() export default abstract class BaseApiSteps extends BaseSteps { private _requestsFactory: RequestsFactory; @@ -46,4 +51,39 @@ export default abstract class BaseApiSteps extends BaseSteps { } } } + + protected async validatePages( + ccdEvent: CCDEvent, + pageDataMap: Record, + user: User, + ccdEventToken: string, + ) { + const { ccdRequests } = this.requestsFactory; + let eventData = {}; + for (const pageId of Object.keys(pageDataMap)) { + eventData = ObjectHelper.deepSpread(eventData, pageDataMap[pageId]); + const pageData = await ccdRequests.validatePageData( + ccdEvent, + user, + pageId, + pageDataMap[pageId], + eventData, + ccdEventToken, + ); + eventData = ObjectHelper.deepSpread(eventData, pageData); + } + return eventData; + } + + protected async waitForFinishedBusinessProcess(user: User, caseId?: number) { + const { civilServiceRequests } = this.requestsFactory; + await this.setupUserData(user); + await civilServiceRequests.waitForFinishedBusinessProcess(user, caseId ?? this.ccdCaseData.id); + } + + protected async fetchAndSetCCDCaseData(user: User, caseId?: number) { + const { ccdRequests } = this.requestsFactory; + await this.setupUserData(user); + this.setCCDCaseData = await ccdRequests.fetchCCDCaseData(user, caseId ?? this.ccdCaseData.id); + } } diff --git a/playwright-e2e/base/base-data-builder.ts b/playwright-e2e/base/base-data-builder.ts new file mode 100644 index 0000000000..02d33f3a71 --- /dev/null +++ b/playwright-e2e/base/base-data-builder.ts @@ -0,0 +1,3 @@ +export default abstract class BaseDataBuilder { + protected abstract buildData(...args: any[]): any; +} diff --git a/playwright-e2e/base/base-exui-steps.ts b/playwright-e2e/base/base-exui-steps.ts new file mode 100644 index 0000000000..59e99a493e --- /dev/null +++ b/playwright-e2e/base/base-exui-steps.ts @@ -0,0 +1,53 @@ +import { AllMethodsStep } from '../decorators/test-steps'; +import ccdEvents from '../fixtures/ccd-events/events'; +import { CCDEvent } from '../models/ccd/ccd-events'; +import TestData from '../models/test-data'; +import User from '../models/user'; +import ExuiDashboardPageFactory from '../pages/exui/exui-dashboard/exui-dashboard-page-factory'; +import RequestsFactory from '../requests/requests-factory'; +import BaseApiSteps from './base-api-steps'; + +@AllMethodsStep() +export default abstract class BaseExuiSteps extends BaseApiSteps { + private exuiDashboardPageFactory: ExuiDashboardPageFactory; + + constructor( + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(requestsFactory, testData); + this.exuiDashboardPageFactory = exuiDashboardPageFactory; + } + + async retryExuiEvent( + steps: () => Promise, + ccdEvent: CCDEvent, + user: User, + { retries = 3 } = {}, + ) { + const { caseDetailsPage } = this.exuiDashboardPageFactory; + while (retries > 0) { + try { + if (ccdEvent === ccdEvents.CREATE_CLAIM || ccdEvent === ccdEvents.CREATE_CLAIM_SPEC) { + const { navBar } = this.exuiDashboardPageFactory; + await navBar.clickCreateCase(); + } else { + await caseDetailsPage.goToCaseDetails(this.ccdCaseData.id); + await caseDetailsPage.verifyContent(this.ccdCaseData); + await caseDetailsPage.retryChooseNextStep(ccdEvent); + } + caseDetailsPage.setCCDEvent = ccdEvent; + await steps(); + break; + } catch (error) { + retries--; + if (!retries) throw error; + console.log(`Event: ${ccdEvent.id} failed, trying again (Retries left: ${retries})`); + } + } + await caseDetailsPage.verifySuccessEvent(this.ccdCaseData.id, ccdEvent); + caseDetailsPage.clearCCDEvent(); + await this.waitForFinishedBusinessProcess(user, this.ccdCaseData.id); + } +} diff --git a/playwright-e2e/base/base-page.ts b/playwright-e2e/base/base-page.ts index b73d96f03a..a7738d4aa7 100644 --- a/playwright-e2e/base/base-page.ts +++ b/playwright-e2e/base/base-page.ts @@ -81,8 +81,8 @@ export default abstract class BasePage { @BoxedDetailedStep(classKey, 'text') @TruthyParams(classKey, 'text') - protected async clickByText(text: string, options: { timeout?: number } = {}) { - await this.page.getByText(text).click({ timeout: options.timeout }); + protected async clickByText(text: string, options: { timeout?: number; exact?: boolean } = {}) { + await this.page.getByText(text, { exact: options.exact }).click({ timeout: options.timeout }); } @BoxedDetailedStep(classKey, 'input', 'selector') @@ -290,29 +290,75 @@ export default abstract class BasePage { }).toBeVisible({ timeout: options.timeout }); } + private getSelectorLocator( + selector: string, + containerSelector?: string, + index?: number, + first?: boolean, + ) { + const locator = containerSelector + ? this.page.locator(containerSelector).locator(selector) + : this.page.locator(selector); + return first ? locator.nth(0) : index ? locator.nth(index) : locator; + } + @BoxedDetailedStep(classKey, 'selector') protected async expectSelector( selector: string, - options: { message?: string; timeout?: number } = {}, + options: { + containerSelector?: string; + index?: number; + first?: boolean; + message?: string; + timeout?: number; + } = {}, ) { - await pageExpect(this.page.locator(selector), { message: options.message }).toBeVisible({ - timeout: options.timeout, - }); + if (options.first && options.index !== undefined) { + throw new ExpectError("Cannot use 'first' and 'index' options at the same time"); + } + const locator = this.getSelectorLocator( + selector, + options.containerSelector, + options.index, + options.first, + ); + await pageExpect(locator, { message: options.message }).toBeVisible(options); } @BoxedDetailedStep(classKey, 'selector') protected async expectNoSelector( selector: string, - options: { message?: string; timeout?: number } = {}, + options: { + containerSelector?: string; + all?: boolean; + index?: number; + first?: boolean; + message?: string; + timeout?: number; + } = {}, ) { - const locator = this.page.locator(selector); + if (options.first && options.index !== undefined) { + throw new ExpectError("Cannot use 'first' and 'index' options at the same time"); + } + const locator = this.getSelectorLocator( + selector, + options.containerSelector, + options.index, + options.first, + ); try { await locator.waitFor({ state: 'visible', timeout: 500 }); // eslint-disable-next-line no-empty } catch (err) {} - await pageExpect(locator, { message: options.message }).toBeHidden({ - timeout: options.timeout, - }); + if (options.all) { + await pageExpect(locator, { message: options.message }).allToBeHidden({ + timeout: options.timeout, + }); + } else { + await pageExpect(locator, { message: options.message }).toBeHidden({ + timeout: options.timeout, + }); + } } private getTextLocator( @@ -386,6 +432,7 @@ export default abstract class BasePage { message?: string; exact?: boolean; containerSelector?: string; + all?: boolean; index?: number; first?: boolean; timeout?: number; @@ -402,9 +449,15 @@ export default abstract class BasePage { await locator.waitFor({ state: 'visible', timeout: 500 }); // eslint-disable-next-line no-empty } catch (err) {} - await pageExpect(locator, { message: options.message }).toBeHidden({ - timeout: options.timeout, - }); + if (options.all) { + await pageExpect(locator, { message: options.message }).allToBeHidden({ + timeout: options.timeout, + }); + } else { + await pageExpect(locator, { message: options.message }).toBeHidden({ + timeout: options.timeout, + }); + } } @BoxedDetailedStep(classKey, 'label') @@ -431,6 +484,54 @@ export default abstract class BasePage { }); } + @BoxedDetailedStep(classKey, 'name') + protected async expectTab( + name: string, + options: { message?: string; exact?: boolean; timeout?: number } = { exact: false }, + ) { + await pageExpect(this.page.getByRole('tab', { name, exact: options.exact }), { + message: options.message, + }).toBeVisible({ + timeout: options.timeout, + }); + } + + @BoxedDetailedStep(classKey, 'name') + protected async expectNoTab( + name: string, + options: { message?: string; exact?: boolean; timeout?: number } = { exact: false }, + ) { + await pageExpect(this.page.getByRole('tab', { name, exact: options.exact }), { + message: options.message, + }).toBeHidden({ + timeout: options.timeout, + }); + } + + @BoxedDetailedStep(classKey, 'name') + protected async expectButton( + name: string, + options: { message?: string; exact?: boolean; timeout?: number } = { exact: false }, + ) { + await pageExpect(this.page.getByRole('button', { name, exact: options.exact }), { + message: options.message, + }).toBeVisible({ + timeout: options.timeout, + }); + } + + @BoxedDetailedStep(classKey, 'name') + protected async expectNoButton( + name: string, + options: { message?: string; exact?: boolean; timeout?: number } = { exact: false }, + ) { + await pageExpect(this.page.getByRole('button', { name, exact: options.exact }), { + message: options.message, + }).toBeHidden({ + timeout: options.timeout, + }); + } + @BoxedDetailedStep(classKey, 'selector') @TruthyParams(classKey, 'selector') protected async expectOptionChecked( diff --git a/playwright-e2e/base/base-request.ts b/playwright-e2e/base/base-request.ts index 6ba97bad42..b759ffaaed 100644 --- a/playwright-e2e/base/base-request.ts +++ b/playwright-e2e/base/base-request.ts @@ -18,15 +18,15 @@ export default abstract class BaseRequest { return new Promise((resolve) => setTimeout(resolve, ms)); } - private async getResponseData( + private getResponseData( response: APIResponse, responseDataType: ResponseDataType, ): Promise { switch (responseDataType) { case ResponseDataType.JSON: - return await response.json(); + return response.json(); case ResponseDataType.TEXT: - return await response.text(); + return response.text(); default: return null; } @@ -36,7 +36,7 @@ export default abstract class BaseRequest { url: string, { headers = { 'Content-Type': 'application/json' }, - body, + body: body, method = 'GET', params, }: RequestOptions = {}, @@ -49,7 +49,12 @@ export default abstract class BaseRequest { headers, params, }); - this.expectStatus(expectedStatus, response.status(), response.url(), response.statusText()); + await this.expectStatus( + expectedStatus, + response.status(), + response.url(), + response.statusText(), + ); const responseData = await this.getResponseData(response, responseType); if (verifyResponse) await verifyResponse(responseData ?? response, { @@ -65,7 +70,7 @@ export default abstract class BaseRequest { responseDataType = ResponseDataType.NONE, { expectedStatus = 200, - remainingRetries = 3, + retries = 3, retryTimeInterval = 5000, verifyResponse, }: responseOptions._RetryResponseOptions = {}, @@ -73,8 +78,8 @@ export default abstract class BaseRequest { if (retryTimeInterval > this.MAX_RETRY_TIMEOUT) { retryTimeInterval = this.MAX_RETRY_TIMEOUT; } - while (remainingRetries > 0) { - remainingRetries--; + while (retries > 0) { + retries--; try { const response = await this._request(url, requestOptions, responseDataType, { expectedStatus, @@ -82,9 +87,9 @@ export default abstract class BaseRequest { }); return response; } catch (error: any) { - if (!remainingRetries) throw error; + if (!retries) throw error; console.log( - `${error.message.split('\n')[0]}, retrying in ${retryTimeInterval / 1000} seconds (Retries left: ${remainingRetries})`, + `${error.message.split('\n')[0]}, retrying in ${retryTimeInterval / 1000} seconds (Retries left: ${retries})`, ); await this.sleep(retryTimeInterval); } @@ -92,7 +97,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async request( + protected async request( url: string, requestOptions?: RequestOptions, responseOptions?: responseOptions.ResponseOptions, @@ -106,7 +111,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async retryRequest( + protected async retryRequest( url: string, requestOptions?: RequestOptions, retryResponseOptions?: responseOptions.RetryResponseOptions, @@ -120,7 +125,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async requestJson( + protected async requestJson( url: string, requestOptions?: RequestOptions, responseJsonOptions?: responseOptions.ResponseJsonOptions, @@ -134,7 +139,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async retryRequestJson( + protected async retryRequestJson( url: string, requestOptions?: RequestOptions, retryResponseJsonOptions?: responseOptions.RetryResponseJsonOptions, @@ -148,7 +153,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async requestText( + protected async requestText( url: string, requestOptions?: RequestOptions, responseTextOptions?: responseOptions.ResponseTextOptions, @@ -162,7 +167,7 @@ export default abstract class BaseRequest { } @BoxedDetailedStep(classKey, 'url') - async retryRequestText( + protected async retryRequestText( url: string, requestOptions?: RequestOptions, retryResponseTextOptions?: responseOptions.RetryResponseTextOptions, @@ -202,6 +207,33 @@ export default abstract class BaseRequest { ).toHaveProperty(keyPath); } + @BoxedDetailedStep(classKey, 'keyPath') + protected async expectResponseJsonToNotHaveProperty( + keyPath: string, + responseJson: Record, + options: { message?: string } = {}, + ) { + expect( + responseJson, + options.message ?? + `Expected response json to have property '${keyPath.split('.').join(' => ')}'`, + ).not.toHaveProperty(keyPath); + } + + @BoxedDetailedStep(classKey, 'keyPath', 'value') + protected async expectResponseJsonToHavePropertyValue( + keyPath: string, + value: unknown, + responseJson: Record, + options: { message?: string } = {}, + ) { + expect( + responseJson, + options.message ?? + `Expected response json to have property '${keyPath.split('.').join(' => ')}'`, + ).toHaveProperty(keyPath, value); + } + @BoxedDetailedStep(classKey) protected async expectResponseJsonToContain( partialObject: Record | Array, diff --git a/playwright-e2e/base/base-steps.ts b/playwright-e2e/base/base-steps.ts index 703a3ba077..f10eacfbc5 100644 --- a/playwright-e2e/base/base-steps.ts +++ b/playwright-e2e/base/base-steps.ts @@ -16,7 +16,7 @@ export default abstract class BaseSteps { return this._testData.ccdCaseData; } - protected set setCcdCaseData(ccdCaseData: CCDCaseData) { + protected set setCCDCaseData(ccdCaseData: CCDCaseData) { this._testData.ccdCaseData = ccdCaseData; } } diff --git a/playwright-e2e/config/config.ts b/playwright-e2e/config/config.ts index 295a6bc8a3..607d4144b8 100644 --- a/playwright-e2e/config/config.ts +++ b/playwright-e2e/config/config.ts @@ -6,6 +6,7 @@ const config = { idamStudEnabled: process.env.IDAM_STUB_ENABLED === 'true', runSetup: process.env.PLAYWRIGHT_RUN_SETUP === 'true', runAxeTests: process.env.PLAYWRIGHT_RUN_ACCESSIBILITY_TESTS === 'true', + unassignCases: process.env.PLAYWRIGHT_UNASSIGN_CASES === 'true', s2s: { microservice: 'civil_service', secret: process.env.S2S_SECRET || 'AABBCCDDEEFFGGHH', @@ -24,6 +25,7 @@ const config = { workers: parseInt(process.env.PLAYWRIGHT_WORKERS), actionTimeout: 25_000, showBrowserWindow: process.env.PLAYWRIGHT_SHOW_BROWSER_WINDOW === 'true', + retries: process.env.PLAYWRIGHT_RETRIES ? parseInt(process.env.PLAYWRIGHT_RETRIES) : undefined, }, }; diff --git a/playwright-e2e/config/file-paths.ts b/playwright-e2e/config/file-paths.ts index c42075ead7..8a426b4727 100644 --- a/playwright-e2e/config/file-paths.ts +++ b/playwright-e2e/config/file-paths.ts @@ -1,6 +1,7 @@ const filePaths = { userCookies: 'playwright-e2e/fixtures/.user-cookies', users: 'playwright-e2e/fixtures/.users', + userAssignedCases: 'playwright-e2e/fixtures/.user-assigned-cases', axe: 'playwright-test-results/accessibility-cache', testPdfFile: 'playwright-e2e/fixtures/files/test.pdf', testTextFile: 'playwright-e2e/fixtures/files/fileupload.txt', diff --git a/playwright-e2e/config/preferred-courts.ts b/playwright-e2e/config/preferred-courts.ts new file mode 100644 index 0000000000..12945d581f --- /dev/null +++ b/playwright-e2e/config/preferred-courts.ts @@ -0,0 +1,14 @@ +const preferredCourts = { + claimant: + 'Central London County Court - Thomas More Building, Royal Courts of Justice, Strand, London - WC2A 2LL', + claimantDJ: + 'Central London County Court - Thomas More Building, Royal Courts of Justice, Strand, London - WC2A 2LL', + claimantHMC: 'Nottingham County Court And Family Court - Canal Street - NG1 7EJ', + defendantHMC: 'Nottingham County Court And Family Court - Canal Street - NG1 7EJ', + defendant1: + 'Central London County Court - Thomas More Building, Royal Courts of Justice, Strand, London - WC2A 2LL', + defendant2: + 'Central London County Court - Thomas More Building, Royal Courts of Justice, Strand, London - WC2A 2LL', +}; + +export default preferredCourts; diff --git a/playwright-e2e/config/users/exui-users.ts b/playwright-e2e/config/users/exui-users.ts index 67baca2784..5f034df34e 100644 --- a/playwright-e2e/config/users/exui-users.ts +++ b/playwright-e2e/config/users/exui-users.ts @@ -172,6 +172,13 @@ export const ctscAdminUser: User = getUser({ wa: true, }); +export const solicitorUsers = [ + claimantSolicitorUser, + claimantSolicitorBulkScanUser, + defendantSolicitor1User, + defendantSolicitor2User, +]; + export const exuiAuthSetupUsers = [ claimantSolicitorUser, defendantSolicitor1User, diff --git a/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder.ts b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder.ts new file mode 100644 index 0000000000..4c9ab71b0f --- /dev/null +++ b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder.ts @@ -0,0 +1,43 @@ +import { AllMethodsStep } from '../../../../../../decorators/test-steps'; +import createClaimSpecData from './create-claim-spec-data-components'; +import ClaimTrack from '../../../../../../enums/claim-track'; +import ClaimType from '../../../../../../enums/claim-type'; +import PartyType from '../../../../../../enums/party-type'; +import BaseDataBuilder from '../../../../../../base/base-data-builder'; + +@AllMethodsStep() +export default class CreateClaimSpecDataBuilder extends BaseDataBuilder { + async buildSmallTrack1v1() { + return this.buildData(); + } + protected async buildData({ + claimType = ClaimType.ONE_VS_ONE, + claimTrack = ClaimTrack.SMALL_CLAIM, + claimant1PartyType = PartyType.INDIVIDUAL, + claimant2PartyType = PartyType.INDIVIDUAL, + defendant1PartyType = PartyType.INDIVIDUAL, + defendant2PartyType = PartyType.INDIVIDUAL, + }: { + claimType?: ClaimType; + claimTrack?: ClaimTrack; + claimant1PartyType?: PartyType; + claimant2PartyType?: PartyType; + defendant1PartyType?: PartyType; + defendant2PartyType?: PartyType; + } = {}) { + return { + ...createClaimSpecData.references, + ...createClaimSpecData.claimant1(claimant1PartyType), + ...createClaimSpecData.claimantSolicitor1, + ...createClaimSpecData.claimant2(claimType, claimant2PartyType), + ...createClaimSpecData.defendant1(defendant1PartyType), + ...createClaimSpecData.defendantSolicitor1(claimType), + ...createClaimSpecData.defendant2(claimType, defendant2PartyType), + ...createClaimSpecData.defendant2Represented(claimType), + ...createClaimSpecData.defendant2SameSolicitor(claimType), + ...createClaimSpecData.defendantSolicitor2(claimType), + ...createClaimSpecData.claimDetails(claimTrack), + ...createClaimSpecData.statementOfTruth, + }; + } +} diff --git a/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-components.ts b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-components.ts new file mode 100644 index 0000000000..e2b5fb3c1b --- /dev/null +++ b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-components.ts @@ -0,0 +1,253 @@ +import { + claimantSolicitorUser, + defendantSolicitor1User, + defendantSolicitor2User, +} from '../../../../../../config/users/exui-users'; +import ClaimTrack from '../../../../../../enums/claim-track'; +import ClaimType from '../../../../../../enums/claim-type'; +import PartyType from '../../../../../../enums/party-type'; +import CaseDataHelper from '../../../../../../helpers/case-data-helper'; +import ClaimTypeHelper from '../../../../../../helpers/claim-type-helper'; + +const references = { + References: { + solicitorReferences: { + applicantSolicitor1Reference: 'Claimant Solicitor Reference', + respondentSolicitor1Reference: 'Defendant Solicitor Reference', + }, + }, +}; + +const claimant1 = (partyType: PartyType) => { + return { + Claimant: { + applicant1: CaseDataHelper.buildClaimantOrDefData('Claimant1', partyType), + }, + }; +}; + +const claimant2 = (claimType: ClaimType, partyType: PartyType) => { + if (ClaimTypeHelper.isClaimant2(claimType)) + return { + AddAnotherClaimant: { + addApplicant2: 'Yes', + }, + SecondClaimant: { + applicant2: CaseDataHelper.buildClaimantOrDefData('Claimant2', partyType), + }, + }; + return { + AddAnotherClaimant: { + addApplicant2: 'No', + }, + }; +}; + +const claimantSolicitor1 = { + Notifications: { + applicantSolicitor1CheckEmail: { + email: claimantSolicitorUser.email, + correct: 'No', + }, + applicantSolicitor1UserDetails: { + email: claimantSolicitorUser.email, + }, + }, + ClaimantSolicitorOrganisation: { + applicant1OrganisationPolicy: { + OrgPolicyReference: 'Claimant policy reference', + OrgPolicyCaseAssignedRole: '[APPLICANTSOLICITORONE]', + Organisation: { + OrganisationID: claimantSolicitorUser.orgId, + }, + }, + }, + SpecCorrespondenceAddress: { + specApplicantCorrespondenceAddressRequired: 'Yes', + specApplicantCorrespondenceAddressdetails: CaseDataHelper.buildAddressData('ClaimantService'), + }, +}; + +const defendant1 = (partyType: PartyType) => ({ + Defendant: { + respondent1: CaseDataHelper.buildClaimantOrDefData('Defendant1', partyType), + }, +}); + +const defendantSolicitor1 = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant1Represented(claimType)) + return { + LegalRepresentation: { + specRespondent1Represented: 'Yes', + }, + DefendantSolicitorOrganisation: { + respondent1OrgRegistered: 'Yes', + respondent1OrganisationPolicy: { + OrgPolicyReference: 'Defendant policy reference', + OrgPolicyCaseAssignedRole: '[RESPONDENTSOLICITORONE]', + Organisation: { + OrganisationID: defendantSolicitor1User.orgId, + }, + }, + }, + DefendantSolicitorEmail: { + respondentSolicitor1EmailAddress: defendantSolicitor1User.email, + }, + SpecRespondentCorrespondenceAddress: { + specRespondentCorrespondenceAddressRequired: 'Yes', + specRespondentCorrespondenceAddressdetails: + CaseDataHelper.buildAddressData('Defendant2Service'), + }, + }; + return { + LegalRepresentation: { + specRespondent1Represented: 'No', + }, + }; +}; + +const defendant2 = (claimType: ClaimType, partyType: PartyType) => { + if (ClaimTypeHelper.isDefendant2(claimType)) + return { + AddAnotherDefendant: { + addRespondent2: 'Yes', + }, + SecondDefendant: { + respondent2: CaseDataHelper.buildClaimantOrDefData('Defendant2', partyType), + }, + }; + return { + AddAnotherDefendant: { + addRespondent2: 'No', + }, + }; +}; + +const defendant2Represented = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant2Represented(claimType)) + return { + LegalRepresentationRespondent2: { + specRespondent2Represented: 'Yes', + }, + }; + else if (ClaimTypeHelper.isDefendant2Unrepresented(claimType)) { + return { + LegalRepresentationRespondent2: { + specRespondent2Represented: 'No', + }, + }; + } + return {}; +}; + +const defendant2SameSolicitor = (claimType: ClaimType) => { + if (claimType === ClaimType.ONE_VS_TWO_SAME_SOL) + return { + SameLegalRepresentative: { + respondent2SameLegalRepresentative: 'Yes', + }, + }; + else if (claimType === ClaimType.ONE_VS_TWO_DIFF_SOL) + return { + SameLegalRepresentative: { + respondent2SameLegalRepresentative: 'No', + }, + }; + return {}; +}; + +const defendantSolicitor2 = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant2RepresentedNotSame(claimType)) + return { + SecondDefendantSolicitorOrganisation: { + respondent2OrgRegistered: 'Yes', + respondent2OrganisationPolicy: { + OrgPolicyReference: 'Defendant policy reference 2', + OrgPolicyCaseAssignedRole: '[RESPONDENTSOLICITORTWO]', + Organisation: { OrganisationID: defendantSolicitor2User.orgId }, + }, + }, + SecondDefendantSolicitorEmail: { + respondentSolicitor2EmailAddress: defendantSolicitor2User.email, + }, + SpecRespondent2CorrespondenceAddress: { + specRespondent2CorrespondenceAddressRequired: 'Yes', + specRespondent2CorrespondenceAddressdetails: + CaseDataHelper.buildAddressData('Defendant2Service'), + }, + }; + return {}; +}; + +const claimDetails = (claimTrack: ClaimTrack) => ({ + FlightDelayClaim: { + isFlightDelayClaim: 'No', + }, + Details: { + detailsOfClaim: 'Test details of claim', + }, + ClaimTimeline: { + timelineOfEvents: [ + { + value: { + timelineDate: '2021-02-01', + timelineDescription: 'event 1', + }, + }, + ], + }, + EvidenceList: { + speclistYourEvidenceList: [ + { + value: { + evidenceType: 'CONTRACTS_AND_AGREEMENTS', + contractAndAgreementsEvidence: 'evidence details', + }, + }, + ], + }, + ClaimAmount: { + claimAmountBreakup: [ + { + value: { + claimReason: 'amount reason', + claimAmount: `${CaseDataHelper.getClaimValue(claimTrack) * 100}`, + }, + }, + ], + }, + ClaimAmountDetails: { + totalClaimAmount: `${CaseDataHelper.getClaimValue(claimTrack) * 100}`, + }, + ClaimInterest: { + claimInterest: 'No', + }, + InterestSummary: {}, + PbaNumber: {}, +}); + +const statementOfTruth = { + StatementOfTruth: { + uiStatementOfTruth: { + name: claimantSolicitorUser.name, + role: 'Solicitor', + }, + }, +}; + +const createClaimSpecData = { + references, + claimant1, + claimant2, + claimantSolicitor1, + defendant1, + defendantSolicitor1, + defendant2, + defendant2Represented, + defendant2SameSolicitor, + defendantSolicitor2, + claimDetails, + statementOfTruth, +}; + +export default createClaimSpecData; diff --git a/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder.ts b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder.ts new file mode 100644 index 0000000000..bc28cde6a1 --- /dev/null +++ b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder.ts @@ -0,0 +1,49 @@ +import BaseDataBuilder from '../../../../../../base/base-data-builder'; +import { AllMethodsStep } from '../../../../../../decorators/test-steps'; +import ClaimTrack from '../../../../../../enums/claim-track'; +import ClaimType from '../../../../../../enums/claim-type'; +import PartyType from '../../../../../../enums/party-type'; +import { UploadDocumentValue } from '../../../../../../models/ccd/ccd-case-data'; +import createClaimData from './create-claim-data-components'; + +@AllMethodsStep() +export default class CreateClaimDataBuilder extends BaseDataBuilder { + async buildSmallTrack1v1(particularsOfClaimDocument: UploadDocumentValue) { + return this.buildData(particularsOfClaimDocument); + } + + protected async buildData( + particularsOfClaimDocument: UploadDocumentValue, + { + claimType = ClaimType.ONE_VS_ONE, + claimTrack = ClaimTrack.SMALL_CLAIM, + claimant1PartyType = PartyType.INDIVIDUAL, + claimant2PartyType = PartyType.INDIVIDUAL, + defendant1PartyType = PartyType.INDIVIDUAL, + defendant2PartyType = PartyType.INDIVIDUAL, + }: { + claimType?: ClaimType; + claimTrack?: ClaimTrack; + claimant1PartyType?: PartyType; + claimant2PartyType?: PartyType; + defendant1PartyType?: PartyType; + defendant2PartyType?: PartyType; + } = {}, + ) { + return { + ...createClaimData.references, + ...createClaimData.claimantCourt, + ...createClaimData.claimant1(claimant1PartyType), + ...createClaimData.claimantSolicitor1, + ...createClaimData.claimant2(claimType, claimant2PartyType), + ...createClaimData.defendant1(defendant1PartyType), + ...createClaimData.defendantSolicitor1(claimType), + ...createClaimData.defendant2(claimType, defendant2PartyType), + ...createClaimData.defendant2Represented(claimType), + ...createClaimData.defendant2SameSolicitor(claimType), + ...createClaimData.defendantSolicitor2(claimType), + ...createClaimData.claimDetails(claimTrack, particularsOfClaimDocument), + ...createClaimData.statementOfTruth, + }; + } +} diff --git a/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-components.ts b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-components.ts new file mode 100644 index 0000000000..f645ced684 --- /dev/null +++ b/playwright-e2e/data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-components.ts @@ -0,0 +1,277 @@ +import preferredCourts from '../../../../../../config/preferred-courts'; +import { + claimantSolicitorUser, + defendantSolicitor1User, + defendantSolicitor2User, +} from '../../../../../../config/users/exui-users'; +import ClaimTrack from '../../../../../../enums/claim-track'; +import ClaimType from '../../../../../../enums/claim-type'; +import PartyType from '../../../../../../enums/party-type'; +import CaseDataHelper from '../../../../../../helpers/case-data-helper'; +import ClaimTypeHelper from '../../../../../../helpers/claim-type-helper'; +import { UploadDocumentValue } from '../../../../../../models/ccd/ccd-case-data'; + +const references = { + References: { + solicitorReferences: { + applicantSolicitor1Reference: 'Claimant Solicitor Reference', + respondentSolicitor1Reference: 'Defendant Solicitor Reference', + }, + }, +}; + +const claimantCourt = { + Court: { + courtLocation: { + applicantPreferredCourtLocationList: { + list_items: [CaseDataHelper.setCodeToData(preferredCourts.claimant)], + value: CaseDataHelper.setCodeToData(preferredCourts.claimant), + }, + }, + applicant1DQRemoteHearing: { + remoteHearingRequested: 'Yes', + reasonForRemoteHearing: 'No reason', + }, + }, +}; + +const claimant1 = (partyType: PartyType) => { + return { + Claimant: { + applicant1: CaseDataHelper.buildClaimantOrDefData('Claimant1', partyType), + }, + ClaimantLitigationFriendRequired: { + applicant1LitigationFriendRequired: 'Yes', + }, + ClaimantLitigationFriend: { + applicant1LitigationFriend: { + firstName: 'Bob', + lastName: 'Litigation', + emailAddress: 'bobthelitigant@litigants.com', + phoneNumber: '07123456789', + hasSameAddressAsLitigant: 'No', + primaryAddress: CaseDataHelper.buildAddressData('Litigation1'), + }, + }, + }; +}; + +const claimantSolicitor1 = { + Notifications: { + applicantSolicitor1CheckEmail: { + email: claimantSolicitorUser.email, + correct: 'No', + }, + applicantSolicitor1UserDetails: { + email: claimantSolicitorUser.email, + }, + }, + ClaimantSolicitorOrganisation: { + applicant1OrganisationPolicy: { + OrgPolicyReference: 'Claimant policy reference', + OrgPolicyCaseAssignedRole: '[APPLICANTSOLICITORONE]', + Organisation: { + OrganisationID: claimantSolicitorUser.orgId, + }, + }, + }, + ClaimantSolicitorServiceAddress: { + applicantSolicitor1ServiceAddressRequired: 'Yes', + applicantSolicitor1ServiceAddress: CaseDataHelper.buildAddressData('ClaimantService'), + }, +}; + +const claimant2 = (claimType: ClaimType, partyType: PartyType) => { + if (ClaimTypeHelper.isClaimant2(claimType)) + return { + AddAnotherClaimant: { + addApplicant2: 'Yes', + }, + SecondClaimant: { + applicant2: CaseDataHelper.buildClaimantOrDefData('Claimant2', partyType), + }, + SecondClaimantLitigationFriendRequired: { + applicant2LitigationFriendRequired: 'Yes', + }, + SecondClaimantLitigationFriend: { + applicant2LitigationFriend: { + firstName: 'Paul', + lastName: 'Litigation', + emailAddress: 'paulthelitigant@litigants.com', + phoneNumber: '07123456789', + hasSameAddressAsLitigant: 'No', + primaryAddress: CaseDataHelper.buildAddressData('Litigation2'), + }, + }, + }; + return { + AddAnotherClaimant: { + addApplicant2: 'No', + }, + }; +}; + +const defendant1 = (partyType: PartyType) => ({ + Defendant: { + respondent1: CaseDataHelper.buildClaimantOrDefData('Defendant1', partyType), + }, +}); + +const defendantSolicitor1 = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant1Represented(claimType)) + return { + LegalRepresentation: { + respondent1Represented: 'Yes', + }, + DefendantSolicitorOrganisation: { + respondent1OrgRegistered: 'Yes', + respondent1OrganisationPolicy: { + OrgPolicyReference: 'Defendant policy reference', + OrgPolicyCaseAssignedRole: '[RESPONDENTSOLICITORONE]', + Organisation: { + OrganisationID: defendantSolicitor1User.orgId, + }, + }, + }, + DefendantSolicitorServiceAddress: { + respondentSolicitor1ServiceAddressRequired: 'Yes', + respondentSolicitor1ServiceAddress: CaseDataHelper.buildAddressData('DefendantService'), + }, + DefendantSolicitorEmail: { + respondentSolicitor1EmailAddress: defendantSolicitor1User.email, + }, + }; + return { + LegalRepresentation: { + respondent1Represented: 'No', + }, + }; +}; + +const defendant2 = (claimType: ClaimType, partyType: PartyType) => { + if (ClaimTypeHelper.isDefendant2(claimType)) + return { + AddAnotherDefendant: { + addRespondent2: 'Yes', + }, + SecondDefendant: { + respondent2: CaseDataHelper.buildClaimantOrDefData('Defendant2', partyType), + }, + }; + return { + AddAnotherDefendant: { + addRespondent2: 'No', + }, + }; +}; + +const defendant2Represented = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant2Represented(claimType)) + return { + SecondDefendantLegalRepresentation: { + respondent2Represented: 'Yes', + }, + }; + else if (ClaimTypeHelper.isDefendant2Unrepresented(claimType)) { + return { + SecondDefendantLegalRepresentation: { + respondent2Represented: 'No', + }, + }; + } + return {}; +}; + +const defendant2SameSolicitor = (claimType: ClaimType) => { + if (claimType === ClaimType.ONE_VS_TWO_SAME_SOL) + return { + SameLegalRepresentative: { + respondent2SameLegalRepresentative: 'Yes', + }, + }; + else if (claimType === ClaimType.ONE_VS_TWO_DIFF_SOL) + return { + SameLegalRepresentative: { + respondent2SameLegalRepresentative: 'No', + }, + }; + return {}; +}; + +const defendantSolicitor2 = (claimType: ClaimType) => { + if (ClaimTypeHelper.isDefendant2RepresentedNotSame(claimType)) + return { + SecondDefendantSolicitorOrganisation: { + respondent2OrgRegistered: 'Yes', + respondent2OrganisationPolicy: { + OrgPolicyReference: 'Defendant policy reference 2', + OrgPolicyCaseAssignedRole: '[RESPONDENTSOLICITORTWO]', + Organisation: { OrganisationID: defendantSolicitor2User.orgId }, + }, + }, + SecondDefendantSolicitorServiceAddress: { + respondentSolicitor2ServiceAddressRequired: 'Yes', + respondentSolicitor2ServiceAddress: CaseDataHelper.buildAddressData('Defendant2Service'), + }, + SecondDefendantSolicitorReference: { + respondentSolicitor2Reference: 'Defendant Solicitor Reference', + }, + SecondDefendantSolicitorEmail: { + respondentSolicitor2EmailAddress: defendantSolicitor2User.email, + }, + }; + return {}; +}; + +const claimDetails = (claimTrack: ClaimTrack, particularsOfClaimDocument: UploadDocumentValue) => ({ + ClaimTypeUnSpec: { + claimTypeUnSpec: 'PERSONAL_INJURY', + }, + ClaimType: { + claimTypeUnSpec: 'PERSONAL_INJURY', + }, + PersonalInjuryType: { + personalInjuryType: 'ROAD_ACCIDENT', + }, + Details: { + detailsOfClaim: 'Test details of claim', + }, + Upload: { + servedDocumentFiles: { + particularsOfClaimDocument: [CaseDataHelper.setIdToData(particularsOfClaimDocument)], + }, + }, + ClaimValue: { + claimValue: { + statementOfValueInPennies: `${CaseDataHelper.getClaimValue(claimTrack) * 100}`, + }, + }, + PbaNumber: {}, +}); + +const statementOfTruth = { + StatementOfTruth: { + uiStatementOfTruth: { + name: claimantSolicitorUser.name, + role: 'Solicitor', + }, + }, +}; + +const createClaimData = { + references, + claimantCourt, + claimant1, + claimant2, + claimantSolicitor1, + defendant1, + defendantSolicitor1, + defendant2, + defendant2Represented, + defendant2SameSolicitor, + defendantSolicitor2, + claimDetails, + statementOfTruth, +}; + +export default createClaimData; diff --git a/playwright-e2e/data-builders/service-request/service-request-data-builder-components.ts b/playwright-e2e/data-builders/service-request/service-request-data-builder-components.ts new file mode 100644 index 0000000000..c96bd7c845 --- /dev/null +++ b/playwright-e2e/data-builders/service-request/service-request-data-builder-components.ts @@ -0,0 +1,12 @@ +export const serviceUpdateDTO = (caseId: number, paymentStatus: string) => ({ + service_request_reference: '1324646546456', + ccd_case_number: caseId, + service_request_amount: '167.00', + service_request_status: paymentStatus, + payment: { + payment_amount: 167.0, + payment_reference: '13213223', + payment_method: 'by account', + case_reference: 'example of case ref', + }, +}); diff --git a/playwright-e2e/data-builders/service-request/service-request-data-builder.ts b/playwright-e2e/data-builders/service-request/service-request-data-builder.ts new file mode 100644 index 0000000000..63395e4e69 --- /dev/null +++ b/playwright-e2e/data-builders/service-request/service-request-data-builder.ts @@ -0,0 +1,16 @@ +import { AllMethodsStep } from '../../decorators/test-steps'; +import BaseDataBuilder from '../../base/base-data-builder'; +import { serviceUpdateDTO } from './service-request-data-builder-components'; + +@AllMethodsStep() +export default class ServiceRequestDataBuilder extends BaseDataBuilder { + async buildPaidServiceRequestDTO(caseId: number, paymentStatus: string) { + return this.buildData(caseId, paymentStatus); + } + + protected async buildData(caseId: number, paymentStatus: string) { + return { + ...serviceUpdateDTO(caseId, paymentStatus), + }; + } +} diff --git a/playwright-e2e/decorators/test-steps.ts b/playwright-e2e/decorators/test-steps.ts index 78640f67f2..7a96d4751a 100644 --- a/playwright-e2e/decorators/test-steps.ts +++ b/playwright-e2e/decorators/test-steps.ts @@ -4,7 +4,7 @@ import DecoratorHelper from '../helpers/decorator-helper'; import { test } from '../playwright-fixtures/index'; import ClassMethodHelper from '../helpers/class-method-helper'; -//DO NOT APPLY AllMethodStep Decorator with Step decorator!!!!! +//DO NOT APPLY AllMethodStep Decorator with Step decorator const stepFlag = '__allMethodsStepApplied'; diff --git a/playwright-e2e/decorators/truthy-params.ts b/playwright-e2e/decorators/truthy-params.ts index 3a1754cbd5..87683506c9 100644 --- a/playwright-e2e/decorators/truthy-params.ts +++ b/playwright-e2e/decorators/truthy-params.ts @@ -55,7 +55,6 @@ export const TruthyParams = (classKey: string, ...paramNamesToCheck: string[]) = if (isAsyncFunction(target)) { return async function asyncReplacementMethod(this: any, ...args: any[]) { - const className = ClassMethodHelper.formatClassName(this.constructor.name); filterAndValidate(paramNamesToCheck, methodParamNames, args, methodName, className); return await target.call(this, ...args); }; diff --git a/playwright-e2e/enums/case-roles.ts b/playwright-e2e/enums/case-roles.ts new file mode 100644 index 0000000000..6d6eac0ea9 --- /dev/null +++ b/playwright-e2e/enums/case-roles.ts @@ -0,0 +1,7 @@ +enum CaseRoles { + RESPONDENT_SOLICITOR_ONE = 'RESPONDENTSOLICITORONE', + RESPONDENT_SOLICITOR_TWO = 'RESPONDENTSOLICITORTWO', + DEFENDANT = 'DEFENDANT', +} + +export default CaseRoles; diff --git a/playwright-e2e/enums/case-states.ts b/playwright-e2e/enums/case-states.ts new file mode 100644 index 0000000000..121cebe1b8 --- /dev/null +++ b/playwright-e2e/enums/case-states.ts @@ -0,0 +1,16 @@ +enum CaseStates { + PENDING_CASE_ISSUED = 'PENDING_CASE_ISSUED', + CASE_ISSUED = 'CASE_ISSUED', + AWAITING_CASE_DETAILS_NOTIFICATION = 'AWAITING_CASE_DETAILS_NOTIFICATION', + AWAITING_RESPONDENT_ACKNOWLEDGEMENT = 'AWAITING_RESPONDENT_ACKNOWLEDGEMENT', + AWAITING_APPLICANT_INTENTION = 'AWAITING_APPLICANT_INTENTION', + PROCEEDS_IN_HERITAGE_SYSTEM = 'PROCEEDS_IN_HERITAGE_SYSTEM', + JUDICIAL_REFERRAL = 'JUDICIAL_REFERRAL', + CASE_PROGRESSION = 'CASE_PROGRESSION', + HEARING_READINESS = 'HEARING_READINESS', + All_FINAL_ORDERS_ISSUED = 'All_FINAL_ORDERS_ISSUED', + CASE_DISCONTINUED = 'CASE_DISCONTINUED', + CLOSED = 'CLOSED', +} + +export default CaseStates; diff --git a/playwright-e2e/enums/claim-track.ts b/playwright-e2e/enums/claim-track.ts new file mode 100644 index 0000000000..bafb6623d5 --- /dev/null +++ b/playwright-e2e/enums/claim-track.ts @@ -0,0 +1,8 @@ +enum ClaimTrack { + SMALL_CLAIM = 'SMALL_CLAIM', + FAST_CLAIM = 'FAST_CLAIM', + INTERMEDIATE_CLAIM = 'INTERMEDIATE_CLAIM', + MULTI_CLAIM = 'MULTI_CLAIM', +} + +export default ClaimTrack; diff --git a/playwright-e2e/enums/claim-type.ts b/playwright-e2e/enums/claim-type.ts new file mode 100644 index 0000000000..09501fb97b --- /dev/null +++ b/playwright-e2e/enums/claim-type.ts @@ -0,0 +1,13 @@ +enum ClaimType { + ONE_VS_ONE_LIP, + TWO_VS_ONE_LIP, + ONE_VS_TWO_LIPS, + ONE_VS_TWO_ONE_LR_ONE_LIP, + ONE_VS_TWO_ONE_LIP_ONE_LR, + ONE_VS_ONE, + TWO_VS_ONE, + ONE_VS_TWO_SAME_SOL, + ONE_VS_TWO_DIFF_SOL, +} + +export default ClaimType; diff --git a/playwright-e2e/enums/party-type.ts b/playwright-e2e/enums/party-type.ts new file mode 100644 index 0000000000..5dddf7f1b4 --- /dev/null +++ b/playwright-e2e/enums/party-type.ts @@ -0,0 +1,8 @@ +enum PartyType { + INDIVIDUAL = 'INDIVIDUAL', + COMPANY = 'COMPANY', + SOLE_TRADER = 'SOLE_TRADER', + ORGANISATION = 'ORGANISATION', +} + +export default PartyType; diff --git a/playwright-e2e/errors/expect-error.ts b/playwright-e2e/errors/expect-error.ts index 98b085db61..733cf07d4c 100644 --- a/playwright-e2e/errors/expect-error.ts +++ b/playwright-e2e/errors/expect-error.ts @@ -2,6 +2,6 @@ import CustomError from './custom-error'; export default class ExpectError extends CustomError { constructor(message: string) { - super('AssertionError', message); + super('ExpectError', message); } } diff --git a/playwright-e2e/global/teardown-ci.ts b/playwright-e2e/global/teardown-ci.ts index 431a917ebd..a2476eb84b 100644 --- a/playwright-e2e/global/teardown-ci.ts +++ b/playwright-e2e/global/teardown-ci.ts @@ -2,12 +2,14 @@ import AxeCacheHelper from '../helpers/axe-cache-helper'; import BankHolidaysHelper from '../helpers/bank-holidays-helper'; import CookiesHelper from '../helpers/cookies-helper'; import UserStateHelper from '../helpers/users-state-helper'; +import UserAssignedCasesHelper from '../helpers/user-assigned-cases-helper'; const globalTeardownCI = () => { UserStateHelper.deleteAllUsersState(); CookiesHelper.deleteAllCookies(); AxeCacheHelper.deleteAllCache(); BankHolidaysHelper.deleteBankHolidays(); + UserAssignedCasesHelper.deleteAllUsersAssignedCases(); }; globalTeardownCI(); diff --git a/playwright-e2e/global/teardown-local.ts b/playwright-e2e/global/teardown-local.ts index 9d1459a179..f8e52cd04f 100644 --- a/playwright-e2e/global/teardown-local.ts +++ b/playwright-e2e/global/teardown-local.ts @@ -1,13 +1,115 @@ import AxeCacheHelper from '../helpers/axe-cache-helper'; import BankHolidaysHelper from '../helpers/bank-holidays-helper'; import CookiesHelper from '../helpers/cookies-helper'; +import UserAssignedCasesHelper from '../helpers/user-assigned-cases-helper'; import UserStateHelper from '../helpers/users-state-helper'; +import { APIRequestContext, request } from 'playwright-core'; +import { solicitorUsers } from '../config/users/exui-users'; +import User from '../models/user'; +import config from '../config/config'; +import urls from '../config/urls'; +import { TOTP } from 'totp-generator'; -const globalTeardown = async () => { +/* +This is last resort teardown for unassigning case if test execution gets interupted in local. +The logic here is also covered in the step method in the teardown project given by the following file path +'playwright-e2e/tests/bootstrap/case-role-assignment/case-role-assignment.teardown.ts' +The reason why this code is duplicated is because when tests are being run locally an interruption caused by ctrl + c +Will not cause teardown projects to run in playwright, so this code has been duplicated to allow teardowns to still occur. +The code in the file path above will still be run, because it appears in playwrights reports as steps and logs however the code below will not. +*/ + +const getAccessToken = async ( + { name, email, password }: User, + requestContext: APIRequestContext, +): Promise => { + console.log(`Fetching access token for user: ${name}...`); + const url = `${urls.idamApi}/loginUser`; + const requestOptions = { + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + params: { username: email, password: password }, + method: 'POST', + }; + const responseJson = await (await requestContext.fetch(url, requestOptions)).json(); + console.log(`Access token for user: ${name} fetched successfully`); + return responseJson.access_token; +}; + +const fetchCivilS2sToken = async (requestContext: APIRequestContext) => { + console.log('Fetching s2s token...'); + const url = `${urls.authProviderApi}/lease`; + const requestOptions = { + method: 'POST', + data: { + microservice: config.s2s.microservice, + oneTimePassword: TOTP.generate(config.s2s.secret).otp, + }, + }; + const responseText = await (await requestContext.fetch(url, requestOptions)).text(); + console.log('s2s token fetched successfully'); + return responseText; +}; + +const getRequestHeaders = async ({ accessToken }: User, civilS2sToken: string) => { + return { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, + ServiceAuthorization: civilS2sToken, + }; +}; + +const unassignCaseFromUser = async ( + requestContext: APIRequestContext, + user: User, + civilS2sToken: string, + caseIds: number[], +) => { + console.log(`Unassigning cases from user: ${user.name}...`); + const url = `${urls.civilService}/testing-support/unassign-user`; + const requestOptions = { + headers: await getRequestHeaders(user, civilS2sToken), + data: { + caseIds, + }, + method: 'POST', + }; + await requestContext.fetch(url, requestOptions); + caseIds.forEach((caseId) => + console.log(`User: ${user.name} unassigned from case [${caseId}] successfully`), + ); +}; + +const unassignCases = async () => { + if (config.unassignCases) { + let civilS2sToken: string; + for (const solicitorUser of solicitorUsers) { + const assignedCases = await UserAssignedCasesHelper.getUserAssignedCases(solicitorUser); + if (assignedCases) { + try { + const requestContext = await request.newContext(); + if (!solicitorUser.accessToken) { + solicitorUser.accessToken = await getAccessToken(solicitorUser, requestContext); + } + if (!civilS2sToken) { + civilS2sToken = await fetchCivilS2sToken(requestContext); + } + await unassignCaseFromUser(requestContext, solicitorUser, civilS2sToken, assignedCases); + } catch (error) { + console.log(`Unable to unassign cases for user: ${solicitorUser.name}`); + console.log(error); + } + } + } + } +}; + +const globalTeardownLocal = async () => { + await unassignCases(); UserStateHelper.deleteAllUsersState(); CookiesHelper.deleteAllCookies(); AxeCacheHelper.deleteAllCache(); BankHolidaysHelper.deleteBankHolidays(); + UserAssignedCasesHelper.deleteAllUsersAssignedCases(); }; -export default globalTeardown; +export default globalTeardownLocal; diff --git a/playwright-e2e/helpers/axe-cache-helper.ts b/playwright-e2e/helpers/axe-cache-helper.ts index 652a1dc360..165e1cf2b5 100644 --- a/playwright-e2e/helpers/axe-cache-helper.ts +++ b/playwright-e2e/helpers/axe-cache-helper.ts @@ -3,6 +3,9 @@ import FileType from '../enums/file-type'; import { AxeResults, PageResult } from '../models/axe-results'; import FileSystemHelper from './file-system-helper'; +//TODO: Could be a potential concurrency issue when caching page results when multiple workers are running but will fix later. +//e.g. Two workers could be caching at the same time. + export default class AxeCacheHelper { private static getResultsFilePath(projectName: string) { return `${filePaths.axe}/${projectName}/accessibility-results.json`; diff --git a/playwright-e2e/helpers/case-data-helper.ts b/playwright-e2e/helpers/case-data-helper.ts index 561ab34c95..f9b333d00a 100644 --- a/playwright-e2e/helpers/case-data-helper.ts +++ b/playwright-e2e/helpers/case-data-helper.ts @@ -1,3 +1,8 @@ +import { v4 as uuidv4 } from 'uuid'; +import PartyType from '../enums/party-type'; +import StringHelper from './string-helper'; +import ClaimTrack from '../enums/claim-track'; + export default class CaseDataHelper { static getNextClaimNumber() { return '00' + Math.random().toString(36).slice(-6); @@ -8,4 +13,85 @@ export default class CaseDataHelper { const formattedString = '#' + groups.join('-'); return formattedString; } + + static setCodeToData(data: any) { + return { + code: uuidv4(), + label: data, + }; + } + + static setIdToData(data: any) { + return { + id: uuidv4(), + value: data, + }; + } + + static buildClaimantOrDefData(key: string, partyType: PartyType) { + const commonPartyData = { + type: partyType, + partyEmail: `${key}@${partyType.toLowerCase()}.com`, + partyPhone: '07987332384', + primaryAddress: this.buildAddressData(key), + partyTypeDisplayValue: StringHelper.capitalise(partyType), + }; + + switch (partyType) { + case PartyType.INDIVIDUAL: + return { + ...commonPartyData, + individualTitle: 'Mr', + individualFirstName: `${key}FirstName`, + individualLastName: `${key}LastName`, + individualDateOfBirth: '1980-10-12', + }; + + case PartyType.COMPANY: + return { + ...commonPartyData, + companyName: `${key} ${StringHelper.capitalise(partyType)}`, + }; + + case PartyType.SOLE_TRADER: + return { + ...commonPartyData, + soleTraderTitle: 'Mr', + soleTraderFirstName: `${key}FirstName`, + soleTraderLastName: `${key}LastName`, + soleTraderTradingAs: `${key}TradingAs`, + soleTraderDateOfBirth: '1985-06-20', + }; + case PartyType.ORGANISATION: + return { + ...commonPartyData, + organisationName: `${key} ${StringHelper.capitalise(partyType)}`, + }; + } + } + + static buildAddressData(key: string) { + return { + AddressLine1: `Flat 12 - ${key}`, + AddressLine2: `${key} House 15 - 17`, + AddressLine3: `${key} Street`, + PostTown: `${key} Town`, + County: `${key} County`, + Country: 'England', + PostCode: 'RG4 7AA', + }; + } + + static getClaimValue(claimTrack: ClaimTrack) { + switch (claimTrack) { + case ClaimTrack.SMALL_CLAIM: + return 100; + case ClaimTrack.FAST_CLAIM: + return 11000; + case ClaimTrack.INTERMEDIATE_CLAIM: + return 26000; + case ClaimTrack.MULTI_CLAIM: + return 110000; + } + } } diff --git a/playwright-e2e/helpers/claim-type-helper.ts b/playwright-e2e/helpers/claim-type-helper.ts new file mode 100644 index 0000000000..9190f8e8bf --- /dev/null +++ b/playwright-e2e/helpers/claim-type-helper.ts @@ -0,0 +1,63 @@ +import ClaimType from '../enums/claim-type'; + +export default class ClaimTypeHelper { + static isClaimant2(claimType: ClaimType) { + return claimType === ClaimType.TWO_VS_ONE || claimType === ClaimType.TWO_VS_ONE_LIP; + } + + static isDefendant1Represented(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_ONE || + claimType === ClaimType.ONE_VS_TWO_DIFF_SOL || + claimType === ClaimType.ONE_VS_TWO_ONE_LR_ONE_LIP || + claimType === ClaimType.ONE_VS_TWO_SAME_SOL || + claimType === ClaimType.TWO_VS_ONE + ); + } + + static isDefendant1RepresentedNotSame(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_TWO_DIFF_SOL || + claimType === ClaimType.ONE_VS_TWO_ONE_LR_ONE_LIP + ); + } + + static isDefendant1Unrepresented(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_ONE_LIP || + claimType === ClaimType.ONE_VS_TWO_ONE_LIP_ONE_LR || + claimType === ClaimType.TWO_VS_ONE_LIP + ); + } + + static isDefendant2(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_TWO_DIFF_SOL || + claimType === ClaimType.ONE_VS_TWO_ONE_LR_ONE_LIP || + claimType === ClaimType.ONE_VS_TWO_SAME_SOL || + claimType === ClaimType.ONE_VS_TWO_LIPS || + claimType === ClaimType.ONE_VS_TWO_ONE_LIP_ONE_LR + ); + } + + static isDefendant2Represented(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_TWO_SAME_SOL || + claimType === ClaimType.ONE_VS_TWO_DIFF_SOL || + claimType === ClaimType.ONE_VS_TWO_ONE_LIP_ONE_LR + ); + } + + static isDefendant2RepresentedNotSame(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_TWO_DIFF_SOL || + claimType === ClaimType.ONE_VS_TWO_ONE_LIP_ONE_LR + ); + } + + static isDefendant2Unrepresented(claimType: ClaimType) { + return ( + claimType === ClaimType.ONE_VS_TWO_LIPS || claimType === ClaimType.ONE_VS_TWO_ONE_LR_ONE_LIP + ); + } +} diff --git a/playwright-e2e/helpers/class-method-helper.ts b/playwright-e2e/helpers/class-method-helper.ts index 844af5e069..ba14f29b22 100644 --- a/playwright-e2e/helpers/class-method-helper.ts +++ b/playwright-e2e/helpers/class-method-helper.ts @@ -1,8 +1,10 @@ +import StringHelper from './string-helper'; + export default class ClassMethodHelper { static formatClassName = (className: string) => { if (className.endsWith('Steps')) { return className; } - return className.charAt(0).toLowerCase() + className.slice(1); + return StringHelper.decapitalise(className); }; } diff --git a/playwright-e2e/helpers/file-system-helper.ts b/playwright-e2e/helpers/file-system-helper.ts index ef9688bc18..804a0d835f 100644 --- a/playwright-e2e/helpers/file-system-helper.ts +++ b/playwright-e2e/helpers/file-system-helper.ts @@ -8,6 +8,7 @@ import filePaths from '../config/file-paths'; export default class FileSystemHelper { private static writePaths = [ `${filePaths.users}/`, + `${filePaths.userAssignedCases}/`, `${filePaths.userCookies}/`, `${filePaths.axe}/`, filePaths.bankHolidaysJson, @@ -81,15 +82,25 @@ export default class FileSystemHelper { return this.decode(data, fileType); }; - static writeFile = (data: any, filePath = '', fileType: FileType): void => { - this.validateFilePath(filePath, fileType); + static writeFile = ( + data: any, + filePath = '', + fileType: FileType, + { force }: { force?: boolean } = { force: false }, + ): void => { + if (!force) this.validateFilePath(filePath, fileType); data = this.encode(data, fileType); this.mkDir(filePath); fs.writeFileSync(filePath, data); }; - static writeFileAsync = async (data: any, filePath = '', fileType: FileType): Promise => { - this.validateFilePath(filePath, fileType); + static writeFileAsync = async ( + data: any, + filePath = '', + fileType: FileType, + { force }: { force?: boolean } = { force: false }, + ): Promise => { + if (!force) this.validateFilePath(filePath, fileType); data = this.encode(data, fileType); this.mkDir(filePath); await fsAsync.writeFile(filePath, data); diff --git a/playwright-e2e/helpers/object-helper.ts b/playwright-e2e/helpers/object-helper.ts new file mode 100644 index 0000000000..05241a9c12 --- /dev/null +++ b/playwright-e2e/helpers/object-helper.ts @@ -0,0 +1,26 @@ +export default class ObjectHelper { + /** + * {...obj1, ...obj2} replaces elements. For instance, if obj1 = { check : { correct : false }} + * and obj2 = { check: { newValue : 'ASDF' }} the result will be { check : {newValue : 'ASDF} }. + * + * What this method does is a kind of deep spread, in a case like the one before, + * @param objectToBeModified the object we want to modify + * @param modificationObject the object holding the modifications + * @return a caseData with the new values + */ + static deepSpread(objectToBeModified: object, modificationObject: object) { + const modified = { ...objectToBeModified }; + for (const key in modificationObject) { + if (objectToBeModified[key] && typeof objectToBeModified[key] === 'object') { + if (Array.isArray(objectToBeModified[key])) { + modified[key] = modificationObject[key]; + } else { + modified[key] = this.deepSpread(objectToBeModified[key], modificationObject[key]); + } + } else { + modified[key] = modificationObject[key]; + } + } + return modified; + } +} diff --git a/playwright-e2e/helpers/request-options.ts b/playwright-e2e/helpers/request-options.ts deleted file mode 100644 index 6111ec0c72..0000000000 --- a/playwright-e2e/helpers/request-options.ts +++ /dev/null @@ -1,8 +0,0 @@ -type RequestOptions = { - readonly headers?: Record; - readonly body?: Record; - readonly method?: 'GET' | 'POST' | 'PUT' | 'DELETE'; - readonly params?: { [key: string]: string | number | boolean }; -}; - -export default RequestOptions; diff --git a/playwright-e2e/helpers/string-helper.ts b/playwright-e2e/helpers/string-helper.ts new file mode 100644 index 0000000000..84c73fede6 --- /dev/null +++ b/playwright-e2e/helpers/string-helper.ts @@ -0,0 +1,34 @@ +export default class StringHelper { + static capitalise(str: string) { + const firstChar = str.charAt(0).toUpperCase(); + const restOfStr = str.substring(1).toLowerCase(); + return `${firstChar}${restOfStr}`; + } + + static decapitalise(str: string) { + let newStr = ''; + let keepDecapitalising = true; + for (let i = 1; i <= str.length; i++) { + if (keepDecapitalising) { + if (i === str.length || (this.isUpper(str[i - 1]) && this.isUpper(str[i]))) { + newStr += str[i - 1].toLowerCase(); + } else if (this.isUpper(str[i - 1]) && this.isLower(str[i])) { + keepDecapitalising = false; + } + } + if (!keepDecapitalising) { + if (i === 1) newStr += str[i - 1].toLowerCase(); + else newStr += str[i - 1]; + } + } + return newStr; + } + + static isUpper(str: string) { + return str === str.toUpperCase(); + } + + static isLower(str: string) { + return str === str.toLowerCase(); + } +} diff --git a/playwright-e2e/helpers/user-assigned-cases-helper.ts b/playwright-e2e/helpers/user-assigned-cases-helper.ts new file mode 100644 index 0000000000..745586a7ae --- /dev/null +++ b/playwright-e2e/helpers/user-assigned-cases-helper.ts @@ -0,0 +1,53 @@ +import config from '../config/config'; +import filePaths from '../config/file-paths'; +import FileType from '../enums/file-type'; +import UserKey from '../enums/user-key'; +import User from '../models/user'; +import FileSystemHelper from './file-system-helper'; + +//TODO: Could be a potentially concurrency issue when storing assigned caseIds for users when multiple workers are running but will assess and fix later. +//e.g. Two workers could be updating caseIds for a user at the same time. + +export default class UserAssignedCasesHelper { + private static getUserAssignedCasesPath = (userKey: UserKey) => + `${filePaths.userAssignedCases}/${userKey}.json`; + + static async getUserAssignedCases({ key: userKey }: User): Promise { + if (config.unassignCases) { + try { + const unassignedCases = FileSystemHelper.readFile( + this.getUserAssignedCasesPath(userKey), + FileType.JSON, + ); + return unassignedCases; + } catch { + return null; + } + } + return null; + } + + static async addAssignedCaseToUser(user: User, caseId: number) { + if (config.unassignCases) { + console.log(`Adding caseId: ${caseId} to user assigned cases for user: ${user.name}`); + const userAssignedCases = (await this.getUserAssignedCases(user)) ?? []; + userAssignedCases.push(caseId); + await FileSystemHelper.writeFileAsync( + userAssignedCases, + this.getUserAssignedCasesPath(user.key), + FileType.JSON, + ); + console.log( + `Added caseId: ${caseId} to user assigned cases for user: ${user.name} successfully`, + ); + } + } + + static async deleteUserAssignedCases({ key: userKey }: User) { + FileSystemHelper.delete(this.getUserAssignedCasesPath(userKey)); + } + + static async deleteAllUsersAssignedCases() { + FileSystemHelper.delete(`${filePaths.userAssignedCases}/`); + } +} diff --git a/playwright-e2e/helpers/users-state-helper.ts b/playwright-e2e/helpers/users-state-helper.ts index b1df71ba1f..48b2914a04 100644 --- a/playwright-e2e/helpers/users-state-helper.ts +++ b/playwright-e2e/helpers/users-state-helper.ts @@ -11,16 +11,18 @@ export default class UserStateHelper { `${filePaths.users}/${userKey}-users.json`; static addUsersToState = (users: User[]) => { + const usersStateExists = this.usersStateExists(users); FileSystemHelper.writeFile(users, this.getUserStatePath(users[0].key), FileType.JSON); console.log( - `Users with key: ${users[0].key} ${this.userStateExists(users[0]) ? 'successfully updated' : 'successfully created'}`, + `Users with key: ${users[0].key} ${usersStateExists ? 'successfully updated' : 'successfully created'}`, ); }; static addUserToState = (user: User) => { + const userStateExists = this.userStateExists(user); FileSystemHelper.writeFile(user, this.getUserStatePath(user.key), FileType.JSON); console.log( - `User with key: ${user.key} ${this.userStateExists(user) ? 'successfully updated' : 'successfully created'}`, + `User with key: ${user.key} ${userStateExists ? 'successfully updated' : 'successfully created'}`, ); }; diff --git a/playwright-e2e/models/api/response-options.ts b/playwright-e2e/models/api/response-options.ts index f21cbe0fac..5ae8cda0c0 100644 --- a/playwright-e2e/models/api/response-options.ts +++ b/playwright-e2e/models/api/response-options.ts @@ -51,7 +51,7 @@ export interface ResponseTextOptions extends _ResponseOptions { export interface _RetryResponseOptions { expectedStatus?: number; - remainingRetries?: number; + retries?: number; retryTimeInterval?: number; verifyResponse?: ( response: APIResponse | any | string, diff --git a/playwright-e2e/models/ccd/ccd-case-data.ts b/playwright-e2e/models/ccd/ccd-case-data.ts index 8ed65670d0..48eabdf21c 100644 --- a/playwright-e2e/models/ccd/ccd-case-data.ts +++ b/playwright-e2e/models/ccd/ccd-case-data.ts @@ -103,69 +103,69 @@ export default interface CCDCaseData { respondent2AcknowledgeNotificationDate?: string; } -interface ServedDocumentFiles { +export interface ServedDocumentFiles { particularsOfClaimDocument?: ParticularsOfClaimDocument[]; } -interface SolicitorReferences { +export interface SolicitorReferences { applicantSolicitor1Reference?: string; respondentSolicitor1Reference?: string; } -interface ParticularsOfClaimDocument { +export interface ParticularsOfClaimDocument { id?: string; - value?: ParticularsOfClaimDocumentValue; + value?: UploadDocumentValue; } -interface ApplicantSolicitor1PbaAccounts { +export interface ApplicantSolicitor1PbaAccounts { value?: ApplicantSolicitor1PbaAccountsValue; list_items?: ApplicantSolicitor1PbaAccountsListItem[]; } -interface ApplicantSolicitor1PbaAccountsValue { +export interface ApplicantSolicitor1PbaAccountsValue { code?: string; label?: string; } -interface ApplicantSolicitor1PbaAccountsListItem { +export interface ApplicantSolicitor1PbaAccountsListItem { code?: string; label?: string; } -interface ClaimStatementOfTruth { +export interface ClaimStatementOfTruth { name?: string; role?: string; } -interface ClaimIssuedPaymentDetails { +export interface ClaimIssuedPaymentDetails { status?: string; reference?: string; customerReference?: string; } -interface ClaimValue { +export interface ClaimValue { statementOfValueInPennies?: string; } -interface ClaimMediationSpecRequired { +export interface ClaimMediationSpecRequired { hasAgreedFreeMediation?: string; } -interface NotifyClaimDetailsOptions { +export interface NotifyClaimDetailsOptions { value?: NotifyClaimDetailsOptionsValue; } -interface NotifyClaimDetailsOptionsValue { +export interface NotifyClaimDetailsOptionsValue { code?: string; label?: string; } -interface Expert { +export interface Expert { id?: string; value?: ExpertValue; } -interface ExpertValue { +export interface ExpertValue { email?: string; flags?: CaseFlags; phone?: string; @@ -174,12 +174,12 @@ interface ExpertValue { firstName?: string; } -interface Witnesses { +export interface Witnesses { id?: string; value?: Witness; } -interface Witness { +export interface Witness { email?: string; flags?: CaseFlags; phone?: string; @@ -188,7 +188,7 @@ interface Witness { firstName?: string; } -interface Party { +export interface Party { type?: string; flags?: CaseFlags; partyID?: string; @@ -202,7 +202,7 @@ interface Party { partyTypeDisplayValue?: string; } -interface ParticularsOfClaimDocumentValue { +export interface UploadDocumentValue { category_id?: string; document_url?: string; upload_timestamp?: string; @@ -210,16 +210,16 @@ interface ParticularsOfClaimDocumentValue { document_binary_url?: string; } -interface ApplicantSolicitor1UserDetails { +export interface ApplicantSolicitor1UserDetails { email?: string; } -interface SystemGeneratedCaseDocument { +export interface SystemGeneratedCaseDocument { id?: string; value?: SystemGeneratedCaseDocumentValue; } -interface SystemGeneratedCaseDocumentValue { +export interface SystemGeneratedCaseDocumentValue { createdBy?: string; documentLink?: SystemGeneratedDocumentDocumentLink; documentName?: string; @@ -228,7 +228,7 @@ interface SystemGeneratedCaseDocumentValue { createdDatetime?: string; } -interface SystemGeneratedDocumentDocumentLink { +export interface SystemGeneratedDocumentDocumentLink { category_id?: string; document_url?: string; upload_timestamp?: string; @@ -236,53 +236,53 @@ interface SystemGeneratedDocumentDocumentLink { document_binary_url?: string; } -interface OrganisationPolicy { +export interface OrganisationPolicy { Organisation?: Organisation; OrgPolicyReference?: string; OrgPolicyCaseAssignedRole?: string; } -interface Organisation { +export interface Organisation { OrganisationID?: string; } -interface ClaimFee { +export interface ClaimFee { code?: string; version?: number; calculatedAmountInPence?: number; } -interface CaseManagementLocation { +export interface CaseManagementLocation { region?: number; baseLocation?: number; } -interface CaseManagementCategory { +export interface CaseManagementCategory { value?: CaseManagementCategoryValue; list_items?: CaseManagementCategoryListItem[]; } -interface CaseManagementCategoryValue { +export interface CaseManagementCategoryValue { code?: string; label?: string; } -interface CaseManagementCategoryListItem { +export interface CaseManagementCategoryListItem { id?: string; value?: CaseManagementCategoryListItemValue; } -interface CaseManagementCategoryListItemValue { +export interface CaseManagementCategoryListItemValue { code?: string; label?: string; } -interface HearingAttendee { +export interface HearingAttendee { id?: string; value?: HearingAttendeeValue; } -interface HearingAttendeeValue { +export interface HearingAttendeeValue { email?: string; flags?: CaseFlags; phone?: string; @@ -291,18 +291,18 @@ interface HearingAttendeeValue { firstName?: string; } -interface CaseFlags { +export interface CaseFlags { details?: CaseFlagsDetails[]; partyName?: string; roleOnCase?: string; } -interface CaseFlagsDetails { +export interface CaseFlagsDetails { id?: string; value?: CaseFlagsDetailsValue; } -interface CaseFlagsDetailsValue { +export interface CaseFlagsDetailsValue { name?: string; path?: CaseFlagsDetailsValuePath[]; status?: string; @@ -312,12 +312,12 @@ interface CaseFlagsDetailsValue { hearingRelevant?: string; } -interface CaseFlagsDetailsValuePath { +export interface CaseFlagsDetailsValuePath { id?: string; value?: string; } -interface PrimaryAddress { +export interface PrimaryAddress { County?: string; Country?: string; PostCode?: string; @@ -327,19 +327,19 @@ interface PrimaryAddress { AddressLine3?: string; } -interface DQExperts { +export interface DQExperts { details?: DQExpertsDetails[]; expertRequired?: string; expertReportsSent?: string; jointExpertSuitable?: string; } -interface DQExpertsDetails { +export interface DQExpertsDetails { id?: string; value?: DQExpertsDetailsValue; } -interface DQExpertsDetailsValue { +export interface DQExpertsDetailsValue { partyID?: string; lastName?: string; dateAdded?: string; @@ -352,22 +352,22 @@ interface DQExpertsDetailsValue { fieldOfExpertise?: string; } -interface DQHearingSupport { +export interface DQHearingSupport { supportRequirements?: string; supportRequirementsAdditional?: string; } -interface DQVulnerabilityQuestions { +export interface DQVulnerabilityQuestions { vulnerabilityAdjustments?: string; vulnerabilityAdjustmentsRequired?: string; } -interface DQWitnesses { +export interface DQWitnesses { details?: DQWitness[]; witnessesToAppear?: string; } -interface DQWitness { +export interface DQWitness { id?: string; value?: { partyID?: string; @@ -381,64 +381,64 @@ interface DQWitness { }; } -interface DQHearing { +export interface DQHearing { unavailableDates?: DQHearingUnavailableDate[]; unavailableDatesRequired?: string; } -interface DQHearingUnavailableDate { +export interface DQHearingUnavailableDate { id?: string; value?: DQHearingUnavailableDateValue; } -interface DQHearingUnavailableDateValue { +export interface DQHearingUnavailableDateValue { date?: string; unavailableDateType?: string; toDate?: string; fromDate?: string; } -interface DQFixedRecoverableCosts { +export interface DQFixedRecoverableCosts { band?: string; reasons?: string; complexityBandingAgreed?: string; isSubjectToFixedRecoverableCostRegime?: string; } -interface DQLanguage { +export interface DQLanguage { court?: string; documents?: string; } -interface DQRemoteHearing { +export interface DQRemoteHearing { reasonForRemoteHearing?: string; remoteHearingRequested?: string; } -interface DQDisclosureReport { +export interface DQDisclosureReport { disclosureProposalAgreed?: string; disclosureFormFiledAndServed?: string; } -interface DQDisclosureOfNonElectronicDocuments { +export interface DQDisclosureOfNonElectronicDocuments { bespokeDirections?: string; standardDirectionsRequired?: string; directionsForDisclosureProposed?: string; } -interface DQFileDirectionsQuestionnaire { +export interface DQFileDirectionsQuestionnaire { explainedToClient?: string[]; oneMonthStayRequested?: string; reactionProtocolCompliedWith?: string; } -interface DQFurtherInformation { +export interface DQFurtherInformation { futureApplications?: string; otherInformationForJudge?: string; reasonForFutureApplications?: string; } -interface CourtLocation { +export interface CourtLocation { caseLocation?: CaseManagementLocation; applicantPreferredCourt?: string; } diff --git a/playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim-spec.ts b/playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim-spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim.ts b/playwright-e2e/models/ccd/ccd-event-data/exui/solicitor-events/create-claim/create-claim.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/playwright-e2e/models/request-options.ts b/playwright-e2e/models/request-options.ts deleted file mode 100644 index 6111ec0c72..0000000000 --- a/playwright-e2e/models/request-options.ts +++ /dev/null @@ -1,8 +0,0 @@ -type RequestOptions = { - readonly headers?: Record; - readonly body?: Record; - readonly method?: 'GET' | 'POST' | 'PUT' | 'DELETE'; - readonly params?: { [key: string]: string | number | boolean }; -}; - -export default RequestOptions; diff --git a/playwright-e2e/pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory.ts b/playwright-e2e/pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory.ts new file mode 100644 index 0000000000..fecf7917fd --- /dev/null +++ b/playwright-e2e/pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory.ts @@ -0,0 +1,3 @@ +import BasePageFactory from '../../../../base/base-page-factory'; + +export default class CreateCaseFlagsPageFactory extends BasePageFactory {} diff --git a/playwright-e2e/pages/exui/exui-dashboard/case-details/case-details-page.ts b/playwright-e2e/pages/exui/exui-dashboard/case-details/case-details-page.ts index 5e7dcdcabb..aa46055a1a 100644 --- a/playwright-e2e/pages/exui/exui-dashboard/case-details/case-details-page.ts +++ b/playwright-e2e/pages/exui/exui-dashboard/case-details/case-details-page.ts @@ -4,26 +4,26 @@ import { AllMethodsStep } from '../../../../decorators/test-steps'; import { TruthyParams } from '../../../../decorators/truthy-params'; import CCDCaseData from '../../../../models/ccd/ccd-case-data'; import { CCDEvent } from '../../../../models/ccd/ccd-events'; -import ExuiEvent from '../../exui-event/exui-event'; +import ExuiPage from '../../exui-page/exui-page'; import { buttons, containers, dropdowns, getSuccessBannerText, tabs } from './case-details-content'; const classKey = 'CaseDetailsPage'; @AllMethodsStep() -export default class CaseDetailsPage extends ExuiEvent(BasePage) { +export default class CaseDetailsPage extends ExuiPage(BasePage) { async verifyContent(caseData: CCDCaseData) { await super.runVerifications( [ super.verifyHeadings(caseData), - super.expectText(tabs.summary.title), - super.expectText(tabs.caseFile.title), - super.expectText(tabs.claimDetails.title, { exact: true }), - super.expectText(tabs.history.title, { exact: true }), + super.expectTab(tabs.summary.title), + super.expectTab(tabs.caseFile.title), + super.expectTab(tabs.claimDetails.title, { exact: true }), + super.expectTab(tabs.history.title, { exact: true }), // super.expectText(tabs.claimDocs.title), - super.expectText(tabs.paymentHistory.title), + super.expectTab(tabs.paymentHistory.title), // super.expectText(tabs.serviceRequest.title, { exact: true }), - super.expectText(tabs.bundles.title), - super.expectText(tabs.caseFlags.title), + super.expectTab(tabs.bundles.title), + super.expectTab(tabs.caseFlags.title), super.expectLabel(dropdowns.nextStep.label), ], { useAxeCache: false }, @@ -68,9 +68,7 @@ export default class CaseDetailsPage extends ExuiEvent(BasePage) { @TruthyParams(classKey, 'caseId') async goToCaseDetails(caseId: number) { console.log(`Navigating to case with ccd case id: ${caseId}`); - await super.goTo(`${urls.manageCase}/cases/case-details/${caseId}`, { - force: true, - }); + await super.goTo(`${urls.manageCase}/cases/case-details/${caseId}`); } async retryChooseNextStep(ccdEvent: CCDEvent) { @@ -79,18 +77,19 @@ export default class CaseDetailsPage extends ExuiEvent(BasePage) { await super.retryClickBySelector( buttons.go.selector, () => - super.expectNoText(tabs.summary.title, { + super.expectNoTab(tabs.summary.title, { timeout: 15_000, + exact: true, }), { retries: 3 }, ); - super.setCCDEvent = ccdEvent; } async chooseNextStep(ccdEvent: CCDEvent) { console.log(`Starting event: ${ccdEvent.name}`); await super.selectFromDropdown(ccdEvent.name, dropdowns.nextStep.selector); await super.clickBySelector(buttons.go.selector); + super.setCCDEvent = ccdEvent; } async verifySuccessEvent(caseId: number, ccdEvent: CCDEvent) { @@ -98,7 +97,7 @@ export default class CaseDetailsPage extends ExuiEvent(BasePage) { await super.runVerifications( [ super.expectText(getSuccessBannerText(caseId, ccdEvent)), - super.clickByText(tabs.history.title), + super.clickByText(tabs.history.title, { exact: true }), super.expectTableRowValue(ccdEvent.name, containers.eventHistory.selector, { rowNum: 1, }), diff --git a/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar-content.ts b/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar-content.ts index 5d10a346a7..2affc0dda3 100644 --- a/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar-content.ts +++ b/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar-content.ts @@ -1,4 +1,4 @@ -export const heading = 'Money Claims'; +export const heading = 'Manage Cases'; export const links = { signOut: { diff --git a/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar.ts b/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar.ts index 16c1e38144..c45aa8da90 100644 --- a/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar.ts +++ b/playwright-e2e/pages/exui/exui-dashboard/exui-nav-bar/exui-nav-bar.ts @@ -8,6 +8,13 @@ export default class ExuiNavBar extends BasePage { throw new Error('Method not implemented.'); } + async solicitorVerifyContent(): Promise { + super.runVerifications( + [super.expectLink(links.createCase.title), super.expectLink(links.caseList.title)], + { runAxe: false }, + ); + } + async clickCreateCase() { await super.clickLink(links.createCase.title); } diff --git a/playwright-e2e/pages/exui/exui-event/exui-event-content.ts b/playwright-e2e/pages/exui/exui-page/exui-content.ts similarity index 100% rename from playwright-e2e/pages/exui/exui-event/exui-event-content.ts rename to playwright-e2e/pages/exui/exui-page/exui-content.ts diff --git a/playwright-e2e/pages/exui/exui-event/exui-event.ts b/playwright-e2e/pages/exui/exui-page/exui-page.ts similarity index 89% rename from playwright-e2e/pages/exui/exui-event/exui-event.ts rename to playwright-e2e/pages/exui/exui-page/exui-page.ts index 81de90b70f..f94856bc0a 100644 --- a/playwright-e2e/pages/exui/exui-event/exui-event.ts +++ b/playwright-e2e/pages/exui/exui-page/exui-page.ts @@ -4,15 +4,15 @@ import ccdEvents from '../../../fixtures/ccd-events/events'; import CaseDataHelper from '../../../helpers/case-data-helper'; import CCDCaseData from '../../../models/ccd/ccd-case-data'; import { CCDEvent } from '../../../models/ccd/ccd-events'; -import { buttons, components } from './exui-event-content'; +import { buttons, components } from './exui-content'; let ccdEventState: CCDEvent; -export default function ExuiEvent BasePage>( +export default function ExuiPage BasePage>( Base: TBase, ) { @AllMethodsStep({ methodNamesToIgnore: ['setCCDEvent', 'clearCCDEvent'] }) - abstract class ExuiEvent extends Base { + abstract class ExuiPage extends Base { protected async verifyHeadings(ccdCaseData?: CCDCaseData) { let expects: Promise[] | Promise; @@ -64,6 +64,7 @@ export default function ExuiEvent }); await super.expectNoSelector(components.error.selector, { timeout: 500, + all: true, }); if (expect) await expect(); }, @@ -73,14 +74,14 @@ export default function ExuiEvent abstract submit(...args: any[]): Promise; - protected set setCCDEvent(ccdEvent: CCDEvent) { + set setCCDEvent(ccdEvent: CCDEvent) { ccdEventState = ccdEvent; } - protected clearCCDEvent() { + clearCCDEvent() { ccdEventState = undefined; } } - return ExuiEvent; + return ExuiPage; } diff --git a/playwright-e2e/pages/exui/fragments/certificate-of-service-submit/certificate-of-service-submit-fragment.ts b/playwright-e2e/pages/exui/fragments/certificate-of-service-submit/certificate-of-service-submit-fragment.ts index 716bd7e486..71c855fddf 100644 --- a/playwright-e2e/pages/exui/fragments/certificate-of-service-submit/certificate-of-service-submit-fragment.ts +++ b/playwright-e2e/pages/exui/fragments/certificate-of-service-submit/certificate-of-service-submit-fragment.ts @@ -1,7 +1,7 @@ import BasePage from '../../../../base/base-page'; import { AllMethodsStep } from '../../../../decorators/test-steps'; import DateHelper from '../../../../helpers/date-helper'; -import ExuiEvent from '../../exui-event/exui-event'; +import ExuiPage from '../../exui-page/exui-page'; import { defendant1Heading, defendant2Heading, @@ -10,7 +10,7 @@ import { } from './certificate-of-service-submit-content'; @AllMethodsStep() -export default class CertificateOfServiceSubmitFragment extends ExuiEvent(BasePage) { +export default class CertificateOfServiceSubmitFragment extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications( [ diff --git a/playwright-e2e/pages/exui/fragments/certificate-of-service/certificate-of-service-fragment.ts b/playwright-e2e/pages/exui/fragments/certificate-of-service/certificate-of-service-fragment.ts index 9c9560b751..60a0f33ff9 100644 --- a/playwright-e2e/pages/exui/fragments/certificate-of-service/certificate-of-service-fragment.ts +++ b/playwright-e2e/pages/exui/fragments/certificate-of-service/certificate-of-service-fragment.ts @@ -2,7 +2,7 @@ import BasePage from '../../../../base/base-page'; import filePaths from '../../../../config/file-paths'; import { AllMethodsStep } from '../../../../decorators/test-steps'; import DateHelper from '../../../../helpers/date-helper'; -import ExuiEvent from '../../exui-event/exui-event'; +import ExuiPage from '../../exui-page/exui-page'; import { defendant1Buttons, defendant1Checkboxes, @@ -19,7 +19,7 @@ import { } from './certificate-of-service-content'; @AllMethodsStep() -export default class CertificateOfServiceFragment extends ExuiEvent(BasePage) { +export default class CertificateOfServiceFragment extends ExuiPage(BasePage) { async verifyContent() { throw new Error('Method not implemented.'); } diff --git a/playwright-e2e/pages/exui/solicitor-events/create-claim/common/case-filter/case-filter-page.ts b/playwright-e2e/pages/exui/solicitor-events/create-claim/common/case-filter/case-filter-page.ts index 56640953ad..ca4dfc7eca 100644 --- a/playwright-e2e/pages/exui/solicitor-events/create-claim/common/case-filter/case-filter-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/create-claim/common/case-filter/case-filter-page.ts @@ -1,11 +1,11 @@ import BasePage from '../../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../../decorators/test-steps'; import ccdEvents from '../../../../../../fixtures/ccd-events/events'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { dropdowns } from './case-filter-content'; @AllMethodsStep() -export default class CaseFilterPage extends ExuiEvent(BasePage) { +export default class CaseFilterPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ super.expectLabel(dropdowns.jurisdiction.label), diff --git a/playwright-e2e/pages/exui/solicitor-events/create-claim/lr-spec/check-list-spec/checklist-spec-page.ts b/playwright-e2e/pages/exui/solicitor-events/create-claim/lr-spec/check-list-spec/checklist-spec-page.ts index 9271b59bc3..bfff1242c1 100644 --- a/playwright-e2e/pages/exui/solicitor-events/create-claim/lr-spec/check-list-spec/checklist-spec-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/create-claim/lr-spec/check-list-spec/checklist-spec-page.ts @@ -1,10 +1,10 @@ import BasePage from '../../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../../decorators/test-steps'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { paragraphs, subheadings } from './checklist-spec-content'; @AllMethodsStep() -export default class ChecklistSpecPage extends ExuiEvent(BasePage) { +export default class ChecklistSpecPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ super.verifyHeadings(), diff --git a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/extension-date-spec/extension-date-spec-page.ts b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/extension-date-spec/extension-date-spec-page.ts index ac2e94e988..3a17611866 100644 --- a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/extension-date-spec/extension-date-spec-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/extension-date-spec/extension-date-spec-page.ts @@ -2,11 +2,11 @@ import BasePage from '../../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../../decorators/test-steps'; import DateHelper from '../../../../../../helpers/date-helper'; import CCDCaseData from '../../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { inputs } from './extension-date-spec-content'; @AllMethodsStep() -export default class ExtensionDateSpecPage extends ExuiEvent(BasePage) { +export default class ExtensionDateSpecPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ super.expectLabel(inputs.day.label), diff --git a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/inform-agreed-extension-date-confirm-spec/inform-agreed-extension-date-confirm-spec-page.ts b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/inform-agreed-extension-date-confirm-spec/inform-agreed-extension-date-confirm-spec-page.ts index ac8eeba4e0..fea8b0735c 100644 --- a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/inform-agreed-extension-date-confirm-spec/inform-agreed-extension-date-confirm-spec-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/lr-spec/inform-agreed-extension-date-confirm-spec/inform-agreed-extension-date-confirm-spec-page.ts @@ -1,13 +1,13 @@ import BasePage from '../../../../../../base/base-page'; import DateHelper from '../../../../../../helpers/date-helper'; import CCDCaseData from '../../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { confirmationHeading, subheadings, } from './inform-agreed-extension-date-confirm-spec-content'; -export default class InformAgreedExtensionDateConfirmSpecPage extends ExuiEvent(BasePage) { +export default class InformAgreedExtensionDateConfirmSpecPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { const date = DateHelper.addToDate(ccdCaseData.respondent1ResponseDeadline, { days: 28, diff --git a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/extension-date/extension-date-page.ts b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/extension-date/extension-date-page.ts index 49b32b9614..3509f14ce4 100644 --- a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/extension-date/extension-date-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/extension-date/extension-date-page.ts @@ -2,11 +2,11 @@ import BasePage from '../../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../../decorators/test-steps'; import DateHelper from '../../../../../../helpers/date-helper'; import CCDCaseData from '../../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { paragraphs } from './extension-date-content'; @AllMethodsStep() -export default class ExtensionDatePage extends ExuiEvent(BasePage) { +export default class ExtensionDatePage extends ExuiPage(BasePage) { async verifyContent() { throw new Error('Method not implemented.'); } diff --git a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/inform-agreed-extension-date-confirm/inform-agreed-extension-date-confirm-page.ts b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/inform-agreed-extension-date-confirm/inform-agreed-extension-date-confirm-page.ts index c88ac061a1..d09bd63cef 100644 --- a/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/inform-agreed-extension-date-confirm/inform-agreed-extension-date-confirm-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/inform-agreed-extension-date/unspec/inform-agreed-extension-date-confirm/inform-agreed-extension-date-confirm-page.ts @@ -2,11 +2,11 @@ import BasePage from '../../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../../decorators/test-steps'; import DateHelper from '../../../../../../helpers/date-helper'; import CCDCaseData from '../../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../../exui-event/exui-event'; +import ExuiPage from '../../../../exui-page/exui-page'; import { confirmationHeading } from './inform-agreed-extension-date-confirm-content'; @AllMethodsStep() -export default class InformAgreedExtensionDateConfirmPage extends ExuiEvent(BasePage) { +export default class InformAgreedExtensionDateConfirmPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { const date = DateHelper.addToDate(ccdCaseData.respondent1ResponseDeadline, { days: 28, diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-confirm/notify-claim-details-confirm-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-confirm/notify-claim-details-confirm-page.ts index 750f114305..a2795cbc7a 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-confirm/notify-claim-details-confirm-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-confirm/notify-claim-details-confirm-page.ts @@ -1,19 +1,18 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import DateHelper from '../../../../../helpers/date-helper'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { confirmationHeading, paragraphs } from './notify-claim-details-confirm-content'; @AllMethodsStep() -export default class NotifyClaimDetailsConfirmPage extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsConfirmPage extends ExuiPage(BasePage) { async verifyContent() { const responseDeadline = DateHelper.addToToday({ days: 14 }); await super.runVerifications([ - super.verifyHeadings(), super.expectHeading(confirmationHeading), super.expectText(paragraphs.descriptionText1), super.expectText( - DateHelper.formatDateToString(responseDeadline, { outputFormat: 'DD-Month-YYYY' }), + DateHelper.formatDateToString(responseDeadline, { outputFormat: 'DD Month YYYY' }), ), ]); } diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-confirm/notify-claim-details-cos-confirm-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-confirm/notify-claim-details-cos-confirm-page.ts index d34ccc175f..6e5e781438 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-confirm/notify-claim-details-cos-confirm-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-confirm/notify-claim-details-cos-confirm-page.ts @@ -1,13 +1,12 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { confirmationHeading, paragraphs } from './notify-claim-details-cos-confirm-content'; @AllMethodsStep() -export default class NotifyClaimDetailsCOSConfirmPage extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsCOSConfirmPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ - super.verifyHeadings(), super.expectHeading(confirmationHeading), super.expectText(paragraphs.descriptionText1), super.expectText(paragraphs.descriptionText2), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-1/notify-claim-details-cos-defendant-1-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-1/notify-claim-details-cos-defendant-1-page.ts index 18fc491c28..9e97cc41f9 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-1/notify-claim-details-cos-defendant-1-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-1/notify-claim-details-cos-defendant-1-page.ts @@ -2,10 +2,10 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceFragment from '../../../fragments/certificate-of-service/certificate-of-service-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; @AllMethodsStep() -export default class NotifyClaimDetailsCOSDefendant1Page extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsCOSDefendant1Page extends ExuiPage(BasePage) { private certificateOfServiceFragment: CertificateOfServiceFragment; constructor(certificateOfServiceFragment: CertificateOfServiceFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-2/notify-claim-details-cos-defendant-2-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-2/notify-claim-details-cos-defendant-2-page.ts index 6a8f867afb..849f5f97c4 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-2/notify-claim-details-cos-defendant-2-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-defendant-2/notify-claim-details-cos-defendant-2-page.ts @@ -2,11 +2,11 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceFragment from '../../../fragments/certificate-of-service/certificate-of-service-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; @AllMethodsStep() -export default class NotifyClaimDetailsCOSDefendant2Page extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsCOSDefendant2Page extends ExuiPage(BasePage) { private certificateOfServiceFragment: CertificateOfServiceFragment; constructor(certificateOfServiceFragment: CertificateOfServiceFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-submit/notify-claim-details-cos-submit-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-submit/notify-claim-details-cos-submit-page.ts index 2fdca24f0c..7dde9b9484 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-submit/notify-claim-details-cos-submit-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-cos-submit/notify-claim-details-cos-submit-page.ts @@ -2,11 +2,11 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceSubmitFragment from '../../../fragments/certificate-of-service-submit/certificate-of-service-submit-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; @AllMethodsStep() -export default class NotifyClaimDetailsCOSSubmitPage extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsCOSSubmitPage extends ExuiPage(BasePage) { private certificateOfServiceSubmitFragment: CertificateOfServiceSubmitFragment; constructor(certificateOfServiceSubmitFragment: CertificateOfServiceSubmitFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-submit/notify-claim-details-submit-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-submit/notify-claim-details-submit-page.ts index 4ac6ed86bb..54270c4b9d 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-submit/notify-claim-details-submit-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/notify-claim-details-submit/notify-claim-details-submit-page.ts @@ -1,11 +1,11 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { subheading, table } from './notify-claim-details-submit-content'; @AllMethodsStep() -export default class NotifyClaimDetailsSubmitPage extends ExuiEvent(BasePage) { +export default class NotifyClaimDetailsSubmitPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications([ super.verifyHeadings(ccdCaseData), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/select-defendant-solicitor/select-defendant-solicitor-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/select-defendant-solicitor/select-defendant-solicitor-page.ts index f31b874512..47ac7cfc51 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/select-defendant-solicitor/select-defendant-solicitor-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/select-defendant-solicitor/select-defendant-solicitor-page.ts @@ -1,11 +1,11 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { dropdowns } from './select-defendant-solicitor-content'; @AllMethodsStep() -export default class SelectDefendantSolicitorPage extends ExuiEvent(BasePage) { +export default class SelectDefendantSolicitorPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications([ super.verifyHeadings(ccdCaseData), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/upload-documents/upload-documents-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/upload-documents/upload-documents-page.ts index d8e4d3ad28..a0df72b7ff 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/upload-documents/upload-documents-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim-details/upload-documents/upload-documents-page.ts @@ -2,11 +2,11 @@ import BasePage from '../../../../../base/base-page'; import filePaths from '../../../../../config/file-paths'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { buttons, inputs, subheadings } from './upload-documents-content'; @AllMethodsStep() -export default class UploadDocumentsPage extends ExuiEvent(BasePage) { +export default class UploadDocumentsPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications([ super.verifyHeadings(ccdCaseData), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/access-granted-warning/access-granted-warning-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/access-granted-warning/access-granted-warning-page.ts index 577f5b251e..be1985dcf0 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/access-granted-warning/access-granted-warning-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/access-granted-warning/access-granted-warning-page.ts @@ -1,11 +1,11 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { paragraphs } from './access-granted-warning-content'; @AllMethodsStep() -export default class AccessGrantedWarningPage extends ExuiEvent(BasePage) { +export default class AccessGrantedWarningPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications([ super.verifyHeadings(ccdCaseData), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/defendant-solicitor-to-notify/defendant-solicitor-to-notify-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/defendant-solicitor-to-notify/defendant-solicitor-to-notify-page.ts index 299c925c66..2d82f36a1a 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/defendant-solicitor-to-notify/defendant-solicitor-to-notify-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/defendant-solicitor-to-notify/defendant-solicitor-to-notify-page.ts @@ -1,11 +1,11 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { dropdowns } from './defendant-solicitor-to-notify-content'; @AllMethodsStep() -export default class DefendantSolicitorToNotifyPage extends ExuiEvent(BasePage) { +export default class DefendantSolicitorToNotifyPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications([ super.verifyHeadings(ccdCaseData), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-confirm/notify-claim-confirm-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-confirm/notify-claim-confirm-page.ts index fc5fc05ad0..897f3ade0b 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-confirm/notify-claim-confirm-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-confirm/notify-claim-confirm-page.ts @@ -1,13 +1,12 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { confirmationHeading, paragraphs } from './notify-claim-confirm-content'; @AllMethodsStep() -export default class NotifyClaimConfirmPage extends ExuiEvent(BasePage) { +export default class NotifyClaimConfirmPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ - super.verifyHeadings(), super.expectHeading(confirmationHeading), super.expectText(paragraphs.descriptionText1), super.expectText(paragraphs.descriptionText2), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-confirm/notify-claim-cos-confirm-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-confirm/notify-claim-cos-confirm-page.ts index 849db5622c..ba85d6b08a 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-confirm/notify-claim-cos-confirm-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-confirm/notify-claim-cos-confirm-page.ts @@ -1,10 +1,10 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import { confirmationHeading, paragraphs } from './notify-claim-cos-confirm-content'; @AllMethodsStep() -export default class NotifyClaimCOSConfirmPage extends ExuiEvent(BasePage) { +export default class NotifyClaimCOSConfirmPage extends ExuiPage(BasePage) { async verifyContent() { await super.runVerifications([ super.verifyHeadings(), diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-1/notify-claim-cos-defendant-1-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-1/notify-claim-cos-defendant-1-page.ts index 1728a8643c..ac30d1a84c 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-1/notify-claim-cos-defendant-1-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-1/notify-claim-cos-defendant-1-page.ts @@ -2,11 +2,11 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceFragment from '../../../fragments/certificate-of-service/certificate-of-service-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; @AllMethodsStep() -export default class NotifyClaimCOSDefendant1Page extends ExuiEvent(BasePage) { +export default class NotifyClaimCOSDefendant1Page extends ExuiPage(BasePage) { private certificateOfServiceFragment: CertificateOfServiceFragment; constructor(certificateOfServiceFragment: CertificateOfServiceFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-2/notify-claim-cos-defendant-2-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-2/notify-claim-cos-defendant-2-page.ts index 4d7408021c..482b653875 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-2/notify-claim-cos-defendant-2-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-defendant-2/notify-claim-cos-defendant-2-page.ts @@ -2,11 +2,11 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceFragment from '../../../fragments/certificate-of-service/certificate-of-service-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; @AllMethodsStep() -export default class NotifyClaimCOSDefendant2Page extends ExuiEvent(BasePage) { +export default class NotifyClaimCOSDefendant2Page extends ExuiPage(BasePage) { private certificateOfServiceFragment: CertificateOfServiceFragment; constructor(certificateOfServiceFragment: CertificateOfServiceFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-submit/notify-claim-cos-submit-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-submit/notify-claim-cos-submit-page.ts index 8c13824a2f..180433402a 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-submit/notify-claim-cos-submit-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-cos-submit/notify-claim-cos-submit-page.ts @@ -2,11 +2,11 @@ import { Page } from 'playwright-core'; import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CertificateOfServiceSubmitFragment from '../../../fragments/certificate-of-service-submit/certificate-of-service-submit-fragment'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; @AllMethodsStep() -export default class NotifyClaimCOSSubmitPage extends ExuiEvent(BasePage) { +export default class NotifyClaimCOSSubmitPage extends ExuiPage(BasePage) { private certificateOfServiceSubmitFragment: CertificateOfServiceSubmitFragment; constructor(certificateOfServiceSubmitFragment: CertificateOfServiceSubmitFragment, page: Page) { diff --git a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-submit/notify-claim-submit-page.ts b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-submit/notify-claim-submit-page.ts index 69a0a3e4ed..621546e5e4 100644 --- a/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-submit/notify-claim-submit-page.ts +++ b/playwright-e2e/pages/exui/solicitor-events/notify-claim/notify-claim-submit/notify-claim-submit-page.ts @@ -1,10 +1,10 @@ import BasePage from '../../../../../base/base-page'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import CCDCaseData from '../../../../../models/ccd/ccd-case-data'; -import ExuiEvent from '../../../exui-event/exui-event'; +import ExuiPage from '../../../exui-page/exui-page'; @AllMethodsStep() -export default class NotifyClaimSubmitPage extends ExuiEvent(BasePage) { +export default class NotifyClaimSubmitPage extends ExuiPage(BasePage) { async verifyContent(ccdCaseData: CCDCaseData) { await super.runVerifications(super.verifyHeadings(ccdCaseData)); } diff --git a/playwright-e2e/pages/idam/login/login-page.ts b/playwright-e2e/pages/idam/login/login-page.ts index b1f58913e8..25f9d4b9dc 100644 --- a/playwright-e2e/pages/idam/login/login-page.ts +++ b/playwright-e2e/pages/idam/login/login-page.ts @@ -14,8 +14,8 @@ export default class LoginPage extends BasePage { ]); } - private async login({ email, password }) { - console.log(`Authenticating user with email ${email} by Idam`); + private async login({ name, email, password }: User) { + console.log(`Authenticating user: ${name} by Idam`); await super.inputText(email, inputs.email.selector); await super.inputSensitiveText(password, inputs.password.selector); await super.clickBySelector(buttons.submit.selector); diff --git a/playwright-e2e/pages/utils/page-cookies-manager.ts b/playwright-e2e/pages/utils/page-cookies-manager.ts index ca8ab05bcf..b0212dc495 100644 --- a/playwright-e2e/pages/utils/page-cookies-manager.ts +++ b/playwright-e2e/pages/utils/page-cookies-manager.ts @@ -18,7 +18,7 @@ export default class PageCookiesManager extends BasePage { async cookiesLogin(user: User, cookies: Cookie[]) { console.log( - `Authenticating ${user.key} with email ${user.email} by setting cookies stored in path: ${user.cookiesPath}`, + `Authenticating ${user.name} with email ${user.email} by setting cookies stored in path: ${user.cookiesPath}`, ); await super.addCookies(cookies); } @@ -27,9 +27,9 @@ export default class PageCookiesManager extends BasePage { await super.addCookies(acceptIdamCookies); } - async addExuiCookies({ userId, email }: User) { + async addExuiCookies({ userId, name }: User) { if (!userId) { - throw new PageError(`UserId for user: ${email} is invalid`); + throw new PageError(`UserId for user: ${name} is invalid`); } await super.addCookies(generateAcceptExuiCookies(userId)); } diff --git a/playwright-e2e/playwright-fixtures/api/api-steps-fixtures.ts b/playwright-e2e/playwright-fixtures/api/api-steps-fixtures.ts index 29395243b0..65b51dd926 100644 --- a/playwright-e2e/playwright-fixtures/api/api-steps-fixtures.ts +++ b/playwright-e2e/playwright-fixtures/api/api-steps-fixtures.ts @@ -1,17 +1,40 @@ -import ApiDataSteps from '../../steps/api/api-data-setup'; +import { test as requestFactories } from './requests-factory-fixtures'; +import { test as dataBuilders } from './data-builder-fixtures'; +import { test as testUtils } from '../utils/test-utils-fixtures'; +import { mergeTests } from '@playwright/test'; +import ApiDataSteps from '../../steps/api/api-data-steps'; import ApiUserSteps from '../../steps/api/api-user-steps'; -import { test as base } from './requests-factory-fixtures'; +import ApiCaseRoleAssignmentSteps from '../../steps/api/api-case-role-assignment-steps'; +import ApiCreateClaimSteps from '../../steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-steps'; +import ApiCreateClaimSpecSteps from '../../steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-spec-steps'; +import ApiServiceRequestSteps from '../../steps/api/api-service-request-steps'; type ApiStepsFixtures = { ApiUserSteps: ApiUserSteps; ApiDataSteps: ApiDataSteps; + ApiCreateClaimSteps: ApiCreateClaimSteps; + ApiCreateClaimSpecSteps: ApiCreateClaimSpecSteps; + ApiServiceRequestsSteps: ApiServiceRequestSteps; + ApiCaseRoleAssignmentSteps: ApiCaseRoleAssignmentSteps; }; -export const test = base.extend({ +export const test = mergeTests(testUtils, requestFactories, dataBuilders).extend({ ApiUserSteps: async ({ _testData, _requestsFactory }, use) => { await use(new ApiUserSteps(_requestsFactory, _testData)); }, ApiDataSteps: async ({ _testData, _requestsFactory }, use) => { await use(new ApiDataSteps(_requestsFactory, _testData)); + }, + ApiCreateClaimSteps: async ({ _createClaimDataBuilder, _testData, _requestsFactory }, use) => { + await use(new ApiCreateClaimSteps(_createClaimDataBuilder, _requestsFactory, _testData)); + }, + ApiCreateClaimSpecSteps: async ({ _createClaimSpecDataBuilder, _testData, _requestsFactory }, use) => { + await use(new ApiCreateClaimSpecSteps(_createClaimSpecDataBuilder, _requestsFactory, _testData)); + }, + ApiServiceRequestsSteps: async ({ _serviceRequestDataBuilder, _testData, _requestsFactory }, use) => { + await use(new ApiServiceRequestSteps(_serviceRequestDataBuilder, _requestsFactory, _testData)); + }, + ApiCaseRoleAssignmentSteps: async ({ _testData, _requestsFactory }, use) => { + await use(new ApiCaseRoleAssignmentSteps(_requestsFactory, _testData)); } }); diff --git a/playwright-e2e/playwright-fixtures/api/data-builder-fixtures.ts b/playwright-e2e/playwright-fixtures/api/data-builder-fixtures.ts new file mode 100644 index 0000000000..1bdc7c4d43 --- /dev/null +++ b/playwright-e2e/playwright-fixtures/api/data-builder-fixtures.ts @@ -0,0 +1,22 @@ +import { test as base } from '@playwright/test'; +import CreateClaimDataBuilder from '../../data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder'; +import CreateClaimSpecDataBuilder from '../../data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder'; +import ServiceRequestDataBuilder from '../../data-builders/service-request/service-request-data-builder'; + +type DataBuilderFixtures = { + _createClaimDataBuilder: CreateClaimDataBuilder; + _createClaimSpecDataBuilder: CreateClaimSpecDataBuilder; + _serviceRequestDataBuilder: ServiceRequestDataBuilder; +}; + +export const test = base.extend({ + _createClaimDataBuilder: async ({}, use) => { + await use(new CreateClaimDataBuilder()); + }, + _createClaimSpecDataBuilder: async ({}, use) => { + await use(new CreateClaimSpecDataBuilder()); + }, + _serviceRequestDataBuilder: async ({}, use) => { + await use(new ServiceRequestDataBuilder()); + } +}); diff --git a/playwright-e2e/playwright-fixtures/api/requests-factory-fixtures.ts b/playwright-e2e/playwright-fixtures/api/requests-factory-fixtures.ts index 03ff938aac..b39e82bf66 100644 --- a/playwright-e2e/playwright-fixtures/api/requests-factory-fixtures.ts +++ b/playwright-e2e/playwright-fixtures/api/requests-factory-fixtures.ts @@ -1,5 +1,5 @@ import RequestsFactory from '../../requests/requests-factory'; -import { test as base } from '../utils/test-utils-fixtures'; +import { test as base } from '@playwright/test'; type RequestsFactoryFixtures = { _requestsFactory: RequestsFactory; @@ -8,5 +8,5 @@ type RequestsFactoryFixtures = { export const test = base.extend({ _requestsFactory: async ({ request }, use) => { await use(new RequestsFactory(request)); - }, + } }); diff --git a/playwright-e2e/playwright-fixtures/ui/page-expect-fixtures.ts b/playwright-e2e/playwright-fixtures/ui/page-expect-fixtures.ts index 97423bd200..2ae0f8ea51 100644 --- a/playwright-e2e/playwright-fixtures/ui/page-expect-fixtures.ts +++ b/playwright-e2e/playwright-fixtures/ui/page-expect-fixtures.ts @@ -221,6 +221,45 @@ export const expect = baseExpect `Expected: ${this.isNot ? 'not' : ''}${count !== null ? count : 'multiple' + ' '}matching locator(s) to be visible\n` + (matcherResult ? `Received: ${locatorCount === undefined ? 'locator count ' + this.utils.printReceived(0) : this.utils.printReceived(matcherResult.actual)}` : ''); + return { + message, + pass, + name: assertionName, + actual: matcherResult?.actual + }; + }, + async allToBeHidden(locator: Locator, options?: { timeout?: number }) { + const assertionName = 'allToBeHidden'; + let pass: boolean; + let matcherResult: any; + let locatorCount: number; + let failureCount = 0; + + try { + locatorCount = await locator.count(); + const promises = []; + for (let i = 0; i < locatorCount; i++) { + promises.push(baseExpect(locator.nth(i)).toBeHidden({ timeout: options.timeout })); + } + const results = await Promise.allSettled(promises); + results.forEach((result) => { + if (result.status === 'rejected') failureCount++; + }); + if (failureCount) { + const firstResult = results.find((result) => (result.status = 'rejected')) as any; + throw firstResult.reason; + } + pass = true; + } catch (error) { + pass = false; + matcherResult = error.matcherResult; + } + const message = pass + ? () => + this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) + '\n\n' + `Locator: ${locator}\n` + `Expected: ${this.isNot ? 'not ' : ''}all locator(s) to be hidden\n` + (matcherResult ? `Received: ${locatorCount} locator(s) and ${failureCount} were visible` : '') + : () => + this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) + '\n\n' + `Locator: ${locator}\n` + `Expected: ${this.isNot ? 'not ' : ''}all locator(s) to be hidden\n` + (matcherResult ? `Received: ${locatorCount} locator(s) and ${failureCount} were visible` : ''); + return { message, pass, diff --git a/playwright-e2e/playwright-fixtures/ui/page-factory-fixtures.ts b/playwright-e2e/playwright-fixtures/ui/page-factory-fixtures.ts index ba9f2daf1d..d4e6e7300b 100644 --- a/playwright-e2e/playwright-fixtures/ui/page-factory-fixtures.ts +++ b/playwright-e2e/playwright-fixtures/ui/page-factory-fixtures.ts @@ -1,4 +1,4 @@ -import { test as base } from '../api/api-steps-fixtures'; +import { test as base } from '@playwright/test'; import PageUtilsFactory from '../../pages/utils/page-utils-factory'; import IdamPageFactory from '../../pages/idam/idam-page-factory'; import ExuiDashboardPageFactory from '../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; @@ -8,6 +8,7 @@ import NotifyClaimDetailsPageFactory from '../../pages/exui/solicitor-events/not import DefendantResponsePageFactory from '../../pages/exui/solicitor-events/defendant-response/defendant-response-page-factory'; import ClaimantResponsePageFactory from '../../pages/exui/solicitor-events/claimant-response/claimant-response-page-factory'; import InformAgreedExtensionDatePageFactory from '../../pages/exui/solicitor-events/inform-agreed-extension-date/inform-agreed-extension-date-page-factory'; +import CreateCaseFlagsPageFactory from '../../pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory'; type PageFactoryFixtures = { _pageUtilsFactory: PageUtilsFactory; @@ -19,6 +20,7 @@ type PageFactoryFixtures = { _informAgreedExtensionDateFactory: InformAgreedExtensionDatePageFactory; _defendantResponsePageFactory: DefendantResponsePageFactory; _claimantResponsePageFactory: ClaimantResponsePageFactory; + _createCaseFlagsPageFactory: CreateCaseFlagsPageFactory; }; export const test = base.extend({ @@ -48,5 +50,8 @@ export const test = base.extend({ }, _claimantResponsePageFactory: async ({ page }, use) => { await use(new ClaimantResponsePageFactory(page)); + }, + _createCaseFlagsPageFactory: async ({ page }, use) => { + await use(new CreateCaseFlagsPageFactory(page)); } }); diff --git a/playwright-e2e/playwright-fixtures/ui/ui-steps-fixtures.ts b/playwright-e2e/playwright-fixtures/ui/ui-steps-fixtures.ts index 6456335fc2..37ecac235e 100644 --- a/playwright-e2e/playwright-fixtures/ui/ui-steps-fixtures.ts +++ b/playwright-e2e/playwright-fixtures/ui/ui-steps-fixtures.ts @@ -1,3 +1,7 @@ +import { test as pageFactories } from './page-factory-fixtures'; +import { test as requestFactories } from '../api/requests-factory-fixtures'; +import { test as testUtils } from '../utils/test-utils-fixtures'; +import { mergeTests } from '@playwright/test'; import ExuiDashboardSteps from '../../steps/ui/exui/exui-dashboard-steps'; import ClaimantResponseSpecSteps from '../../steps/ui/exui/solicitor-events/claimant-response/claimant-response-spec-steps'; import ClaimantResponseSteps from '../../steps/ui/exui/solicitor-events/claimant-response/claimant-response-steps'; @@ -8,7 +12,6 @@ import DefendantResponseSteps from '../../steps/ui/exui/solicitor-events/defenda import NotifyClaimDetailsSteps from '../../steps/ui/exui/solicitor-events/notify-claim-details-steps'; import NotifyClaimSteps from '../../steps/ui/exui/solicitor-events/notify-claim-steps'; import IdamSteps from '../../steps/ui/idam/idam-steps'; -import { test as base } from './page-factory-fixtures'; type UiStepsFixtures = { IdamSteps: IdamSteps; @@ -23,35 +26,35 @@ type UiStepsFixtures = { ClaimantResponseSteps: ClaimantResponseSteps; }; -export const test = base.extend({ +export const test = mergeTests(testUtils, pageFactories, requestFactories).extend({ IdamSteps: async ({ _pageUtilsFactory, _idamPageFactory, _requestsFactory, _testData, _isSetupTest, _isTeardownTest, _verifyCookiesBanner }, use) => { await use(new IdamSteps(_pageUtilsFactory, _idamPageFactory, _requestsFactory, _isSetupTest, _isTeardownTest, _verifyCookiesBanner, _testData)); }, ExuiDashboardSteps: async ({ _pageUtilsFactory, _exuiDashboardPageFactory, _testData }, use) => { await use(new ExuiDashboardSteps(_pageUtilsFactory, _exuiDashboardPageFactory, _testData)); }, - CreateClaimSpecSteps: async ({ _createClaimPageFactory, _testData }, use) => { - await use(new CreateClaimSpecSteps(_createClaimPageFactory, _testData)); + CreateClaimSpecSteps: async ({ _createClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new CreateClaimSpecSteps(_createClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - CreateClaimSteps: async ({ _createClaimPageFactory, _testData }, use) => { - await use(new CreateClaimSteps(_createClaimPageFactory, _testData)); + CreateClaimSteps: async ({ _createClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new CreateClaimSteps(_createClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - NotifyClaimSteps: async ({ _notifyClaimPageFactory, _testData }, use) => { - await use(new NotifyClaimSteps(_notifyClaimPageFactory, _testData)); + NotifyClaimSteps: async ({ _notifyClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new NotifyClaimSteps(_notifyClaimPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - NotifyClaimDetailsSteps: async ({ _notifyClaimDetailsPageFactory, _testData }, use) => { - await use(new NotifyClaimDetailsSteps(_notifyClaimDetailsPageFactory, _testData)); + NotifyClaimDetailsSteps: async ({ _notifyClaimDetailsPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new NotifyClaimDetailsSteps(_notifyClaimDetailsPageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - DefendantResponseSpecSteps: async ({ _defendantResponsePageFactory, _testData }, use) => { - await use(new DefendantResponseSpecSteps(_defendantResponsePageFactory, _testData)); + DefendantResponseSpecSteps: async ({ _defendantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new DefendantResponseSpecSteps(_defendantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - DefendantResponseSteps: async ({ _defendantResponsePageFactory, _testData }, use) => { - await use(new DefendantResponseSteps(_defendantResponsePageFactory, _testData)); + DefendantResponseSteps: async ({ _defendantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new DefendantResponseSteps(_defendantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - ClaimantResponseSpecSteps: async ({ _claimantResponsePageFactory, _testData }, use) => { - await use(new ClaimantResponseSpecSteps(_claimantResponsePageFactory, _testData)); + ClaimantResponseSpecSteps: async ({ _claimantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new ClaimantResponseSpecSteps(_claimantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); }, - ClaimantResponseSteps: async ({ _claimantResponsePageFactory, _testData }, use) => { - await use(new ClaimantResponseSteps(_claimantResponsePageFactory, _testData)); + ClaimantResponseSteps: async ({ _claimantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData }, use) => { + await use(new ClaimantResponseSteps(_claimantResponsePageFactory, _exuiDashboardPageFactory, _requestsFactory, _testData)); } }); diff --git a/playwright-e2e/requests/ccd-requests.ts b/playwright-e2e/requests/ccd-requests.ts index 84632ad184..56ac952c49 100644 --- a/playwright-e2e/requests/ccd-requests.ts +++ b/playwright-e2e/requests/ccd-requests.ts @@ -1,85 +1,113 @@ import BaseRequest from '../base/base-request'; import config from '../config/config'; import urls from '../config/urls'; -import { Step } from '../decorators/test-steps'; -import RequestOptions from '../models/request-options'; -import { TruthyParams } from '../decorators/truthy-params'; +import { AllMethodsStep } from '../decorators/test-steps'; +import RequestOptions from '../models/api/request-options'; import CCDCaseData from '../models/ccd/ccd-case-data'; import User from '../models/user'; import ServiceAuthProviderRequests from './service-auth-provider-requests'; import { CCDEvent } from '../models/ccd/ccd-events'; +import CaseStates from '../enums/case-states'; -const classKey = 'CCDRequests'; +@AllMethodsStep({ methodNamesToIgnore: ['getCCDDataStoreBaseUrl'] }) export default class CCDRequests extends ServiceAuthProviderRequests(BaseRequest) { - private getCcdDataStoreBaseUrl({ userId, role }: User) { + private getCCDDataStoreBaseUrl({ userId, role }: User) { return `${urls.ccdDataStore}/${role}s/${userId}/jurisdictions/${config.definition.jurisdiction}/case-types/${config.definition.caseType}`; } - private async getRequestHeaders({ accessToken }: User) { - const civilS2sToken = await this.fetchCivilS2sToken(); - return { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - ServiceAuthorization: civilS2sToken, + async fetchCCDCaseData(user: User, caseId: number) { + console.log(`Fetching CCD case data, caseId: ${caseId}...`); + const url = `${this.getCCDDataStoreBaseUrl(user)}/cases/${caseId}`; + const requestOptions: RequestOptions = { + headers: await super.getRequestHeaders(user), }; + const responseJson = await super.retryRequestJson(url, requestOptions); + console.log(`CCD case data fetched successfully, caseId: ${caseId}`); + return { id: responseJson.id, ...responseJson.case_data }; } - @Step(classKey) - @TruthyParams(classKey, 'caseId') - async fetchCCDCaseData(caseId: number, user: User) { - console.log(`Fetching CCD case data with id: ${caseId}...`); - const url = `${this.getCcdDataStoreBaseUrl(user)}/cases/${caseId}`; + async validatePageData( + ccdEvent: CCDEvent, + user: User, + pageId: string, + pageData: object, + eventData: object, + ccdEventToken: string, + ): Promise { + console.log(`Asserting page: ${pageId} has valid data...`); + const url = `${this.getCCDDataStoreBaseUrl(user)}/validate?pageId=${ccdEvent.id}${pageId}`; const requestOptions: RequestOptions = { headers: await this.getRequestHeaders(user), + body: { + data: pageData, + event: { id: ccdEvent.id }, + event_data: eventData, + event_token: ccdEventToken, + }, + method: 'POST', }; const responseJson = await super.retryRequestJson(url, requestOptions); - console.log(`CCD case data fetched successfully with id: ${caseId}`); - return { id: responseJson.id, ...responseJson.case_data }; + console.log(`Page: ${pageId} has valid data`); + return responseJson.data; } - @Step(classKey) - async startEvent(ccdEvent: CCDEvent, user: User, caseId?: number) { + async startEvent(user: User, ccdEvent: CCDEvent, caseId?: number): Promise { console.log( `Starting event: ${ccdEvent.id}` + (typeof caseId !== 'undefined' ? ` caseId: ${caseId}` : ''), ); - let url = this.getCcdDataStoreBaseUrl(user); + let url = this.getCCDDataStoreBaseUrl(user); if (caseId) { url += `/cases/${caseId}`; } url += `/event-triggers/${ccdEvent.id}/token`; const requestOptions: RequestOptions = { - headers: await this.getRequestHeaders(user), + headers: await super.getRequestHeaders(user), }; - const response = await super.retryRequestJson(url, requestOptions); + const response = await super.retryRequestJson(url, requestOptions, { + verifyResponse: async (responseJson) => { + await super.expectResponseJsonToHaveProperty('token', responseJson); + }, + }); console.log(`Event: ${ccdEvent.id} started successfully`); return response.token; } - @Step(classKey) - async submit(ccdEvent: CCDEvent, caseData: CCDCaseData, user: User, ccdEventToken: string) { + async submitEvent( + user: User, + ccdEvent: CCDEvent, + expectedState: CaseStates, + eventData: any, + ccdEventToken: string, + caseId?: number, + ): Promise { console.log( `Submitting event: ${ccdEvent.id}` + - (typeof caseData.id !== 'undefined' ? ` caseId: ${caseData.id}` : ''), + (typeof caseId !== 'undefined' ? ` caseId: ${caseId}` : ''), ); - let url = `${this.getCcdDataStoreBaseUrl(user)}/cases`; - if (caseData.id) { - url += `/${caseData.id}/events`; + let url = `${this.getCCDDataStoreBaseUrl(user)}/cases`; + if (caseId) { + url += `/${caseId}/events`; } const requestOptions: RequestOptions = { - headers: await this.getRequestHeaders(user), + headers: await super.getRequestHeaders(user), body: { - data: caseData, + data: eventData, event: { id: ccdEvent.id }, - event_data: caseData, event_token: ccdEventToken, }, method: 'POST', }; - const responseJson = await super.retryRequestJson(url, requestOptions, { expectedStatus: 201 }); - console.log(`Event: ${ccdEvent.id} submitted successfully`); - return responseJson; + const responseJson = await super.retryRequestJson(url, requestOptions, { + expectedStatus: 201, + verifyResponse: async (responseJson) => { + await super.expectResponseJsonToHavePropertyValue('state', expectedState, responseJson); + }, + }); + const caseData: CCDCaseData = { id: responseJson.id, ...responseJson.case_data }; + console.log(`Event: ${ccdEvent.id} submitted successfully, caseId: ${caseData.id}`); + return caseData; } } diff --git a/playwright-e2e/requests/civil-service-requests.ts b/playwright-e2e/requests/civil-service-requests.ts new file mode 100644 index 0000000000..a6759996a6 --- /dev/null +++ b/playwright-e2e/requests/civil-service-requests.ts @@ -0,0 +1,103 @@ +import BaseRequest from '../base/base-request'; +import urls from '../config/urls'; +import CaseRoles from '../enums/case-roles'; +import RequestOptions from '../models/api/request-options'; +import { UploadDocumentValue } from '../models/ccd/ccd-case-data'; +import User from '../models/user'; +import ServiceAuthProviderRequests from './service-auth-provider-requests'; + +export default class CivilServiceRequests extends ServiceAuthProviderRequests(BaseRequest) { + private testingSupportUrl = `${urls.civilService}/testing-support`; + + async uploadTestDocument(user: User): Promise { + console.log('Uploading test document...'); + const url = `${this.testingSupportUrl}/upload/test-document`; + const requestOptions: RequestOptions = { + headers: await super.getRequestHeaders(user), + method: 'POST', + }; + + const responseJson = await super.retryRequestJson(url, requestOptions, { + verifyResponse: async (responseJson) => { + await super.expectResponseJsonToHaveProperty('document_url', responseJson); + await super.expectResponseJsonToHaveProperty('document_binary_url', responseJson); + await super.expectResponseJsonToHaveProperty('document_filename', responseJson); + }, + }); + console.log('Test document uploaded sucessfully'); + return { + document_url: responseJson.document_url, + document_binary_url: responseJson.document_binary_url, + document_filename: responseJson.document_filename, + }; + } + + async waitForFinishedBusinessProcess(user: User, caseId: number) { + console.log(`Waiting for business process to finish, caseId: ${caseId}...`); + const url = `${this.testingSupportUrl}/case/${caseId}/business-process`; + const requestOptions: RequestOptions = { + headers: await this.getRequestHeaders(user), + }; + await super.retryRequestJson(url, requestOptions, { + retries: 100, + retryTimeInterval: 5000, + verifyResponse: async (responseJson) => { + await super.expectResponseJsonToHaveProperty('businessProcess', responseJson); + const businessProcess = responseJson.businessProcess; + await super.expectResponseJsonToHavePropertyValue( + 'businessProcess.status', + 'FINISHED', + responseJson, + { + message: + `Ongoing business process: ${businessProcess.camundaEvent}, caseId: ${caseId}, status: ${businessProcess.status},` + + ` process instance: ${businessProcess.processInstanceId}, last finished activity: ${businessProcess.activityId}`, + }, + ); + await super.expectResponseJsonToNotHaveProperty('incidentMessage', responseJson, { + message: `Business process failed for case: ${caseId}, incident message: ${responseJson.incidentMessage}`, + }); + }, + }); + console.log(`Business process successfully finished, caseId: ${caseId}`); + } + + async updatePaymentForClaimIssue(user: User, serviceRequestDTO: any) { + console.log(`Updating payment for claim issue, caseId: ${serviceRequestDTO.id}...`); + const url = `${urls.civilService}/service-request-update-claim-issued`; + const requestOptions: RequestOptions = { + headers: await super.getRequestHeaders(user), + body: serviceRequestDTO, + method: 'PUT', + }; + await super.retryRequest(url, requestOptions); + console.log(`Payment for claim issue successfully updated, caseId: ${serviceRequestDTO.id}`); + } + + async assignCaseToDefendant(user: User, caseId: number, caseRole: CaseRoles) { + console.log(`Assigning role: ${caseRole} to user: ${user.name}, caseId: ${caseId}...`); + const url = `${this.testingSupportUrl}/assign-case/${caseId}/${caseRole}`; + const requestOptions: RequestOptions = { + headers: await this.getRequestHeaders(user), + method: 'POST', + }; + await super.retryRequest(url, requestOptions); + console.log(`Role: ${caseRole} successfully assigned to user: ${user.name}, caseId: ${caseId}`); + } + + async unassignUserFromCases(user: User, caseIds: number[]) { + console.log(`Unassigning cases from user: ${user.name}...`); + const url = `${this.testingSupportUrl}/unassign-user`; + const requestOptions: RequestOptions = { + headers: await this.getRequestHeaders(user), + body: { + caseIds, + }, + method: 'POST', + }; + await super.retryRequest(url, requestOptions); + caseIds.forEach((caseId) => + console.log(`User: ${user.name} unassigned from case [${caseId}] successfully`), + ); + } +} diff --git a/playwright-e2e/requests/idam-requests.ts b/playwright-e2e/requests/idam-requests.ts index 0910a1926c..aa5de894ea 100644 --- a/playwright-e2e/requests/idam-requests.ts +++ b/playwright-e2e/requests/idam-requests.ts @@ -1,13 +1,13 @@ import BaseRequest from '../base/base-request'; import urls from '../config/urls'; import { AllMethodsStep } from '../decorators/test-steps'; -import RequestOptions from '../models/request-options'; +import RequestOptions from '../models/api/request-options'; import User from '../models/user'; @AllMethodsStep() export default class IdamRequests extends BaseRequest { - async getAccessToken({ email, password }: User): Promise { - console.log(`Fetching access token for user: ${email}...`); + async getAccessToken({ name, email, password }: User): Promise { + console.log(`Fetching access token for user: ${name}...`); const url = `${urls.idamApi}/loginUser`; const requestOptions: RequestOptions = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, @@ -15,12 +15,12 @@ export default class IdamRequests extends BaseRequest { method: 'POST', }; const responseJson = await super.retryRequestJson(url, requestOptions); - console.log(`Access token for user: ${email} fetched successfully`); + console.log(`Access token for user: ${name} fetched successfully`); return responseJson.access_token; } - async getUserId({ accessToken, email }: User): Promise { - console.log(`Fetching User ID for user: ${email}`); + async getUserId({ accessToken, email, name }: User): Promise { + console.log(`Fetching User ID for user: ${name}`); const url = `${urls.idamApi}/o/userinfo`; const requestOptions: RequestOptions = { headers: { @@ -30,7 +30,7 @@ export default class IdamRequests extends BaseRequest { method: 'GET', }; const responseJson = await super.retryRequestJson(url, requestOptions); - console.log(`User ID for user: ${email} fetched successfully`); + console.log(`User ID for user: ${name} fetched successfully`); return responseJson.uid; } } diff --git a/playwright-e2e/requests/requests-factory.ts b/playwright-e2e/requests/requests-factory.ts index 4e18d715d4..6c3b88c753 100644 --- a/playwright-e2e/requests/requests-factory.ts +++ b/playwright-e2e/requests/requests-factory.ts @@ -1,5 +1,6 @@ import BaseRequestsFactory from '../base/base-requests-factory'; import CCDRequests from './ccd-requests'; +import CivilServiceRequests from './civil-service-requests'; import GovUKRequests from './gov-uk-requests'; import IdamRequests from './idam-requests'; @@ -15,4 +16,8 @@ export default class RequestsFactory extends BaseRequestsFactory { get govUKRequests() { return new GovUKRequests(this.requestContext); } + + get civilServiceRequests() { + return new CivilServiceRequests(this.requestContext); + } } diff --git a/playwright-e2e/requests/service-auth-provider-requests.ts b/playwright-e2e/requests/service-auth-provider-requests.ts index 57201878d6..9f8bc229e6 100644 --- a/playwright-e2e/requests/service-auth-provider-requests.ts +++ b/playwright-e2e/requests/service-auth-provider-requests.ts @@ -2,18 +2,28 @@ import BaseRequest from '../base/base-request'; import { TOTP } from 'totp-generator'; import { AllMethodsStep } from '../decorators/test-steps'; import config from '../config/config'; -import RequestOptions from '../models/request-options'; +import RequestOptions from '../models/api/request-options'; import urls from '../config/urls'; +import User from '../models/user'; + +let civilS2sToken: string; export default function ServiceAuthProviderRequests< TBase extends abstract new (...args: any[]) => BaseRequest, >(Base: TBase) { @AllMethodsStep() abstract class ServiceAuthProviderRequests extends Base { - private static civilS2sToken: string; + protected async getRequestHeaders({ accessToken }: User) { + const civilS2sToken = await this.fetchCivilS2sToken(); + return { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, + ServiceAuthorization: civilS2sToken, + }; + } - async fetchCivilS2sToken() { - if (!ServiceAuthProviderRequests.civilS2sToken) { + private async fetchCivilS2sToken() { + if (!civilS2sToken) { console.log('Fetching s2s token...'); const url = `${urls.authProviderApi}/lease`; const requestOptions: RequestOptions = { @@ -25,9 +35,9 @@ export default function ServiceAuthProviderRequests< }; const responseText = await super.retryRequestText(url, requestOptions); console.log('s2s token fetched successfully'); - ServiceAuthProviderRequests.civilS2sToken = responseText; + civilS2sToken = responseText; } - return ServiceAuthProviderRequests.civilS2sToken; + return civilS2sToken; } } diff --git a/playwright-e2e/steps/api/api-case-role-assignment-steps.ts b/playwright-e2e/steps/api/api-case-role-assignment-steps.ts new file mode 100644 index 0000000000..15b4cf6e03 --- /dev/null +++ b/playwright-e2e/steps/api/api-case-role-assignment-steps.ts @@ -0,0 +1,70 @@ +import { AllMethodsStep } from '../../decorators/test-steps'; +import BaseApiSteps from '../../base/base-api-steps'; +import RequestsFactory from '../../requests/requests-factory'; +import TestData from '../../models/test-data'; +import User from '../../models/user'; +import UserAssignedCasesHelper from '../../helpers/user-assigned-cases-helper'; +import { defendantSolicitor1User, defendantSolicitor2User } from '../../config/users/exui-users'; +import CaseRoles from '../../enums/case-roles'; + +@AllMethodsStep() +export default class ApiCaseRoleAssignmentSteps extends BaseApiSteps { + constructor(requestsFactory: RequestsFactory, testData: TestData) { + super(requestsFactory, testData); + } + + async AssignDefendantCaseRoles1v1() { + await this.setupUserData(defendantSolicitor1User); + const { civilServiceRequests } = this.requestsFactory; + await civilServiceRequests.assignCaseToDefendant( + defendantSolicitor1User, + this.ccdCaseData.id, + CaseRoles.RESPONDENT_SOLICITOR_ONE, + ); + UserAssignedCasesHelper.addAssignedCaseToUser(defendantSolicitor1User, this.ccdCaseData.id); + } + + async AssignDefendantCaseRoles1v2SS() { + await this.setupUserData(defendantSolicitor1User); + const { civilServiceRequests } = this.requestsFactory; + await civilServiceRequests.assignCaseToDefendant( + defendantSolicitor1User, + this.ccdCaseData.id, + CaseRoles.RESPONDENT_SOLICITOR_ONE, + ); + UserAssignedCasesHelper.addAssignedCaseToUser(defendantSolicitor1User, this.ccdCaseData.id); + await civilServiceRequests.assignCaseToDefendant( + defendantSolicitor2User, + this.ccdCaseData.id, + CaseRoles.RESPONDENT_SOLICITOR_ONE, + ); + UserAssignedCasesHelper.addAssignedCaseToUser(defendantSolicitor2User, this.ccdCaseData.id); + } + + async AssignDefendantCaseRoles1v2DS() { + await this.setupUserData(defendantSolicitor1User); + await this.setupUserData(defendantSolicitor2User); + const { civilServiceRequests } = this.requestsFactory; + await civilServiceRequests.assignCaseToDefendant( + defendantSolicitor1User, + this.ccdCaseData.id, + CaseRoles.RESPONDENT_SOLICITOR_ONE, + ); + UserAssignedCasesHelper.addAssignedCaseToUser(defendantSolicitor1User, this.ccdCaseData.id); + await civilServiceRequests.assignCaseToDefendant( + defendantSolicitor2User, + this.ccdCaseData.id, + CaseRoles.RESPONDENT_SOLICITOR_TWO, + ); + UserAssignedCasesHelper.addAssignedCaseToUser(defendantSolicitor2User, this.ccdCaseData.id); + } + + async UnassignCasesForUser(user: User) { + const assignedCases = await UserAssignedCasesHelper.getUserAssignedCases(user); + if (assignedCases) { + await this.setupUserData(user); + const { civilServiceRequests } = this.requestsFactory; + await civilServiceRequests.unassignUserFromCases(user, assignedCases); + } + } +} diff --git a/playwright-e2e/steps/api/api-data-setup.ts b/playwright-e2e/steps/api/api-data-steps.ts similarity index 100% rename from playwright-e2e/steps/api/api-data-setup.ts rename to playwright-e2e/steps/api/api-data-steps.ts diff --git a/playwright-e2e/steps/api/api-service-request-steps.ts b/playwright-e2e/steps/api/api-service-request-steps.ts new file mode 100644 index 0000000000..b180bec6a1 --- /dev/null +++ b/playwright-e2e/steps/api/api-service-request-steps.ts @@ -0,0 +1,33 @@ +import BaseApiSteps from '../../base/base-api-steps'; +import { claimantSolicitorUser } from '../../config/users/exui-users'; +import ServiceRequestDataBuilder from '../../data-builders/service-request/service-request-data-builder'; +import { AllMethodsStep } from '../../decorators/test-steps'; +import TestData from '../../models/test-data'; +import RequestsFactory from '../../requests/requests-factory'; + +@AllMethodsStep() +export default class ApiServiceRequestSteps extends BaseApiSteps { + serviceRequestDataBuilder: ServiceRequestDataBuilder; + + constructor( + serviceRequestDataBuilder: ServiceRequestDataBuilder, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(requestsFactory, testData); + this.serviceRequestDataBuilder = serviceRequestDataBuilder; + } + + async MakePaymentForClaimIssue() { + const paidServiceRequestDTO = await this.serviceRequestDataBuilder.buildPaidServiceRequestDTO( + this.ccdCaseData.id, + 'paid', + ); + const { civilServiceRequests } = this.requestsFactory; + await civilServiceRequests.updatePaymentForClaimIssue( + claimantSolicitorUser, + paidServiceRequestDTO, + ); + await super.waitForFinishedBusinessProcess(claimantSolicitorUser, this.ccdCaseData.id); + } +} diff --git a/playwright-e2e/steps/api/api-user-steps.ts b/playwright-e2e/steps/api/api-user-steps.ts index aeb1f67161..22dea16d64 100644 --- a/playwright-e2e/steps/api/api-user-steps.ts +++ b/playwright-e2e/steps/api/api-user-steps.ts @@ -4,6 +4,8 @@ import BaseApiSteps from '../../base/base-api-steps'; import RequestsFactory from '../../requests/requests-factory'; import TestData from '../../models/test-data'; import UserStateHelper from '../../helpers/users-state-helper'; +import UserAssignedCasesHelper from '../../helpers/user-assigned-cases-helper'; +import BaseSteps from '../../base/base-steps'; @AllMethodsStep() export default class ApiUserSteps extends BaseApiSteps { diff --git a/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-spec-steps.ts b/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-spec-steps.ts new file mode 100644 index 0000000000..9ccf04ed9a --- /dev/null +++ b/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-spec-steps.ts @@ -0,0 +1,49 @@ +import BaseApiSteps from '../../../../../base/base-api-steps'; +import { claimantSolicitorUser } from '../../../../../config/users/exui-users'; +import CreateClaimSpecDataBuilder from '../../../../../data-builders/ccd-events/exui/solicitor-events/create-claim/lr-spec/create-claim-spec-data-builder'; +import { AllMethodsStep } from '../../../../../decorators/test-steps'; +import CaseStates from '../../../../../enums/case-states'; +import ccdEvents from '../../../../../fixtures/ccd-events/events'; +import UserAssignedCasesHelper from '../../../../../helpers/user-assigned-cases-helper'; +import TestData from '../../../../../models/test-data'; +import RequestsFactory from '../../../../../requests/requests-factory'; + +@AllMethodsStep() +export default class ApiCreateClaimSpecSteps extends BaseApiSteps { + private createClaimSpecDataBuilder: CreateClaimSpecDataBuilder; + + constructor( + createClaimSpecDataBuilder: CreateClaimSpecDataBuilder, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(requestsFactory, testData); + this.createClaimSpecDataBuilder = createClaimSpecDataBuilder; + } + + async Create1v1Claim() { + await this.setupUserData(claimantSolicitorUser); + const createClaimEventData = await this.createClaimSpecDataBuilder.buildSmallTrack1v1(); + const { ccdRequests } = this.requestsFactory; + const eventToken = await ccdRequests.startEvent( + claimantSolicitorUser, + ccdEvents.CREATE_CLAIM_SPEC, + ); + const eventData = await super.validatePages( + ccdEvents.CREATE_CLAIM_SPEC, + createClaimEventData, + claimantSolicitorUser, + eventToken, + ); + const eventCaseData = await ccdRequests.submitEvent( + claimantSolicitorUser, + ccdEvents.CREATE_CLAIM_SPEC, + CaseStates.PENDING_CASE_ISSUED, + eventData, + eventToken, + ); + await super.waitForFinishedBusinessProcess(claimantSolicitorUser, eventCaseData.id); + await this.fetchAndSetCCDCaseData(claimantSolicitorUser, eventCaseData.id); + UserAssignedCasesHelper.addAssignedCaseToUser(claimantSolicitorUser, this.ccdCaseData.id); + } +} diff --git a/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-steps.ts b/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-steps.ts new file mode 100644 index 0000000000..8d38aaf044 --- /dev/null +++ b/playwright-e2e/steps/api/ccd-events/solicitor-events/create-claim/api-create-claim-steps.ts @@ -0,0 +1,52 @@ +import BaseApiSteps from '../../../../../base/base-api-steps'; +import { claimantSolicitorUser } from '../../../../../config/users/exui-users'; +import CreateClaimDataBuilder from '../../../../../data-builders/ccd-events/exui/solicitor-events/create-claim/unspec/create-claim-data-builder'; +import { AllMethodsStep } from '../../../../../decorators/test-steps'; +import CaseStates from '../../../../../enums/case-states'; +import ccdEvents from '../../../../../fixtures/ccd-events/events'; +import UserAssignedCasesHelper from '../../../../../helpers/user-assigned-cases-helper'; +import TestData from '../../../../../models/test-data'; +import RequestsFactory from '../../../../../requests/requests-factory'; + +@AllMethodsStep() +export default class ApiCreateClaimSteps extends BaseApiSteps { + private createClaimDataBuilder: CreateClaimDataBuilder; + + constructor( + createClaimDataBuilder: CreateClaimDataBuilder, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(requestsFactory, testData); + this.createClaimDataBuilder = createClaimDataBuilder; + } + + async Create1v1Claim() { + await this.setupUserData(claimantSolicitorUser); + const { civilServiceRequests } = this.requestsFactory; + const particularsOfClaimDocument = + await civilServiceRequests.uploadTestDocument(claimantSolicitorUser); + const createClaimData = await this.createClaimDataBuilder.buildSmallTrack1v1( + particularsOfClaimDocument, + ); + + const { ccdRequests } = this.requestsFactory; + const eventToken = await ccdRequests.startEvent(claimantSolicitorUser, ccdEvents.CREATE_CLAIM); + const eventData = await super.validatePages( + ccdEvents.CREATE_CLAIM, + createClaimData, + claimantSolicitorUser, + eventToken, + ); + const eventCaseData = await ccdRequests.submitEvent( + claimantSolicitorUser, + ccdEvents.CREATE_CLAIM, + CaseStates.PENDING_CASE_ISSUED, + eventData, + eventToken, + ); + await super.waitForFinishedBusinessProcess(claimantSolicitorUser, eventCaseData.id); + await this.fetchAndSetCCDCaseData(claimantSolicitorUser, eventCaseData.id); + UserAssignedCasesHelper.addAssignedCaseToUser(claimantSolicitorUser, this.ccdCaseData.id); + } +} diff --git a/playwright-e2e/steps/ui/exui/caseworker-events/create-case-flags-steps.ts b/playwright-e2e/steps/ui/exui/caseworker-events/create-case-flags-steps.ts new file mode 100644 index 0000000000..a4e72fcd99 --- /dev/null +++ b/playwright-e2e/steps/ui/exui/caseworker-events/create-case-flags-steps.ts @@ -0,0 +1,21 @@ +import BaseExuiSteps from '../../../../base/base-exui-steps'; +import { AllMethodsStep } from '../../../../decorators/test-steps'; +import TestData from '../../../../models/test-data'; +import CreateCaseFlagsPageFactory from '../../../../pages/exui/caseworker-events/create-case-flags/create-case-flags-page-factory'; +import ExuiDashboardPageFactory from '../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; +import RequestsFactory from '../../../../requests/requests-factory'; + +@AllMethodsStep() +export default class CreateCaseFlagsSteps extends BaseExuiSteps { + private createCaseFlagsPageFactory: CreateCaseFlagsPageFactory; + + constructor( + createCaseFlagsPageFactory: CreateCaseFlagsPageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); + this.createCaseFlagsPageFactory = createCaseFlagsPageFactory; + } +} diff --git a/playwright-e2e/steps/ui/exui/exui-dashboard-steps.ts b/playwright-e2e/steps/ui/exui/exui-dashboard-steps.ts index aca60b62a2..64ee1babf4 100644 --- a/playwright-e2e/steps/ui/exui/exui-dashboard-steps.ts +++ b/playwright-e2e/steps/ui/exui/exui-dashboard-steps.ts @@ -1,10 +1,10 @@ import ExuiDashboardPageFactory from '../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; -import BaseSteps from '../../../base/base-steps'; import { AllMethodsStep } from '../../../decorators/test-steps'; import TestData from '../../../models/test-data'; import User from '../../../models/user'; import PageUtilsFactory from '../../../pages/utils/page-utils-factory'; import CookiesHelper from '../../../helpers/cookies-helper'; +import BaseSteps from '../../../base/base-steps'; @AllMethodsStep() export default class ExuiDashboardSteps extends BaseSteps { @@ -38,6 +38,12 @@ export default class ExuiDashboardSteps extends BaseSteps { await caseListPage.openCaseList(); } + async GoToCaseDetails() { + const { caseDetailsPage } = this.exuiDashboardPageFactory; + await caseDetailsPage.goToCaseDetails(this.ccdCaseData.id); + await caseDetailsPage.verifyContent(this.ccdCaseData); + } + async SignOut() { const { navBar } = this.exuiDashboardPageFactory; await navBar.clickSignOut(); diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-spec-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-spec-steps.ts index 967281cd65..7ff5844eba 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-spec-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-spec-steps.ts @@ -1,14 +1,22 @@ +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import BaseSteps from '../../../../../base/base-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/claimant-response/claimant-response-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class ClaimantResponseSpecSteps extends BaseSteps { +export default class ClaimantResponseSpecSteps extends BaseExuiSteps { private claimantResponsePageFactory: ClaimantResponsePageFactory; - constructor(claimantResponsePageFactory: ClaimantResponsePageFactory, testData: TestData) { - super(testData); + constructor( + claimantResponsePageFactory: ClaimantResponsePageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.claimantResponsePageFactory = claimantResponsePageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-steps.ts index 57319568c3..32c9a7b8d9 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/claimant-response/claimant-response-steps.ts @@ -1,14 +1,22 @@ +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import BaseSteps from '../../../../../base/base-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/claimant-response/claimant-response-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class ClaimantResponseSteps extends BaseSteps { +export default class ClaimantResponseSteps extends BaseExuiSteps { private claimantResponsePageFactory: ClaimantResponsePageFactory; - constructor(claimantResponsePageFactory: ClaimantResponsePageFactory, testData: TestData) { - super(testData); + constructor( + claimantResponsePageFactory: ClaimantResponsePageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.claimantResponsePageFactory = claimantResponsePageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-spec-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-spec-steps.ts index b9729c0647..e855e97fee 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-spec-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-spec-steps.ts @@ -1,14 +1,22 @@ +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import BaseSteps from '../../../../../base/base-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import CreateClaimPageFactory from '../../../../../pages/exui/solicitor-events/create-claim/create-claim-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class CreateClaimSpecSteps extends BaseSteps { +export default class CreateClaimSpecSteps extends BaseExuiSteps { private createClaimPageFactory: CreateClaimPageFactory; - constructor(createClaimPageFactory: CreateClaimPageFactory, testData: TestData) { - super(testData); + constructor( + createClaimPageFactory: CreateClaimPageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.createClaimPageFactory = createClaimPageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-steps.ts index ce95644293..cbdeaf5832 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/create-claim/create-claim-steps.ts @@ -1,14 +1,22 @@ +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import BaseSteps from '../../../../../base/base-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import CreateClaimPageFactory from '../../../../../pages/exui/solicitor-events/create-claim/create-claim-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class CreateClaimSteps extends BaseSteps { +export default class CreateClaimSteps extends BaseExuiSteps { private createClaimPageFactory: CreateClaimPageFactory; - constructor(createClaimPageFactory: CreateClaimPageFactory, testData: TestData) { - super(testData); + constructor( + createClaimPageFactory: CreateClaimPageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.createClaimPageFactory = createClaimPageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-spec-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-spec-steps.ts index c662a770e9..910fb38d27 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-spec-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-spec-steps.ts @@ -1,14 +1,21 @@ -import BaseSteps from '../../../../../base/base-steps'; +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import DefendantResponsePageFactory from '../../../../../pages/exui/solicitor-events/defendant-response/defendant-response-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class DefendantResponseSpecSteps extends BaseSteps { +export default class DefendantResponseSpecSteps extends BaseExuiSteps { private defendantResponsePageFactory: DefendantResponsePageFactory; - constructor(defendantResponsePageFactory: DefendantResponsePageFactory, testData: TestData) { - super(testData); + constructor( + defendantResponsePageFactory: DefendantResponsePageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.defendantResponsePageFactory = defendantResponsePageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-steps.ts index 43a22f3450..f8b6264679 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/defendant-response/defendant-response-steps.ts @@ -1,14 +1,22 @@ +import BaseExuiSteps from '../../../../../base/base-exui-steps'; import BaseSteps from '../../../../../base/base-steps'; import { AllMethodsStep } from '../../../../../decorators/test-steps'; import TestData from '../../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import DefendantResponsePageFactory from '../../../../../pages/exui/solicitor-events/defendant-response/defendant-response-page-factory'; +import RequestsFactory from '../../../../../requests/requests-factory'; @AllMethodsStep() -export default class DefendantResponseSteps extends BaseSteps { +export default class DefendantResponseSteps extends BaseExuiSteps { private defendantResponsePageFactory: DefendantResponsePageFactory; - constructor(defendantResponsePageFactory: DefendantResponsePageFactory, testData: TestData) { - super(testData); + constructor( + defendantResponsePageFactory: DefendantResponsePageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.defendantResponsePageFactory = defendantResponsePageFactory; } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-details-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-details-steps.ts index 7f0d95f513..d1cf311609 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-details-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-details-steps.ts @@ -1,14 +1,45 @@ -import BaseSteps from '../../../../base/base-steps'; +import BaseExuiSteps from '../../../../base/base-exui-steps'; +import { claimantSolicitorUser } from '../../../../config/users/exui-users'; import { AllMethodsStep } from '../../../../decorators/test-steps'; +import ccdEvents from '../../../../fixtures/ccd-events/events'; import TestData from '../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import NotifyClaimDetailsPageFactory from '../../../../pages/exui/solicitor-events/notify-claim-details/notify-claim-details-page-factory'; +import RequestsFactory from '../../../../requests/requests-factory'; @AllMethodsStep() -export default class NotifyClaimDetailsSteps extends BaseSteps { +export default class NotifyClaimDetailsSteps extends BaseExuiSteps { private notifyClaimDetailsPageFactory: NotifyClaimDetailsPageFactory; - constructor(notifyClaimDetailsPageFactory: NotifyClaimDetailsPageFactory, testData: TestData) { - super(testData); + constructor( + notifyClaimDetailsPageFactory: NotifyClaimDetailsPageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.notifyClaimDetailsPageFactory = notifyClaimDetailsPageFactory; } + + async NotifyClaimDetails1v1() { + await this.retryExuiEvent( + async () => { + const { uploadDocumentsPage } = this.notifyClaimDetailsPageFactory; + await uploadDocumentsPage.verifyContent(this.ccdCaseData); + await uploadDocumentsPage.uploadDocuments(); + await uploadDocumentsPage.submit(); + + const { notifyClaimDetailsSubmitPage } = this.notifyClaimDetailsPageFactory; + await notifyClaimDetailsSubmitPage.verifyContent(this.ccdCaseData); + await notifyClaimDetailsSubmitPage.submit(); + + const { notifyClaimDetailsConfirmPage } = this.notifyClaimDetailsPageFactory; + await notifyClaimDetailsConfirmPage.verifyContent(); + await notifyClaimDetailsConfirmPage.submit(); + }, + ccdEvents.NOTIFY_DEFENDANT_OF_CLAIM_DETAILS, + claimantSolicitorUser, + { retries: 1 }, + ); + } } diff --git a/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-steps.ts b/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-steps.ts index 0959360cbc..daffdd704f 100644 --- a/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-steps.ts +++ b/playwright-e2e/steps/ui/exui/solicitor-events/notify-claim-steps.ts @@ -1,14 +1,44 @@ +import BaseExuiSteps from '../../../../base/base-exui-steps'; import BaseSteps from '../../../../base/base-steps'; +import { claimantSolicitorUser } from '../../../../config/users/exui-users'; import { AllMethodsStep } from '../../../../decorators/test-steps'; +import ccdEvents from '../../../../fixtures/ccd-events/events'; import TestData from '../../../../models/test-data'; +import ExuiDashboardPageFactory from '../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory'; import NotifyClaimPageFactory from '../../../../pages/exui/solicitor-events/notify-claim/notify-claim-page-factory'; +import RequestsFactory from '../../../../requests/requests-factory'; @AllMethodsStep() -export default class NotifyClaimSteps extends BaseSteps { +export default class NotifyClaimSteps extends BaseExuiSteps { private notifyClaimPageFactory: NotifyClaimPageFactory; - constructor(notifyClaimPageFactory: NotifyClaimPageFactory, testData: TestData) { - super(testData); + constructor( + notifyClaimPageFactory: NotifyClaimPageFactory, + exuiDashboardPageFactory: ExuiDashboardPageFactory, + requestsFactory: RequestsFactory, + testData: TestData, + ) { + super(exuiDashboardPageFactory, requestsFactory, testData); this.notifyClaimPageFactory = notifyClaimPageFactory; } + + async NotifyClaim1v1() { + await this.retryExuiEvent( + async () => { + const { accessGrantedWarningPage } = this.notifyClaimPageFactory; + await accessGrantedWarningPage.verifyContent(this.ccdCaseData); + await accessGrantedWarningPage.submit(); + + const { notifyClaimSubmitPage } = this.notifyClaimPageFactory; + await notifyClaimSubmitPage.verifyContent(this.ccdCaseData); + await notifyClaimSubmitPage.submit(); + + const { notifyClaimConfirmPage } = this.notifyClaimPageFactory; + await notifyClaimConfirmPage.verifyContent(); + await notifyClaimConfirmPage.submit(); + }, + ccdEvents.NOTIFY_DEFENDANT_OF_CLAIM, + claimantSolicitorUser, + ); + } } diff --git a/playwright-e2e/tests/Example.spec.ts b/playwright-e2e/tests/Example.spec.ts new file mode 100644 index 0000000000..937b211c2c --- /dev/null +++ b/playwright-e2e/tests/Example.spec.ts @@ -0,0 +1,34 @@ +import { test } from '../playwright-fixtures/index'; + +test('Api Spec Test Example', async ({ + ApiCreateClaimSpecSteps, + ApiServiceRequestsSteps, + ApiCaseRoleAssignmentSteps, + IdamSteps, + ExuiDashboardSteps, +}) => { + await ApiCreateClaimSpecSteps.Create1v1Claim(); + await ApiServiceRequestsSteps.MakePaymentForClaimIssue(); + await ApiCaseRoleAssignmentSteps.AssignDefendantCaseRoles1v1(); + await IdamSteps.ClaimantSolicitorLogin(); + await ExuiDashboardSteps.GoToCaseDetails(); + await IdamSteps.DefendantSolicitor1Login(); + await ExuiDashboardSteps.GoToCaseDetails(); +}); + +test('Api Unspec Test Example', async ({ + ApiCreateClaimSteps, + ApiServiceRequestsSteps, + IdamSteps, + NotifyClaimSteps, + ApiCaseRoleAssignmentSteps, + NotifyClaimDetailsSteps, +}) => { + await ApiCreateClaimSteps.Create1v1Claim(); + await ApiServiceRequestsSteps.MakePaymentForClaimIssue(); + await IdamSteps.ClaimantSolicitorLogin(); + await NotifyClaimSteps.NotifyClaim1v1(); + await ApiCaseRoleAssignmentSteps.AssignDefendantCaseRoles1v1(); + await NotifyClaimDetailsSteps.NotifyClaimDetails1v1(); + await IdamSteps.DefendantSolicitor1Login(); +}); diff --git a/playwright-e2e/tests/Login.spec.ts b/playwright-e2e/tests/Login.spec.ts index 8c2e54a6a7..3b3ff961a3 100644 --- a/playwright-e2e/tests/Login.spec.ts +++ b/playwright-e2e/tests/Login.spec.ts @@ -2,7 +2,15 @@ import { civilAdminUser } from '../config/users/exui-users'; import ccdEvents from '../fixtures/ccd-events/events'; import { test } from '../playwright-fixtures/index'; -test('Testing Login', async ({ IdamSteps, ExuiDashboardSteps, ApiUserSteps, ApiDataSteps, _requestsFactory, _exuiDashboardPageFactory, _notifyClaimPageFactory }) => { +test('Testing Login', async ({ + IdamSteps, + ExuiDashboardSteps, + ApiUserSteps, + ApiDataSteps, + _requestsFactory, + _exuiDashboardPageFactory, + _notifyClaimPageFactory, +}) => { // await ApiUserSteps.SetupUserData(civilAdminUser); // await ApiDataSteps.SetupBankHolidaysData(); await IdamSteps.ClaimantSolicitorLogin(); diff --git a/playwright-e2e/tests/bootstrap/auth/user-auth.setup.ts b/playwright-e2e/tests/bootstrap/auth/user-auth.setup.ts index 16c97bbe40..210427dc75 100644 --- a/playwright-e2e/tests/bootstrap/auth/user-auth.setup.ts +++ b/playwright-e2e/tests/bootstrap/auth/user-auth.setup.ts @@ -6,19 +6,23 @@ if (config.runSetup) { setup.describe('Authenticating exui user(s) and saving cookies', () => { setup.describe.configure({ mode: 'parallel' }); - exuiAuthSetupUsers.forEach((exuiAuthSetupUser, index) => { + for (const [index, exuiAuthSetupUser] of exuiAuthSetupUsers.entries()) { if (index === 0) { - setup(exuiAuthSetupUser.name, { tag: '@verify-cookies-banner' }, async ({ IdamSteps, ExuiDashboardSteps }) => { - await IdamSteps.ExuiLogin(exuiAuthSetupUser); - await ExuiDashboardSteps.AcceptCookies(); - await ExuiDashboardSteps.SaveCookies(exuiAuthSetupUser); - }); + setup( + exuiAuthSetupUser.name, + { tag: '@verify-cookies-banner' }, + async ({ IdamSteps, ExuiDashboardSteps }) => { + await IdamSteps.ExuiLogin(exuiAuthSetupUser); + await ExuiDashboardSteps.AcceptCookies(); + await ExuiDashboardSteps.SaveCookies(exuiAuthSetupUser); + }, + ); } else setup(exuiAuthSetupUser.name, async ({ IdamSteps, ExuiDashboardSteps }) => { await IdamSteps.ExuiLogin(exuiAuthSetupUser); await ExuiDashboardSteps.SaveCookies(exuiAuthSetupUser); }); - }); + } }); } else { console.log('Skipping authenticate exui users and save cookies setup'); diff --git a/playwright-e2e/tests/bootstrap/case-role-assignment/case-role-assignment.teardown.ts b/playwright-e2e/tests/bootstrap/case-role-assignment/case-role-assignment.teardown.ts new file mode 100644 index 0000000000..de7d61fff0 --- /dev/null +++ b/playwright-e2e/tests/bootstrap/case-role-assignment/case-role-assignment.teardown.ts @@ -0,0 +1,17 @@ +import { test as teardown } from '../../../playwright-fixtures/index'; +import { solicitorUsers } from '../../../config/users/exui-users'; +import config from '../../../config/config'; + +if (config.unassignCases) { + teardown.describe('Unassigning case roles for solicitor users', () => { + teardown.describe.configure({ mode: 'parallel' }); + + for (const solicitorUser of solicitorUsers) { + teardown(solicitorUser.name, async ({ ApiCaseRoleAssignmentSteps }) => { + await ApiCaseRoleAssignmentSteps.UnassignCasesForUser(solicitorUser); + }); + } + }); +} else { + console.log('Skipping case role unassignment for users'); +} diff --git a/playwright.config.ts b/playwright.config.ts index 699e23a3f0..0828f6abf8 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ globalTeardown: process.env.CI ? undefined : './playwright-e2e/global/teardown-local', forbidOnly: !!process.env.CI, fullyParallel: true, - retries: process.env.CI ? 2 : 0, + retries: config.playwright.retries ?? 0, workers: config.playwright.workers, reporter: process.env.CI ? [ @@ -69,10 +69,16 @@ export default defineConfig({ use: { ...devices['Desktop Chrome'] }, testMatch: '**playwright-e2e/tests/bootstrap/auth/**.teardown.ts', }, + { + name: 'case-role-assignment-teardown', + use: { ...devices['Desktop Chrome'] }, + testMatch: '**playwright-e2e/tests/bootstrap/case-role-assignment/**.teardown.ts', + }, { name: 'e2e-full-functional', use: { ...devices['Desktop Chrome'] }, dependencies: ['data-setup', 'users-auth-setup'], + teardown: 'case-role-assignment-teardown' }, ], }); diff --git a/yarn.lock b/yarn.lock index c0ef0e912e..32bf16de48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1917,7 +1917,7 @@ __metadata: ts-node: ^10.9.2 typescript: 5.1.3 typescript-eslint: 8.0.0 - uuid: ^3.4.0 + uuid: ^11.0.3 webdriverio: ^6.12.1 languageName: unknown linkType: soft @@ -6766,7 +6766,16 @@ __metadata: languageName: node linkType: hard -"uuid@npm:^3.0.1, uuid@npm:^3.4.0": +"uuid@npm:^11.0.3": + version: 11.0.3 + resolution: "uuid@npm:11.0.3" + bin: + uuid: dist/esm/bin/uuid + checksum: 646181c77e8b8df9bd07254faa703943e1c4d5ccde7d080312edf12f443f6c5750801fd9b27bf2e628594182165e6b1b880c0382538f7eca00b26622203741dc + languageName: node + linkType: hard + +"uuid@npm:^3.0.1": version: 3.4.0 resolution: "uuid@npm:3.4.0" bin: From a9d6cccbac2c2aafc9444cccb2cf7b4698a35599 Mon Sep 17 00:00:00 2001 From: drummondjm <93932689+drummondjm@users.noreply.github.com> Date: Tue, 10 Dec 2024 08:02:00 +0000 Subject: [PATCH 9/9] CIV-15736 wa court location for tasks (#5123) * Initial code changes for evaluating court location DMN * Update values.preview.template.yaml * Update Jenkinsfile_CNP * update casetype * add into casedetails, placeholder fhttps://tools.hmcts.net/jira/browse/CIV-15730or * Update values.preview.template.yaml * clean up * Update values.preview.template.yaml --- .../AuthorisationCaseField-MINTI-nonprod.json | 22 ++++++++++++ .../CaseField/CaseField-MINTI-nonprod.json | 8 +++++ .../ClaimDetails-MINTI-nonprod.json | 6 ++++ ...ManagementLocationTypes-MINTI-nonprod.json | 34 +++++++++++++++++++ ...anagementLocationsModel-MINTI-nonprod.json | 34 +++++++++++++++++++ charts/civil-ccd/values.preview.template.yaml | 1 + 6 files changed, 105 insertions(+) create mode 100644 ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationTypes-MINTI-nonprod.json create mode 100644 ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationsModel-MINTI-nonprod.json diff --git a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-MINTI-nonprod.json b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-MINTI-nonprod.json index 3721529ecd..c90f384f0b 100644 --- a/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-MINTI-nonprod.json +++ b/ccd-definition/AuthorisationCaseField/AuthorisationCaseField-MINTI-nonprod.json @@ -382,5 +382,27 @@ "CRUD": "R" } ] + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "CaseFieldID": "taskManagementLocations", + "AccessControl": [ + { + "UserRoles": [ + "caseworker-civil-solicitor", + "caseworker-civil-admin", + "judge-profile" + ], + "CRUD": "CRU" + }, + { + "UserRoles": [ + "caseworker-ras-validation", + "caseworker-civil-systemupdate", + "GS_profile" + ], + "CRUD": "R" + } + ] } ] diff --git a/ccd-definition/CaseField/CaseField-MINTI-nonprod.json b/ccd-definition/CaseField/CaseField-MINTI-nonprod.json index ff3bca834e..cf164a0ae4 100644 --- a/ccd-definition/CaseField/CaseField-MINTI-nonprod.json +++ b/ccd-definition/CaseField/CaseField-MINTI-nonprod.json @@ -193,5 +193,13 @@ "FieldTypeParameter": "ConfirmListingTickBox", "SecurityClassification": "Public", "Searchable": "N" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "ID": "taskManagementLocations", + "Label": "Task management location", + "FieldType": "TaskManagementLocationTypes", + "SecurityClassification": "Public", + "Searchable": "Y" } ] diff --git a/ccd-definition/CaseTypeTab/ClaimDetails-MINTI-nonprod.json b/ccd-definition/CaseTypeTab/ClaimDetails-MINTI-nonprod.json index 78ad20cc3f..512d6be2fa 100644 --- a/ccd-definition/CaseTypeTab/ClaimDetails-MINTI-nonprod.json +++ b/ccd-definition/CaseTypeTab/ClaimDetails-MINTI-nonprod.json @@ -110,5 +110,11 @@ "CaseFieldID": "applicant2DQDisclosureReport", "TabFieldDisplayOrder": 81, "FieldShowCondition": "responseClaimTrack = \"INTERMEDIATE_CLAIM\" OR allocatedTrack = \"INTERMEDIATE_CLAIM\" OR responseClaimTrack = \"MULTI_CLAIM\" OR allocatedTrack = \"MULTI_CLAIM\"" + }, + { + "CaseTypeID": "CIVIL${CCD_DEF_VERSION}", + "TabID": "ClaimDetails", + "CaseFieldID": "taskManagementLocations", + "TabFieldDisplayOrder": 90 } ] diff --git a/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationTypes-MINTI-nonprod.json b/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationTypes-MINTI-nonprod.json new file mode 100644 index 0000000000..6697962d3d --- /dev/null +++ b/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationTypes-MINTI-nonprod.json @@ -0,0 +1,34 @@ +[ + { + "ID": "TaskManagementLocationTypes", + "ListElementCode": "cmcListingLocation", + "ElementLabel": "Case conference location", + "FieldType": "TaskManagementLocationsModel", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationTypes", + "ListElementCode": "ccmcListingLocation", + "ElementLabel": "Cost conference location", + "FieldType": "TaskManagementLocationsModel", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationTypes", + "ListElementCode": "ptrListingLocation", + "ElementLabel": "Pre Trial Location", + "FieldType": "TaskManagementLocationsModel", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationTypes", + "ListElementCode": "trialListingLocation", + "ElementLabel": "Trial Location", + "FieldType": "TaskManagementLocationsModel", + "SecurityClassification": "Public", + "Searchable": "Y" + } +] diff --git a/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationsModel-MINTI-nonprod.json b/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationsModel-MINTI-nonprod.json new file mode 100644 index 0000000000..9d0bc609b4 --- /dev/null +++ b/ccd-definition/ComplexTypes/CaseProgression/TaskManagementLocationsModel-MINTI-nonprod.json @@ -0,0 +1,34 @@ +[ + { + "ID": "TaskManagementLocationsModel", + "ListElementCode": "region", + "ElementLabel": "Region", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationsModel", + "ListElementCode": "regionName", + "ElementLabel": "Region Name", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationsModel", + "ListElementCode": "location", + "ElementLabel": "Location", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "Y" + }, + { + "ID": "TaskManagementLocationsModel", + "ListElementCode": "locationName", + "ElementLabel": "Location Name", + "FieldType": "Text", + "SecurityClassification": "Public", + "Searchable": "Y" + } +] diff --git a/charts/civil-ccd/values.preview.template.yaml b/charts/civil-ccd/values.preview.template.yaml index abc14e6637..9864b81e08 100644 --- a/charts/civil-ccd/values.preview.template.yaml +++ b/charts/civil-ccd/values.preview.template.yaml @@ -59,6 +59,7 @@ civil-service: SERVICE_REQUEST_UPDATE_CLAIM_ISSUED: https://${SERVICE_NAME}.preview.platform.hmcts.net/service-request-update-claim-issued HMC_HEARINGS_SUBSCRIPTION_ENABLED: false CMC_DB_PASSWORD: "{{ .Values.postgresql.auth.postgresPassword}}" + COURT_LOCATION_WA_DMN_ENABLED: true # CMC_DB_HOST: civil-preview.postgres.database.azure.com # CMC_DB_CONNECTION_OPTIONS: "?stringtype=unspecified&reWriteBatchedInserts=true&sslmode=require" # CMC_DB_USERNAME: hmcts