@ministryofjustice/hmpps-probation-integration-e2e-tests 1.118.0 → 1.120.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 +4 -2
- package/steps/accredited-programmes/application.mjs +1 -2
- package/steps/api/prison-identifier-and-delius/prison-identifier-and-delius.mjs +2 -3
- package/steps/api/utils/api-utils.d.mts +1 -1
- package/steps/cas2-short-term-accommodation/application.mjs +1 -3
- package/steps/court-case/prepare-case-for-sentence/application.mjs +2 -4
- package/steps/cvl-licences/application.mjs +1 -3
- package/steps/delius/contact/find-contacts.mjs +2 -4
- package/steps/delius/event/find-events.mjs +1 -2
- package/steps/delius/offender/delete-offender.d.mts +6 -0
- package/steps/delius/offender/delete-offender.mjs +15 -0
- package/steps/esupervision/check-in.d.mts +9 -0
- package/steps/esupervision/check-in.mjs +70 -0
- package/steps/make-recall-decisions/start-recommendation.mjs +1 -2
- package/steps/workforce/utils.mjs +1 -4
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.120.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@faker-js/faker": "^10.0.0",
|
|
19
19
|
"@kubernetes/client-node": "^1.0.0",
|
|
20
|
-
"@playwright/test": "1.56.
|
|
20
|
+
"@playwright/test": "1.56.1",
|
|
21
21
|
"dotenv": "^17.0.0",
|
|
22
22
|
"luxon": "^3.5.0",
|
|
23
23
|
"node-stream-zip": "^1.15.0",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"./steps/delius/logout": "./steps/delius/logout.mjs",
|
|
123
123
|
"./steps/delius/oasys-rsr-score/verify-rsr-score": "./steps/delius/oasys-rsr-score/verify-rsr-score.mjs",
|
|
124
124
|
"./steps/delius/offender/create-offender": "./steps/delius/offender/create-offender.mjs",
|
|
125
|
+
"./steps/delius/offender/delete-offender": "./steps/delius/offender/delete-offender.mjs",
|
|
125
126
|
"./steps/delius/offender/find-offender": "./steps/delius/offender/find-offender.mjs",
|
|
126
127
|
"./steps/delius/offender/update-offender": "./steps/delius/offender/update-offender.mjs",
|
|
127
128
|
"./steps/delius/registration/create-registration": "./steps/delius/registration/create-registration.mjs",
|
|
@@ -140,6 +141,7 @@
|
|
|
140
141
|
"./steps/delius/utils/refresh": "./steps/delius/utils/refresh.mjs",
|
|
141
142
|
"./steps/dps/caseload": "./steps/dps/caseload.mjs",
|
|
142
143
|
"./steps/dps/login": "./steps/dps/login.mjs",
|
|
144
|
+
"./steps/esupervision/check-in": "./steps/esupervision/check-in.mjs",
|
|
143
145
|
"./steps/hdc-licences/login": "./steps/hdc-licences/login.mjs",
|
|
144
146
|
"./steps/hmpps-auth/login": "./steps/hmpps-auth/login.mjs",
|
|
145
147
|
"./steps/k8s/k8s-utils": "./steps/k8s/k8s-utils.mjs",
|
|
@@ -53,8 +53,7 @@ async function clickOnOffenderLink(page, linkName, fullName) {
|
|
|
53
53
|
await nameLink.click();
|
|
54
54
|
}
|
|
55
55
|
async function verifyAssessmentDateTextToBe(page, expectedText) {
|
|
56
|
-
|
|
57
|
-
expect(actualText).toBe(expectedText);
|
|
56
|
+
expect(await page.locator(oasysImportDateText).first().evaluate((el) => el.textContent?.trim().replace(/\s+/g, " "))).toBe(expectedText);
|
|
58
57
|
}
|
|
59
58
|
async function assertRoSHRiskTable(page, assertions) {
|
|
60
59
|
const selectors = {
|
|
@@ -3,14 +3,13 @@ import { expect, request } from "@playwright/test";
|
|
|
3
3
|
|
|
4
4
|
//#region steps/api/prison-identifier-and-delius/prison-identifier-and-delius.ts
|
|
5
5
|
async function triggerMatching(nomsNumber) {
|
|
6
|
-
|
|
6
|
+
expect((await (await request.newContext({ baseURL: process.env.PRISON_IDENTIFIER_AND_DELIUS_URL })).post(`/person/match-by-noms?dryRun=false`, {
|
|
7
7
|
headers: {
|
|
8
8
|
Authorization: `Bearer ${await getToken()}`,
|
|
9
9
|
"Content-Type": "application/json"
|
|
10
10
|
},
|
|
11
11
|
data: JSON.stringify([nomsNumber])
|
|
12
|
-
});
|
|
13
|
-
expect(response.ok()).toBeTruthy();
|
|
12
|
+
})).ok()).toBeTruthy();
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region steps/api/utils/api-utils.d.ts
|
|
2
2
|
declare const sanitiseError: <T>(fn: AsyncFunction<T>) => AsyncFunction<T>;
|
|
3
3
|
declare const retry: <T>(fn: AsyncFunction<T>, retryCount?: number) => AsyncFunction<T>;
|
|
4
|
-
type AsyncFunction<T> = (...args: unknown[]) => Promise<T>;
|
|
4
|
+
type AsyncFunction<T$1> = (...args: unknown[]) => Promise<T$1>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { retry, sanitiseError };
|
|
@@ -45,9 +45,7 @@ async function confirmEligibilityAndConsent(page) {
|
|
|
45
45
|
await fillDateInput(page, "When did they give consent?");
|
|
46
46
|
await page.getByRole("button", { name: "Save and continue" }).click();
|
|
47
47
|
await expect(page).toHaveTitle("The person's Home Detention Curfew (HDC) licence dates - Short-Term Accommodation (CAS-2)");
|
|
48
|
-
|
|
49
|
-
const conditionalReleaseDate = await fillDateInput(page, "conditional release date", 2);
|
|
50
|
-
if (hdcEligibilityDate >= conditionalReleaseDate) throw new Error("HDC eligibility date must be before the conditional release date.");
|
|
48
|
+
if (await fillDateInput(page, "HDC eligibility date", 1) >= await fillDateInput(page, "conditional release date", 2)) throw new Error("HDC eligibility date must be before the conditional release date.");
|
|
51
49
|
await page.getByRole("button", { name: "Save and continue" }).click();
|
|
52
50
|
await expect(page).toHaveTitle(/Task list/);
|
|
53
51
|
}
|
|
@@ -54,11 +54,9 @@ async function extractRegistrationDetails(page) {
|
|
|
54
54
|
async function extractProbationRecordDetails(page) {
|
|
55
55
|
await page.getByRole("link", { name: "Probation record" }).click();
|
|
56
56
|
await expect(page).toHaveTitle("Probation record - Prepare a case for sentence");
|
|
57
|
-
const outcome = await page.locator(".govuk-summary-card__title").innerText();
|
|
58
|
-
const offence = await page.locator("dd p.govuk-body").first().innerText();
|
|
59
57
|
return {
|
|
60
|
-
outcome,
|
|
61
|
-
offence
|
|
58
|
+
outcome: await page.locator(".govuk-summary-card__title").innerText(),
|
|
59
|
+
offence: await page.locator("dd p.govuk-body").first().innerText()
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
62
|
|
|
@@ -58,9 +58,7 @@ const approveLicence = async (page, crn, nomsNumber, establishment) => {
|
|
|
58
58
|
await page.getByRole("link", { name: /Sign out/ }).click();
|
|
59
59
|
};
|
|
60
60
|
const cvlFormattedPhoneNumber = () => {
|
|
61
|
-
|
|
62
|
-
const cityNumber = Math.floor(Math.random() * 1e6).toString().padStart(6, "0");
|
|
63
|
-
return `${areaCode} ${cityNumber}`;
|
|
61
|
+
return `${"01" + Math.floor(Math.random() * 1e3).toString().padStart(2, "0")} ${Math.floor(Math.random() * 1e6).toString().padStart(6, "0")}`;
|
|
64
62
|
};
|
|
65
63
|
|
|
66
64
|
//#endregion
|
|
@@ -107,13 +107,11 @@ const updateSAAppointmentLocation = async (page, referralRef, appointmentMethod,
|
|
|
107
107
|
await page.waitForURL(/service-provider\/referrals\/.*\/supplier-assessment\/rescheduled-confirmation/);
|
|
108
108
|
await page.locator(".govuk-button", { hasText: "Return to progress" }).click();
|
|
109
109
|
await page.getByRole("link", { name: "View details or reschedule" }).click();
|
|
110
|
-
|
|
111
|
-
await expect(await appointmentDL.locator("p").nth(4).textContent()).toContain(NPSLocationToBeVerifiedInRAndM);
|
|
110
|
+
await expect(await (await page.locator(".govuk-summary-list")).locator("p").nth(4).textContent()).toContain(NPSLocationToBeVerifiedInRAndM);
|
|
112
111
|
};
|
|
113
112
|
const verifySAApptmntLocationInDelius = async (page, appointmentType, NPSOfficeLocationToBeVerified) => {
|
|
114
113
|
await (await page.locator("tr", { hasText: appointmentType })).locator("[title=\"Link to view the contact details.\"]").click();
|
|
115
|
-
|
|
116
|
-
await expect(location).toBe(NPSOfficeLocationToBeVerified);
|
|
114
|
+
await expect(await page.locator("#location\\:outputText").textContent()).toBe(NPSOfficeLocationToBeVerified);
|
|
117
115
|
};
|
|
118
116
|
const fillAndSaveIfTextBoxIsAvailable = async (page, textBoxLocator, textToBeEnteredInTextBox, saveButtonLocator, radioButtonLocator) => {
|
|
119
117
|
const textBox = page.locator(textBoxLocator);
|
|
@@ -36,8 +36,7 @@ const verifyDate = async (page, label, date) => {
|
|
|
36
36
|
await expect(page.locator(`[id="${id}"]`)).toHaveText(DeliusDateFormatter(date));
|
|
37
37
|
};
|
|
38
38
|
const verifyTableDate = async (page, label, date) => {
|
|
39
|
-
|
|
40
|
-
await expect(matchingRecord).toContainText(DeliusDateFormatter(date));
|
|
39
|
+
await expect(page.locator("tr", { hasText: label })).toContainText(DeliusDateFormatter(date));
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { findOffenderByCRN } from "./find-offender.mjs";
|
|
2
|
+
|
|
3
|
+
//#region steps/delius/offender/delete-offender.ts
|
|
4
|
+
async function deleteOffender(page, crn) {
|
|
5
|
+
await findOffenderByCRN(page, crn);
|
|
6
|
+
await page.getByRole("link", { name: "Event List" }).click();
|
|
7
|
+
await page.getByRole("link", { name: "delete" }).click();
|
|
8
|
+
await page.getByRole("button", { name: "Confirm" }).click();
|
|
9
|
+
await page.getByRole("link", { name: "Personal Details" }).click();
|
|
10
|
+
await page.getByRole("button", { name: "Delete" }).click();
|
|
11
|
+
await page.getByRole("button", { name: "Confirm" }).click();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { deleteOffender };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Person } from "../delius/utils/person.mjs";
|
|
2
|
+
import { Page } from "@playwright/test";
|
|
3
|
+
|
|
4
|
+
//#region steps/esupervision/check-in.d.ts
|
|
5
|
+
declare function registerCase(page: Page, person: Person, crn: string): Promise<string>;
|
|
6
|
+
declare function createCheckin(page: Page, uuid: string, person: Person): Promise<void>;
|
|
7
|
+
declare function reviewCheckin(page: Page, person: Person): Promise<void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createCheckin, registerCase, reviewCheckin };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DeliusDateFormatter } from "../delius/utils/date-time.mjs";
|
|
2
|
+
import { login } from "../hmpps-auth/login.mjs";
|
|
3
|
+
import { expect } from "@playwright/test";
|
|
4
|
+
import { DateTime } from "luxon";
|
|
5
|
+
|
|
6
|
+
//#region steps/esupervision/check-in.ts
|
|
7
|
+
async function registerCase(page, person, crn) {
|
|
8
|
+
await login(page);
|
|
9
|
+
await page.goto(process.env.ESUPERVISION_URL);
|
|
10
|
+
await page.getByRole("button", { name: "Add person" }).click();
|
|
11
|
+
await enterPersonalDetails(page, person);
|
|
12
|
+
await page.getByRole("textbox", { name: /CRN/ }).fill(crn);
|
|
13
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
14
|
+
await page.getByRole("link", { name: "Upload photo instead" }).click();
|
|
15
|
+
await page.locator("#photoUpload-input").setInputFiles("files/mock-person-photo.png");
|
|
16
|
+
await page.getByRole("button", { name: "Upload photo" }).click();
|
|
17
|
+
await page.getByRole("link", { name: "Yes, continue" }).click();
|
|
18
|
+
await page.getByRole("radio", { name: "Email" }).check();
|
|
19
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
20
|
+
await page.locator("#email").fill(`simulate-delivered+${person.firstName}${person.lastName}@notifications.service.gov.uk`);
|
|
21
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
22
|
+
await page.locator("#startDate").fill(DeliusDateFormatter(/* @__PURE__ */ new Date()));
|
|
23
|
+
await page.getByRole("radio", { name: "Every 8 weeks" }).check();
|
|
24
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
25
|
+
await page.getByRole("button", { name: "Confirm and add person" }).click();
|
|
26
|
+
await page.getByRole("link", { name: "Awaiting check in" }).click();
|
|
27
|
+
const cell = page.getByRole("cell", {
|
|
28
|
+
name: person.firstName + " " + person.lastName,
|
|
29
|
+
exact: true
|
|
30
|
+
});
|
|
31
|
+
return await page.getByRole("row").filter({ has: cell }).getAttribute("data-checkin-uuid");
|
|
32
|
+
}
|
|
33
|
+
async function createCheckin(page, uuid, person) {
|
|
34
|
+
await page.goto(`${process.env.ESUPERVISION_URL}/submission/${uuid}`);
|
|
35
|
+
await page.getByRole("button", { name: "Start now" }).click();
|
|
36
|
+
await enterPersonalDetails(page, person);
|
|
37
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
38
|
+
await page.getByRole("radio", { name: "Very well" }).check();
|
|
39
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
40
|
+
await page.getByRole("checkbox", { name: "No, I do not need help" }).check();
|
|
41
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
42
|
+
await page.getByRole("radio", { name: "No" }).check();
|
|
43
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
44
|
+
await page.getByRole("button", { name: "Continue" }).click();
|
|
45
|
+
await page.getByRole("button", { name: "Start recording" }).click();
|
|
46
|
+
await page.getByRole("button", { name: "Submit video anyway" }).click();
|
|
47
|
+
await page.getByRole("checkbox", { name: /I confirm/ }).check();
|
|
48
|
+
await page.getByRole("button", { name: "Complete check in" }).click();
|
|
49
|
+
await expect(page.locator("h1")).toContainText("Check in completed");
|
|
50
|
+
}
|
|
51
|
+
async function enterPersonalDetails(page, person) {
|
|
52
|
+
await page.getByRole("textbox", { name: "First name" }).fill(person.firstName);
|
|
53
|
+
await page.getByRole("textbox", { name: "Last name" }).fill(person.lastName);
|
|
54
|
+
const dob = DateTime.fromJSDate(person.dob);
|
|
55
|
+
await page.getByRole("textbox", { name: "Day" }).fill(dob.day.toString());
|
|
56
|
+
await page.getByRole("textbox", { name: "Month" }).fill(dob.month.toString());
|
|
57
|
+
await page.getByRole("textbox", { name: "Year" }).fill(dob.year.toString());
|
|
58
|
+
}
|
|
59
|
+
async function reviewCheckin(page, person) {
|
|
60
|
+
await page.goto(process.env.ESUPERVISION_URL);
|
|
61
|
+
await page.getByRole("row").filter({ has: page.getByRole("cell", {
|
|
62
|
+
name: person.firstName + " " + person.lastName,
|
|
63
|
+
exact: true
|
|
64
|
+
}) }).getByRole("link", { name: /Review/ }).click();
|
|
65
|
+
await page.getByRole("radio", { name: "Yes" }).check();
|
|
66
|
+
await page.getByRole("button", { name: "Mark as reviewed" }).click();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { createCheckin, registerCase, reviewCheckin };
|
|
@@ -81,8 +81,7 @@ const verifyRecallOffendersAddress = async (page, street, city, postcode) => {
|
|
|
81
81
|
};
|
|
82
82
|
const verifyLicenceCondition = async (page, licenceCondition) => {
|
|
83
83
|
await page.getByRole("link", { name: "Licence conditions" }).click();
|
|
84
|
-
|
|
85
|
-
await expect(recallLicenseDesc).toMatch(licenceCondition.replace(/(.*)-/, "").trim());
|
|
84
|
+
await expect(await page.locator("#accordion-with-summary-sections-content-2 p, [data-qa=\"condition-description\"]").first().textContent()).toMatch(licenceCondition.replace(/(.*)-/, "").trim());
|
|
86
85
|
};
|
|
87
86
|
const verifyContact = async (page, contactDetails) => {
|
|
88
87
|
await page.getByRole("link", { name: "Contact history" }).click();
|
|
@@ -15,10 +15,7 @@ const months = [
|
|
|
15
15
|
];
|
|
16
16
|
const WorkforceDateFormat = (date) => {
|
|
17
17
|
if (!date.isValid) throw new Error("Invalid DateTime object provided");
|
|
18
|
-
|
|
19
|
-
const month = months[date.month - 1];
|
|
20
|
-
const year = date.year;
|
|
21
|
-
return `${day} ${month} ${year}`;
|
|
18
|
+
return `${date.day} ${months[date.month - 1]} ${date.year}`;
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
//#endregion
|