@ministryofjustice/hmpps-probation-integration-e2e-tests 1.203.0 → 1.205.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 +3 -1
- package/steps/api/probation-access-control/probation-access-control.d.mts +6 -0
- package/steps/api/probation-access-control/probation-access-control.mjs +19 -0
- package/steps/delius/upw/create-upw-appointment.d.mts +31 -0
- package/steps/delius/upw/create-upw-appointment.mjs +29 -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.205.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"./steps/api/esupervision/esupervision": "./steps/api/esupervision/esupervision.mjs",
|
|
46
46
|
"./steps/api/external-api/external-api": "./steps/api/external-api/external-api.mjs",
|
|
47
47
|
"./steps/api/prison-identifier-and-delius/prison-identifier-and-delius": "./steps/api/prison-identifier-and-delius/prison-identifier-and-delius.mjs",
|
|
48
|
+
"./steps/api/probation-access-control/probation-access-control": "./steps/api/probation-access-control/probation-access-control.mjs",
|
|
48
49
|
"./steps/api/resettlement-passport/resettlement-passport-api": "./steps/api/resettlement-passport/resettlement-passport-api.mjs",
|
|
49
50
|
"./steps/api/sentence-plan/sentence-plan-and-delius": "./steps/api/sentence-plan/sentence-plan-and-delius.mjs",
|
|
50
51
|
"./steps/api/utils/api-utils": "./steps/api/utils/api-utils.mjs",
|
|
@@ -136,6 +137,7 @@
|
|
|
136
137
|
"./steps/delius/transfer/internal-transfer": "./steps/delius/transfer/internal-transfer.mjs",
|
|
137
138
|
"./steps/delius/upw/allocate-current-case-to-upw-project": "./steps/delius/upw/allocate-current-case-to-upw-project.mjs",
|
|
138
139
|
"./steps/delius/upw/checkAppointmentDetails": "./steps/delius/upw/checkAppointmentDetails.mjs",
|
|
140
|
+
"./steps/delius/upw/create-upw-appointment": "./steps/delius/upw/create-upw-appointment.mjs",
|
|
139
141
|
"./steps/delius/upw/create-upw-project": "./steps/delius/upw/create-upw-project.mjs",
|
|
140
142
|
"./steps/delius/upw/start-upw-assessment": "./steps/delius/upw/start-upw-assessment.mjs",
|
|
141
143
|
"./steps/delius/upw/verify-time-credited": "./steps/delius/upw/verify-time-credited.mjs",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as _$playwright_core0 from "playwright-core";
|
|
2
|
+
|
|
3
|
+
//#region steps/api/probation-access-control/probation-access-control.d.ts
|
|
4
|
+
declare function getAccessControlForUserAndPerson(user: string, crn: string): Promise<_$playwright_core0.APIResponse>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getAccessControlForUserAndPerson };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getToken } from "../auth/get-token.mjs";
|
|
2
|
+
import { request } from "@playwright/test";
|
|
3
|
+
//#region steps/api/probation-access-control/probation-access-control.ts
|
|
4
|
+
async function getContext() {
|
|
5
|
+
const token = await getToken();
|
|
6
|
+
return request.newContext({
|
|
7
|
+
baseURL: process.env.PROBATION_ACCESS_CONTROL_API,
|
|
8
|
+
extraHTTPHeaders: {
|
|
9
|
+
Accept: "application/json",
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
Authorization: `Bearer ${token}`
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async function getAccessControlForUserAndPerson(user, crn) {
|
|
16
|
+
return await (await getContext()).get(`/user/${user}/access/${crn}`);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getAccessControlForUserAndPerson };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Page } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
//#region steps/delius/upw/create-upw-appointment.d.ts
|
|
4
|
+
interface Options {
|
|
5
|
+
crn: string;
|
|
6
|
+
eventNumber?: number;
|
|
7
|
+
projectName: string;
|
|
8
|
+
date: Date;
|
|
9
|
+
providerName: string;
|
|
10
|
+
teamName: string;
|
|
11
|
+
startTime?: string;
|
|
12
|
+
endTime?: string;
|
|
13
|
+
supervisorName?: string;
|
|
14
|
+
projectType: string;
|
|
15
|
+
allocation: string;
|
|
16
|
+
}
|
|
17
|
+
declare function createUpwAppointment(page: Page, {
|
|
18
|
+
crn,
|
|
19
|
+
eventNumber,
|
|
20
|
+
projectName,
|
|
21
|
+
date,
|
|
22
|
+
providerName,
|
|
23
|
+
teamName,
|
|
24
|
+
startTime,
|
|
25
|
+
endTime,
|
|
26
|
+
supervisorName,
|
|
27
|
+
projectType,
|
|
28
|
+
allocation
|
|
29
|
+
}: Options): Promise<void>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { createUpwAppointment as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { waitForAjax } from "../utils/refresh.mjs";
|
|
2
|
+
import { fillDate, selectOption } from "../utils/inputs.mjs";
|
|
3
|
+
import { findEventByCRN } from "../event/find-events.mjs";
|
|
4
|
+
import { expect } from "@playwright/test";
|
|
5
|
+
//#region steps/delius/upw/create-upw-appointment.ts
|
|
6
|
+
async function createUpwAppointment(page, { crn, eventNumber = 1, projectName, date, providerName, teamName, startTime, endTime, supervisorName = "Unallocated", projectType, allocation }) {
|
|
7
|
+
await findEventByCRN(page, crn, eventNumber);
|
|
8
|
+
await page.click("#navigation-include\\:linkNavigation3UnpaidWork");
|
|
9
|
+
await page.getByRole("button", { name: "Worksheet summary" }).click();
|
|
10
|
+
await waitForAjax(page);
|
|
11
|
+
await page.getByRole("button", { name: "Add appointment" }).click();
|
|
12
|
+
await waitForAjax(page);
|
|
13
|
+
await fillDate(page, "#appointmentDate\\:datePicker", date);
|
|
14
|
+
await selectOption(page, "#trustList\\:selectOneMenu", providerName);
|
|
15
|
+
await selectOption(page, "#projectTeamList\\:selectOneMenu", teamName);
|
|
16
|
+
await selectOption(page, "#project\\:selectOneMenu", projectName);
|
|
17
|
+
await selectOption(page, "#projectType\\:selectOneMenu", projectType);
|
|
18
|
+
await selectOption(page, "#projectAvailability\\:selectOneMenu", allocation);
|
|
19
|
+
await waitForAjax(page);
|
|
20
|
+
if (startTime) await page.fill("#startTime\\:timePicker", startTime);
|
|
21
|
+
if (endTime) await page.fill("#endTime\\:timePicker", endTime);
|
|
22
|
+
await selectOption(page, "#supervisorTeam\\:selectOneMenu", teamName);
|
|
23
|
+
await selectOption(page, "#supervisorEmployee\\:selectOneMenu", supervisorName);
|
|
24
|
+
await page.getByRole("button", { name: "Save" }).click();
|
|
25
|
+
await waitForAjax(page);
|
|
26
|
+
await expect(page.getByRole("heading", { level: 1 })).toContainText("Worksheet Summary");
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { createUpwAppointment as default };
|