Skip to content

Commit

Permalink
SSCSSI-207 update not listable (#1662)
Browse files Browse the repository at this point in the history
* Added test for Listing Error event and updating verifyPageContent method.

* Added test for Listing Error event and updating verifyPageContent method.

* Update config.ts

* Update listing-error.spec.ts

* SSCSSI-278: Evidence Reminder case tests (#1571)

* Add initial tests

* Update tests for evidence reminder

* Update tests for evidence reminder

* Update steps for evidence reminder

* Fix conflict

* Fix conflicts

* Readd URLs

* functional-test/pages/common/homePage.ts

---------

Co-authored-by: gokul-sol <gokul.sridharan@HMCTS.NET>

* Adding Not listable and Update not listable case tests.

* Updating Not listable and Update not listable case test suite.

---------

Co-authored-by: pats-john <13101669+pats-john@users.noreply.github.com>
Co-authored-by: Derin Aya <106395889+derin-aya@users.noreply.github.com>
Co-authored-by: gokul-sol <gokul.sridharan@HMCTS.NET>
  • Loading branch information
4 people committed Jul 24, 2024
1 parent aa3ea24 commit 49aaeb2
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 4 deletions.
49 changes: 49 additions & 0 deletions functional-test/e2e/update-not-listable.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {test} from "../lib/steps.factory";



test.describe("Update Not listable tests", {tag: '@WIP'}, async() => {

//Happy Path Test
test("Not listable test - Set case to Not listable", async ({updateNotListableSteps}) => {
test.slow();
await updateNotListableSteps.performNotListableEvent();
});

//Test for Error Messages
test("Not listable test - Not listable error message test", async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.verifyNotListableErrorMessages()
})

test("Update Not listable test - Directions fulfilled case ready to list",async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionFulfilled();
})

test("Update Not Listable test - Directions not fulfilled - New Due Date Assigned", async({updateNotListableSteps}) =>{
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionNotFulfilledNewDueDate();
})

test("Update Not listable test - Directions not fulfilled - Case moves to ready to list",async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionNotFulfilledReadyToList();
})

test("Update Not listable test - Directions not fulfilled - Case moves to With FTA",async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionNotFulfilledWithFTA();
})

test("Update Not listable test - Directions not fulfilled - Interlocutory Review (TCW)",async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionNotFulfilledTCW()
})

test("Update Not listable test - Directions not fulfilled - Interlocutory Review (Judge)",async({updateNotListableSteps})=> {
test.slow();
await updateNotListableSteps.performUpdateNotListableDirectionNotFulfilledJudge()
})

});
10 changes: 7 additions & 3 deletions functional-test/fixtures/steps/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ import { updateOtherPartyDataPage } from '../../pages/update.other.party.data.pa
import { SendCaseToTcwPage } from '../../pages/send.case.to.tcw.page';
import {WriteFinalDecisionPages} from "../../pages/write.final.decision.page";
import {SendToInterlocPrevalidPage} from "../../pages/send.to.interloc.prevalid.page";

import {NotListablePage} from "../../pages/not.listable.page";
import {UpdateNotListablePage} from "../../pages/update.not.listable.page";

export abstract class BaseStep {

Expand Down Expand Up @@ -103,9 +104,10 @@ export abstract class BaseStep {
protected sendCaseToTcwPage: SendCaseToTcwPage;
protected writeFinalDecisionPage : WriteFinalDecisionPages;
protected sendToInterlocPrevalidPage : SendToInterlocPrevalidPage;
protected notListablePage: NotListablePage;
protected updateNotListablePage: UpdateNotListablePage;


constructor(page: Page) {
constructor(page: Page) {
this.page = page;
this.loginPage = new LoginPage(this.page);
this.homePage = new HomePage(this.page);
Expand Down Expand Up @@ -156,6 +158,8 @@ export abstract class BaseStep {
this.sendCaseToTcwPage = new SendCaseToTcwPage(this.page);
this.writeFinalDecisionPage = new WriteFinalDecisionPages(page);
this.sendToInterlocPrevalidPage = new SendToInterlocPrevalidPage(page);
this.notListablePage = new NotListablePage(this.page);
this.updateNotListablePage = new UpdateNotListablePage(this.page);
}

async loginUserWithCaseId(user, clearCacheFlag: boolean = false, caseId?: string) {
Expand Down
150 changes: 150 additions & 0 deletions functional-test/fixtures/steps/update.not.listable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import {BaseStep} from "./base";
import {Page} from "@playwright/test";
import createCaseBasedOnCaseType from "../../api/client/sscs/factory/appeal.type.factory";
import {credentials} from "../../config/config";
import updateNotListableData from "../../pages/content/update.not.listable_en.json";
import eventTestData from "../../pages/content/event.name.event.description_en.json";


export class UpdateNotListable extends BaseStep {

readonly page: Page;


constructor(page: Page) {
super(page);
this.page = page;
}

async performNotListableEvent() {
let pipCaseId = await createCaseBasedOnCaseType('PIP');
//Trigger Not listable event:
await this.goToNotListablePage(this.page, pipCaseId);
await this.notListablePage.verifyPageContent(); //Verifying Heading and Caption for event
//inserting data and verifying said data during the event
await this.notListablePage.enterNotListableProvideReason();
await this.notListablePage.continueEvent();

await this.notListablePage.enterValidDirectionDueDate();
await this.notListablePage.continueEvent();

await this.notListablePage.confirmSubmission();
// verifying that event has submitted successfully and details are showing in Summary and History Tabs
await this.verifyHistoryTabDetails("Not listable","Not listable")
}

//Method to verify the error messaging for Not listable.
async verifyNotListableErrorMessages(){
let pipCaseId = await createCaseBasedOnCaseType('PIP');
await this.goToNotListablePage(this.page, pipCaseId);
await this.notListablePage.verifyPageContent();
await this.notListablePage.continueEvent()
await this.notListablePage.verifyNotListableReasonError()

await this.notListablePage.enterNotListableProvideReason()
await this.notListablePage.continueEvent()

await this.notListablePage.enterInvalidDirectionDueDate()
await this.notListablePage.confirmSubmission()
await this.notListablePage.verifyPastDueDateErrorMessage()
}

async performUpdateNotListableDirectionFulfilled(){
await this.performNotListableEvent();
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.verifyPageContent();
await this.updateNotListablePage.requirementsFulfilled()
await this.updateNotListablePage.confirmSubmission()
await this.verifyHistoryTabDetails("Ready to list", "Update not listable case");
}

async performUpdateNotListableDirectionNotFulfilledReadyToList(){

await this.performNotListableEvent();
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.requirementsNotFulfilled();

//Set interlocutory review option to No
await this.updateNotListablePage.interlocutoryReviewStateNotRequired();

//Selecting NO to updating Directions Due Date
await this.updateNotListablePage.noNewDueDateRequired();

//Moving case to ready to list and confirming event success
await this.updateNotListablePage.moveCaseToReadyToList();
await this.updateNotListablePage.confirmSubmission();

await this.verifyHistoryTabDetails("Ready to list", "Update not listable case");
}

async performUpdateNotListableDirectionNotFulfilledWithFTA(){

await this.performNotListableEvent();
//Trigger Update not listable case event
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.requirementsNotFulfilled();

//Set interlocutory review option to No
await this.updateNotListablePage.interlocutoryReviewStateNotRequired()

//Selecting NO to updating Directions Due Date
await this.updateNotListablePage.noNewDueDateRequired()

//Moving case to With FTA and confirming event success
await this.updateNotListablePage.moveCaseToWithFTA();

await this.verifyHistoryTabDetails("With FTA", "Update not listable case");
}

async performUpdateNotListableDirectionNotFulfilledNewDueDate(){

await this.performNotListableEvent();
//Trigger Update not listable case event
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.requirementsNotFulfilled();

//Set interlocutory review option to No
await this.updateNotListablePage.interlocutoryReviewStateNotRequired()

//Selecting NO to updating Directions Due Date
await this.updateNotListablePage.newDueDateRequired();

await this.updateNotListablePage.confirmSubmission();

await this.verifyHistoryTabDetails("Not listable", "Update not listable case");
}

async performUpdateNotListableDirectionNotFulfilledTCW(){
await this.performNotListableEvent();
//Trigger Update not listable case event
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.requirementsNotFulfilled();

//Set interlocutory review option to Yes TCW to review.
await this.updateNotListablePage.interlocutoryReviewRequiredTCW()

await this.updateNotListablePage.confirmSubmission()

await this.verifyHistoryTabDetails("Not listable", "Update not listable case");
}

async performUpdateNotListableDirectionNotFulfilledJudge(){
await this.performNotListableEvent();
//Trigger Update not listable case event
await this.homePage.chooseEvent("Update not listable case");
await this.updateNotListablePage.requirementsNotFulfilled();

//Set interlocutory review option to Yes Judge to review.
await this.updateNotListablePage.interlocutoryReviewRequiredJudge()

await this.updateNotListablePage.confirmSubmission()

await this.verifyHistoryTabDetails("Not listable", "Update not listable case");
}

private async goToNotListablePage(page: Page, caseId: string) {
await this.loginUserWithCaseId(credentials.amCaseWorker, true, caseId);
await this.homePage.chooseEvent("Not listable");
}

}
8 changes: 7 additions & 1 deletion functional-test/lib/steps.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import { UpdateSubscription } from '../fixtures/steps/update.subscription'
import { UpdateOtherPartyData } from '../fixtures/steps/update.other.party.data';
import {IssueDirectionsNotice} from "../fixtures/steps/issue.directions.notice";
import {WriteFinalDecision} from "../fixtures/steps/write.final.decision";

import {UpdateNotListable} from "../fixtures/steps/update.not.listable";
import {use} from "chai";


type MyStepsFixtures = {
Expand Down Expand Up @@ -81,6 +82,7 @@ type MyStepsFixtures = {
processAVEvidenceSteps: ProcessAVEvidence
updateOtherPartyDataSteps: UpdateOtherPartyData
issueFinalDecisionSteps: WriteFinalDecision
updateNotListableSteps: UpdateNotListable
};

export const test = stepsFactory.extend<MyStepsFixtures>({
Expand Down Expand Up @@ -239,6 +241,10 @@ export const test = stepsFactory.extend<MyStepsFixtures>({
updateOtherPartyDataSteps: async ({ page }, use) => {
const updateOtherPartyDataSteps = new UpdateOtherPartyData(page);
await use(updateOtherPartyDataSteps);
},
updateNotListableSteps: async ({page}, use)=>{
const updateNotListableSteps = new UpdateNotListable(page);
await use(updateNotListableSteps);
}

})
9 changes: 9 additions & 0 deletions functional-test/pages/content/update.not.listable_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"notListableEventCaption": "Not listable",
"notListableEventHeading": "Reasons",
"notListableReasonsErrorMessage": "Reason(s) for the case being unlistable is required",
"notListablePastDueDataErrorMessage": "Directions due date must be in the future",
"notListableProvideReasons": "Test Reason(s) for the case being not listable is required",
"updateNotListableEventCaption": "Update not listable case",
"updateNotListableEventHeading": "Directions fulfilled"
}
71 changes: 71 additions & 0 deletions functional-test/pages/not.listable.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {WebAction} from "../common/web.action";
import {Page} from "@playwright/test";
import updatenotListableData from "./content/update.not.listable_en.json";
import eventTestData from "./content/event.name.event.description_en.json";

let webActions: WebAction;

export class NotListablePage {

readonly page: Page;

constructor(page: Page) {
this.page = page;
webActions = new WebAction(this.page);
}

async verifyPageContent() {
await webActions.verifyPageLabel('.govuk-caption-l', updatenotListableData.notListableEventCaption); //Caption Text
await webActions.verifyPageLabel('.govuk-heading-l', updatenotListableData.notListableEventHeading); //Heading Text
}

async enterNotListableProvideReason(){
await webActions.inputField('#notListableProvideReasons',updatenotListableData.notListableProvideReasons);
}


async enterValidDirectionDueDate() {
await webActions.inputField('#notListableDueDate-day', '21');
await webActions.inputField('#notListableDueDate-month', '12');
await webActions.inputField('#notListableDueDate-year', '2025');
await this.page.getByText('Continue').click();
}

async enterInvalidDirectionDueDate() {
await webActions.inputField('#notListableDueDate-day', '01');
await webActions.inputField('#notListableDueDate-month', '02');
await webActions.inputField('#notListableDueDate-year', '2024');
await this.page.getByText('Continue').click()
}

async verifyPastDueDateErrorMessage(){
this.page.getByText(updatenotListableData.notListablePastDueDataErrorMessage)
}

async verifyNotListableReasonError(){
await webActions.verifyPageLabel('.validation-error', updatenotListableData.notListableReasonsErrorMessage);
}

async verifyCheckYourAnswersPage(){
await webActions.verifyTextVisibility('Test Reason(s) for the case being not listable is required');
await webActions.verifyTextVisibility('21 Dec 2025');
}

async insertEventSummaryAndDescription(){
await webActions.inputField('#field-trigger-summary',eventTestData.eventSummaryInput)
await webActions.inputField('#field-trigger-description',eventTestData.eventDescriptionInput)
}

async confirmSubmission(): Promise<void> {
await this.page.waitForTimeout(3000);
await this.page.getByText('Submit').dblclick();
await this.page.waitForLoadState("domcontentloaded");
}

async continueEvent(): Promise<void> {
await this.page.waitForTimeout(3000);
await this.page.getByText('Continue').click();

}

}
Loading

0 comments on commit 49aaeb2

Please sign in to comment.