@ministryofjustice/hmpps-probation-integration-e2e-tests 1.134.0 → 1.136.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.134.0",
4
+ "version": "1.136.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.1",
20
+ "@playwright/test": "1.57.0",
21
21
  "luxon": "^3.5.0",
22
22
  "node-stream-zip": "^1.15.0",
23
23
  "pdf2json": "^4.0.0"
@@ -29,7 +29,7 @@
29
29
  "@typescript-eslint/parser": "^8.0.1",
30
30
  "eslint-config-prettier": "^10.0.1",
31
31
  "eslint-plugin-prettier": "^5.2.1",
32
- "prettier": "3.6.2",
32
+ "prettier": "3.7.3",
33
33
  "tsdown": "^0.16.1"
34
34
  },
35
35
  "exports": {
@@ -133,6 +133,7 @@
133
133
  "./steps/delius/staff/community-manager": "./steps/delius/staff/community-manager.mjs",
134
134
  "./steps/delius/transfer/internal-transfer": "./steps/delius/transfer/internal-transfer.mjs",
135
135
  "./steps/delius/upw/allocate-current-case-to-upw-project": "./steps/delius/upw/allocate-current-case-to-upw-project.mjs",
136
+ "./steps/delius/upw/create-upw-project": "./steps/delius/upw/create-upw-project.mjs",
136
137
  "./steps/delius/upw/start-upw-assessment": "./steps/delius/upw/start-upw-assessment.mjs",
137
138
  "./steps/delius/utils/contact": "./steps/delius/utils/contact.mjs",
138
139
  "./steps/delius/utils/date-time": "./steps/delius/utils/date-time.mjs",
@@ -4,11 +4,13 @@ import { Page } from "@playwright/test";
4
4
  declare function allocateCurrentCaseToUpwProject(page: Page, {
5
5
  providerName,
6
6
  teamName,
7
+ projectName,
7
8
  day,
8
9
  projectType
9
10
  }: {
10
11
  providerName: string;
11
12
  teamName: string;
13
+ projectName: string;
12
14
  day?: string;
13
15
  projectType?: string;
14
16
  }): Promise<void>;
@@ -1,8 +1,9 @@
1
+ import { getCurrentDay } from "../utils/date-time.mjs";
1
2
  import { selectOption } from "../utils/inputs.mjs";
2
3
  import { expect } from "@playwright/test";
3
4
 
4
5
  //#region steps/delius/upw/allocate-current-case-to-upw-project.ts
5
- async function allocateCurrentCaseToUpwProject(page, { providerName, teamName, day = "Monday", projectType = "Group Placement - National Project" }) {
6
+ async function allocateCurrentCaseToUpwProject(page, { providerName, teamName, projectName, day = getCurrentDay(), projectType = "Group Placement - National Project" }) {
6
7
  await expect(page.locator("#content > h1")).toContainText("Personal Details");
7
8
  await page.getByRole("button", { name: "Update" }).click();
8
9
  await page.getByRole("link", { name: "Event List" }).click();
@@ -18,7 +19,7 @@ async function allocateCurrentCaseToUpwProject(page, { providerName, teamName, d
18
19
  await selectOption(page, "#selectionDay\\:selectOneMenu", day);
19
20
  await selectOption(page, "#projectType\\:selectOneMenu", projectType);
20
21
  await selectOption(page, "#team\\:selectOneMenu", teamName);
21
- const projectName = await selectOption(page, "#project\\:selectOneMenu");
22
+ await selectOption(page, "#project\\:selectOneMenu", projectName);
22
23
  await selectOption(page, "#allocationDay\\:selectOneMenu");
23
24
  await page.getByRole("button", { name: "Add" }).click();
24
25
  await expect(page.locator("#currentAllocationsTable tbody > tr")).toHaveCount(1);
@@ -0,0 +1,33 @@
1
+ import { Page } from "@playwright/test";
2
+
3
+ //#region steps/delius/upw/create-upw-project.d.ts
4
+ declare function createUpwProject(page: Page, {
5
+ providerName,
6
+ teamName,
7
+ projectType,
8
+ pickupPoint,
9
+ projectName,
10
+ projectCode,
11
+ projectAvailability
12
+ }: {
13
+ providerName: string;
14
+ teamName: string;
15
+ projectType?: string;
16
+ pickupPoint?: string;
17
+ projectName?: string;
18
+ projectCode?: string;
19
+ projectAvailability?: {
20
+ day: string;
21
+ frequency: string;
22
+ startDate: Date;
23
+ endDate: Date;
24
+ startTime: string;
25
+ endTime: string;
26
+ };
27
+ }): Promise<{
28
+ projectCode: string;
29
+ projectName: string;
30
+ }>;
31
+ declare function createNameWithTimeStamp(prefix?: string): string;
32
+ //#endregion
33
+ export { createNameWithTimeStamp, createUpwProject };
@@ -0,0 +1,57 @@
1
+ import { Tomorrow, getCurrentDay } from "../utils/date-time.mjs";
2
+ import { waitForAjax } from "../utils/refresh.mjs";
3
+ import { fillDate, selectOption } from "../utils/inputs.mjs";
4
+ import { expect } from "@playwright/test";
5
+ import { DateTime } from "luxon";
6
+ import { faker } from "@faker-js/faker";
7
+
8
+ //#region steps/delius/upw/create-upw-project.ts
9
+ async function createUpwProject(page, { providerName, teamName, projectType = "Group Placement - National Project", pickupPoint = "Chelmsford", projectName = createNameWithTimeStamp(), projectCode = faker.string.alphanumeric(6), projectAvailability = {
10
+ day: getCurrentDay(),
11
+ frequency: "Weekly",
12
+ startDate: /* @__PURE__ */ new Date(),
13
+ endDate: Tomorrow.toJSDate(),
14
+ startTime: "09:00",
15
+ endTime: "17:00"
16
+ } }) {
17
+ await page.getByRole("link", { name: "UPW Projects" }).click();
18
+ await expect(page.locator("#content > h1")).toContainText("UPW Projects List");
19
+ await page.locator("input", { hasText: "Add New Project" }).click();
20
+ await expect(page.locator("#content > h1")).toContainText("Add Project");
21
+ await selectOption(page, "#Trust\\:selectOneMenu", providerName);
22
+ await selectOption(page, "#Team\\:selectOneMenu", teamName);
23
+ await page.selectOption("#ProjectType\\:selectOneMenu", projectType);
24
+ await page.selectOption("#DefaultPickupPoint\\:selectOneMenu", { label: pickupPoint });
25
+ await page.fill("#ProjectCode\\:prependedInputText", projectCode);
26
+ await page.fill("#ProjectName\\:inputText", projectName);
27
+ await fillDate(page, "#ProjectStartDate\\:datePicker", /* @__PURE__ */ new Date());
28
+ await page.getByRole("button", { name: "Save" }).click();
29
+ await expect(page.locator("#content > h1")).toContainText("Update Project");
30
+ await addProjectAvailability(page, projectAvailability);
31
+ return {
32
+ projectCode,
33
+ projectName
34
+ };
35
+ }
36
+ function createNameWithTimeStamp(prefix = "project") {
37
+ return `${prefix}-${DateTime.now().toFormat("ddMMyyyyHHmmss")}`;
38
+ }
39
+ async function addProjectAvailability(page, projectAvailability) {
40
+ await page.getByRole("button", { name: "Project Availability" }).click();
41
+ await selectOption(page, "#Day\\:selectOneMenu", projectAvailability.day);
42
+ await selectOption(page, "#Frequency\\:selectOneMenu", projectAvailability.frequency);
43
+ await fillDate(page, "#StartDate\\:datePicker", projectAvailability.startDate);
44
+ await fillDate(page, "#EndDate\\:datePicker", projectAvailability.endDate);
45
+ await page.fill("#StartTime\\:timePicker", projectAvailability.startTime);
46
+ await page.fill("#EndTime\\:timePicker", projectAvailability.endTime);
47
+ await page.getByRole("button", {
48
+ name: "Add",
49
+ exact: true
50
+ }).nth(1).click();
51
+ await page.getByTitle("Project Availability").click();
52
+ await waitForAjax(page);
53
+ await page.getByRole("button", { name: "Save" }).click();
54
+ }
55
+
56
+ //#endregion
57
+ export { createNameWithTimeStamp, createUpwProject };
@@ -23,5 +23,6 @@ declare const subMonths: (date: DateTime, months: number) => DateTime;
23
23
  declare const formatDate: (date: Date | DateTime, formatString: string) => string;
24
24
  declare const minutesToMilliseconds: (minutes: number) => number;
25
25
  declare const secondsToMilliseconds: (seconds: number) => number;
26
+ declare function getCurrentDay(): string;
26
27
  //#endregion
27
- export { DeliusDateFormatter, DeliusTimeFormatter, HmppsDateFormatter, LastMonth, NextMonth, NextWeek, OasysDateFormatter, Tomorrow, Yesterday, addDays, addMonths, formatDate, get12Hour, getDate, getMonth, getTimeOfDay, getYear, minutesToMilliseconds, options, secondsToMilliseconds, subDays, subMonths };
28
+ export { DeliusDateFormatter, DeliusTimeFormatter, HmppsDateFormatter, LastMonth, NextMonth, NextWeek, OasysDateFormatter, Tomorrow, Yesterday, addDays, addMonths, formatDate, get12Hour, getCurrentDay, getDate, getMonth, getTimeOfDay, getYear, minutesToMilliseconds, options, secondsToMilliseconds, subDays, subMonths };
@@ -57,6 +57,9 @@ const minutesToMilliseconds = (minutes) => {
57
57
  const secondsToMilliseconds = (seconds) => {
58
58
  return Duration.fromObject({ seconds }).as("milliseconds");
59
59
  };
60
+ function getCurrentDay() {
61
+ return DateTime.now().weekdayLong;
62
+ }
60
63
 
61
64
  //#endregion
62
- export { DeliusDateFormatter, DeliusTimeFormatter, HmppsDateFormatter, LastMonth, NextMonth, NextWeek, OasysDateFormatter, Tomorrow, Yesterday, addDays, addMonths, formatDate, get12Hour, getDate, getMonth, getTimeOfDay, getYear, minutesToMilliseconds, options, secondsToMilliseconds, subDays, subMonths };
65
+ export { DeliusDateFormatter, DeliusTimeFormatter, HmppsDateFormatter, LastMonth, NextMonth, NextWeek, OasysDateFormatter, Tomorrow, Yesterday, addDays, addMonths, formatDate, get12Hour, getCurrentDay, getDate, getMonth, getTimeOfDay, getYear, minutesToMilliseconds, options, secondsToMilliseconds, subDays, subMonths };