@ministryofjustice/hmpps-probation-integration-e2e-tests 1.146.0 → 1.147.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.147.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ministryofjustice/hmpps-probation-integration-e2e-tests#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { doUntil } from "../utils/refresh.mjs";
|
|
1
2
|
import { selectOption } from "../utils/inputs.mjs";
|
|
2
3
|
import { findEventByCRN } from "../event/find-events.mjs";
|
|
3
4
|
import { expect } from "@playwright/test";
|
|
@@ -21,7 +22,9 @@ const createLicenceCondition = async (page, crn, eventNumber = 1) => {
|
|
|
21
22
|
};
|
|
22
23
|
const navigateToLicenceConditions = async (page, crn, eventNumber = 1) => {
|
|
23
24
|
await findEventByCRN(page, crn, eventNumber);
|
|
24
|
-
await page.getByRole("link", { name: "Licence
|
|
25
|
+
await doUntil(() => page.getByRole("link", { name: "Licence Conditions" }).click(), () => expect(page.locator("h1")).toContainText("Licence Conditions"), { rollback: async () => {
|
|
26
|
+
if (await page.title() === "Error Page") await page.goBack();
|
|
27
|
+
} });
|
|
25
28
|
};
|
|
26
29
|
const deliusLicenceCondition = "table tr:first-child td:nth-child(2)";
|
|
27
30
|
|
|
@@ -5,6 +5,7 @@ declare const refreshUntil: (page: Page, expectation: () => Promise<void>, optio
|
|
|
5
5
|
declare const doUntil: <T>(action: () => Promise<T>, expectation: () => Promise<void>, options?: {
|
|
6
6
|
timeout?: number;
|
|
7
7
|
intervals?: number[];
|
|
8
|
+
rollback?: () => Promise<unknown>;
|
|
8
9
|
}) => Promise<void>;
|
|
9
10
|
declare const waitForJS: (page: Page, timeout?: number) => Promise<unknown>;
|
|
10
11
|
declare const waitForAjax: (page: Page) => Promise<void>;
|
|
@@ -11,11 +11,17 @@ const doUntil = async (action, expectation, options = {
|
|
|
11
11
|
500,
|
|
12
12
|
1e3,
|
|
13
13
|
5e3
|
|
14
|
-
]
|
|
14
|
+
],
|
|
15
|
+
rollback: null
|
|
15
16
|
}) => {
|
|
16
17
|
await expect(async () => {
|
|
17
18
|
await action();
|
|
18
|
-
|
|
19
|
+
try {
|
|
20
|
+
return await expectation();
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (options.rollback) await options.rollback();
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
19
25
|
}).toPass(options);
|
|
20
26
|
};
|
|
21
27
|
const waitForJS = (page, timeout = 0) => {
|