Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-15442 GA Creation Tests #5538

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
const ContactUs = require('../../common/contactUs');
const I = actor();

Expand All @@ -13,13 +14,17 @@ class CheckAndSend {
I.click(nextAction);
}

async verifyPageContent(caseNumber, parties, applicationType, communicationType) {
async verifyPageContent(caseNumber, parties, applicationType, communicationType, firstApplicationType = 'none', secondApplicationType = 'none') {
this.checkPageFullyLoaded();
this.verifyBreadcrumbs();
this.verifyHeadingDetails(applicationType, caseNumber, parties);
this.applicationType(applicationType);
if (applicationType !== 'Make an application') {
this.applicationType(applicationType);
} else {
this.multipleApplicationType(firstApplicationType, secondApplicationType);
}
if (applicationType !== 'Set aside (remove) a judgment' && applicationType !== 'Vary a judgment' && applicationType !== 'Court to make an order settling the claim by consent') {
this.additionalApplication();
this.additionalApplication(applicationType);
}
this.partiesAgreed(communicationType);
if (communicationType !== 'consent' && applicationType !== 'Set aside (remove) a judgment' && applicationType !== 'Vary a judgment' && applicationType !== 'Court to make an order settling the claim by consent') {
Expand Down Expand Up @@ -60,10 +65,29 @@ class CheckAndSend {
await I.see('Change', applicatonTypeSelector);
}

async additionalApplication() {
async multipleApplicationType(firstApplicationType, secondApplicationType) {
const firstSummaryCardTitleSelector = '.govuk-summary-card:first-of-type .govuk-summary-card__title';
const secondSummaryCardTitleSelector = '.govuk-summary-card:nth-of-type(2) .govuk-summary-card__title';
const firstSummaryCardFirstRowSelector = '.govuk-summary-card:first-of-type .govuk-summary-list__row:first-of-type';
const SecondSummaryCardFirstRowSelector = '.govuk-summary-card:nth-of-type(2) .govuk-summary-list__row:first-of-type';
I.see('Application 1', firstSummaryCardTitleSelector);
I.see('Application type', firstSummaryCardFirstRowSelector);
I.see(firstApplicationType, firstSummaryCardFirstRowSelector);
await I.see('Change', firstSummaryCardFirstRowSelector);
I.see('Application 2', secondSummaryCardTitleSelector);
I.see('Application type', SecondSummaryCardFirstRowSelector);
I.see(secondApplicationType, SecondSummaryCardFirstRowSelector);
await I.see('Change', SecondSummaryCardFirstRowSelector);
}

async additionalApplication(applicationType) {
const applicatonTypeSelector = '//div[@class=\'govuk-summary-list__row\'][contains(., \'Do you want to add another application?\')]';
I.see('Do you want to add another application?', applicatonTypeSelector);
I.see('No', applicatonTypeSelector);
if (applicationType !== 'Make an application') {
I.see('No', applicatonTypeSelector);
} else {
I.see('Yes', applicatonTypeSelector);
}
await I.see('Change', applicatonTypeSelector);
}

Expand Down
147 changes: 147 additions & 0 deletions src/test/functionalTests/citizenFeatures/GA/steps/createGASteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,153 @@ class createGASteps {
await paymentConfirmationPage.verifyAdditionalPaymentPageContent();
await paymentConfirmationPage.nextAction('Close and return to dashboard');
}

async createMultipleApplications(caseRef, parties, communicationType = 'consent') {

const caseNumber = StringUtilsComponent.StringUtilsComponent.formatClaimReferenceToAUIDisplayFormat(caseRef);
const firstApplicationType = 'Change a hearing date';
const secondApplicationType = 'Court to strike out all or part of the other parties\' case without a trial';
const applicationType = 'Make an application';
let feeAmount;

switch(communicationType) {
case 'consent':
feeAmount = '119';
break;
case 'notice':
feeAmount = '303';
break;
case 'withoutnotice':
feeAmount = '119';
break;
}

// Primary application to Adjourn a hearing
await I.waitForContent('Contact the court to request a change to my case', 60);
await I.click('Contact the court to request a change to my case');
await I.amOnPage(`case/${caseRef}/general-application/application-type`);
await applicationTypePage.verifyPageContent();
await applicationTypePage.nextAction('Ask to change a hearing date');
await applicationTypePage.nextAction('Continue');

if (communicationType == 'consent') {
await agreementFromOtherPartyPage.verifyPageContent(firstApplicationType);
await agreementFromOtherPartyPage.nextAction('Yes');
await agreementFromOtherPartyPage.nextAction('Continue');
} else {
await agreementFromOtherPartyPage.verifyPageContent(firstApplicationType);
await agreementFromOtherPartyPage.nextAction('No');
await agreementFromOtherPartyPage.nextAction('Continue');
if (communicationType == 'notice') {
await informOtherPartiesPage.verifyPageContent(firstApplicationType);
await informOtherPartiesPage.selectAndVerifyDoInformOption();
} else {
await informOtherPartiesPage.verifyPageContent(firstApplicationType);
await informOtherPartiesPage.selectAndVerifyDontInformOption();
}
}

await applicationCostsPage.verifyPageContent(firstApplicationType, feeAmount);
await applicationCostsPage.nextAction('Start now');

await claimApplicationCostPage.verifyPageContent(firstApplicationType);
await claimApplicationCostPage.selectAndVerifyYesOption();
await claimApplicationCostPage.nextAction('Continue');

await orderJudgePage.verifyPageContent(firstApplicationType);
await orderJudgePage.fillTextBox('Test order');
await orderJudgePage.nextAction('Continue');

await requestingReasonPage.verifyPageContent(firstApplicationType);
await requestingReasonPage.fillTextBox('Test order');
await requestingReasonPage.nextAction('Continue');

await addAnotherApplicationPage.verifyPageContent(firstApplicationType);
await addAnotherApplicationPage.nextAction('Yes');
await addAnotherApplicationPage.nextAction('Continue');

// Secondary application to Strike out
await I.amOnPage(`case/${caseRef}/general-application/application-type?linkFrom=addAnotherApp`);
await applicationTypePage.verifyPageContent();
await applicationTypePage.nextAction('Other applications');
await applicationTypePage.nextAction('Ask the court to strike out all or part of the other parties\' case without a trial');
await applicationTypePage.nextAction('Continue');

await orderJudgePage.verifyPageContent(secondApplicationType);
await orderJudgePage.fillTextBox('Test order');
await orderJudgePage.nextAction('Continue');

await requestingReasonPage.verifyPageContent(secondApplicationType);
await requestingReasonPage.fillTextBox('Test order');
await requestingReasonPage.nextAction('Continue');

await addAnotherApplicationPage.verifyPageContent(secondApplicationType);
await addAnotherApplicationPage.nextAction('No');
await addAnotherApplicationPage.nextAction('Continue');

// Multiple application journey
await wantToUploadDocumentsPage.verifyPageContent(applicationType);
await wantToUploadDocumentsPage.nextAction('No');
await wantToUploadDocumentsPage.nextAction('Continue');

await hearingArrangementsGuidancePage.verifyPageContent(applicationType);
await hearingArrangementsGuidancePage.nextAction('Continue');

await hearingArrangementPage.verifyPageContent(applicationType);
await hearingArrangementPage.nextAction('In person at the court');
await hearingArrangementPage.fillTextAndSelectLocation('In person', config.gaCourtToBeSelected);
await hearingArrangementPage.nextAction('Continue');

await hearingContactDetailsPage.verifyPageContent(applicationType);
await hearingContactDetailsPage.fillContactDetails('07555655326', '[email protected]');
await hearingContactDetailsPage.nextAction('Continue');

await unavailableDatesConfirmationPage.verifyPageContent(applicationType);
unavailableDatesConfirmationPage.nextAction('Yes');
unavailableDatesConfirmationPage.nextAction('Continue');

await unavailableDatesPage.verifyPageContent(applicationType);
unavailableDatesPage.fillFields();
unavailableDatesPage.nextAction('Continue');

await hearingSupportPage.verifyPageContent(applicationType);
await hearingSupportPage.nextAction('Continue');

await payingForApplicationPage.verifyPageContent(applicationType, feeAmount);
await payingForApplicationPage.nextAction('Continue');

await checkAndSendPage.verifyPageContent(caseNumber, parties, applicationType, communicationType, firstApplicationType, secondApplicationType);
await checkAndSendPage.checkAndSign();
await checkAndSendPage.nextAction('Submit');

await submitGAConfirmationPage.verifyPageContent(feeAmount);
await submitGAConfirmationPage.nextAction('Pay application fee');

I.wait(2);

await applyHelpFeeSelectionPage.verifyPageContent();
await applyHelpFeeSelectionPage.nextAction('No');
await applyHelpFeeSelectionPage.nextAction('Continue');

await govPay.addValidCardDetails(feeAmount);
govPay.confirmPayment();

const generalApplicationID = (await I.grabCurrentUrl()).match(/\/general-application\/(\d+)\//)[1];

await paymentConfirmationPage.verifyPageContent();
await paymentConfirmationPage.nextAction('Close and return to dashboard');

I.wait(5);
await I.refreshPage();
await I.waitForClickable('View Applications', 5);
await I.click('.govuk-link >> text=View Applications');
await I.amOnPage(`/case/${caseRef}/general-application/summary`);
await I.see('Adjourn a hearing, Strike out');
await I.see('Awaiting Respondent Response');

return generalApplicationID;
}

}

module.exports = new createGASteps();
3 changes: 3 additions & 0 deletions src/test/functionalTests/specClaimHelpers/api/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ module.exports = {
case 'requestMoreInformation':
payload = makeAnOrderGA.requestMoreInformation(document);
break;
case 'listForHearing':
payload = makeAnOrderGA.listForHearing(document);
break;
default:
payload = makeAnOrderGA.makeAnOrderGA(document);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,65 @@ module.exports = {
},
};
},
listForHearing: (document) => {
return {
event: 'MAKE_DECISION',
caseDataUpdate: {
judicialDecision: {
decision: 'LIST_FOR_A_HEARING',
},
applicationIsCloaked: 'No',
judgeTitle: 'Angel Morgan',
judicialByCourtsInitiativeListForHearing: 'OPTION_1',
hearingOrderDocument: [
{
id: '1ebaf4dd-a1e5-4d8e-801d-bf27a1a3fa99',
value: {
createdBy: 'Civil',
createdDatetime: '2025-01-29T10:43:42.716255484',
documentLink: {
category_id: 'applications',
document_binary_url: document.document_binary_url,
document_filename: document.document_filename,
document_url: document.document_url,
},
documentName: 'Request_for_information_for_application_2025-01-29 10:43:42.pdf',
documentSize: 56542,
documentType: 'REQUEST_FOR_INFORMATION',
},
},
],
judicialGeneralHearingOrderRecital: 'The Judge considered the application of the claimant dated 11 February 2025',
judicialGeneralOrderHearingEstimationTimeText: 'Estimated length of hearing is 30 minutes',
judicialGOHearingDirections: 'test',
judicialHearingGeneralOrderHearingText: 'The hearing will be held via telephone.',
judicialHearingGOHearingReqText: 'Hearing requirements Hearing loop',
judicialListForHearing: {
addlnInfoCourtStaff: 'test',
hearingPreferencesPreferredType: 'TELEPHONE',
hearingPreferredLocation: {
list_items: [
{
code: '1cfc5c6b-291c-433e-a797-539b70ddbb60',
label: 'Birmingham Civil and Family Justice Centre - Priory Courts, 33 Bull Street - B4 6DS',
},
],
value: {
code: '1cfc5c6b-291c-433e-a797-539b70ddbb60',
label: 'Birmingham Civil and Family Justice Centre - Priory Courts, 33 Bull Street - B4 6DS',
},
},
judicialSupportRequirement: [
'HEARING_LOOPS',
],
judicialTimeEstimate: 'MINUTES_30',
judicialVulnerabilityText: 'No support required with regards to vulnerability',
},
orderCourtOwnInitiativeListForHearing: {
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: '2025-02-18',
},
},
};
},
};
33 changes: 33 additions & 0 deletions src/test/functionalTests/tests/nonprod/LiPvLiP_GA_e2e_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,36 @@ Scenario('LipvLip Applicant GA creation e2e tests - Request for more info @citiz
}
}
});

Scenario('LipvLip Applicant GA creation e2e tests - List for hearing @citizenUI - @api @ga @nightly', async ({
I,
api,
}) => {
courtResponseType = 'listForHearing';
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', 'notice');

console.log('Responding to the GA as defendant');
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 change a hearing date', 'Miss Jane Doe v Sir John Doe');

console.log('Perform List for hearing as the Judge');
await api.makeOrderGA(gaID, courtResponseType);

const isDashboardServiceEnabled = await isDashboardServiceToggleEnabled();

if (isDashboardServiceEnabled) {
const notification = orderMadeGA();
await I.wait(10);
await verifyNotificationTitleAndContent(claimNumber, notification.title, notification.content);
await I.click(notification.nextSteps);
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const config = require('../../../config');
const {createAccount} = require('../../specClaimHelpers/api/idamHelper');
const LoginSteps = require('../../commonFeatures/home/steps/login');
const createGASteps = require('../../citizenFeatures/GA/steps/createGASteps');
// eslint-disable-next-line no-unused-vars

let claimRef, claimType, caseData, claimNumber;

Expand All @@ -12,7 +11,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);
Expand Down Expand Up @@ -49,6 +48,9 @@ Scenario('LipvLip Applicant GA creation tests @citizenUI @nightly - @api @ga', a

console.log('Creating change claim or defence GA app as claimant');
await createGASteps.askToChangeSubmittedGA(claimRef, 'Miss Jane Doe v Sir John Doe', 'withoutnotice');

console.log('Creating multiple applications as claimant');
await createGASteps.createMultipleApplications(claimRef, 'Miss Jane Doe v Sir John Doe', 'consent');
}
});

Expand Down Expand Up @@ -76,4 +78,4 @@ Scenario('LipvLip Defendant GA creation tests @citizenUI @nightly - @api @ga', a
console.log('Creating not on list GA app as defendant');
await createGASteps.askSomethingNotOnListGA(claimRef, 'Miss Jane Doe v Sir John Doe', 'withoutnotice');
}
});
});