Skip to content

Commit

Permalink
CIV-16464 Added GALip e2e tests (#5454)
Browse files Browse the repository at this point in the history
* added tests

* added tests

* added tests

* added tests

---------

Co-authored-by: Raja <[email protected]>
  • Loading branch information
rajakm and Raja authored Jan 23, 2025
1 parent 8382165 commit 0871ee5
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 16 deletions.
30 changes: 20 additions & 10 deletions src/test/functionalTests/specClaimHelpers/api/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
};
},
};
91 changes: 85 additions & 6 deletions src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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');

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);
Expand All @@ -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);

Expand All @@ -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();

Expand All @@ -70,4 +71,82 @@ Scenario('LipvLip Applicant GA creation e2e tests @citizenUI @nightly - @api @ga
//await I.amOnPage(`/case/${gaID}/general-application/summary`);

}
});
});

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);
}
}
});

0 comments on commit 0871ee5

Please sign in to comment.