@ministryofjustice/hmpps-probation-integration-e2e-tests 1.209.0 → 1.211.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
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.211.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -212,7 +212,9 @@ async function enterPlacementConsiderations(page) {
|
|
|
212
212
|
await page.locator("#riskToPublic").fill("Risk to public details");
|
|
213
213
|
await page.locator("#riskToKnownAdult").fill("Risk to known adult details");
|
|
214
214
|
await page.locator("#riskToStaff").fill("Risk to staff details");
|
|
215
|
+
await page.locator("input[name=\"riskToSelfConcerns\"][value=\"no\"]").click();
|
|
215
216
|
await page.locator("#riskToSelf").fill("Risk to self details");
|
|
217
|
+
await page.locator("input[name=\"safetyPlanCompleted\"][value=\"yesAndConsentToShareHasBeenGiven\"]").click();
|
|
216
218
|
await page.getByRole("button", { name: "Next" }).click();
|
|
217
219
|
await expect(page).toHaveTitle("Risk management plan - CAS3");
|
|
218
220
|
await page.getByRole("textbox", { name: "Victim safety planning" }).fill("Victim safety planning details");
|
|
@@ -2,10 +2,11 @@ import { Person } from "../delius/utils/person.mjs";
|
|
|
2
2
|
import { Page } from "@playwright/test";
|
|
3
3
|
|
|
4
4
|
//#region steps/community-payback/record-outcome.d.ts
|
|
5
|
-
declare function recordAttendanceCompliedOutcome(page: Page,
|
|
6
|
-
declare function recordUnacceptableAbsenceOutcome(page: Page
|
|
5
|
+
declare function recordAttendanceCompliedOutcome(page: Page, startTime?: string, endTime?: string): Promise<void>;
|
|
6
|
+
declare function recordUnacceptableAbsenceOutcome(page: Page): Promise<void>;
|
|
7
7
|
declare function adjustTravelTime(page: Page, hours: string, minutes: string): 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 findPlacementsWithHostPartner(page: Page, provider: string, teamName: string): Promise<string>;
|
|
10
|
+
declare function recordSessionAttendance(page: Page, startTime: string, endTime: string): Promise<string>;
|
|
10
11
|
//#endregion
|
|
11
|
-
export { adjustTravelTime, findGroupSession, findPlacementsWithHostPartner, recordAttendanceCompliedOutcome, recordUnacceptableAbsenceOutcome };
|
|
12
|
+
export { adjustTravelTime, findGroupSession, findPlacementsWithHostPartner, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Yesterday } from "../delius/utils/date-time.mjs";
|
|
2
1
|
import { selectOption } from "../delius/utils/inputs.mjs";
|
|
3
2
|
import { expect } from "@playwright/test";
|
|
4
3
|
import { DateTime } from "luxon";
|
|
5
4
|
import { faker } from "@faker-js/faker";
|
|
6
5
|
//#region steps/community-payback/record-outcome.ts
|
|
7
|
-
async function recordAttendanceCompliedOutcome(page,
|
|
6
|
+
async function recordAttendanceCompliedOutcome(page, startTime, endTime) {
|
|
8
7
|
await page.getByText("Attended - Complied").click();
|
|
9
8
|
await page.locator("#notes").fill(faker.lorem.sentence());
|
|
10
9
|
await page.getByRole("radio", { name: "No, they are not sensitive" }).click();
|
|
@@ -22,23 +21,20 @@ async function recordAttendanceCompliedOutcome(page, crn, startTime, endTime) {
|
|
|
22
21
|
await page.getByRole("heading", { name: "Confirm details" }).isVisible();
|
|
23
22
|
await page.locator("input[name=\"alertPractitioner\"][value=\"no\"]").click();
|
|
24
23
|
await page.getByRole("button", { name: "Confirm" }).click();
|
|
25
|
-
await page.pause();
|
|
26
24
|
await expect(page.getByRole("heading", { name: "Success" })).toBeVisible();
|
|
27
25
|
await expect(page.locator(".govuk-notification-banner__content h3")).toContainText(/Attendance recorded/);
|
|
28
26
|
await page.getByRole("link", { name: "Sign out" }).click();
|
|
29
27
|
}
|
|
30
|
-
async function recordUnacceptableAbsenceOutcome(page
|
|
31
|
-
page.locator("h1.govuk-fieldset__heading");
|
|
32
|
-
await page.pause();
|
|
28
|
+
async function recordUnacceptableAbsenceOutcome(page) {
|
|
33
29
|
await page.getByText("Unacceptable Absence").click();
|
|
34
30
|
await page.locator("#notes").fill(faker.lorem.sentence());
|
|
31
|
+
await page.getByRole("radio", { name: "No, they are not sensitive" }).click();
|
|
35
32
|
await page.getByRole("button", { name: "Continue" }).click();
|
|
36
|
-
await page.locator("#penaltyTimeHours").fill(penaltyTimeHours);
|
|
37
|
-
await page.locator("#penaltyTimeMinutes").fill(penaltyTimeMinutes);
|
|
38
|
-
await page.getByRole("button", { name: "Continue" }).click();
|
|
39
|
-
await page.pause();
|
|
40
33
|
await page.getByRole("heading", { name: "Confirm details" }).isVisible();
|
|
41
34
|
await expect(page.locator(".moj-alert__content")).toContainText(/This outcome will be shared with the practitioner as it requires enforcement action./);
|
|
35
|
+
await page.getByRole("button", { name: "Confirm" }).click();
|
|
36
|
+
await expect(page.getByRole("heading", { name: "Success" })).toBeVisible();
|
|
37
|
+
await expect(page.locator(".govuk-notification-banner__content h3")).toContainText(/Attendance recorded/);
|
|
42
38
|
await page.getByRole("link", { name: "Sign out" }).click();
|
|
43
39
|
}
|
|
44
40
|
async function adjustTravelTime(page, hours, minutes) {
|
|
@@ -57,9 +53,9 @@ async function findGroupSession(page, crn, person, projectName, provider, teamNa
|
|
|
57
53
|
await page.getByRole("link", { name: "Record group session" }).click();
|
|
58
54
|
await selectOption(page, "#provider", provider);
|
|
59
55
|
await selectOption(page, "#team", teamName);
|
|
60
|
-
await page.locator("#startDate-day").fill(
|
|
61
|
-
await page.locator("#startDate-month").fill(
|
|
62
|
-
await page.locator("#startDate-year").fill(
|
|
56
|
+
await page.locator("#startDate-day").fill(today.day.toString());
|
|
57
|
+
await page.locator("#startDate-month").fill(today.month.toString());
|
|
58
|
+
await page.locator("#startDate-year").fill(today.year.toString());
|
|
63
59
|
await page.locator("#endDate-day").fill(today.day.toString());
|
|
64
60
|
await page.locator("#endDate-month").fill(today.month.toString());
|
|
65
61
|
await page.locator("#endDate-year").fill(today.year.toString());
|
|
@@ -70,23 +66,42 @@ async function findGroupSession(page, crn, person, projectName, provider, teamNa
|
|
|
70
66
|
await page.getByRole("cell", { name: crn }).isVisible();
|
|
71
67
|
await page.getByRole("link", { name: "Update" }).click();
|
|
72
68
|
await expect(page.locator(".govuk-caption-l")).toContainText(crn);
|
|
69
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
70
|
+
await expect(page.getByRole("heading", { name: "Add supervisor details" })).toBeVisible();
|
|
73
71
|
await selectOption(page, "#supervisor", supervisor);
|
|
74
72
|
await page.getByRole("button", { name: "Continue" }).click();
|
|
75
73
|
}
|
|
76
74
|
async function findPlacementsWithHostPartner(page, provider, teamName) {
|
|
77
|
-
await page.pause();
|
|
78
75
|
const supervisor = "Unallocated Staff";
|
|
79
76
|
await page.getByRole("link", { name: "Record attendance with host" }).click();
|
|
80
77
|
await selectOption(page, "#provider", provider);
|
|
81
78
|
await selectOption(page, "#team", teamName);
|
|
82
79
|
await page.getByRole("button", { name: "Apply filters" }).click();
|
|
83
|
-
await page.
|
|
80
|
+
await page.locator("//tbody/tr[1]/td[1]/a").click();
|
|
84
81
|
await page.getByRole("link", { name: "Update" }).first().click();
|
|
85
82
|
const crn = await page.locator(".govuk-caption-l").textContent();
|
|
86
83
|
await expect(page.locator("h2.govuk-heading-m")).toContainText("Appointment details");
|
|
84
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
85
|
+
await expect(page.getByRole("heading", { name: "Add supervisor details" })).toBeVisible();
|
|
87
86
|
await selectOption(page, "#supervisor", supervisor);
|
|
88
87
|
await page.getByRole("button", { name: "Continue" }).click();
|
|
89
88
|
return crn;
|
|
90
89
|
}
|
|
90
|
+
async function recordSessionAttendance(page, startTime, endTime) {
|
|
91
|
+
await expect(page).toHaveTitle(/Record group session attendance/);
|
|
92
|
+
await page.getByRole("button", { name: "View details" }).first().click();
|
|
93
|
+
await page.getByRole("heading", { name: "Session details" }).isVisible();
|
|
94
|
+
await page.getByRole("heading", { name: "Automated UI Tests" }).isVisible();
|
|
95
|
+
await page.getByRole("link", { name: "View and update" }).click();
|
|
96
|
+
const crn = await page.locator(".govuk-caption-l").textContent();
|
|
97
|
+
await page.getByRole("button", { name: "Arrived" }).click();
|
|
98
|
+
await page.locator("#time").fill(startTime);
|
|
99
|
+
await page.getByRole("button", { name: "Confirm and continue" }).click();
|
|
100
|
+
await page.locator("input[name=\"ableToWork\"][value=\"yes\"]").click();
|
|
101
|
+
await page.getByRole("button", { name: "Confirm and continue" }).click();
|
|
102
|
+
await page.locator("#time").fill(endTime);
|
|
103
|
+
await page.getByRole("button", { name: "Confirm and continue" }).click();
|
|
104
|
+
return crn;
|
|
105
|
+
}
|
|
91
106
|
//#endregion
|
|
92
|
-
export { adjustTravelTime, findGroupSession, findPlacementsWithHostPartner, recordAttendanceCompliedOutcome, recordUnacceptableAbsenceOutcome };
|
|
107
|
+
export { adjustTravelTime, findGroupSession, findPlacementsWithHostPartner, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
|
|
@@ -42,6 +42,7 @@ async function createEvent(page, { crn, allocation, event, date }) {
|
|
|
42
42
|
await selectOption(page, "#OutcomeArea\\:selectOneMenu", allocation?.team?.provider);
|
|
43
43
|
await selectOption(page, "#OutcomeTeam\\:selectOneMenu", allocation?.team?.name);
|
|
44
44
|
}
|
|
45
|
+
if (event.appearanceType === "Sentence") await selectOption(page, "#jfda\\:selectOneMenu", "No");
|
|
45
46
|
if (event.length) await page.fill("#Length", event.length);
|
|
46
47
|
if (event.reportType) {
|
|
47
48
|
await selectOption(page, "#Report\\:selectOneMenu", event.reportType);
|