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

[SSCSSI-295]: add tests for Allocate Case Roles and Create Bundle work allocation task #1682

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def secrets = [
secret('test-e2e-am-caseofficer-case-allocator-password', 'TEST_AM_CASEOFFICER_CASE_ALLOCATOR_PASSWORD'),
secret('test-e2e-hmrc-username', 'TEST_HMRC_USERNAME'),
secret('test-e2e-hmrc-password', 'TEST_HMRC_PASSWORD'),
secret('test-e2e-am-regional-center-admin-username', 'TEST_AM_REGIONAL_CENTER_ADMIN_USERNAME'),
secret('test-e2e-am-regional-center-admin-password', 'TEST_AM_REGIONAL_CENTER_ADMIN_PASSWORD'),
secret('test-e2e-am-regional-center-team-leader-username', 'TEST_AM_REGIONAL_CENTER_TEAM_LEADER_USERNAME'),
secret('test-e2e-am-regional-center-team-leader-password', 'TEST_AM_REGIONAL_CENTER_TEAM_LEADER_PASSWORD'),


secret('test-e2e-am-caseofficer-username', 'TEST_AM_CASEOFFICER_USERNAME'),
Expand Down
8 changes: 8 additions & 0 deletions functional-test/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ export const credentials = {
amSeniorTribunalCaseWorkerWithCaseAllocatorRole: {
email: process.env.TEST_AM_SENIOR_TRIBUNAL_CASEWORKER_CASE_ALLOCATOR_USERNAME,
password: process.env.TEST_AM_SENIOR_TRIBUNAL_CASEWORKER_CASE_ALLOCATOR_PASSWORD,
},
amRegionalCenterAdmin: {
email: process.env.TEST_AM_REGIONAL_CENTER_ADMIN_USERNAME,
password: process.env.TEST_AM_REGIONAL_CENTER_ADMIN_PASSWORD,
},
amRegionalCenterTeamLeader: {
email: process.env.TEST_AM_REGIONAL_CENTER_TEAM_LEADER_USERNAME,
password: process.env.TEST_AM_REGIONAL_CENTER_TEAM_LEADER_PASSWORD,
}
};

Expand Down
2 changes: 1 addition & 1 deletion functional-test/e2e/create-a-bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ test.beforeAll("Case has to be Created", async () => {
test("As a caseworker create a bundle", {tag: '@pipeline'}, async ({createBundleSteps}) => {
test.slow();
await createBundleSteps.performUploadBundleResponse(caseId);
});
});
104 changes: 104 additions & 0 deletions functional-test/e2e/prepare.case.for.hearing.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { test } from "../lib/steps.factory";
import createCaseBasedOnCaseType from "../api/client/sscs/factory/appeal.type.factory";
import performAppealDormantOnCase from "../api/client/sscs/appeal.event";

test.describe('WA - Allocate Case Roles and Create Bundle RPC task initiation and completion tests', {
tag: '@work-allocation'
}, async () => {

test.describe.serial('WA - Task initiation and completion by Regional Center Admin', async () => {

let caseId : string;

test.beforeAll("Case has to be Created",async () => {
caseId = await createCaseBasedOnCaseType('PIP');
});

test("Prepare case for hearing", async ({
uploadResponseSteps,
prepareCaseForHearingSteps}) => {

test.slow();
await uploadResponseSteps.uploadResponseWithoutFurtherInfoAsDwpCaseWorker(caseId);
await prepareCaseForHearingSteps.prepareCaseForHearing(caseId, true);
});

test("Regional Center Admin, views and completes the Allocate Case Roles and Create Bundle task", async ({
prepareCaseForHearingSteps }) => {

test.slow();
await prepareCaseForHearingSteps.verifyRegionalCenterAdminCanViewAndCompleteTheAllocateCaseRolesAndCreateBundleTask(caseId);
});

test.afterAll("Case has to be set to Dormant", async () => {
await performAppealDormantOnCase(caseId);
});
});

test.describe.serial('WA - Task initiation and completion by Regional Center Team Leader', async () => {

let caseId : string;

test.beforeAll("Case has to be Created",async () => {
caseId = await createCaseBasedOnCaseType('PIP');
});

test("Prepare case for hearing", async ({
uploadResponseSteps,
prepareCaseForHearingSteps}) => {

test.slow();
await uploadResponseSteps.uploadResponseWithoutFurtherInfoAsDwpCaseWorker(caseId);
await prepareCaseForHearingSteps.prepareCaseForHearing(caseId, true);
});

test("Regional Center Team Leader, views and completes the Allocate Case Roles and Create Bundle task", async ({
prepareCaseForHearingSteps }) => {

test.slow();
await prepareCaseForHearingSteps.verifyRegionalCenterTeamLeaderCanViewAndCompleteTheAllocateCaseRolesAndCreateBundleTask(caseId);
});

test.afterAll("Case has to be set to Dormant", async () => {
await performAppealDormantOnCase(caseId);
});
});
});

test.describe.serial('WA - Allocate Case Roles and Create Bundle RPC task automatic cancellation when case is struck out', {
tag: '@work-allocation'
}, async() => {

let caseId : string;

test.beforeAll("Case has to be Created", async () => {
caseId = await createCaseBasedOnCaseType('PIP');
});

test("Prepare case for hearing", async ({
uploadResponseSteps,
prepareCaseForHearingSteps}) => {

test.slow();
await uploadResponseSteps.uploadResponseWithoutFurtherInfoAsDwpCaseWorker(caseId);
await prepareCaseForHearingSteps.prepareCaseForHearing(caseId, true);
});

test("Regional Center Admin, views and self assigns the Allocate Case Roles and Create Bundle task", async ({
prepareCaseForHearingSteps }) => {

test.slow();
await prepareCaseForHearingSteps.verifyRegionalCenterAdminCanViewTheAllocateCaseRolesAndCreateBundleTask(caseId);
});

test("Allocate Case Roles and Create Bundle task is cancelled automatically when case is struck out", async ({
prepareCaseForHearingSteps}) => {

test.slow();
await prepareCaseForHearingSteps.verifyAllocateCaseRolesAndCreateBundleIsCancelledAutomaticallyWhenTheCaseIsStruckOut(caseId);
});

test.afterAll("Case has to be set to Dormant", async () => {
await performAppealDormantOnCase(caseId);
});
});
2 changes: 1 addition & 1 deletion functional-test/e2e/request.info.from.party.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe.serial('WA - Review Information Requested CTSC task initiation and
});
});

test.describe('WA - Review Information Requested CTSC task automatic cancellation when case is void', {
test.describe.serial('WA - Review Information Requested CTSC task automatic cancellation when case is void', {
tag: '@work-allocation'
}, async() => {

Expand Down
4 changes: 2 additions & 2 deletions functional-test/e2e/supplementary.response.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import createCaseBasedOnCaseType from "../api/client/sscs/factory/appeal.type.fa
import performAppealDormantOnCase from "../api/client/sscs/appeal.event";


test.describe.serial('WA - Action Unprocessed Correspondence CTSC task initiation and completion tests', {
test.describe.serial('WA - Supplementary Response - Action Unprocessed Correspondence CTSC task initiation and completion tests', {
tag: '@work-allocation'
}, async () => {

Expand Down Expand Up @@ -45,7 +45,7 @@ test.describe.serial('WA - Action Unprocessed Correspondence CTSC task initiatio
});
});

test.describe('WA - Action Unprocessed Correspondence CTSC task cancellation', {
test.describe.serial('WA - Supplementary Response - Action Unprocessed Correspondence CTSC task cancellation tests', {
tag: '@work-allocation'
}, async() => {

Expand Down
7 changes: 3 additions & 4 deletions functional-test/e2e/upload.document.further.evidence.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import createCaseBasedOnCaseType from '../api/client/sscs/factory/appeal.type.fa
import performAppealDormantOnCase from '../api/client/sscs/appeal.event';


test.describe.serial('WA - Action Unprocessed Correspondence CTSC task initiation and completion tests', {
test.describe.serial('WA - Upload document FE - Action Unprocessed Correspondence CTSC task initiation and completion tests', {
tag: '@work-allocation'
}, async () => {

Expand Down Expand Up @@ -46,14 +46,13 @@ test.describe.serial('WA - Action Unprocessed Correspondence CTSC task initiatio
});


test.describe('WA - Action Unprocessed Correspondence CTSC task cancellation', {
test.describe.serial('WA - Upload document FE - Action Unprocessed Correspondence CTSC task cancellation', {
tag: '@work-allocation'
}, async() => {

let caseId : string;

test.beforeAll('Create case', async () => {
test.slow();
caseId = await createCaseBasedOnCaseType('PIP');
});

Expand Down
3 changes: 3 additions & 0 deletions functional-test/fixtures/steps/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {NotListablePage} from "../../pages/not.listable.page";
import { UpdateNotListablePage } from "../../pages/update.not.listable.page";
import { SearchFilterPage } from '../../pages/search.filter.page';
import { ReissueFurtherEvidencePage } from '../../pages/reissue.further.evidence.page';
import { PrepareCaseForHearingPage } from '../../pages/prepare.case.for.hearing.page';

export abstract class BaseStep {

Expand Down Expand Up @@ -110,6 +111,7 @@ export abstract class BaseStep {
protected updateNotListablePage: UpdateNotListablePage;
protected searchFilterPage: SearchFilterPage;
protected reissueFurtherEvidencePage: ReissueFurtherEvidencePage;
protected prepareCaseForHearingPage: PrepareCaseForHearingPage;

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -166,6 +168,7 @@ export abstract class BaseStep {
this.updateNotListablePage = new UpdateNotListablePage(this.page);
this.searchFilterPage = new SearchFilterPage(this.page);
this.reissueFurtherEvidencePage = new ReissueFurtherEvidencePage(this.page);
this.prepareCaseForHearingPage = new PrepareCaseForHearingPage(this.page);
}

async loginUserWithCaseId(user, clearCacheFlag: boolean = false, caseId?: string) {
Expand Down
130 changes: 130 additions & 0 deletions functional-test/fixtures/steps/prepare.case.for.hearing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { expect, Page } from '@playwright/test';
import { BaseStep } from './base';
import { credentials } from "../../config/config";
import prepareCaseForHearingData from '../../pages/content/prepare.case.for.hearing_en.json';
import task from '../../pages/content/allocate.case.roles.and.create.bundle.task_en.json'

export class PrepareCaseForHearing extends BaseStep {

readonly page: Page;

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

async prepareCaseForHearing(caseId: string, signOutRequired: boolean = false): Promise<void>{

if(signOutRequired) {
await this.homePage.signOut();
}
await this.loginUserWithCaseId(credentials.amSuperUser, false, caseId);
await this.homePage.chooseEvent(prepareCaseForHearingData.eventName);
await this.prepareCaseForHearingPage.verifyPageContent();
await this.prepareCaseForHearingPage.confirmSubmission();
await expect(this.homePage.summaryTab).toBeVisible();

await this.homePage.delay(3000);
await this.homePage.navigateToTab("History");
await this.verifyHistoryTabDetails(prepareCaseForHearingData.eventName);
}

async allocateCaseToRegionalCenterAdmin(caseId: string) {

// CTSC Admin with case allocator role allocates case to Regional Center Admin
await this.homePage.signOut();
await this.loginUserWithCaseId(credentials.amCaseWorkerWithCaseAllocatorRole, false, caseId);
await expect(this.homePage.summaryTab).toBeVisible();
await this.homePage.delay(3000);
await this.homePage.navigateToTab('Roles and access');
await this.rolesAndAccessTab.allocateAdminRole(credentials.amRegionalCenterAdmin.email);
}

async verifyRegionalCenterAdminCanViewTheAllocateCaseRolesAndCreateBundleTask(caseId: string) {

// Regional Center Admin views the Allocate Case Roles and Create Bundle - RPC task
await this.loginUserWithCaseId(credentials.amRegionalCenterAdmin, false, caseId);
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyTaskIsDisplayed(task.name);
await this.tasksTab.verifyPriortiy(task.name, task.priority);
await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToWhenNotAssigned);
await this.tasksTab.verifyManageOptions(task.name, task.unassignedManageOptionsForRegionalCenterAdmin);

// Regional Center Admin self assigns the task
await this.tasksTab.selfAssignTask(task.name)
await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToRegionalCenterAdmin);
await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForRegionalCenterAdmin);
await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions);
}

async verifyRegionalCenterAdminCanViewAndCompleteTheAllocateCaseRolesAndCreateBundleTask(caseId: string) {

await this.verifyRegionalCenterAdminCanViewTheAllocateCaseRolesAndCreateBundleTask(caseId);

// Regional Center Admin completes the Create bundle next step event
await this.tasksTab.clickNextStepLink(task.createBundle.link);
await this.completeCreateBundle();

// Regional Center Admin verifies that the task is removed from the Tasks tab
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyTaskIsHidden(task.name);
}

async verifyRegionalCenterTeamLeaderCanViewAndCompleteTheAllocateCaseRolesAndCreateBundleTask(caseId: string) {

// Regional Center Team Leader views the Allocate Case Roles and Create Bundle - RPC task
await this.loginUserWithCaseId(credentials.amRegionalCenterTeamLeader, false, caseId);
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyTaskIsDisplayed(task.name);
await this.tasksTab.verifyPriortiy(task.name, task.priority);
await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToWhenNotAssigned);
await this.tasksTab.verifyManageOptions(task.name, task.unassignedManageOptionsForRegionalCenterTeamLeader);

// Regional Center Team Leader self assigns the task
await this.tasksTab.selfAssignTask(task.name)
await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToRegionalCenterTeamLeader);
await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForRegionalCenterTeamLeader);
await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions);

// Regional Center Team Leader completes the Create bundle next step event
await this.tasksTab.clickNextStepLink(task.createBundle.link);
await this.completeCreateBundle();

// Regional Center Team Leader verifies that the task is removed from the Tasks tab
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyTaskIsHidden(task.name);
}

async verifyAllocateCaseRolesAndCreateBundleIsCancelledAutomaticallyWhenTheCaseIsStruckOut(caseId: string) {

// Regional Center Admin views the task
await this.loginUserWithCaseId(credentials.amRegionalCenterAdmin, true, caseId);
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyPageContentByKeyValue(task.name, 'Assigned to', task.assignedToRegionalCenterAdmin);
await this.tasksTab.verifyManageOptions(task.name, task.assignedManageOptionsForRegionalCenterAdmin);
await this.tasksTab.verifyNextStepsOptions(task.name, task.nextStepsOptions);

// CTSC Admin strikes out the case
await this.homePage.chooseEvent('Strike out case');
await this.eventNameAndDescriptionPage.verifyPageContent("Strike out case");
await this.eventNameAndDescriptionPage.confirmSubmission();
await expect(this.homePage.summaryTab).toBeVisible();

await this.homePage.delay(3000);
await this.homePage.navigateToTab("History");
await this.verifyHistoryTabDetails('Dormant', 'Strike out case');

// Verify task is removed from the tasks list within Tasks tab
await this.homePage.navigateToTab('Tasks');
await this.tasksTab.verifyTaskIsHidden(task.name);
}

async completeCreateBundle() {
await this.createBundlePage.verifyPageContent();
await this.createBundlePage.confirmSubmission();
await expect(this.homePage.summaryTab).toBeVisible();
await this.homePage.delay(3000);
await this.homePage.navigateToTab("History");
await this.verifyHistoryTabDetails("Create bundle");
}
}
11 changes: 11 additions & 0 deletions functional-test/fixtures/steps/upload.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,15 @@ export class UploadResponse extends BaseStep {
uploadResponseTestdata.pipBenefitCode, uploadResponseTestdata.pipIssueCode);
await this.checkYourAnswersPage.confirmSubmission();
}

async uploadResponseWithoutFurtherInfoAsDwpCaseWorker(caseId: string) {

// As DWP caseworker upload response with further info
await this.loginUserWithCaseId(credentials.dwpResponseWriter, false, caseId);
await this.stepsHelper.uploadResponseHelper(uploadResponseTestdata.pipIssueCode, 'No');

await this.checkYourAnswersPage.verifyCYAPageContent("Upload response",
uploadResponseTestdata.pipBenefitCode, uploadResponseTestdata.pipIssueCode);
await this.checkYourAnswersPage.confirmSubmission();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ReviewIncompleteAppealTask extends BaseStep {
await this.tasksTab.clickNextStepLink(task.requestInformationFromParty.link);

let requestInfoFromParty = new RequestInfoFromParty(this.page)
await requestInfoFromParty.performRequestInfoFromPartyEvent();
await requestInfoFromParty.completeRequestInfoFromParty();

// Verify task is removed from the tasks list within Tasks tab
await this.homePage.navigateToTab('Tasks');
Expand Down
6 changes: 6 additions & 0 deletions functional-test/lib/steps.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {UpdateNotListable} from "../fixtures/steps/update.not.listable";
import { use } from "chai";
import { SearchFilter } from '../fixtures/steps/search.filter';
import { ReissueFurtherEvidence } from '../fixtures/steps/reissue.further.evidence';
import { PrepareCaseForHearing } from '../fixtures/steps/prepare.case.for.hearing';


type MyStepsFixtures = {
Expand Down Expand Up @@ -87,6 +88,7 @@ type MyStepsFixtures = {
updateNotListableSteps: UpdateNotListable
searchFilterSteps: SearchFilter
reissueFurtherEvidenceSteps: ReissueFurtherEvidence
prepareCaseForHearingSteps: PrepareCaseForHearing
};

export const test = stepsFactory.extend<MyStepsFixtures>({
Expand Down Expand Up @@ -257,5 +259,9 @@ export const test = stepsFactory.extend<MyStepsFixtures>({
reissueFurtherEvidenceSteps: async ({ page }, use) => {
const reissueFurtherEvidenceSteps = new ReissueFurtherEvidence(page);
await use(reissueFurtherEvidenceSteps);
},
prepareCaseForHearingSteps: async ({ page }, use) => {
const prepareCaseForHearingSteps = new PrepareCaseForHearing(page);
await use(prepareCaseForHearingSteps);
}
})
Loading