@camunda/e2e-test-suite 0.0.1661 → 0.0.1663

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
- const task = this.taskInList(name);
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".
@@ -594,7 +594,14 @@ class IdpCreatePage {
594
594
  await (0, test_1.expect)(this.classificationAccuracyValue).toHaveText(/^\d+%$/);
595
595
  }
596
596
  async classifyingProgressIsComplete() {
597
- await (0, test_1.expect)(this.classifyingLoader).not.toBeVisible({ timeout: 300000 });
597
+ // Web Modeler runs classification as a process instance with a 600s
598
+ // incident timer (camunda-hub `performClassification` ->
599
+ // `runInstanceWithResult(..., 600, ...)`) and keeps the spinner up until
600
+ // the instance completes. Waiting only 300s gives up while the product is
601
+ // still within its own budget when the LLM provider is slow; wait out the
602
+ // full product window (+ variable-fetch retries). The result assertions
603
+ // that follow still fail if classification errors or times out.
604
+ await (0, test_1.expect)(this.classifyingLoader).not.toBeVisible({ timeout: 660000 });
598
605
  }
599
606
  async assertClassificationTemplateSuccessNotification() {
600
607
  await (0, test_1.expect)(this.classificationSuccessfullPublishNotification).toBeVisible({ timeout: 120000 });
@@ -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
- _8_10_1.test.beforeAll(async () => {
91
- authToken = await (0, apiHelpers_1.authSaasAPI)();
92
- await Promise.all([
93
- (0, apiHelpers_1.deployProcess)('./resources/agentic_ai/ai-agent-chat-user-feedback.form', authToken),
94
- (0, apiHelpers_1.deployProcess)('./resources/connectors/db_vector_connector/db-vector-retrieve-data.form', authToken),
95
- ]);
96
- await (0, sleep_1.sleep)(5000);
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 appsPage.clickCamundaApps();
101
- await appsPage.clickOperate(clusterName);
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 () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1661",
3
+ "version": "0.0.1663",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",