@ministryofjustice/hmpps-probation-integration-e2e-tests 1.150.0 → 1.152.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.150.0",
4
+ "version": "1.152.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
7
7
  "bugs": {
@@ -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.7.4",
32
+ "prettier": "3.8.0",
33
33
  "tsdown": "^0.19.0"
34
34
  },
35
35
  "exports": {
@@ -1,4 +1,4 @@
1
- import { Locator, Page } from "@playwright/test";
1
+ import { Page } from "@playwright/test";
2
2
 
3
3
  //#region steps/delius/upw/checkAppointmentDetails.d.ts
4
4
  type CheckAppointmentOptions = {
@@ -15,7 +15,6 @@ type CheckAppointmentOptions = {
15
15
  hoursCredited?: string;
16
16
  outStanding?: string;
17
17
  };
18
- declare function getRowByContent(page: Page, content: string): Promise<Locator>;
19
18
  declare function checkAppointmentOnDelius(page: Page, checkAppointmentOptions: CheckAppointmentOptions): Promise<void>;
20
19
  //#endregion
21
- export { CheckAppointmentOptions, checkAppointmentOnDelius, getRowByContent };
20
+ export { CheckAppointmentOptions, checkAppointmentOnDelius };
@@ -1,12 +1,20 @@
1
+ import { waitForAjax } from "../utils/refresh.mjs";
1
2
  import { expect } from "@playwright/test";
2
3
 
3
4
  //#region steps/delius/upw/checkAppointmentDetails.ts
5
+ async function clickNextButton(page) {
6
+ const nextButtonSelector = "a.page-link[title=\"Next\"]:not(.disabled)";
7
+ await page.waitForSelector(nextButtonSelector, { state: "visible" });
8
+ await page.click(nextButtonSelector);
9
+ await waitForAjax(page);
10
+ await page.waitForSelector("#searchResultsTable tbody");
11
+ return true;
12
+ }
4
13
  async function getRowByContent(page, content) {
5
14
  const row = page.locator(`#searchResultsTable tbody tr:has-text("${content}")`).first();
6
15
  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");
16
+ if (await page.locator("a.page-link[title=\"Next\"]:not(.disabled)").count() > 0) {
17
+ await clickNextButton(page);
10
18
  return getRowByContent(page, content);
11
19
  }
12
20
  throw new Error(`Row with content "${content}" not found`);
@@ -22,6 +30,7 @@ async function checkAppointmentOnDelius(page, checkAppointmentOptions) {
22
30
  await page.getByRole("combobox", { name: "Provider:" }).selectOption(teamProvider);
23
31
  await page.getByRole("combobox", { name: "Team:" }).selectOption(teamName);
24
32
  await page.getByRole("button", { name: "Search" }).click();
33
+ await waitForAjax(page);
25
34
  await page.waitForSelector("h2:text-is(\"Project List\")");
26
35
  await (await getRowByContent(page, projectName)).getByRole("link", { name: "manage" }).click();
27
36
  await page.waitForSelector("h2:text-is(\"Allocated To Attend\")");
@@ -38,4 +47,4 @@ async function checkAppointmentOnDelius(page, checkAppointmentOptions) {
38
47
  }
39
48
 
40
49
  //#endregion
41
- export { checkAppointmentOnDelius, getRowByContent };
50
+ export { checkAppointmentOnDelius };