@ministryofjustice/hmpps-probation-integration-e2e-tests 1.118.0 → 1.119.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 +2 -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/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.119.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",
|
|
@@ -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
|
|
@@ -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
|