@ministryofjustice/hmpps-probation-integration-e2e-tests 1.225.0 → 1.227.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/steps/accredited-programmes/application.d.mts +4 -2
- package/steps/accredited-programmes/application.mjs +51 -3
- package/steps/api/arns/arns-api.d.mts +1 -3
- package/steps/api/court-case/court-case-api.d.mts +1 -3
- package/steps/api/probation-access-control/probation-access-control.d.mts +1 -3
- package/steps/community-payback/record-outcome.d.mts +1 -1
- package/steps/community-payback/record-outcome.mjs +7 -5
- package/steps/manage-a-supervision/check-in.mjs +1 -1
- package/test-data/environments/test.mjs +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-probation-integration-e2e-tests",
|
|
3
3
|
"description": "Playwright end to end tests for hmpps-probation-integration-services.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.227.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -16,12 +16,14 @@ interface RoSHRiskAssertion {
|
|
|
16
16
|
declare function assertRoSHRiskTable(page: Page, assertions: RoSHRiskAssertion): Promise<void>;
|
|
17
17
|
declare function findCase(page: Page, person: Person, crn: string): Promise<void>;
|
|
18
18
|
declare function addCaseToGroup(page: Page, person: Person): Promise<void>;
|
|
19
|
+
declare function createPostProgrammeReviewSession(page: Page, person: Person): Promise<void>;
|
|
20
|
+
declare function recordPostProgrammeSessionAttendance(page: Page, person: Person): Promise<void>;
|
|
19
21
|
declare function updateReferralStatusToAwaitingAllocation(page: Page, person: Person, crn: string, event: CreatedEvent, date: Date): Promise<void>;
|
|
20
22
|
declare function updateReferralStatus(page: Page): Promise<void>;
|
|
21
23
|
declare function updateReferralStatusToOnProgramme(page: Page, person: Person, crn: string): Promise<void>;
|
|
22
|
-
declare function updateReferralStatusToComplete(page: Page, person: Person): Promise<void>;
|
|
24
|
+
declare function updateReferralStatusToComplete(page: Page, person: Person, crn: string): Promise<void>;
|
|
23
25
|
declare const oasysImportDateText = "[data-testid=\"last-assessment-date-text\"]";
|
|
24
26
|
declare const apFormattedTodayDate: string;
|
|
25
27
|
declare const briefOffenceDetailsSummaryCard = "[data-testid=\"brief-offence-details-summary-card\"]";
|
|
26
28
|
//#endregion
|
|
27
|
-
export { addCaseToGroup, apFormattedTodayDate, assertRoSHRiskTable, briefOffenceDetailsSummaryCard, clickOnOffenderLink, findCase, findProgrammeAndMakeReferral, oasysImportDateText, updateReferralStatus, updateReferralStatusToAwaitingAllocation, updateReferralStatusToComplete, updateReferralStatusToOnProgramme, verifyAssessmentDateTextToBe };
|
|
29
|
+
export { addCaseToGroup, apFormattedTodayDate, assertRoSHRiskTable, briefOffenceDetailsSummaryCard, clickOnOffenderLink, createPostProgrammeReviewSession, findCase, findProgrammeAndMakeReferral, oasysImportDateText, recordPostProgrammeSessionAttendance, updateReferralStatus, updateReferralStatusToAwaitingAllocation, updateReferralStatusToComplete, updateReferralStatusToOnProgramme, verifyAssessmentDateTextToBe };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { formatDate } from "../delius/utils/date-time.mjs";
|
|
2
|
+
import { selectOption } from "../delius/utils/inputs.mjs";
|
|
2
3
|
import { expect } from "@playwright/test";
|
|
3
4
|
import { DateTime } from "luxon";
|
|
4
5
|
import { faker } from "@faker-js/faker";
|
|
@@ -92,7 +93,7 @@ async function addCaseToGroup(page, person) {
|
|
|
92
93
|
await page.getByRole("link", { name: "Groups" }).click();
|
|
93
94
|
await page.getByRole("link", { name: "AutoTestGroup" }).click();
|
|
94
95
|
await page.getByRole("link", { name: "Allocations and waitlist" }).click();
|
|
95
|
-
await page.getByRole("link", { name:
|
|
96
|
+
await page.getByRole("link", { name: /Waitlist/ }).click();
|
|
96
97
|
await page.locator("input[name=\"add-to-group\"]").click();
|
|
97
98
|
await page.getByRole("button", { name: "Add to group" }).click();
|
|
98
99
|
await expect(page.locator("h1.govuk-fieldset__heading")).toContainText(`Add ${person.firstName} ${person.lastName} to this group?`);
|
|
@@ -103,6 +104,52 @@ async function addCaseToGroup(page, person) {
|
|
|
103
104
|
await page.getByRole("button", { name: "Submit" }).click();
|
|
104
105
|
await expect(page.locator(".moj-alert__content")).toContainText(`${person.firstName} ${person.lastName} was added to this group. Their referral status is now Scheduled.`);
|
|
105
106
|
}
|
|
107
|
+
async function createPostProgrammeReviewSession(page, person) {
|
|
108
|
+
await page.getByRole("link", { name: "Sessions and attendance" }).click();
|
|
109
|
+
await page.getByRole("button", { name: /Post-programme reviews/ }).click();
|
|
110
|
+
await page.getByRole("link", { name: "Schedule a post-programme review" }).click();
|
|
111
|
+
await expect(page.locator(".govuk-caption-l")).toContainText("Schedule a post-programme review");
|
|
112
|
+
await page.getByRole("radio", {
|
|
113
|
+
name: "Post-programme review",
|
|
114
|
+
exact: true
|
|
115
|
+
}).click();
|
|
116
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
117
|
+
const sessionDate = DateTime.now().setLocale("en-gb").toLocaleString();
|
|
118
|
+
await page.getByRole("heading", { name: "Add session details" }).isVisible();
|
|
119
|
+
await page.locator(".moj-js-datepicker-input").fill(sessionDate);
|
|
120
|
+
await page.locator("#session-details-start-time-hour").fill("09");
|
|
121
|
+
await page.locator("#session-details-start-time-minute").fill("30");
|
|
122
|
+
await selectOption(page, "#session-details-start-time-part-of-day", "am");
|
|
123
|
+
await page.locator("#session-details-end-time-hour").fill("09");
|
|
124
|
+
await page.locator("#session-details-end-time-minute").fill("40");
|
|
125
|
+
await selectOption(page, "#session-details-end-time-part-of-day", "am");
|
|
126
|
+
await page.getByRole("radio", { name: `${person.firstName} ${person.lastName}` }).click();
|
|
127
|
+
await page.locator("#session-details-facilitator").fill("AccreditedProgrammes TestUser");
|
|
128
|
+
await page.locator("#session-details-facilitator__option--0").click();
|
|
129
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
130
|
+
await expect(page.locator("h1.govuk-heading-l")).toContainText("Review your session details");
|
|
131
|
+
await page.getByRole("button", { name: "Create session" }).click();
|
|
132
|
+
await expect(page.locator(".moj-alert__content")).toContainText(`Post-programme review for ${person.firstName} ${person.lastName} has been added.`);
|
|
133
|
+
}
|
|
134
|
+
async function recordPostProgrammeSessionAttendance(page, person) {
|
|
135
|
+
await page.getByRole("link", { name: "Groups" }).click();
|
|
136
|
+
await page.getByRole("link", { name: "AutoTestGroup" }).click();
|
|
137
|
+
await page.getByRole("link", {
|
|
138
|
+
name: "Sessions and attendance",
|
|
139
|
+
exact: true
|
|
140
|
+
}).click();
|
|
141
|
+
await page.getByRole("button", { name: /Post-programme reviews/ }).click();
|
|
142
|
+
await page.getByRole("link", { name: `${person.firstName} ${person.lastName}` }).click();
|
|
143
|
+
await expect(page.locator("h1.govuk-fieldset__heading")).toContainText(`${person.firstName} ${person.lastName}: Post programme review`);
|
|
144
|
+
await page.getByRole("button", { name: "Update attendance and notes" }).click();
|
|
145
|
+
await expect(page.locator(".govuk-caption-l")).toContainText("Record attendance and progress");
|
|
146
|
+
await expect(page.locator("h1.govuk-heading-l")).toContainText(`Did ${person.firstName} ${person.lastName} attend Post-programme review?`);
|
|
147
|
+
await page.getByRole("radio", { name: "Yes - attended" }).click();
|
|
148
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
149
|
+
await page.locator("#record-session-attendance-notes").fill(faker.lorem.sentence());
|
|
150
|
+
await page.getByRole("button", { name: "Submit" }).click();
|
|
151
|
+
await expect(page.locator(".moj-alert__content")).toContainText(`Attendance recorded for ${person.firstName} ${person.lastName}`);
|
|
152
|
+
}
|
|
106
153
|
async function updateReferralStatusToAwaitingAllocation(page, person, crn, event, date) {
|
|
107
154
|
await expect(page.locator("p:right-of(:text(\"Programme Name\"))").first()).toContainText("Building Choices");
|
|
108
155
|
await expect(page.locator("p:right-of(:text(\"Name\"))").first()).toContainText(person.firstName + " " + person.lastName);
|
|
@@ -140,7 +187,8 @@ async function updateReferralStatusToOnProgramme(page, person, crn) {
|
|
|
140
187
|
await expect(page.locator(".moj-alert__content")).toContainText(`${person.firstName} ${person.lastName}'s referral status is now On programme.`);
|
|
141
188
|
await expect(page.getByRole("heading", { name: "On programme" })).toBeVisible();
|
|
142
189
|
}
|
|
143
|
-
async function updateReferralStatusToComplete(page, person) {
|
|
190
|
+
async function updateReferralStatusToComplete(page, person, crn) {
|
|
191
|
+
await findCase(page, person, crn);
|
|
144
192
|
await updateReferralStatus(page);
|
|
145
193
|
await expect(page.locator(".moj-alert__content h2")).toContainText("Referral status updated");
|
|
146
194
|
await expect(page.locator(".moj-alert__content")).toContainText(`${person.firstName} ${person.lastName}'s referral status is now Programme complete.`);
|
|
@@ -150,4 +198,4 @@ const oasysImportDateText = "[data-testid=\"last-assessment-date-text\"]";
|
|
|
150
198
|
const apFormattedTodayDate = formatDate(DateTime.now(), "d MMMM yyyy");
|
|
151
199
|
const briefOffenceDetailsSummaryCard = "[data-testid=\"brief-offence-details-summary-card\"]";
|
|
152
200
|
//#endregion
|
|
153
|
-
export { addCaseToGroup, apFormattedTodayDate, assertRoSHRiskTable, briefOffenceDetailsSummaryCard, clickOnOffenderLink, findCase, findProgrammeAndMakeReferral, oasysImportDateText, updateReferralStatus, updateReferralStatusToAwaitingAllocation, updateReferralStatusToComplete, updateReferralStatusToOnProgramme, verifyAssessmentDateTextToBe };
|
|
201
|
+
export { addCaseToGroup, apFormattedTodayDate, assertRoSHRiskTable, briefOffenceDetailsSummaryCard, clickOnOffenderLink, createPostProgrammeReviewSession, findCase, findProgrammeAndMakeReferral, oasysImportDateText, recordPostProgrammeSessionAttendance, updateReferralStatus, updateReferralStatusToAwaitingAllocation, updateReferralStatusToComplete, updateReferralStatusToOnProgramme, verifyAssessmentDateTextToBe };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$playwright_core0 from "playwright-core";
|
|
2
|
-
|
|
3
1
|
//#region steps/api/arns/arns-api.d.ts
|
|
4
|
-
declare function getRisksFromArns(crn: string): Promise<
|
|
2
|
+
declare function getRisksFromArns(crn: string): Promise<import("playwright-core").APIResponse>;
|
|
5
3
|
//#endregion
|
|
6
4
|
export { getRisksFromArns };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import * as _$playwright_core0 from "playwright-core";
|
|
2
|
-
|
|
3
1
|
//#region steps/api/court-case/court-case-api.d.ts
|
|
4
|
-
declare function addCourtHearing(hearing: CourtHearing): Promise<
|
|
2
|
+
declare function addCourtHearing(hearing: CourtHearing): Promise<import("playwright-core").APIResponse>;
|
|
5
3
|
interface CourtHearing {
|
|
6
4
|
hearing: {
|
|
7
5
|
jurisdictionType: string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$playwright_core0 from "playwright-core";
|
|
2
|
-
|
|
3
1
|
//#region steps/api/probation-access-control/probation-access-control.d.ts
|
|
4
|
-
declare function getAccessControlForUserAndPerson(user: string, crn: string): Promise<
|
|
2
|
+
declare function getAccessControlForUserAndPerson(user: string, crn: string): Promise<import("playwright-core").APIResponse>;
|
|
5
3
|
//#endregion
|
|
6
4
|
export { getAccessControlForUserAndPerson };
|
|
@@ -4,7 +4,7 @@ import { Page } from "@playwright/test";
|
|
|
4
4
|
//#region steps/community-payback/record-outcome.d.ts
|
|
5
5
|
declare function recordAttendanceCompliedOutcome(page: Page, startTime?: string, endTime?: string): Promise<void>;
|
|
6
6
|
declare function recordUnacceptableAbsenceOutcome(page: Page): Promise<void>;
|
|
7
|
-
declare function adjustTravelTime(page: Page, hours:
|
|
7
|
+
declare function adjustTravelTime(page: Page, hours: number, minutes: number): Promise<void>;
|
|
8
8
|
declare function findGroupSession(page: Page, crn: string, person: Person, projectName: string, provider: string, teamName: string): Promise<void>;
|
|
9
9
|
declare function findAnIndividualPlacement(page: Page, provider: string, teamName: string): Promise<string | null>;
|
|
10
10
|
declare function findAnAppointment(page: Page, provider: string): Promise<string | null>;
|
|
@@ -42,13 +42,15 @@ async function adjustTravelTime(page, hours, minutes) {
|
|
|
42
42
|
await page.locator("#date-day").fill(today.day.toString());
|
|
43
43
|
await page.locator("#date-month").fill(today.month.toString());
|
|
44
44
|
await page.locator("#date-year").fill(today.year.toString());
|
|
45
|
-
await page.locator("#hours").fill(hours);
|
|
46
|
-
await page.locator("#minutes").fill(minutes);
|
|
45
|
+
await page.locator("#hours").fill(hours.toString());
|
|
46
|
+
await page.locator("#minutes").fill(minutes.toString());
|
|
47
47
|
await page.getByRole("button", { name: "Credit travel time" }).click();
|
|
48
48
|
await expect(page.locator("#success-title-1")).toContainText(/Success/);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
let hoursString = "";
|
|
50
|
+
let minutesString = "";
|
|
51
|
+
if (hours > 0) hoursString = hours === 1 ? " 1 hour" : ` ${hours} hours`;
|
|
52
|
+
if (minutes > 0) minutesString = minutes === 1 ? " 1 minute" : ` ${minutes} minutes`;
|
|
53
|
+
await expect(page.locator(".govuk-notification-banner__content h3")).toContainText(RegExp(` has been adjusted for${hoursString}${minutesString} of travel time.`, "i"));
|
|
52
54
|
await page.getByRole("link", { name: "Sign out" }).click();
|
|
53
55
|
}
|
|
54
56
|
async function findGroupSession(page, crn, person, projectName, provider, teamName) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getWorkingDayForEsupervision, uiDateToIso } from "../delius/utils/date-time.mjs";
|
|
2
|
-
import { qa } from "../common/common.mjs";
|
|
3
2
|
import { refreshUntil } from "../delius/utils/refresh.mjs";
|
|
3
|
+
import { qa } from "../common/common.mjs";
|
|
4
4
|
import { searchPersonInMPoP } from "./application.mjs";
|
|
5
5
|
import { login } from "./login.mjs";
|
|
6
6
|
import { createOffenderCheckin } from "../api/esupervision/esupervision.mjs";
|
|
@@ -63,6 +63,10 @@ const testEnvironmentData = {
|
|
|
63
63
|
name: "Default Designated Transfer Team",
|
|
64
64
|
provider: "East of England"
|
|
65
65
|
},
|
|
66
|
+
accreditedProgrammesTestTeam: {
|
|
67
|
+
name: "CPB Automated Test Team",
|
|
68
|
+
provider: "London"
|
|
69
|
+
},
|
|
66
70
|
genericTeam: {
|
|
67
71
|
name: "Vale - Team",
|
|
68
72
|
provider: "Wales"
|