@ministryofjustice/hmpps-probation-integration-e2e-tests 1.153.0 → 1.155.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.
|
|
4
|
+
"version": "1.155.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Page } from "@playwright/test";
|
|
2
2
|
|
|
3
3
|
//#region steps/delius/upw/create-upw-project.d.ts
|
|
4
|
+
interface ProjectAvailability {
|
|
5
|
+
day?: string;
|
|
6
|
+
frequency?: string;
|
|
7
|
+
startDate?: Date;
|
|
8
|
+
endDate?: Date;
|
|
9
|
+
startTime?: string;
|
|
10
|
+
endTime?: string;
|
|
11
|
+
}
|
|
4
12
|
declare function createUpwProject(page: Page, {
|
|
5
13
|
providerName,
|
|
6
14
|
teamName,
|
|
@@ -16,17 +24,11 @@ declare function createUpwProject(page: Page, {
|
|
|
16
24
|
pickupPoint?: string;
|
|
17
25
|
projectName?: string;
|
|
18
26
|
projectCode?: string;
|
|
19
|
-
projectAvailability?:
|
|
20
|
-
day: string;
|
|
21
|
-
frequency: string;
|
|
22
|
-
startDate: Date;
|
|
23
|
-
endDate: Date;
|
|
24
|
-
startTime: string;
|
|
25
|
-
endTime: string;
|
|
26
|
-
};
|
|
27
|
+
projectAvailability?: ProjectAvailability;
|
|
27
28
|
}): Promise<{
|
|
28
29
|
projectCode: string;
|
|
29
30
|
projectName: string;
|
|
31
|
+
projectAvailability: ProjectAvailability;
|
|
30
32
|
}>;
|
|
31
33
|
declare function createNameWithTimeStamp(prefix?: string): string;
|
|
32
34
|
//#endregion
|
|
@@ -6,14 +6,7 @@ import { DateTime } from "luxon";
|
|
|
6
6
|
import { faker } from "@faker-js/faker";
|
|
7
7
|
|
|
8
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
|
-
} }) {
|
|
9
|
+
async function createUpwProject(page, { providerName, teamName, projectType = "Group Placement - National Project", pickupPoint = "Chelmsford", projectName = createNameWithTimeStamp(), projectCode = faker.string.alphanumeric(6), projectAvailability = {} }) {
|
|
17
10
|
await page.getByRole("link", { name: "UPW Projects" }).click();
|
|
18
11
|
await expect(page.locator("#content > h1")).toContainText("UPW Projects List");
|
|
19
12
|
await page.locator("input", { hasText: "Add New Project" }).click();
|
|
@@ -25,31 +18,43 @@ async function createUpwProject(page, { providerName, teamName, projectType = "G
|
|
|
25
18
|
await page.fill("#ProjectCode\\:prependedInputText", projectCode);
|
|
26
19
|
await page.fill("#ProjectName\\:inputText", projectName);
|
|
27
20
|
await fillDate(page, "#ProjectStartDate\\:datePicker", /* @__PURE__ */ new Date());
|
|
21
|
+
await fillDate(page, "#ProjectEndDate\\:datePicker", Tomorrow.toJSDate());
|
|
28
22
|
await page.getByRole("button", { name: "Save" }).click();
|
|
29
23
|
await expect(page.locator("#content > h1")).toContainText("Update Project");
|
|
30
|
-
await addProjectAvailability(page, projectAvailability);
|
|
31
24
|
return {
|
|
32
25
|
projectCode,
|
|
33
|
-
projectName
|
|
26
|
+
projectName,
|
|
27
|
+
projectAvailability: await addProjectAvailability(page, projectAvailability)
|
|
34
28
|
};
|
|
35
29
|
}
|
|
36
30
|
function createNameWithTimeStamp(prefix = "project") {
|
|
37
31
|
return `${prefix}-${DateTime.now().toFormat("ddMMyyyyHHmmss")}`;
|
|
38
32
|
}
|
|
39
33
|
async function addProjectAvailability(page, projectAvailability) {
|
|
34
|
+
const timeNow = DateTime.now();
|
|
35
|
+
const timeLater = timeNow.plus({ hours: 4 });
|
|
36
|
+
const { day = getCurrentDay(), frequency = "Weekly", startDate = /* @__PURE__ */ new Date(), endDate = Tomorrow.toJSDate(), startTime = timeNow.toISOTime({ precision: "minute" }), endTime = timeLater.toISOTime({ precision: "minute" }) } = projectAvailability;
|
|
40
37
|
await page.getByRole("button", { name: "Project Availability" }).click();
|
|
41
|
-
await selectOption(page, "#Day\\:selectOneMenu",
|
|
42
|
-
await selectOption(page, "#Frequency\\:selectOneMenu",
|
|
43
|
-
await fillDate(page, "#StartDate\\:datePicker",
|
|
44
|
-
await fillDate(page, "#EndDate\\:datePicker",
|
|
45
|
-
await page.fill("#StartTime\\:timePicker",
|
|
46
|
-
await page.fill("#EndTime\\:timePicker",
|
|
38
|
+
await selectOption(page, "#Day\\:selectOneMenu", day);
|
|
39
|
+
await selectOption(page, "#Frequency\\:selectOneMenu", frequency);
|
|
40
|
+
await fillDate(page, "#StartDate\\:datePicker", startDate);
|
|
41
|
+
await fillDate(page, "#EndDate\\:datePicker", endDate);
|
|
42
|
+
await page.fill("#StartTime\\:timePicker", startTime);
|
|
43
|
+
await page.fill("#EndTime\\:timePicker", endTime);
|
|
47
44
|
await page.getByRole("button", {
|
|
48
45
|
name: "Add",
|
|
49
46
|
exact: true
|
|
50
47
|
}).nth(0).click();
|
|
51
48
|
await waitForAjax(page);
|
|
52
49
|
await page.getByRole("button", { name: "Save" }).click();
|
|
50
|
+
return {
|
|
51
|
+
day,
|
|
52
|
+
frequency,
|
|
53
|
+
startDate,
|
|
54
|
+
endDate,
|
|
55
|
+
startTime,
|
|
56
|
+
endTime
|
|
57
|
+
};
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
//#endregion
|