@camunda/e2e-test-suite 0.0.1662 → 0.0.1664
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.
|
@@ -12,7 +12,7 @@ declare class TaskPanelPage {
|
|
|
12
12
|
readonly processesInfoText: Locator;
|
|
13
13
|
constructor(page: Page);
|
|
14
14
|
taskInList(name: string): Locator;
|
|
15
|
-
openTask(name: string, totalTimeout?: number): Promise<void>;
|
|
15
|
+
openTask(name: string, totalTimeout?: number, taskKeys?: string[]): Promise<void>;
|
|
16
16
|
filterBy(option: 'All open tasks' | 'Unassigned' | 'Assigned to me' | 'Completed'): Promise<void>;
|
|
17
17
|
private openFilterControls;
|
|
18
18
|
private collapseFilterPanel;
|
|
@@ -80,12 +80,28 @@ class TaskPanelPage {
|
|
|
80
80
|
taskInList(name) {
|
|
81
81
|
return this.availableTasks.getByText(name, { exact: true }).first();
|
|
82
82
|
}
|
|
83
|
-
async openTask(name, totalTimeout = 1200000) {
|
|
83
|
+
async openTask(name, totalTimeout = 1200000, taskKeys) {
|
|
84
84
|
const deadline = Date.now() + totalTimeout;
|
|
85
85
|
let lastError;
|
|
86
86
|
while (Date.now() < deadline) {
|
|
87
87
|
try {
|
|
88
|
-
|
|
88
|
+
// When the caller knows its own task's key(s), match the card by key
|
|
89
|
+
// instead of by name: parallel workers (and repeated/retried runs)
|
|
90
|
+
// leave several same-named tasks in the list, and the first one by
|
|
91
|
+
// name is often another test's task -- already assigned (no "Assign
|
|
92
|
+
// to me") or completed under us. The card links to
|
|
93
|
+
// /tasklist/<userTaskKey> on both Tasklist shells, and the redesigned
|
|
94
|
+
// shell also tags it data-testid="task-<userTaskKey>".
|
|
95
|
+
const task = taskKeys?.length
|
|
96
|
+
? this.availableTasks
|
|
97
|
+
.locator(taskKeys
|
|
98
|
+
.flatMap((key) => [
|
|
99
|
+
`a[href*="/tasklist/${key}"]`,
|
|
100
|
+
`[data-testid="task-${key}"]`,
|
|
101
|
+
])
|
|
102
|
+
.join(', '))
|
|
103
|
+
.first()
|
|
104
|
+
: this.taskInList(name);
|
|
89
105
|
await task.waitFor({
|
|
90
106
|
state: 'visible',
|
|
91
107
|
// Clamped away from 0: Playwright reads `timeout: 0` as "no timeout".
|
|
@@ -9,6 +9,54 @@ const sleep_1 = require("../../utils/sleep");
|
|
|
9
9
|
const users_1 = require("../../utils/users");
|
|
10
10
|
const testUser = (0, users_1.getTestUser)('fourteenthUser');
|
|
11
11
|
let authToken;
|
|
12
|
+
// Forms are deployed once per worker, on the first test that has a token.
|
|
13
|
+
let formsDeployed = false;
|
|
14
|
+
// Poll the V2 API until the process instance's user task exists and return
|
|
15
|
+
// the keys Tasklist may use in the task link (userTaskKey on Tasklist v2,
|
|
16
|
+
// the element instance key on v1). The DB Vector connector jobs can stall
|
|
17
|
+
// until the job timeout and be re-activated, so reaching the user task has
|
|
18
|
+
// been observed to take 6-22 minutes instead of the usual ~1 minute.
|
|
19
|
+
async function waitForUserTaskKeys(processInstanceKey, maxAttempts = 120, retryDelayMs = 10000) {
|
|
20
|
+
const apiRequestContext = await (0, apiHelpers_1.getApiRequestContext)();
|
|
21
|
+
const url = (0, apiHelpers_1.buildZeebeApiUrl)('/v2/user-tasks/search');
|
|
22
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
23
|
+
const response = await apiRequestContext.post(url, {
|
|
24
|
+
headers: { Authorization: authToken },
|
|
25
|
+
data: { filter: { processInstanceKey: String(processInstanceKey) } },
|
|
26
|
+
});
|
|
27
|
+
if (response.status() === 200) {
|
|
28
|
+
const task = (await response.json())?.items?.[0];
|
|
29
|
+
if (task?.userTaskKey != null) {
|
|
30
|
+
return [task.userTaskKey, task.elementInstanceKey]
|
|
31
|
+
.filter((key) => key != null)
|
|
32
|
+
.map(String);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// A connector job that exhausted its retries raises an incident, which
|
|
36
|
+
// never resolves on its own, so stop polling and surface the cause.
|
|
37
|
+
const incidentResponse = await apiRequestContext.post((0, apiHelpers_1.buildZeebeApiUrl)('/v2/incidents/search'), {
|
|
38
|
+
headers: { Authorization: authToken },
|
|
39
|
+
data: {
|
|
40
|
+
filter: {
|
|
41
|
+
processInstanceKey: String(processInstanceKey),
|
|
42
|
+
state: 'ACTIVE',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (incidentResponse.status() === 200) {
|
|
47
|
+
const incident = (await incidentResponse.json())?.items?.[0];
|
|
48
|
+
if (incident != null) {
|
|
49
|
+
throw new Error(`Process instance ${processInstanceKey} has an incident on ` +
|
|
50
|
+
`${incident.elementId} (${incident.errorType}): ` +
|
|
51
|
+
`${incident.errorMessage}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (attempt < maxAttempts) {
|
|
55
|
+
await (0, sleep_1.sleep)(retryDelayMs);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`No user task for process instance ${processInstanceKey} after ${maxAttempts} attempts`);
|
|
59
|
+
}
|
|
12
60
|
const aiAgentTestCases = [
|
|
13
61
|
{
|
|
14
62
|
provider: 'openAI',
|
|
@@ -87,18 +135,29 @@ const regexTestCases = [
|
|
|
87
135
|
_8_10_1.test.describe.configure({ mode: 'parallel' });
|
|
88
136
|
_8_10_1.test.describe('Agentic Orchestation User Flows', () => {
|
|
89
137
|
const clusterName = 'Test Cluster';
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
_8_10_1.test.beforeEach(async ({ page, appsPage, loginPage }, testInfo) => {
|
|
138
|
+
// The Zeebe token used to be taken in a beforeAll, which reads the
|
|
139
|
+
// ZEEBE_API_* env vars the test-setup project sets. Those only reach a spec
|
|
140
|
+
// when setup runs in the same `playwright test` invocation, so any --no-deps
|
|
141
|
+
// run (flakiness validate loop, nightly fix verification) failed every test
|
|
142
|
+
// with "Default-cluster credentials not found". ensureDefaultClusterApiCredentials
|
|
143
|
+
// needs a logged-in Console page, which only exists in beforeEach, so the
|
|
144
|
+
// token and the shared form deployment moved here. It is a no-op when setup
|
|
145
|
+
// already put the credentials in the environment (the nightly's path).
|
|
146
|
+
_8_10_1.test.beforeEach(async ({ page, appsPage, loginPage, homePage, clusterPage, clusterDetailsPage, operateHomePage, }, testInfo) => {
|
|
99
147
|
await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
|
|
100
|
-
await
|
|
101
|
-
await
|
|
148
|
+
await (0, UtilitiesPage_1.ensureDefaultClusterApiCredentials)('Agentic_AI_API_Client' + (await (0, _setup_1.generateRandomStringAsync)(3)), homePage, clusterDetailsPage, clusterName, clusterPage);
|
|
149
|
+
authToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
150
|
+
if (!formsDeployed) {
|
|
151
|
+
await Promise.all([
|
|
152
|
+
(0, apiHelpers_1.deployProcess)('./resources/agentic_ai/ai-agent-chat-user-feedback.form', authToken),
|
|
153
|
+
(0, apiHelpers_1.deployProcess)('./resources/connectors/db_vector_connector/db-vector-retrieve-data.form', authToken),
|
|
154
|
+
]);
|
|
155
|
+
formsDeployed = true;
|
|
156
|
+
}
|
|
157
|
+
// The API-client step can leave the tab on Console cluster details;
|
|
158
|
+
// gate the Operate hand-off on Operate's own banner, as
|
|
159
|
+
// aws-connectors-user-flows.spec.ts does.
|
|
160
|
+
await appsPage.openOperateWithRetry(operateHomePage.operateBanner, clusterName);
|
|
102
161
|
});
|
|
103
162
|
_8_10_1.test.afterEach(async ({ page }, testInfo) => {
|
|
104
163
|
await (0, _setup_1.captureScreenshot)(page, testInfo);
|
|
@@ -121,10 +180,16 @@ _8_10_1.test.describe('Agentic Orchestation User Flows', () => {
|
|
|
121
180
|
await operateProcessInstancePage.assertActiveTokenIsPresent();
|
|
122
181
|
});
|
|
123
182
|
await _8_10_1.test.step('User can view the agent feedback on tasklist', async () => {
|
|
183
|
+
// Open this test's own task by key: parallel workers and repeated
|
|
184
|
+
// runs leave several same-named tasks in the org, and opening the
|
|
185
|
+
// first one by name picked up another test's task (already
|
|
186
|
+
// assigned, or completed under us), so this instance never
|
|
187
|
+
// completed in Operate.
|
|
188
|
+
const taskKeys = await waitForUserTaskKeys(instanceKey);
|
|
124
189
|
await appsPage.clickCamundaApps();
|
|
125
190
|
await appsPage.clickTasklist(clusterName);
|
|
126
191
|
await (0, sleep_1.sleep)(5000);
|
|
127
|
-
await taskPanelPage.openTask(`AI Agent Chat With Tools ${params.provider}
|
|
192
|
+
await taskPanelPage.openTask(`AI Agent Chat With Tools ${params.provider}`, undefined, taskKeys);
|
|
128
193
|
await taskDetailsPage.clickAssignToMeButton();
|
|
129
194
|
});
|
|
130
195
|
await _8_10_1.test.step('User can view the agent response and complete the task', async () => {
|