@ministryofjustice/hmpps-probation-integration-e2e-tests 1.147.0 → 1.149.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.149.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"eslint-config-prettier": "^10.0.1",
|
|
31
31
|
"eslint-plugin-prettier": "^5.2.1",
|
|
32
32
|
"prettier": "3.7.4",
|
|
33
|
-
"tsdown": "^0.
|
|
33
|
+
"tsdown": "^0.19.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
"./steps/accredited-programmes/application": "./steps/accredited-programmes/application.mjs",
|
|
@@ -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/checkAppointmentDetails": "./steps/delius/upw/checkAppointmentDetails.mjs",
|
|
136
137
|
"./steps/delius/upw/create-upw-project": "./steps/delius/upw/create-upw-project.mjs",
|
|
137
138
|
"./steps/delius/upw/start-upw-assessment": "./steps/delius/upw/start-upw-assessment.mjs",
|
|
138
139
|
"./steps/delius/utils/contact": "./steps/delius/utils/contact.mjs",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Locator, Page } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
//#region steps/delius/upw/checkAppointmentDetails.d.ts
|
|
4
|
+
type CheckAppointmentOptions = {
|
|
5
|
+
teamProvider: string;
|
|
6
|
+
teamName: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
popCrn: string;
|
|
9
|
+
popName: string;
|
|
10
|
+
startTime: string;
|
|
11
|
+
endTime: string;
|
|
12
|
+
penalty?: string;
|
|
13
|
+
outcome: string;
|
|
14
|
+
enforcementAction?: string;
|
|
15
|
+
hoursCredited?: string;
|
|
16
|
+
outStanding?: string;
|
|
17
|
+
};
|
|
18
|
+
declare function getRowByContent(page: Page, content: string): Promise<Locator>;
|
|
19
|
+
declare function checkAppointmentOnDelius(page: Page, checkAppointmentOptions: CheckAppointmentOptions): Promise<void>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { CheckAppointmentOptions, checkAppointmentOnDelius, getRowByContent };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
//#region steps/delius/upw/checkAppointmentDetails.ts
|
|
4
|
+
async function getRowByContent(page, content) {
|
|
5
|
+
const row = page.locator(`#searchResultsTable tbody tr:has-text("${content}")`).first();
|
|
6
|
+
if (await row.isVisible().catch(() => false)) return row;
|
|
7
|
+
if (await page.getByRole("link", { name: "Next" }).isEnabled()) {
|
|
8
|
+
await page.getByRole("link", { name: "Next" }).click();
|
|
9
|
+
await page.waitForSelector("#searchResultsTable tbody tr");
|
|
10
|
+
return getRowByContent(page, content);
|
|
11
|
+
}
|
|
12
|
+
throw new Error(`Row with content "${content}" not found`);
|
|
13
|
+
}
|
|
14
|
+
async function getCellContents(row) {
|
|
15
|
+
const cellElements = await row.locator("td").all();
|
|
16
|
+
return await Promise.all(cellElements.map(async (td) => {
|
|
17
|
+
return (await td.innerText()).trim();
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
async function checkAppointmentOnDelius(page, checkAppointmentOptions) {
|
|
21
|
+
const { teamProvider, teamName, projectName, popCrn, popName, startTime, endTime, penalty, outcome, enforcementAction, hoursCredited, outStanding } = checkAppointmentOptions;
|
|
22
|
+
await page.getByRole("combobox", { name: "Provider:" }).selectOption(teamProvider);
|
|
23
|
+
await page.getByRole("combobox", { name: "Team:" }).selectOption(teamName);
|
|
24
|
+
await page.getByRole("button", { name: "Search" }).click();
|
|
25
|
+
await page.waitForSelector("h2:text-is(\"Project List\")");
|
|
26
|
+
await (await getRowByContent(page, projectName)).getByRole("link", { name: "manage" }).click();
|
|
27
|
+
await page.waitForSelector("h2:text-is(\"Allocated To Attend\")");
|
|
28
|
+
const cells = await getCellContents(page.locator("#allocatedOffendersTable tbody tr").filter({ has: page.locator(`td:first-child:text-is("${popCrn}")`) }));
|
|
29
|
+
expect(cells[0]).toBe(popCrn);
|
|
30
|
+
expect(cells[1]).toBe(popName);
|
|
31
|
+
expect(cells[2]).toBe(startTime);
|
|
32
|
+
expect(cells[3]).toBe(endTime);
|
|
33
|
+
if (penalty) expect(cells[4]).toBe(penalty);
|
|
34
|
+
expect(cells[5]).toBe(outcome);
|
|
35
|
+
if (enforcementAction) expect(cells[6]).toBe(enforcementAction);
|
|
36
|
+
if (hoursCredited) expect(cells[7]).toBe(hoursCredited);
|
|
37
|
+
if (outStanding) expect(cells[8]).toBe(outStanding);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { checkAppointmentOnDelius, getRowByContent };
|