@camunda/e2e-test-suite 0.0.1233 → 0.0.1234
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.
|
@@ -11,6 +11,7 @@ declare class OperateProcessInstancePage {
|
|
|
11
11
|
constructor(page: Page);
|
|
12
12
|
connectorResultVariableName(name: string): Promise<Locator>;
|
|
13
13
|
connectorResultVariableValue(variableName: string): Promise<Locator>;
|
|
14
|
+
private assertInstanceStatusIcon;
|
|
14
15
|
completedIconAssertion(): Promise<void>;
|
|
15
16
|
activeIconAssertion(): Promise<void>;
|
|
16
17
|
getProcessVariableValue(variableName: string): Promise<Locator>;
|
|
@@ -32,45 +32,47 @@ class OperateProcessInstancePage {
|
|
|
32
32
|
async connectorResultVariableValue(variableName) {
|
|
33
33
|
return await this.page.getByTestId(variableName).locator('td').last();
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// The instance header renders the status the instance had when the page was
|
|
36
|
+
// loaded, so a status that flips afterwards -- ACTIVE once the instance is
|
|
37
|
+
// exported, COMPLETED once the last task finishes -- only becomes visible on
|
|
38
|
+
// a reload. Sitting out a 60-90s per-attempt timeout before reloading
|
|
39
|
+
// therefore buys nothing: the page under the wait can no longer change. Poll
|
|
40
|
+
// on a short cadence and reload between polls instead, so the status is
|
|
41
|
+
// picked up shortly after it lands rather than at the next minute boundary.
|
|
42
|
+
//
|
|
43
|
+
// The per-attempt timeout escalates rather than staying at its opening
|
|
44
|
+
// value: on a loaded c8Run runner the instance page itself can take longer
|
|
45
|
+
// than the first interval to render, and a fixed short interval would keep
|
|
46
|
+
// reloading a page that was about to show the icon. `deadlineMs` bounds the
|
|
47
|
+
// whole assertion, so a status that never arrives still fails after at least
|
|
48
|
+
// as long as the retry loop this replaces waited.
|
|
49
|
+
async assertInstanceStatusIcon(icon, status, deadlineMs) {
|
|
50
|
+
const attemptTimeouts = [15000, 15000, 30000, 30000, 60000];
|
|
51
|
+
const deadline = Date.now() + deadlineMs;
|
|
52
|
+
let attempt = 0;
|
|
53
|
+
let lastError;
|
|
54
|
+
while (Date.now() < deadline) {
|
|
39
55
|
try {
|
|
40
|
-
await (0, test_1.expect)(
|
|
41
|
-
timeout:
|
|
56
|
+
await (0, test_1.expect)(icon).toBeVisible({
|
|
57
|
+
timeout: attemptTimeouts[Math.min(attempt, attemptTimeouts.length - 1)],
|
|
42
58
|
});
|
|
43
|
-
return;
|
|
59
|
+
return;
|
|
44
60
|
}
|
|
45
61
|
catch (error) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
62
|
+
lastError = error;
|
|
63
|
+
attempt++;
|
|
64
|
+
console.log(`${status} icon not visible yet (attempt ${attempt}). Reloading...`);
|
|
49
65
|
await this.page.reload();
|
|
50
|
-
await (0, sleep_1.sleep)(10000);
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
|
-
throw new Error(
|
|
68
|
+
throw new Error(`${status} icon not visible after ${deadlineMs}ms and ${attempt} ` +
|
|
69
|
+
`reload(s): ${String(lastError)}`);
|
|
70
|
+
}
|
|
71
|
+
async completedIconAssertion() {
|
|
72
|
+
await this.assertInstanceStatusIcon(this.completedIcon, 'COMPLETED', 420000);
|
|
54
73
|
}
|
|
55
74
|
async activeIconAssertion() {
|
|
56
|
-
|
|
57
|
-
const maxRetries = 3;
|
|
58
|
-
while (retryCount < maxRetries) {
|
|
59
|
-
try {
|
|
60
|
-
await (0, test_1.expect)(this.activeIcon).toBeVisible({
|
|
61
|
-
timeout: 90000,
|
|
62
|
-
});
|
|
63
|
-
return; // Exit the function if the expectation is met
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
// If the active icon isn't found, reload the page and try again
|
|
67
|
-
retryCount++;
|
|
68
|
-
console.log(`Attempt ${retryCount} failed. Retrying...`);
|
|
69
|
-
await this.page.reload();
|
|
70
|
-
await (0, sleep_1.sleep)(10000);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
throw new Error(`Active icon not visible after ${maxRetries} attempts.`);
|
|
75
|
+
await this.assertInstanceStatusIcon(this.activeIcon, 'ACTIVE', 300000);
|
|
74
76
|
}
|
|
75
77
|
async getProcessVariableValue(variableName) {
|
|
76
78
|
return await this.page
|
|
@@ -97,11 +97,10 @@ class OperateProcessesPage {
|
|
|
97
97
|
return; // Exit the function if the click is successful
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
|
-
//
|
|
100
|
+
// The next iteration opens with its own reload, so reloading and
|
|
101
|
+
// sleeping here only parks the worker for 10s on top of it.
|
|
101
102
|
retryCount++;
|
|
102
103
|
console.log(`Attempt ${retryCount} failed. Retrying...`);
|
|
103
|
-
await this.page.reload();
|
|
104
|
-
await (0, sleep_1.sleep)(10000);
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
throw new Error(`Failed to click on process instance link after ${maxRetries} attempts.`);
|