diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 90af9c72af..aa98c0d2e0 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -25,8 +25,14 @@ def secrets = [ secret('test-e2e-hmc-caseofficer-password', 'TEST_HMC_CASEOFFICER_PASSWORD'), secret('test-e2e-judge-username', 'TEST_JUDGE_USERNAME'), secret('test-e2e-judge-password', 'TEST_JUDGE_PASSWORD'), + secret('test-e2e-salaried-judge-username', 'TEST_SALARIED_JUDGE_USERNAME'), + secret('test-e2e-salaried-judge-password', 'TEST_SALARIED_JUDGE_PASSWORD'), + secret('test-e2e-fee-paid-judge-username', 'TEST_FEE_PAID_JUDGE_USERNAME'), + secret('test-e2e-fee-paid-judge-password', 'TEST_FEE_PAID_JUDGE_PASSWORD'), secret('test-e2e-dwp-username', 'TEST_DWP_USERNAME'), secret('test-e2e-dwp-password', 'TEST_DWP_PASSWORD'), + secret('test-e2e-am-tcw-username', 'TEST_AM_TRIBUNAL_CASEWORKER_USERNAME'), + secret('test-e2e-am-tcw-password', 'TEST_AM_TRIBUNAL_CASEWORKER_PASSWORD'), secret('test-e2e-am-caseofficer-case-allocator-username', 'TEST_AM_CASEOFFICER_CASE_ALLOCATOR_USERNAME'), secret('test-e2e-am-caseofficer-case-allocator-password', 'TEST_AM_CASEOFFICER_CASE_ALLOCATOR_PASSWORD'), secret('test-e2e-hmrc-username', 'TEST_HMRC_USERNAME'), diff --git a/functional-test/config/config.ts b/functional-test/config/config.ts index b672526861..bc68d49216 100644 --- a/functional-test/config/config.ts +++ b/functional-test/config/config.ts @@ -47,6 +47,18 @@ export const credentials = { email: process.env.SENIOR_JUDGE_USERNAME, password: process.env.SENIOR_JUDGE_PASSWORD, }, + salariedJudge: { + email: process.env.TEST_SALARIED_JUDGE_USERNAME, + password: process.env.TEST_SALARIED_JUDGE_PASSWORD + }, + feePaidJudge: { + email: process.env.TEST_FEE_PAID_JUDGE_USERNAME, + password: process.env.TEST_FEE_PAID_JUDGE_PASSWORD + }, + amTribunalCaseWorker: { + email: process.env.TEST_AM_TRIBUNAL_CASEWORKER_USERNAME, + password: process.env.TEST_AM_TRIBUNAL_CASEWORKER_PASSWORD + }, respondent: { email: process.env.RESPONDENT_USERNAME, password: process.env.RESPONDENT_PASSWORD, diff --git a/functional-test/e2e/reinstatement.spec.ts b/functional-test/e2e/reinstatement.spec.ts index 7205efabe1..b57db6ea53 100644 --- a/functional-test/e2e/reinstatement.spec.ts +++ b/functional-test/e2e/reinstatement.spec.ts @@ -1,20 +1,204 @@ import { test } from "../lib/steps.factory"; import createCaseBasedOnCaseType from "../api/client/sscs/factory/appeal.type.factory"; +import performAppealDormantOnCase from "../api/client/sscs/appeal.event"; -let caseId : string; +test.describe('Reinstatement request tests', async() => { + let caseId : string; -test.beforeEach("Case has to be Created", async () => { - caseId = await createCaseBasedOnCaseType('PIP'); -}); + test.beforeEach("Case has to be Created", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); -test("Grant - Reinstatement request", async ({ reinstatementSteps }) => { - await reinstatementSteps.requestAndGrantAnReinstatement(caseId); -}); + test("Grant - Reinstatement request", async ({ reinstatementSteps }) => { + await reinstatementSteps.requestAndGrantAnReinstatement(caseId); + }); -test("Refuse - Reinstatement request", async ({ reinstatementSteps }) => { - await reinstatementSteps.requestAndRefuseAnReinstatement(caseId); -}); + test("Refuse - Reinstatement request", async ({ reinstatementSteps }) => { + await reinstatementSteps.requestAndRefuseAnReinstatement(caseId); + }); - test.afterAll("Case has to be set to Dormant",async () => { - // await performAppealDormantOnCase(caseId); - }); \ No newline at end of file + test.afterAll("Case has to be set to Dormant",async () => { + // await performAppealDormantOnCase(caseId); + }); +}), + + + +test.describe.serial('WA - Review Reinstatement Request Judge task initiation and completion tests by Salaried Judge', { + tag: '@work-allocation' +}, async() => { + + let caseId : string; + + test.beforeAll("Create case", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); + + test("Grant Reinstatement request", async ({ reinstatementSteps }) => { + test.slow(); + await reinstatementSteps.requestAndGrantAnReinstatement(caseId); + }); + + test("As a Salaried Judge, view the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test("As a Salaried Judge, complete the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanCompleteTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test.afterAll("Case has to be set to Dormant", async () => { + await performAppealDormantOnCase(caseId); + }); +}) + + +test.describe.serial('WA - Review Reinstatement Request Judge task initiation and completion tests by Fee-Paid Judge', { + tag: '@work-allocation' +}, async() => { + + let caseId : string; + + test.beforeAll("Create case", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); + + test("Refuse Reinstatement request", async ({ reinstatementSteps }) => { + test.slow(); + await reinstatementSteps.requestAndRefuseAnReinstatement(caseId); + }); + + test("As a Fee-Paid Judge, view the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifyFeePaidJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test("As a Fee-Paid Judge, complete the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifyFeePaidJudgeCanCompleteTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test.afterAll("Case has to be set to Dormant", async () => { + await performAppealDormantOnCase(caseId); + }); +}) + + +test.describe.serial('WA - Review Reinstatement Request Judge task - Reassign to TCW tests', { + tag: '@work-allocation' +}, async() => { + + let caseId : string; + + test.beforeAll("Create case", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); + + test("Refuse Reinstatement request", async ({ reinstatementSteps }) => { + test.slow(); + await reinstatementSteps.requestAndRefuseAnReinstatement(caseId); + }); + + test("As a Judge, view the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test("As a Judge, assign the Review Reinstatement Request task to Tribunal Caseworker", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanReassignTheReviewReinstatementRequestTaskToTcw(caseId); + }); + + test("As a Tribunal Caseworker, complete the Review Reinstatement Request task ", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifyTcwCanCompleteTheAssignedReviewReinstatementRequestTask(caseId); + }); + + test.afterAll("Case has to be set to Dormant", async () => { + await performAppealDormantOnCase(caseId); + }); +}) + +test.describe.serial('WA - Judge completes Review Reinstatement Request task manually', { + tag: '@work-allocation' +}, async() => { + + let caseId : string; + + test.beforeAll("Create case", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); + + test("Grant Reinstatement request", async ({ reinstatementSteps }) => { + test.slow(); + await reinstatementSteps.requestAndGrantAnReinstatement(caseId); + }); + + test("As a Judge, view the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId); + }); + + test("As a Judge, complete the Review Reinstatement Request task manually", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanCompleteTheReviewReinstatementRequestTaskManually(caseId); + }); + + test.afterAll("Case has to be set to Dormant", async () => { + await performAppealDormantOnCase(caseId); + }); +}) + +test.describe.serial('WA - Review Reinstatement Request Judge task automatic cancellation when case is void', { + tag: '@work-allocation' +}, async() => { + + let caseId : string; + + test.beforeAll("Create case", async () => { + caseId = await createCaseBasedOnCaseType('PIP'); + }); + + test("Refuse Reinstatement request", async ({ reinstatementSteps }) => { + test.slow(); + await reinstatementSteps.requestAndRefuseAnReinstatement(caseId); + }); + + test("As a Judge, view the Review Reinstatement Request - Judge task", async ({ + reinstatementSteps }) => { + + test.slow(); + await reinstatementSteps.verifySalariedJudgeCanViewAndSelfAssignTheReviewReinstatementRequestTask(caseId); + }); + + test("Review Reinstatement Request - Judge task is cancelled automatically when case is void", async ({ + reinstatementSteps}) => { + + test.slow(); + await reinstatementSteps.verifyReviewReinstatementRequestTaskIsCancelledAutomaticallyWhenTheCaseIsVoid(caseId); + }); + + test.afterAll("Case has to be set to Dormant", async () => { + await performAppealDormantOnCase(caseId); + }); +}); \ No newline at end of file diff --git a/functional-test/fixtures/steps/base.ts b/functional-test/fixtures/steps/base.ts index 443c4668c6..df5dff9901 100644 --- a/functional-test/fixtures/steps/base.ts +++ b/functional-test/fixtures/steps/base.ts @@ -36,6 +36,7 @@ import { SupplementaryResponsePage } from "../../pages/supplementary.response.pa import { UploadDocumentFurtherEvidencePage } from '../../pages/upload.document.further.evidence.page'; import { UpdateLanguagePreferencePage } from '../../pages/update.language.preference.page'; import { Welsh } from '../../pages/tabs/welsh'; +import { AmendInterlocReviewStatePage } from '../../pages/amend.interloc.review.state.page'; import { ReviewPHEPage } from '../../pages/review.phe.page'; import { ListingRequirements } from '../../pages/tabs/listing.requirements'; import { UpdateUCBPage } from '../../pages/update.ucb.page'; @@ -81,6 +82,7 @@ export abstract class BaseStep { protected supplementaryResponsePage: SupplementaryResponsePage; protected uploadDocumentFurtherEvidencePage: UploadDocumentFurtherEvidencePage; protected updateLanguagePreferencePage: UpdateLanguagePreferencePage; + protected amendInterlocReviewStatePage: AmendInterlocReviewStatePage; protected reviewPHEPage: ReviewPHEPage; protected listingRequirementsTab: ListingRequirements; protected updateUCBPage: UpdateUCBPage; @@ -125,6 +127,7 @@ export abstract class BaseStep { this.supplementaryResponsePage = new SupplementaryResponsePage(this.page); this.uploadDocumentFurtherEvidencePage = new UploadDocumentFurtherEvidencePage(this.page); this.updateLanguagePreferencePage = new UpdateLanguagePreferencePage(this.page); + this.amendInterlocReviewStatePage = new AmendInterlocReviewStatePage(this.page); this.reviewPHEPage = new ReviewPHEPage(this.page); this.listingRequirementsTab = new ListingRequirements(this.page); this.updateUCBPage = new UpdateUCBPage(this.page); diff --git a/functional-test/fixtures/steps/reinstatement.ts b/functional-test/fixtures/steps/reinstatement.ts index 4047146e25..c542cbaa25 100644 --- a/functional-test/fixtures/steps/reinstatement.ts +++ b/functional-test/fixtures/steps/reinstatement.ts @@ -1,6 +1,11 @@ import { BaseStep } from "./base"; -import { Page } from '@playwright/test'; -import {credentials} from "../../config/config"; +import { expect, Page } from '@playwright/test'; +import { credentials } from "../../config/config"; +import task from '../../pages/content/review.reinstatement.request.task_en.json'; +import amendInterlocReviewStateData from "../../pages/content/amend.interloc.review.state_en.json"; +import dateUtilsComponent from '../../utils/DateUtilsComponent'; +import { SendToAdmin } from "./send.to.admin"; +import { VoidCase } from "./void.case"; const actionFurtherEvidenceTestdata = require('../../pages/content/action.further.evidence_en.json'); const issueDirectionTestdata = require('../../pages/content/issue.direction_en.json'); @@ -27,14 +32,14 @@ export class Reinstatement extends BaseStep { ); await this.eventNameAndDescriptionPage.verifyPageContent(actionFurtherEvidenceTestdata.eventName); await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.eventNameAndDescriptionPage.confirmSubmission(); + await expect(this.homePage.summaryTab).toBeVisible(); + await this.homePage.delay(3000); await this.homePage.navigateToTab("Appeal Details"); await this.appealDetailsTab.verifydueDates('Reinstatement Registered'); await this.appealDetailsTab.verifyAppealDetailsPageContentByKeyValue('Reinstatement Outcome', 'In progress'); await this.verifyHistoryTabDetails('With FTA', 'Issue further evidence'); await this.historyTab.verifyPageContentByKeyValue('Interlocutory review state', 'Review by Judge'); - await this.homePage.reloadPage(); await this.loginUserWithCaseId(credentials.judge, true, caseId); await this.homePage.chooseEvent(issueDirectionTestdata.eventNameCaptor); @@ -46,6 +51,8 @@ export class Reinstatement extends BaseStep { ); await this.eventNameAndDescriptionPage.verifyPageContent(issueDirectionTestdata.eventNameCaptor); await this.eventNameAndDescriptionPage.confirmSubmission(); + await expect(this.homePage.summaryTab).toBeVisible(); + await this.homePage.delay(3000); await this.homePage.navigateToTab("Appeal Details"); await this.appealDetailsTab.verifydueDates('Reinstatement Registered'); @@ -68,14 +75,14 @@ export class Reinstatement extends BaseStep { await this.eventNameAndDescriptionPage.verifyPageContent(actionFurtherEvidenceTestdata.eventName); await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.eventNameAndDescriptionPage.confirmSubmission(); + await expect(this.homePage.summaryTab).toBeVisible(); + await this.homePage.delay(3000); await this.homePage.navigateToTab("Appeal Details"); await this.appealDetailsTab.verifydueDates('Reinstatement Registered'); await this.appealDetailsTab.verifyAppealDetailsPageContentByKeyValue('Reinstatement Outcome', 'In progress'); await this.verifyHistoryTabDetails('With FTA', 'Issue further evidence'); await this.historyTab.verifyPageContentByKeyValue('Interlocutory review state', 'Review by Judge'); - await this.homePage.reloadPage(); await this.loginUserWithCaseId(credentials.judge, true, caseId); await this.homePage.chooseEvent(issueDirectionTestdata.eventNameCaptor); @@ -87,10 +94,149 @@ export class Reinstatement extends BaseStep { ); await this.eventNameAndDescriptionPage.verifyPageContent(issueDirectionTestdata.eventNameCaptor); await this.eventNameAndDescriptionPage.confirmSubmission(); + await expect(this.homePage.summaryTab).toBeVisible(); + await this.homePage.delay(3000); await this.homePage.navigateToTab("Appeal Details"); await this.appealDetailsTab.verifydueDates('Reinstatement Registered'); await this.appealDetailsTab.verifyAppealDetailsPageContentByKeyValue('Reinstatement Outcome', 'Refused'); await this.verifyHistoryTabDetails('With FTA', 'Issue directions notice'); } + + async verifySalariedJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Review Reinstatement Request - Judge task is displayed to the Salaried Judge + await this.loginUserWithCaseId(credentials.salariedJudge, false, caseId); + await this.homePage.navigateToTab('Tasks'); + await this.tasksTab.verifyTaskIsDisplayed(task.name); + await this.tasksTab.verifyPageContentByKeyValue(task.name, + 'Task created', dateUtilsComponent.formatDateToSpecifiedDateFormat(new Date())); + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToWhenNotAssigned); + await this.tasksTab.verifyManageOptions(task.name, task.unassignedManageOptions); + } + + async verifySalariedJudgeCanCompleteTheUnassignedReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Salaried Judge self assigns the task + await this.loginUserWithCaseId(credentials.salariedJudge, true, caseId); + await this.homePage.navigateToTab('Tasks'); + await this.tasksTab.selfAssignTask(task.name); + + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToSalariedJudge); + await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForSalariedJudge); + await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions); + + // Select Action Further Evidence next step and complete the event + await this.tasksTab.clickNextStepLink(task.sendToAdmin.link); + + let sendToAdmin = new SendToAdmin(this.page); + await sendToAdmin.comepleteSendToAdmin(); + + // Verify task is removed from the tasks list within Tasks tab + await this.tasksTab.verifyTaskIsHidden(task.name); + } + + async verifySalariedJudgeCanReassignTheReviewReinstatementRequestTaskToTcw(caseId: string): Promise { + + // Verify Salaried Judge self assigns the task + await this.loginUserWithCaseId(credentials.salariedJudge, true, caseId); + await this.homePage.navigateToTab('Tasks'); + // await this.tasksTab.verifyTaskIsDisplayed(task.name); + await this.tasksTab.selfAssignTask(task.name); + + await this.tasksTab.reassignTaskToTcwUser(task.name, credentials.amTribunalCaseWorker.email); + } + + async verifyFeePaidJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Review Reinstatement Request - Judge task is displayed to the Salaried Judge + await this.loginUserWithCaseId(credentials.feePaidJudge, false, caseId); + await this.homePage.navigateToTab('Tasks'); + await this.tasksTab.verifyTaskIsDisplayed(task.name); + await this.tasksTab.verifyPageContentByKeyValue(task.name, + 'Task created', dateUtilsComponent.formatDateToSpecifiedDateFormat(new Date())); + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToWhenNotAssigned); + await this.tasksTab.verifyManageOptions(task.name, task.unassignedManageOptions); + } + + async verifyFeePaidJudgeCanCompleteTheUnassignedReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Salaried Judge self assigns the task + await this.loginUserWithCaseId(credentials.feePaidJudge, true, caseId); + await this.homePage.navigateToTab('Tasks'); + await this.tasksTab.selfAssignTask(task.name); + + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToFeePaidJudge); + await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForFeePaidJudge); + await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions); + + // Select Action Further Evidence next step and complete the event + await this.tasksTab.clickNextStepLink(task.sendToAdmin.link); + + let sendToAdmin = new SendToAdmin(this.page); + await sendToAdmin.comepleteSendToAdmin(); + + // Verify task is removed from the tasks list within Tasks tab + await this.tasksTab.verifyTaskIsHidden(task.name); + } + + async verifyTcwCanCompleteTheAssignedReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Salaried Judge self assigns the task + await this.loginUserWithCaseId(credentials.amTribunalCaseWorker, false, caseId); + await this.homePage.navigateToTab('Tasks'); + + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToTCW); + await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForTCW); + await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions); + + // Select Action Further Evidence next step and complete the event + await this.tasksTab.clickNextStepLink(task.amendInterlocReviewState.link); + + await this.amendInterlocReviewStatePage.verifyPageContent(); + await this.amendInterlocReviewStatePage.selectReviewState(amendInterlocReviewStateData.interlocReviewStateSelectValue); + await this.amendInterlocReviewStatePage.confirmSelection(); + await this.amendInterlocReviewStatePage.confirmSubmission(); + + // Verify task is removed from the tasks list within Tasks tab + await this.tasksTab.verifyTaskIsHidden(task.name); + } + + async verifySalariedJudgeCanCompleteTheReviewReinstatementRequestTaskManually(caseId: string): Promise { + + // Verify Salaried Judge self assigns the task + await this.loginUserWithCaseId(credentials.salariedJudge, false, caseId); + await this.homePage.navigateToTab('Tasks'); + await this.tasksTab.selfAssignTask(task.name); + + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToSalariedJudge); + await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForSalariedJudge); + await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions); + + // Judge selects to mark the task as done + await this.tasksTab.markTheTaskAsDone(task.name); + + // Verify task is removed from the tasks list within Tasks tab + await this.tasksTab.verifyTaskIsHidden(task.name); + } + + async verifySalariedJudgeCanViewAndSelfAssignTheReviewReinstatementRequestTask(caseId: string): Promise { + + // Verify Review Reinstatement Request - Judge task is displayed to the Salaried Judge + await this.verifySalariedJudgeCanViewTheUnassignedReviewReinstatementRequestTask(caseId); + await this.tasksTab.selfAssignTask(task.name); + await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToSalariedJudge); + await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForSalariedJudge); + await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions); + } + + async verifyReviewReinstatementRequestTaskIsCancelledAutomaticallyWhenTheCaseIsVoid(caseId: string): Promise { + + // CTSC Admin voids the case + let voidCase = new VoidCase(this.page); + await voidCase.performVoidCase(caseId); + + // Verify task is removed from the tasks list within Tasks tab + await this.tasksTab.verifyTaskIsHidden(task.name); + } } diff --git a/functional-test/fixtures/steps/send.to.admin.ts b/functional-test/fixtures/steps/send.to.admin.ts index 8a6b62a065..7d2ee4e029 100644 --- a/functional-test/fixtures/steps/send.to.admin.ts +++ b/functional-test/fixtures/steps/send.to.admin.ts @@ -1,8 +1,7 @@ -import {Page} from '@playwright/test'; -import {BaseStep} from './base'; -import {credentials} from "../../config/config"; - -const sendToAdminData = require("../../pages/content/send.to.admin_en.json"); +import { expect, Page } from '@playwright/test'; +import { BaseStep } from './base'; +import { credentials } from '../../config/config'; +import sendToAdminData from '../../pages/content/send.to.admin_en.json'; const eventTestData = require("../../pages/content/event.name.event.description_en.json"); @@ -10,7 +9,6 @@ export class SendToAdmin extends BaseStep { readonly page: Page; - constructor(page: Page) { super(page); this.page = page; @@ -23,6 +21,10 @@ export class SendToAdmin extends BaseStep { await this.homePage.chooseEvent('Send to admin'); //await this.homePage.waitForLoadState(); + await this.comepleteSendToAdmin(); + } + + async comepleteSendToAdmin() { //Params are passed to this page as this is a common page to be reused. await this.textAreaPage.verifyPageContent(sendToAdminData.sendToAdminCaption, sendToAdminData.sendToAdminHeading, @@ -37,7 +39,8 @@ export class SendToAdmin extends BaseStep { eventTestData.eventDescriptionInput); await this.eventNameAndDescriptionPage.confirmSubmission(); + await expect(this.homePage.summaryTab).toBeVisible(); + await this.homePage.delay(3000); await this.verifyHistoryTabDetails('With FTA', 'Send to admin', 'Event Description for Automation Verification'); } - } diff --git a/functional-test/fixtures/steps/urgent.hearing.ts b/functional-test/fixtures/steps/urgent.hearing.ts index 9e0840ae79..d6f24252e1 100644 --- a/functional-test/fixtures/steps/urgent.hearing.ts +++ b/functional-test/fixtures/steps/urgent.hearing.ts @@ -28,8 +28,6 @@ export class UrgentHearing extends BaseStep { ); await this.eventNameAndDescriptionPage.verifyPageContent(actionFurtherEvidenceTestdata.eventName); await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.summaryTab.verifyPageContentByKeyValue('Urgent case', 'Yes'); @@ -72,8 +70,6 @@ export class UrgentHearing extends BaseStep { await this.eventNameAndDescriptionPage.verifyPageContent(actionFurtherEvidenceTestdata.eventName); await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.eventNameAndDescriptionPage.confirmSubmission(); - await this.summaryTab.verifyPageContentByKeyValue('Urgent case', 'Yes'); @@ -118,5 +114,4 @@ export class UrgentHearing extends BaseStep { await this.actionFurtherEvidencePage.uploadDocs(actionFurtherEvidenceTestdata.corruptedFile); await this.actionFurtherEvidencePage.verifyEncryptedFileErrorMsg(); } - } diff --git a/functional-test/pages/action.further.evidence.page.ts b/functional-test/pages/action.further.evidence.page.ts index c03a916741..2373b50e51 100644 --- a/functional-test/pages/action.further.evidence.page.ts +++ b/functional-test/pages/action.further.evidence.page.ts @@ -1,5 +1,5 @@ -import {Page} from '@playwright/test'; -import {WebAction} from '../common/web.action'; +import { expect, Page } from '@playwright/test'; +import { WebAction } from '../common/web.action'; let webActions: WebAction; @@ -41,10 +41,12 @@ export class ActionFurtherEvidencePage { await webActions.inputField('#scannedDate-day', '21'); await webActions.inputField('#scannedDate-month', '1'); await webActions.inputField('#scannedDate-year', '2021'); + await this.page.locator('#scannedDate').click(); + await expect(this.page.locator('#scannedDate span.error-message')).toBeHidden(); } async selectbundle() { - await webActions.clickElementById("#scannedDocuments_0_includeInBundle_Yes"); + await webActions.clickElementById('label[for=\'scannedDocuments_0_includeInBundle_Yes\']'); } async confirmSubmission(): Promise { diff --git a/functional-test/pages/amend.interloc.review.state.page.ts b/functional-test/pages/amend.interloc.review.state.page.ts new file mode 100644 index 0000000000..e12eaeb5d6 --- /dev/null +++ b/functional-test/pages/amend.interloc.review.state.page.ts @@ -0,0 +1,34 @@ +import { Page, expect } from '@playwright/test'; +import { WebAction } from '../common/web.action'; +import amendInterlocReviewStateData from "./content/amend.interloc.review.state_en.json"; + +let webAction: WebAction; + +export class AmendInterlocReviewStatePage { + + readonly page: Page; + + constructor(page: Page) { + this.page = page; + webAction = new WebAction(this.page); + } + + async verifyPageContent() { + await webAction.verifyPageLabel('span.govuk-caption-l', amendInterlocReviewStateData.caption); //Captor Text + await webAction.verifyPageLabel('h1.govuk-heading-l', amendInterlocReviewStateData.heading); //Heading Text + await webAction.verifyPageLabel('label[for="interlocReviewState"]', amendInterlocReviewStateData.interlocReviewStateDropdownLabel); //Field Label + } + + async selectReviewState(option: string): Promise { + await webAction.chooseOptionByLabel('#interlocReviewState', option); + } + + async confirmSelection(): Promise { + await webAction.clickButton('Submit'); + await expect(this.page.locator('#interlocReviewState')).toBeHidden(); + } + + async confirmSubmission(): Promise { + await webAction.clickButton('Submit'); + } +} \ No newline at end of file diff --git a/functional-test/pages/common/event.name.event.description.ts b/functional-test/pages/common/event.name.event.description.ts index 9c6fb273a8..c1bfd42731 100644 --- a/functional-test/pages/common/event.name.event.description.ts +++ b/functional-test/pages/common/event.name.event.description.ts @@ -19,7 +19,7 @@ export class EventNameEventDescriptionPage { await webActions.verifyPageLabel('.govuk-heading-l', headingValue); //Heading Text if (checkYourAnswersFlag) { await webActions.verifyPageLabel('.heading-h2', eventTestData.eventSummarycheckYourAnswersHeading); //Check your answers Text. - await webActions.verifyPageLabel('.check-your-answers > .text-16', eventTestData.eventSummaryCheckTheInformationText); + await webActions.verifyPageLabel('.check-your-answers h2.heading-h2 + span', eventTestData.eventSummaryCheckTheInformationText); await webActions.verifyPageLabel('.case-field-label > .text-16', key); if (typeof (value) === 'undefined') { } else { diff --git a/functional-test/pages/common/homePage.ts b/functional-test/pages/common/homePage.ts index 6329309d84..20bf6f43b8 100644 --- a/functional-test/pages/common/homePage.ts +++ b/functional-test/pages/common/homePage.ts @@ -62,6 +62,7 @@ export class HomePage { async goToHomePage(caseId: string): Promise { // await this.page.goto(`/cases/case-details/${caseId}`); + await this.selectToViewTasksAndCasesIfRequired(); await webActions.inputField('#caseReference', caseId); await this.delay(1000); await webActions.clickFindButton(); @@ -95,6 +96,14 @@ export class HomePage { await webActions.clickElementById('li a.hmcts-header__navigation-link'); } + async selectToViewTasksAndCasesIfRequired() { + expect(await this.page.locator('h1').count()).toBeGreaterThanOrEqual(1); + let headerText = await this.page.locator('h1').first().textContent(); + if(headerText.toLowerCase().includes('work access')) { + await this.page.getByRole('radio', { name: 'View tasks and cases' }).click(); + await this.page.getByRole('button', { name: 'Continue' }).click(); + } + } async navigateToTab(tabName : string): Promise { switch(tabName) { diff --git a/functional-test/pages/content/amend.interloc.review.state_en.json b/functional-test/pages/content/amend.interloc.review.state_en.json new file mode 100644 index 0000000000..1719c91bbd --- /dev/null +++ b/functional-test/pages/content/amend.interloc.review.state_en.json @@ -0,0 +1,6 @@ +{ + "caption": "Amend interloc review state", + "heading": "Amend interloc review state", + "interlocReviewStateDropdownLabel": "Interlocutory review state", + "interlocReviewStateSelectValue": "Awaiting Information" +} \ No newline at end of file diff --git a/functional-test/pages/content/assign.task_en.json b/functional-test/pages/content/assign.task_en.json deleted file mode 100644 index b73d873fe9..0000000000 --- a/functional-test/pages/content/assign.task_en.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "assign-task-caption" : "Assign task", - "assign-task-role-type-heading" : "Choose a role type", - "assign-task-find-person-heading" : "Find person", - "assign-task-role-type-form-label" : "Which role type are you assigning the task to?", - "assign-task-role-type-judicial-label" : "Judicial", - "assign-task-role-type-legal-ops-label" : "Legal Ops", - "assign-task-role-type-admin-label" : "Admin", - "assign-task-role-type-ctsc-label" : "CTSC" -} \ No newline at end of file diff --git a/functional-test/pages/content/review.reinstatement.request.task_en.json b/functional-test/pages/content/review.reinstatement.request.task_en.json new file mode 100644 index 0000000000..cafef9ebe2 --- /dev/null +++ b/functional-test/pages/content/review.reinstatement.request.task_en.json @@ -0,0 +1,57 @@ +{ + "name": "Review Reinstatement Request - Judge", + "assignedToWhenNotAssigned": "Unassigned", + "assignedToSalariedJudge": "Edwin Ford", + "assignedToFeePaidJudge": "Jay Griffith", + "assignedToTCW": "SSCS cw", + "unassignedManageOptions" : [ + "Assign to me" + ], + "unassignedManageOptions1" : [ + "Assign task", + "Cancel task", + "Assign to me" + ], + "unassignedManageOptionsForFeePaidJudge" : [ + "Assign to me" + ], + "assignedManageOptionsForSalariedJudge" : [ + "Mark as done", + "Reassign task", + "Unassign task" + ], + "assignedManageOptionsForSalariedJudge1" : [ + "Cancel task", + "Mark as done", + "Reassign task", + "Unassign task" + ], + "assignedManageOptionsForFeePaidJudge" : [ + "Unassign task" + ], + "assignedManageOptionsForTCW" : [ + "Unassign task" + ], + "nextStepsOptions": [ + "Amend interloc review state", + "Issue directions notice", + "Send to admin", + "Send case to TCW" + ], + "amendInterlocReviewState": { + "link": "Amend interloc review state", + "eventTitle": "Amend interloc review state" + }, + "issueDirectionsNotice": { + "link": "Issue directions notice", + "eventTitle": "Issue direction" + }, + "sendToAdmin": { + "link": "Send to admin", + "eventTitle": "Send to admin" + }, + "sendCaseToTcw": { + "link": "Send case to TCW", + "eventTitle": "Log case progress" + } +} \ No newline at end of file diff --git a/functional-test/pages/content/tasks_en.json b/functional-test/pages/content/tasks_en.json new file mode 100644 index 0000000000..4c58fc55fb --- /dev/null +++ b/functional-test/pages/content/tasks_en.json @@ -0,0 +1,42 @@ +{ + "tasksHeading": "Active tasks", + "assignToMe": "Assign to me", + "assignTask" : "Assign task", + "unassignTask" : "Unassign task", + "reassignTask" : "Reassign task", + "markAsDone" : "Mark as done", + "cancelTask" : "Cancel task", + "manageLabel" : "Manage", + "nextStepsLabel" : "Next steps", + "assignTaskHeading" : "Assign task", + "reassignTaskHeading" : "Reassign task", + "unassignTaskHeading" : "Unassign task", + "markAsDoneHeading" : "Mark the task as done", + "cancelTaskHeading" : "Cancel a task", + "assignTaskDescription" : "Assign a task to a person based on their role type", + "assignTaskCaseworkerLabel" : "Caseworker", + "roleTypeHeading" : "Choose a role type", + "findPersonHeading" : "Find person", + "roleTypeFormLabel" : "Which role type are you assigning the task to?", + "checkYourAnswersHeading" : "Check your answers", + "assignTaskButtonLabel" : "Assign", + "reassignTaskButtonLabel" : "Reassign", + "unassignTaskButtonLabel" : "Unassign", + "markAsDoneButtonLabel" : "Mark as done", + "cancelTaskButtonLabel" : "Cancel task", + "judicialRole": { + "roleType": "Judicial" + }, + "legalOpsRole": { + "roleType": "Legal Ops", + "assignToName" : "SSCS cw" + }, + "adminRole": { + "roleType": "Admin", + "assignToName" : "SSCS admin" + }, + "ctscRole": { + "roleType": "CTSC", + "assignToName" : "SSCS ctscadmin" + } +} \ No newline at end of file diff --git a/functional-test/pages/tabs/appealDetails.ts b/functional-test/pages/tabs/appealDetails.ts index 3ca96552c9..f463ca52e7 100644 --- a/functional-test/pages/tabs/appealDetails.ts +++ b/functional-test/pages/tabs/appealDetails.ts @@ -23,14 +23,14 @@ export class AppealDetails { const ftaDueDate = new Date(); ftaDueDate.setDate(new Date().getDate() + 28); let formattedDate = dateUtilsComponent.formatDateToSpecifiedDateShortFormat(ftaDueDate); - this.verifyAppealDetailsPageContentByKeyValue('FTA response due date', formattedDate); + await this.verifyAppealDetailsPageContentByKeyValue('FTA response due date', formattedDate); } async verifydueDates(reqField: string){ const dueDate = new Date(); dueDate.setDate(new Date().getDate()); let fomattedDueDate = dateUtilsComponent.formatDateToSpecifiedDateShortFormat(dueDate); - this.verifyAppealDetailsPageContentByKeyValue(reqField, fomattedDueDate); + await this.verifyAppealDetailsPageContentByKeyValue(reqField, fomattedDueDate); } async verifyAppealDetailsAppointeeDetails(appointeeData) { diff --git a/functional-test/pages/tabs/tasks.ts b/functional-test/pages/tabs/tasks.ts index d62d56f1d5..153a9a107a 100644 --- a/functional-test/pages/tabs/tasks.ts +++ b/functional-test/pages/tabs/tasks.ts @@ -2,6 +2,7 @@ import { expect, Page } from '@playwright/test'; import { WebAction } from '../../common/web.action' import { HomePage } from '../../pages/common/homePage'; import { timeouts } from '../../config/config'; +import tasksTestData from '../content/tasks_en.json'; let webActions: WebAction; @@ -65,24 +66,35 @@ export class Tasks { } async verifyTaskIsAssigned(taskName: string) { - let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='Reassign task']`; + let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.reassignTask}']`; await expect(this.page.locator(selector)).toBeVisible(); } async clickCancelTask(taskName: string) { await this.page - .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='Cancel task']`).click(); + .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.cancelTask}']`).click(); + } + + async clickMarkAsDone(taskName: string) { + await this.page + .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.markAsDone}']`).click(); } async selfAssignTask(taskName: string) { - let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='Assign to me']`; + let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.assignToMe}']`; + await expect(this.page.locator(selector)).toBeVisible(); await this.page.locator(selector).click(); await expect(this.page.locator(selector)).toBeHidden(); } async clickAssignTask(taskName: string) { await (this.page - .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='Assign task']`)).click(); + .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.assignTask}']`)).click(); + } + + async clickReassignTask(taskName: string) { + await (this.page + .locator(`//exui-case-task[./*[normalize-space()='${taskName}']]//a[normalize-space()='${tasksTestData.reassignTask}']`)).click(); } async verifyPageContentByKeyValue(taskName: string, fieldLabel: string, fieldValue: string) { @@ -96,7 +108,7 @@ export class Tasks { } async verifyManageOptions(taskName: string, options: string[]) { - let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//div[.//span[normalize-space()='Manage']]/dd/a`; + let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//div[.//span[normalize-space()='${tasksTestData.manageLabel}']]/dd/a`; const availableOptions = await this.page.$$eval(selector, (elements) => elements.map((element) => element.textContent.trim()) @@ -106,7 +118,7 @@ export class Tasks { } async verifyNextStepsOptions(taskName: string, options: string[]) { - let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//div[.//span[normalize-space()='Next steps']]/dd//a`; + let selector = `//exui-case-task[./*[normalize-space()='${taskName}']]//div[.//span[normalize-space()='${tasksTestData.nextStepsLabel}']]/dd//a`; const availableOptions = await this.page.$$eval(selector, (elements) => elements.map((element) => element.textContent.trim()) @@ -133,27 +145,53 @@ export class Tasks { async assignTaskToCtscUser(taskName: string, userEmail: string) { await this.clickAssignTask(taskName); - await this.page.getByRole('radio', { name: 'CTSC' }).click(); + await this.page.getByRole('radio', { name: tasksTestData.ctscRole.roleType }).click(); await this.page.getByRole('button', { name: 'Continue' }).click(); - await this.page.locator('#inputSelectPerson').fill('SSCS ctscadmin'); + await this.page.locator('#inputSelectPerson').fill(tasksTestData.ctscRole.assignToName); await expect(this.page.locator('div.mat-autocomplete-panel.mat-autocomplete-visible')).toBeVisible(); await this.page.locator(`//mat-option/span[contains(text(), '${userEmail.toLowerCase()}')]`).click(); await expect(this.page.locator('//mat-option')).toBeHidden(); await this.page.getByRole('button', { name: 'Continue' }).click(); - await expect(this.page.locator(`h1.govuk-heading-l:has-text('Check your answers')`)).toBeVisible(); - await expect(this.page.locator('//td[normalize-space()=\'SSCS ctscadmin\']')).toBeVisible(); - await this.page.getByRole('button', { name: 'Assign' }).click(); + await expect(this.page.locator(`h1.govuk-heading-l:has-text('${tasksTestData.checkYourAnswersHeading}')`)).toBeVisible(); + await expect(this.page.locator(`//td[normalize-space()='${tasksTestData.ctscRole.assignToName}']`)).toBeVisible(); + await this.page.getByRole('button', { name: tasksTestData.assignTaskButtonLabel }).click(); - await expect(this.page.locator('//h2[normalize-space()=\'Active tasks\']')).toBeVisible(); + await expect(this.page.locator(`//h2[normalize-space()='${tasksTestData.tasksHeading}']`)).toBeVisible(); let task = this.page.locator(`//exui-case-task[./*[normalize-space()='${taskName}']]`); - await expect(task.getByRole('link', { name: 'Assign task' })).toBeHidden(); + await expect(task.getByRole('link', { name: tasksTestData.assignTask })).toBeHidden(); + } + + async reassignTaskToTcwUser(taskName: string, userEmail: string) { + await this.clickReassignTask(taskName); + await this.page.getByRole('radio', { name: tasksTestData.legalOpsRole.roleType }).click(); + await this.page.getByRole('button', { name: 'Continue' }).click(); + await this.page.locator('#inputSelectPerson').fill(tasksTestData.legalOpsRole.assignToName); + await expect(this.page.locator('div.mat-autocomplete-panel.mat-autocomplete-visible')).toBeVisible(); + await this.page.locator(`//mat-option/span[contains(text(), '${userEmail.toLowerCase()}')]`).click(); + await expect(this.page.locator('//mat-option')).toBeHidden(); + await this.page.getByRole('button', { name: 'Continue' }).click(); + await expect(this.page.locator(`h1.govuk-heading-l:has-text('${tasksTestData.checkYourAnswersHeading}')`)).toBeVisible(); + await expect(this.page.locator(`//td[normalize-space()='${tasksTestData.legalOpsRole.assignToName}']`)).toBeVisible(); + await this.page.getByRole('button', { name: tasksTestData.reassignTaskButtonLabel }).click(); + + await expect(this.page.locator(`//h2[normalize-space()='${tasksTestData.tasksHeading}']`)).toBeVisible(); + let task = this.page.locator(`//exui-case-task[./*[normalize-space()='${taskName}']]`); + await expect(task.getByRole('link', { name: tasksTestData.reassignTask })).toBeHidden(); } async cancelTask(taskName: string) { await this.clickCancelTask(taskName); - await expect(this.page.locator('h1.govuk-heading-xl')).toHaveText('Cancel a task'); + await expect(this.page.locator('h1.govuk-heading-xl')).toHaveText(tasksTestData.cancelTaskHeading); + await expect(this.page.locator(`exui-task-field:has-text('${taskName}')`)).toBeVisible(); + await this.page.getByRole('button', { name: tasksTestData.cancelTaskButtonLabel }).click(); + await expect(this.page.locator(`//h2[normalize-space()='${tasksTestData.tasksHeading}']`)).toBeVisible(); + } + + async markTheTaskAsDone(taskName: string) { + await this.clickMarkAsDone(taskName); + await expect(this.page.locator('h1.govuk-heading-xl')).toHaveText(tasksTestData.markAsDoneHeading); await expect(this.page.locator(`exui-task-field:has-text('${taskName}')`)).toBeVisible(); - await this.page.getByRole('button', { name: 'Cancel task' }).click(); - await expect(this.page.locator('//h2[normalize-space()=\'Active tasks\']')).toBeVisible(); + await this.page.getByRole('button', { name: tasksTestData.markAsDoneButtonLabel }).click(); + await expect(this.page.locator(`//h2[normalize-space()='${tasksTestData.tasksHeading}']`)).toBeVisible(); } }