From 0871ee5a8b7a757ce0742bfc97d31d7d59dc4baf Mon Sep 17 00:00:00 2001 From: Raja Mani Date: Thu, 23 Jan 2025 17:37:29 +0000 Subject: [PATCH] CIV-16464 Added GALip e2e tests (#5454) * added tests * added tests * added tests * added tests --------- Co-authored-by: Raja --- .../specClaimHelpers/api/steps.js | 30 +++-- .../fixtures/events/makeAnOrderGA.js | 119 ++++++++++++++++++ .../tests/nonprod/LiPvLiP_GA_e2e_tests.js | 91 +++++++++++++- 3 files changed, 224 insertions(+), 16 deletions(-) diff --git a/src/test/functionalTests/specClaimHelpers/api/steps.js b/src/test/functionalTests/specClaimHelpers/api/steps.js index af97f47201e..8d8cdf5d964 100644 --- a/src/test/functionalTests/specClaimHelpers/api/steps.js +++ b/src/test/functionalTests/specClaimHelpers/api/steps.js @@ -73,26 +73,36 @@ const data = { }; -let caseId, eventName; +let caseId, eventName, payload; let caseData = {}; const PBAv3Toggle = 'pba-version-3-ways-to-pay'; module.exports = { - makeOrderGA: async (gaCaseId, user = config.judgeUserWithRegionId2) => { - console.log('Creating an order without notice on ga of id: ' + gaCaseId); + makeOrderGA: async (gaCaseId, courtResponseType, user = config.judgeUserWithRegionId2) => { + console.log('Make an Order of GA: ' + gaCaseId); eventName = 'MAKE_DECISION'; - const document = await uploadDocument(); - - const payload = makeAnOrderGA.makeAnOrderGA(document); - + switch(courtResponseType){ + case 'approveOrEdit': + payload = makeAnOrderGA.makeAnOrderGA(document); + break; + case 'dismissAnOrder': + payload = makeAnOrderGA.dismissAnOrderGA(document); + break; + case 'giveDirections': + payload = makeAnOrderGA.giveDirections(document); + break; + case 'freeFormOrder': + payload = makeAnOrderGA.freeFormOrder(document); + break; + default: + payload = makeAnOrderGA.makeAnOrderGA(document); + break; + } await apiRequest.setupTokens(user); - caseData = payload['caseDataUpdate']; - await waitForGAFinishedBusinessProcess(gaCaseId, user); - await assertSubmittedGASpecEvent(gaCaseId, 'APPLICATION_SUBMITTED_AWAITING_JUDICIAL_DECISION', user); }, diff --git a/src/test/functionalTests/specClaimHelpers/fixtures/events/makeAnOrderGA.js b/src/test/functionalTests/specClaimHelpers/fixtures/events/makeAnOrderGA.js index 2892447249c..1b84afc2285 100644 --- a/src/test/functionalTests/specClaimHelpers/fixtures/events/makeAnOrderGA.js +++ b/src/test/functionalTests/specClaimHelpers/fixtures/events/makeAnOrderGA.js @@ -43,4 +43,123 @@ module.exports = { }, }; }, + dismissAnOrderGA: (document) => { + return { + event: 'MAKE_AN_ORDER', + caseDataUpdate: { + judicialDecision: { + decision: 'MAKE_AN_ORDER', + }, + judgeTitle: 'judgeb birmin', + bilingualHint: 'No', + judicialDecisionMakeOrder: { + makeAnOrder: 'DISMISS_THE_APPLICATION', + judgeRecitalText: 'The Judge considered the application of the claimant dated 5 December 2024', + orderText: 'Test order', + judgeApproveEditOptionDoc: null, + judgeApproveEditOptionDate: null, + judgeApproveEditOptionDateForUnlessOrder: null, + dismissalOrderText: 'This application is dismissed.', + directionsText: null, + directionsResponseByDate: null, + judicialByCourtsInitiative: 'OPTION_1', + orderCourtOwnInitiative: 'As this order was made on the court\'s own initiative, any party affected by the order may apply to set aside, vary, or stay the order. Any such application must be made by 4pm on', + orderCourtOwnInitiativeDate: '2024-12-12', + orderWithoutNotice: 'If you were not notified of the application before this order was made, you may apply to set aside, vary, or stay the order. Any such application must be made by 4pm on', + orderWithoutNoticeDate: '2024-12-12', + showReasonForDecision: 'No', + reasonForDecisionText: null, + displayjudgeApproveEditOptionDate: 'No', + displayjudgeApproveEditOptionDoc: 'Yes', + isOrderProcessedByStayScheduler: 'No', + isOrderProcessedByUnlessScheduler: 'No', + displayjudgeApproveEditOptionDateForUnlessOrder: 'No', + showJudgeRecitalText: [ + 'SHOW', + ], + }, + judicialMakeOrderDocPreview: { + document_url: document.document_url, + document_binary_url: document.document_binary_url, + document_filename: document.document_filename, + document_hash: document.document_hash, + }, + }, + }; + }, + giveDirections: (document) => { + return { + event: 'MAKE_AN_ORDER', + caseDataUpdate: { + judicialDecision: { + decision: 'MAKE_AN_ORDER', + }, + judgeTitle: 'judgeb birmin', + bilingualHint: 'No', + judicialDecisionMakeOrder: { + makeAnOrder: 'GIVE_DIRECTIONS_WITHOUT_HEARING', + judgeRecitalText: 'The Judge considered the application of the claimant dated 5 December 2024', + orderText: 'Test order', + judgeApproveEditOptionDoc: null, + judgeApproveEditOptionDate: null, + judgeApproveEditOptionDateForUnlessOrder: null, + dismissalOrderText: 'This application is dismissed.', + directionsText: null, + directionsResponseByDate: null, + judicialByCourtsInitiative: 'OPTION_1', + orderCourtOwnInitiative: 'As this order was made on the court\'s own initiative, any party affected by the order may apply to set aside, vary, or stay the order. Any such application must be made by 4pm on', + orderCourtOwnInitiativeDate: '2024-12-12', + orderWithoutNotice: 'If you were not notified of the application before this order was made, you may apply to set aside, vary, or stay the order. Any such application must be made by 4pm on', + orderWithoutNoticeDate: '2024-12-12', + showReasonForDecision: 'No', + reasonForDecisionText: null, + displayjudgeApproveEditOptionDate: 'No', + displayjudgeApproveEditOptionDoc: 'Yes', + isOrderProcessedByStayScheduler: 'No', + isOrderProcessedByUnlessScheduler: 'No', + displayjudgeApproveEditOptionDateForUnlessOrder: 'No', + showJudgeRecitalText: [ + 'SHOW', + ], + }, + judicialMakeOrderDocPreview: { + document_url: document.document_url, + document_binary_url: document.document_binary_url, + document_filename: document.document_filename, + document_hash: document.document_hash, + }, + }, + }; + }, + freeFormOrder: (document) => { + return { + event: 'FREE_FORM_ORDER', + caseDataUpdate: { + judicialDecision: { + decision: 'FREE_FORM_ORDER', + }, + judgeTitle: 'judgeb birmin', + bilingualHint: 'No', + isDocumentVisible: 'No', + orderOnCourtsList: 'ORDER_WITHOUT_NOTICE', + CaseAccessCategory: 'SPEC_CLAIM', + applicantPartyName: 'Sir John Doe', + caseNameGaInternal: 'Jane Doe v John Doe', + claimant1PartyName: 'Miss Jane Doe', + orderWithoutNotice:{ + withoutNoticeSelectionDate: '2026-01-30', + withoutNoticeSelectionTextArea: 'If you were not notified of the application before this order was made, you may apply to set aside, vary, or stay the order. Any such application must be made by 4pm on', + }, + defendant1PartyName: 'Sir John Doe', + freeFormOrderedText: 'test test', + freeFormRecitalText: 'test test', + gaFinalOrderDocPreview:{ + document_url: document.document_url, + document_filename: document.document_filename, + document_binary_url: document.document_binary_url, + document_hash: document.document_hash, + }, + }, + }; + }, }; diff --git a/src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js b/src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js index 6e16577de93..ef6aa2b18ab 100644 --- a/src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js +++ b/src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js @@ -8,7 +8,7 @@ const {isDashboardServiceToggleEnabled} = require('../../specClaimHelpers/api/te const {verifyNotificationTitleAndContent} = require('../../specClaimHelpers/e2e/dashboardHelper'); const {orderMadeGA} = require('../../specClaimHelpers/dashboardNotificationConstants'); -let claimRef, claimType, caseData, claimNumber, gaID; +let claimRef, claimType, caseData, claimNumber, gaID, courtResponseType; Feature('Lip v Lip GA e2e Tests'); @@ -16,7 +16,7 @@ Before(async ({api}) => { if (['preview', 'demo'].includes(config.runningEnv)) { await createAccount(config.claimantCitizenUser.email, config.claimantCitizenUser.password); await createAccount(config.defendantCitizenUser.email, config.defendantCitizenUser.password); - + claimType = 'FastTrack'; claimRef = await api.createLiPClaim(config.claimantCitizenUser, claimType); caseData = await api.retrieveCaseData(config.adminUser, claimRef); @@ -27,7 +27,8 @@ Before(async ({api}) => { } }); -Scenario('LipvLip Applicant GA creation e2e tests @citizenUI @nightly - @api @ga @regression', async ({I, api}) => { +Scenario('LipvLip Applicant GA creation e2e tests - Make an Order @citizenUI - @api @ga @regression', async ({I, api}) => { + courtResponseType = 'approveOrEdit'; if (['preview', 'demo'].includes(config.runningEnv)) { await LoginSteps.EnterCitizenCredentials(config.claimantCitizenUser.email, config.claimantCitizenUser.password); @@ -41,10 +42,10 @@ Scenario('LipvLip Applicant GA creation e2e tests @citizenUI @nightly - @api @ga await LoginSteps.EnterCitizenCredentials(config.defendantCitizenUser.email, config.defendantCitizenUser.password); await I.amOnPage('/dashboard'); await I.click(claimNumber); - + await respondGASteps.respondToGA(claimRef, gaID, 'Respond to an application to more time to do what is required by a court order', 'Miss Jane Doe v Sir John Doe'); - await api.makeOrderGA(gaID); + await api.makeOrderGA(gaID, courtResponseType); const isDashboardServiceEnabled = await isDashboardServiceToggleEnabled(); @@ -70,4 +71,82 @@ Scenario('LipvLip Applicant GA creation e2e tests @citizenUI @nightly - @api @ga //await I.amOnPage(`/case/${gaID}/general-application/summary`); } -}); \ No newline at end of file +}); + +Scenario('LipvLip Applicant GA creation e2e tests - Dismiss an Order @citizenUI - @api @ga @nightly @nightly', async ({I, api}) => { + courtResponseType = 'dismissAnOrder'; + if (['preview', 'demo'].includes(config.runningEnv)) { + await LoginSteps.EnterCitizenCredentials(config.claimantCitizenUser.email, config.claimantCitizenUser.password); + + console.log('Creating an Adjourn Hearing Order GA app as claimant'); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + gaID = await createGASteps.askToChangeHearingDateGA(claimRef, 'Miss Jane Doe v Sir John Doe', 'withoutnotice'); + + await api.makeOrderGA(gaID, courtResponseType); + + const isDashboardServiceEnabled = await isDashboardServiceToggleEnabled(); + + await LoginSteps.EnterCitizenCredentials(config.claimantCitizenUser.email, config.claimantCitizenUser.password); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + + if (isDashboardServiceEnabled) { + const notification = orderMadeGA(); + await verifyNotificationTitleAndContent(claimNumber, notification.title, notification.content); + await I.click(notification.nextSteps); + } + } +}); + +Scenario('LipvLip Applicant GA creation e2e tests - Give directions without listing @citizenUI - @api @ga @nightly', async ({I, api}) => { + courtResponseType = 'giveDirections'; + if (['preview', 'demo'].includes(config.runningEnv)) { + await LoginSteps.EnterCitizenCredentials(config.claimantCitizenUser.email, config.claimantCitizenUser.password); + + console.log('Creating an Adjourn Hearing Order GA app as claimant'); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + gaID = await createGASteps.askToChangeHearingDateGA(claimRef, 'Miss Jane Doe v Sir John Doe', 'withoutnotice'); + + await api.makeOrderGA(gaID, courtResponseType); + + const isDashboardServiceEnabled = await isDashboardServiceToggleEnabled(); + + await LoginSteps.EnterCitizenCredentials(config.claimantCitizenUser.email, config.claimantCitizenUser.password); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + + if (isDashboardServiceEnabled) { + const notification = orderMadeGA(); + await verifyNotificationTitleAndContent(claimNumber, notification.title, notification.content); + await I.click(notification.nextSteps); + } + } +}); + +Scenario('LipvLip Applicant GA creation e2e tests - Give directions without listing @citizenUI - @api @ga @nightly @regression', async ({I, api}) => { + courtResponseType = 'freeFormOrder'; + if (['preview', 'demo'].includes(config.runningEnv)) { + await LoginSteps.EnterCitizenCredentials(config.defendantCitizenUser.email, config.defendantCitizenUser.password); + + console.log('Creating an Adjourn Hearing Order GA app as Defendant'); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + gaID = await createGASteps.askToChangeHearingDateGA(claimRef, 'Miss Jane Doe v Sir John Doe', 'withoutnotice'); + + await api.makeOrderGA(gaID, courtResponseType); + + const isDashboardServiceEnabled = await isDashboardServiceToggleEnabled(); + + await LoginSteps.EnterCitizenCredentials(config.defendantCitizenUser.email, config.defendantCitizenUser.password); + await I.amOnPage('/dashboard'); + await I.click(claimNumber); + + if (isDashboardServiceEnabled) { + const notification = orderMadeGA(); + await verifyNotificationTitleAndContent(claimNumber, notification.title, notification.content); + await I.click(notification.nextSteps); + } + } +});