@ministryofjustice/hmpps-probation-integration-e2e-tests 1.222.0 → 1.224.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.222.0",
4
+ "version": "1.224.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
7
7
  "bugs": {
@@ -8,6 +8,7 @@ declare function adjustTravelTime(page: Page, hours: string, minutes: string): P
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>;
11
+ declare function addSupervisorDetails(page: Page, teamName: string, supervisor: string): Promise<void>;
11
12
  declare function recordSessionAttendance(page: Page, startTime: string, endTime: string): Promise<string | null>;
12
13
  //#endregion
13
- export { adjustTravelTime, findAnAppointment, findAnIndividualPlacement, findGroupSession, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
14
+ export { addSupervisorDetails, adjustTravelTime, findAnAppointment, findAnIndividualPlacement, findGroupSession, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
@@ -15,7 +15,7 @@ async function recordAttendanceCompliedOutcome(page, startTime, endTime) {
15
15
  await page.getByRole("button", { name: "Continue" }).click();
16
16
  await page.locator("input[name=\"hiVis\"][value=\"yes\"]").click();
17
17
  await page.locator("input[name=\"workedIntensively\"][value=\"yes\"]").click();
18
- await page.locator("input[name=\"workQuality\"][value=\"GOOD\"]").click();
18
+ await page.locator("input[name=\"workQuality\"][value=\"EXCELLENT\"]").click();
19
19
  await page.locator("input[name=\"behaviour\"][value=\"GOOD\"]").click();
20
20
  await page.getByRole("button", { name: "Continue" }).click();
21
21
  await page.getByRole("heading", { name: "Confirm details" }).isVisible();
@@ -38,12 +38,16 @@ async function recordUnacceptableAbsenceOutcome(page) {
38
38
  await page.getByRole("link", { name: "Sign out" }).click();
39
39
  }
40
40
  async function adjustTravelTime(page, hours, minutes) {
41
+ const today = DateTime.now();
42
+ await page.locator("#date-day").fill(today.day.toString());
43
+ await page.locator("#date-month").fill(today.month.toString());
44
+ await page.locator("#date-year").fill(today.year.toString());
41
45
  await page.locator("#hours").fill(hours);
42
46
  await page.locator("#minutes").fill(minutes);
43
47
  await page.getByRole("button", { name: "Credit travel time" }).click();
44
48
  await expect(page.locator("#success-title-1")).toContainText(/Success/);
45
49
  const hoursString = hours === "1" ? "hour" : "hours";
46
- const minutesString = hours === "1" ? "minute" : "minutes";
50
+ const minutesString = minutes === "1" ? "minute" : "minutes";
47
51
  await expect(page.locator(".govuk-notification-banner__content h3")).toContainText(RegExp(` has been adjusted for ${hours} ${hoursString} ${minutes} ${minutesString} of travel time.`, "i"));
48
52
  await page.getByRole("link", { name: "Sign out" }).click();
49
53
  }
@@ -66,10 +70,7 @@ async function findGroupSession(page, crn, person, projectName, provider, teamNa
66
70
  await page.getByRole("cell", { name: crn }).isVisible();
67
71
  await page.getByRole("link", { name: "Update" }).first().click();
68
72
  await expect(page.locator(".govuk-caption-l")).toContainText(crn);
69
- await page.getByRole("button", { name: "Update appointment" }).click();
70
- await expect(page.getByRole("heading", { name: "Add supervisor details" })).toBeVisible();
71
- await selectOption(page, "#supervisor", supervisor);
72
- await page.getByRole("button", { name: "Continue" }).click();
73
+ await addSupervisorDetails(page, teamName, supervisor);
73
74
  }
74
75
  async function findAnIndividualPlacement(page, provider, teamName) {
75
76
  const supervisor = "Unallocated Staff";
@@ -81,10 +82,7 @@ async function findAnIndividualPlacement(page, provider, teamName) {
81
82
  await page.getByRole("link", { name: "Update" }).first().click();
82
83
  const crn = await page.locator(".govuk-caption-l").textContent();
83
84
  await expect(page.locator("h2.govuk-heading-m")).toContainText("Appointment details");
84
- await page.getByRole("button", { name: "Update appointment" }).click();
85
- await expect(page.getByRole("heading", { name: "Add supervisor details" })).toBeVisible();
86
- await selectOption(page, "#supervisor", supervisor);
87
- await page.getByRole("button", { name: "Continue" }).click();
85
+ await addSupervisorDetails(page, teamName, supervisor);
88
86
  return crn;
89
87
  }
90
88
  async function findAnAppointment(page, provider) {
@@ -95,6 +93,14 @@ async function findAnAppointment(page, provider) {
95
93
  await page.getByRole("link", { name: "Update" }).nth(3).click();
96
94
  return crn;
97
95
  }
96
+ async function addSupervisorDetails(page, teamName, supervisor) {
97
+ await page.getByRole("button", { name: "Update appointment" }).click();
98
+ await expect(page.getByRole("heading", { name: "Add supervisor details" })).toBeVisible();
99
+ await selectOption(page, "#team", teamName);
100
+ await page.getByRole("button", { name: "Select team" }).click();
101
+ await selectOption(page, "#supervisor", supervisor);
102
+ await page.getByRole("button", { name: "Continue" }).click();
103
+ }
98
104
  async function recordSessionAttendance(page, startTime, endTime) {
99
105
  await expect(page).toHaveTitle(/Record group session attendance/);
100
106
  await page.getByRole("button", { name: "View details" }).first().click();
@@ -115,4 +121,4 @@ async function recordSessionAttendance(page, startTime, endTime) {
115
121
  return crn;
116
122
  }
117
123
  //#endregion
118
- export { adjustTravelTime, findAnAppointment, findAnIndividualPlacement, findGroupSession, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
124
+ export { addSupervisorDetails, adjustTravelTime, findAnAppointment, findAnIndividualPlacement, findGroupSession, recordAttendanceCompliedOutcome, recordSessionAttendance, recordUnacceptableAbsenceOutcome };
@@ -92,7 +92,7 @@ async function reviewCheckinInMPoP(page, crn) {
92
92
  await refreshUntil(page, () => expect(page.getByRole("link", { name: /Manage +Online probation/ })).toBeVisible());
93
93
  await page.getByRole("link", { name: /Manage +Online probation/ }).click();
94
94
  await expect(heading).toContainText("Online check in submitted");
95
- await page.getByRole("radio", { name: "Yes" }).check();
95
+ await page.getByRole("radio", { name: "Yes, and there is nothing" }).click();
96
96
  await page.getByRole("button", { name: "Confirm and review responses" }).click();
97
97
  await expect(heading).toContainText("Online check in submitted");
98
98
  await page.locator("textarea.govuk-textarea").fill(faker.lorem.sentence());
@@ -9,7 +9,8 @@ declare enum UserType {
9
9
  Assessment = 3,
10
10
  OPD = 4,
11
11
  ApprovedPSORole = 5,
12
- AccreditedProgrammesAssessment = 6
12
+ AccreditedProgrammesAssessment = 6,
13
+ ManageAndDeliver = 7
13
14
  }
14
15
  //#endregion
15
16
  export { UserType, login };
@@ -16,6 +16,7 @@ let UserType = /* @__PURE__ */ function(UserType) {
16
16
  UserType[UserType["OPD"] = 4] = "OPD";
17
17
  UserType[UserType["ApprovedPSORole"] = 5] = "ApprovedPSORole";
18
18
  UserType[UserType["AccreditedProgrammesAssessment"] = 6] = "AccreditedProgrammesAssessment";
19
+ UserType[UserType["ManageAndDeliver"] = 7] = "ManageAndDeliver";
19
20
  return UserType;
20
21
  }({});
21
22
  const oasysUserConfig = (userType) => {
@@ -48,6 +49,10 @@ const oasysUserConfig = (userType) => {
48
49
  username: process.env.OASYS_USERNAME_ACCREDITED_PROGRAMMES,
49
50
  password: process.env.OASYS_PASSWORD_ACCREDITED_PROGRAMMES
50
51
  };
52
+ case 7: return {
53
+ username: process.env.OASYS_USERNAME_MANAGE_AND_DELIVER,
54
+ password: process.env.OASYS_PASSWORD_MANAGE_AND_DELIVER
55
+ };
51
56
  }
52
57
  };
53
58
  //#endregion