@camunda/e2e-test-suite 0.0.1300 → 0.0.1302

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.
@@ -712,12 +712,27 @@ class ClusterDetailsPage {
712
712
  'Optimize',
713
713
  'Admin',
714
714
  ]) {
715
+ const clusterUrl = this.page.url();
715
716
  for (const component of components) {
716
717
  await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.page.getByText(`${component}Healthy`, { exact: true }), {
717
718
  visibilityTimeout: 60000,
718
719
  totalTimeout: 300000,
719
720
  maxRetries: 5,
720
721
  preAction: async () => {
722
+ // Hub logs the tab out when its backend fails the session call
723
+ // (/api/internal/self 5xx), and from then on a reload only
724
+ // re-renders the identity provider's form, so the badge can never
725
+ // appear. Sign back in as the same user and return to the cluster.
726
+ if ((0, sessionRecovery_1.isAtIdentityProvider)(this.page) &&
727
+ (await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page))) {
728
+ await this.page.goto(clusterUrl, { waitUntil: 'domcontentloaded' });
729
+ await this.page
730
+ .waitForURL((url) => !HUB_LOGIN_ROUTE.test(url.pathname), {
731
+ timeout: 120000,
732
+ })
733
+ .catch(() => { });
734
+ return;
735
+ }
721
736
  await this.page.reload();
722
737
  },
723
738
  });
@@ -159,7 +159,16 @@ class ClusterPage {
159
159
  async deleteCluster(name) {
160
160
  await this.page.waitForTimeout(1000);
161
161
  const clusterInstance = this.cluster(name).first();
162
- if ((await clusterInstance.count()) <= 0) {
162
+ // createCluster reloads right before its second call, and Console re-runs
163
+ // its auth redirect after the document has loaded; a count() issued
164
+ // mid-redirect throws "Execution context was destroyed". Let the
165
+ // navigation settle and count again.
166
+ const instances = await clusterInstance.count().catch(async () => {
167
+ await this.page.waitForLoadState('load').catch(() => { });
168
+ await this.page.waitForTimeout(3000);
169
+ return clusterInstance.count();
170
+ });
171
+ if (instances <= 0) {
163
172
  console.log(`No clusters found with name ${name}, skipping deletion.`);
164
173
  return;
165
174
  }
@@ -1890,6 +1890,12 @@ class ModelerCreatePage {
1890
1890
  }
1891
1891
  async fillStartEventVariablesForDocHandling(zeebeUrl, zeebeClientId, zeebeClientSecret) {
1892
1892
  console.log(`URL: ${zeebeUrl}, ClientId: ${zeebeClientId}, Secret: ${zeebeClientSecret}`);
1893
+ // The reload that precedes this can drop the session all the way to the
1894
+ // identity provider (retry1 of run 36804948577 landed on the Auth0 email
1895
+ // step), which recoverStuckModelerLogin deliberately ignores -- it only
1896
+ // handles Modeler's own /login route. Re-authenticate first, then let it
1897
+ // un-stick /login if the callback parks there.
1898
+ await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
1893
1899
  await (0, sessionRecovery_1.recoverStuckModelerLogin)(this.page);
1894
1900
  await (0, test_1.expect)(this.connectorsDocHandlingStartEventElement).toBeVisible({
1895
1901
  timeout: 60000,
@@ -10,7 +10,7 @@ declare class TaskPanelPage {
10
10
  readonly expandButton: Locator;
11
11
  readonly processesInfoText: Locator;
12
12
  constructor(page: Page);
13
- openTask(name: string): Promise<void>;
13
+ openTask(name: string, taskKeys?: string[]): Promise<void>;
14
14
  filterBy(option: 'All open' | 'Unassigned' | 'Assigned to me' | 'Completed'): Promise<void>;
15
15
  taskCount(name: string): Promise<number>;
16
16
  clickTasksTab(): Promise<void>;
@@ -30,7 +30,7 @@ class TaskPanelPage {
30
30
  });
31
31
  this.processesInfoText = page.getByText('Browse and run processes published by your organization');
32
32
  }
33
- async openTask(name) {
33
+ async openTask(name, taskKeys) {
34
34
  let attempts = 0;
35
35
  // Tasklist's importer can lag well behind Zeebe under heavy concurrent
36
36
  // load from the sibling chromium-v1/chromium-v2 projects sharing one
@@ -40,7 +40,13 @@ class TaskPanelPage {
40
40
  const maxAttempts = 10;
41
41
  while (attempts < maxAttempts) {
42
42
  try {
43
- const task = this.availableTasks.getByText(name, { exact: true }).first();
43
+ // When the caller knows its own task's key(s), match the task link by
44
+ // key instead of by name: a same-named task left behind by an earlier
45
+ // attempt (e.g. the failed first try of a retried test) would
46
+ // otherwise be opened and completed instead of this run's task.
47
+ const task = (taskKeys?.length
48
+ ? this.availableTasks.locator(taskKeys.map((key) => `a[href*="/tasklist/${key}"]`).join(', '))
49
+ : this.availableTasks.getByText(name, { exact: true })).first();
44
50
  await task.waitFor({ state: 'visible', timeout: 120000 });
45
51
  await task.click({ timeout: 120000 });
46
52
  return;
@@ -15,6 +15,23 @@ const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
15
15
  // rather than on every call -- see the comment at the call site.
16
16
  const staggeredWorkerTimeouts = new Set();
17
17
  const onboardingTourSuppressed = new WeakSet();
18
+ // Last time Hub answered its own session call (/api/internal/login or
19
+ // /api/internal/self) with a 5xx. Auth0 accepts the password, but Hub then
20
+ // logs the tab straight back out, so an attempt made while the backend is
21
+ // failing cannot succeed however the form is filled in.
22
+ const hubSessionFailureAt = new WeakMap();
23
+ function observeHubSessionFailures(page) {
24
+ if (hubSessionFailureAt.has(page)) {
25
+ return;
26
+ }
27
+ hubSessionFailureAt.set(page, 0);
28
+ page.on('response', (response) => {
29
+ if (response.status() >= 500 &&
30
+ /\/api\/internal\/(login|self)$/.test(new URL(response.url()).pathname)) {
31
+ hubSessionFailureAt.set(page, Date.now());
32
+ }
33
+ });
34
+ }
18
35
  // Mirrors camunda-hub@452978f: pre-seed the onboarding tour's "seen" localStorage flag
19
36
  // (SEEN_KEY_PREFIX in .../tour-dialog/use-onboarding-seen.ts) so it never auto-opens. The
20
37
  // "Welcome to Camunda Hub" tour mounts app-wide -- Console included, not just Modeler -- and
@@ -55,6 +72,7 @@ async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 5
55
72
  'matching C8_*_PASSWORD output.');
56
73
  }
57
74
  await suppressOnboardingTour(page);
75
+ observeHubSessionFailures(page);
58
76
  let lastError;
59
77
  // `timeout` is a stable per-worker identifier (derived from workerIndex),
60
78
  // and a worker is a long-lived process across every test/repeat it runs, so
@@ -64,6 +82,7 @@ async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 5
64
82
  const isWorkersFirstCall = !staggeredWorkerTimeouts.has(timeout);
65
83
  staggeredWorkerTimeouts.add(timeout);
66
84
  for (let attempt = 0; attempt < maxRetries; attempt++) {
85
+ const attemptStartedAt = Date.now();
67
86
  try {
68
87
  await page.context().clearCookies();
69
88
  // The Hub bearer-token cache in consoleApiHelpers.ts is keyed by Page
@@ -126,9 +145,11 @@ async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 5
126
145
  if (attempt < maxRetries - 1) {
127
146
  const rateLimited = String(error).includes(authErrorClassification_1.AUTH0_RATE_LIMIT);
128
147
  console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying with clean session...`, error);
129
- if (rateLimited) {
130
- // Auth0 rate-limit windows commonly last 30-90s. Back off long
131
- // enough to outlast the window before the next attempt.
148
+ const hubSessionFailing = (hubSessionFailureAt.get(page) ?? 0) >= attemptStartedAt;
149
+ if (rateLimited || hubSessionFailing) {
150
+ // Auth0 rate-limit windows commonly last 30-90s, and Hub's backend
151
+ // outages run for minutes. Back off long enough to outlast the
152
+ // window before the next attempt.
132
153
  await (0, randomSleep_1.randomSleep)(60000, 90000);
133
154
  }
134
155
  else {
@@ -144,10 +165,41 @@ async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 5
144
165
  }
145
166
  exports.loginWithRetry = loginWithRetry;
146
167
  async function modelDiagramFromFile(page, modelerHomePage, modelerCreatePage, processName, fileName = '', nrOfRenamedUserTasks = 0, taskName = '') {
147
- await modelerHomePage.clickDiagramTypeDropdown();
148
- await modelerHomePage.clickUploadFilesButton();
149
- await (0, fileUpload_1.uploadFile)(page, fileName + '.bpmn');
150
- await modelerHomePage.clickProcessDiagram(fileName);
168
+ // Hub stores an upload with a single request and never retries it, so when
169
+ // its backend is failing the file simply never shows up in the list. Re-read
170
+ // the process application first -- the upload may have landed without the
171
+ // list refreshing -- and upload again only when the file is still missing.
172
+ const maxUploadAttempts = 3;
173
+ for (let attempt = 1;; attempt++) {
174
+ await modelerHomePage.clickDiagramTypeDropdown();
175
+ await modelerHomePage.clickUploadFilesButton();
176
+ await (0, fileUpload_1.uploadFile)(page, fileName + '.bpmn');
177
+ try {
178
+ await modelerHomePage.clickProcessDiagram(fileName);
179
+ break;
180
+ }
181
+ catch (error) {
182
+ if (attempt === maxUploadAttempts) {
183
+ throw error;
184
+ }
185
+ console.warn(`${fileName}.bpmn did not appear after upload ` +
186
+ `(attempt ${attempt}/${maxUploadAttempts}); re-reading the list.`);
187
+ await modelerHomePage.returnToResourceContainer();
188
+ const uploaded = page
189
+ .getByRole('row')
190
+ .filter({ hasText: fileName })
191
+ .getByTitle(fileName)
192
+ .first();
193
+ const landed = await uploaded
194
+ .waitFor({ state: 'visible', timeout: 15000 })
195
+ .then(() => true)
196
+ .catch(() => false);
197
+ if (landed) {
198
+ await uploaded.click();
199
+ break;
200
+ }
201
+ }
202
+ }
151
203
  await modelerCreatePage.clickDiagramBreadcrumb();
152
204
  await modelerCreatePage.clickEditDiagramNameButton();
153
205
  await modelerCreatePage.enterDiagramName(processName);
@@ -168,9 +168,13 @@ class WorkspaceMembersPage {
168
168
  await this.page
169
169
  .locator('[data-test="members-picker-select-all"]')
170
170
  .click({ timeout: 15000 });
171
- await (0, test_1.expect)(result).toHaveAttribute('data-staged', 'true', {
172
- timeout: 15000,
173
- });
171
+ // What marks the row as staged has moved: Hub used to render
172
+ // `data-staged`, the current build renders `aria-checked` instead -- a
173
+ // trace of the 2026-10-01 nightly shows the item going from
174
+ // aria-checked="false" to "true" on this click, "1 selected" in the live
175
+ // status and "Add" enabled, with no `data-staged` attribute at all.
176
+ // aria-selected/data-selected are still cmdk's highlight, not the pick.
177
+ await (0, test_1.expect)(candidates.and(this.page.locator('[aria-checked="true"], [data-staged="true"]'))).toHaveCount(1, { timeout: 15000 });
174
178
  if (role !== 'Editor') {
175
179
  await this.selectRoleIn(this.page.getByRole('combobox', { name: 'Workspace role' }).first(), role);
176
180
  }
@@ -8,6 +8,33 @@ const sleep_1 = require("../../utils/sleep");
8
8
  const users_1 = require("../../utils/users");
9
9
  const testUser = (0, users_1.getTestUser)('fourteenthUser');
10
10
  let authToken;
11
+ // Poll the V2 API until the process instance's user task exists and return
12
+ // the keys Tasklist may use in the task link (userTaskKey on Tasklist v2,
13
+ // the element instance key on v1). The DB Vector connector jobs can stall
14
+ // until the job timeout and be re-activated, so reaching the user task has
15
+ // been observed to take 6-22 minutes instead of the usual ~1 minute.
16
+ async function waitForUserTaskKeys(processInstanceKey, maxAttempts = 120, retryDelayMs = 10000) {
17
+ const apiRequestContext = await (0, apiHelpers_1.getApiRequestContext)();
18
+ const url = (0, apiHelpers_1.buildZeebeApiUrl)('/v2/user-tasks/search');
19
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
20
+ const response = await apiRequestContext.post(url, {
21
+ headers: { Authorization: authToken },
22
+ data: { filter: { processInstanceKey: String(processInstanceKey) } },
23
+ });
24
+ if (response.status() === 200) {
25
+ const task = (await response.json())?.items?.[0];
26
+ if (task?.userTaskKey != null) {
27
+ return [task.userTaskKey, task.elementInstanceKey]
28
+ .filter((key) => key != null)
29
+ .map(String);
30
+ }
31
+ }
32
+ if (attempt < maxAttempts) {
33
+ await (0, sleep_1.sleep)(retryDelayMs);
34
+ }
35
+ }
36
+ throw new Error(`No user task for process instance ${processInstanceKey} after ${maxAttempts} attempts`);
37
+ }
11
38
  // 8.9 ships the v1 AI Agent element template only: connectors stable/8.9 has
12
39
  // no `agenticai-ai-agent-task.v2.json` and no AgentTaskV2Function, so the v2
13
40
  // job type `io.camunda.agenticai:aiagent:task:2` has no worker subscribed to
@@ -177,10 +204,11 @@ _8_9_1.test.describe('Agentic Orchestation User Flows', () => {
177
204
  await operateProcessInstancePage.assertActiveTokenIsPresent();
178
205
  });
179
206
  await _8_9_1.test.step('User can view the agent feedback on tasklist', async () => {
207
+ const taskKeys = await waitForUserTaskKeys(instanceKey);
180
208
  await appsPage.clickCamundaApps();
181
209
  await appsPage.clickTasklist(clusterName);
182
210
  await (0, sleep_1.sleep)(30000);
183
- await taskPanelPage.openTask(params.processName);
211
+ await taskPanelPage.openTask(params.processName, taskKeys);
184
212
  await taskDetailsPage.clickAssignToMeButton();
185
213
  await taskDetailsPage.assertAIResponse(regexTestCases[0].regex_db_vector);
186
214
  await taskDetailsPage.clickCompleteTaskButton();
@@ -379,17 +379,27 @@ _8_9_1.test.describe('Connectors User Flow Tests @tasklistV2', () => {
379
379
  timeout: 120000,
380
380
  });
381
381
  const url = await modelerCreatePage.copyWebhookUrlToClipboardButton.innerText();
382
- // The modeler's "webhook is active" banner can lead the gateway actually
383
- // serving the endpoint, so the first POST can land on a not-yet-registered
384
- // webhook and come back 5xx.
382
+ // The modeler's "webhook is active" banner can lead the connector
383
+ // runtime actually serving the endpoint: an intermediate catch event is
384
+ // only registered once the runtime has picked up the new process
385
+ // instance, so the first POST (seconds after "Deploy & run") can land
386
+ // on a not-yet-registered webhook.
385
387
  //
386
- // Retry ONLY on 5xx. A 5xx means the request was not processed, so
387
- // re-posting cannot double-trigger the process; a 2xx or 4xx is a real
388
- // answer about a live endpoint and must be asserted as-is rather than
389
- // retried until it changes.
388
+ // Retry ONLY while the request provably was not processed: a 5xx, or a
389
+ // 404 with an empty body -- the runtime's InboundWebhookRestController
390
+ // answers `notFound().build()` when no connector is registered for the
391
+ // path, before any correlation is attempted, so re-posting cannot
392
+ // double-trigger the process. A 404 from a failed correlation carries a
393
+ // body, and any other 4xx/2xx is a real answer that is asserted as-is.
394
+ const deadline = Date.now() + 180000;
390
395
  let response = await request.post(url, { data: { test: 'test' } });
391
- for (let attempt = 0; attempt < 5 && response.status() >= 500; attempt++) {
392
- await (0, sleep_1.sleep)(5000);
396
+ while (Date.now() < deadline) {
397
+ const status = response.status();
398
+ const notRegistered = status === 404 && (await response.body()).length === 0;
399
+ if (status < 500 && !notRegistered)
400
+ break;
401
+ console.warn(`Webhook not ready yet: ${url} -> ${status}`);
402
+ await (0, sleep_1.sleep)(10000);
393
403
  response = await request.post(url, { data: { test: 'test' } });
394
404
  }
395
405
  // Not awaited: expect() on a plain value is synchronous, so the previous
@@ -26,33 +26,33 @@ _8_9_1.test.describe('Operate access requires authentication @tasklistV2', () =>
26
26
  await clusterDetailsPage.deleteAPIClientsIfExist(clientName);
27
27
  }
28
28
  });
29
- (0, _8_9_1.test)('check that request POST /v2/process-definitions/search returns 200 with valid credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
29
+ (0, _8_9_1.test)('check that request POST /v2/process-definitions/search returns 200 with valid credentials', async ({ homePage, clusterPage, clusterDetailsPage, request, }) => {
30
30
  clientName = `operate-allow-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
31
- let operateUrl = '';
32
- await _8_9_1.test.step('Add API Client to Cluster', async () => {
31
+ let zeebeRestUrl = '';
32
+ // V2 endpoints are served under the Orchestration Cluster REST address
33
+ // (ZEEBE_REST_ADDRESS, https://<region>.api.<domain>/<clusterId>), not
34
+ // under the Operate URL: the Operate URL is now
35
+ // https://<region>.api.<domain>/<clusterId>/operate, and POSTing
36
+ // .../operate/v2/... is rejected with 401 even with a valid token.
37
+ await _8_9_1.test.step('Add API Client and capture Zeebe REST URL', async () => {
33
38
  await homePage.clickClusters();
34
39
  await clusterPage.clickClusterLink(clusterName);
35
40
  await clusterDetailsPage.clickAPITab();
36
- await clusterDetailsPage.createAPIClient(clientName);
41
+ const variables = await clusterDetailsPage.createAPIClientAndReturnVariables(clientName, false);
42
+ zeebeRestUrl = variables.zeebeUrl;
43
+ (0, test_1.expect)(zeebeRestUrl).toMatch(/^https?:\/\//);
37
44
  await clusterDetailsPage.clickCloseModalButton();
38
45
  await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
39
46
  });
40
- await _8_9_1.test.step('Capture Operate URL', async () => {
41
- await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
42
- operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
43
- (0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
44
- await clientCredentialsDetailsPage.goBack();
45
- await clusterDetailsPage.clickAPITab();
46
- });
47
47
  await _8_9_1.test.step('POST search endpoint with valid Zeebe bearer token returns 200 or 405', async () => {
48
48
  const validToken = await (0, apiHelpers_1.authSaasAPI)();
49
- const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
50
- const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
49
+ const sanitizedUrl = (0, urlHelpers_1.sanitizeUrl)(zeebeRestUrl);
50
+ const response = await request.post(`${sanitizedUrl}/v2/process-definitions/search`, {
51
51
  headers: {
52
52
  Authorization: validToken,
53
53
  'Content-Type': 'application/json',
54
54
  },
55
- data: { filter: {}, size: 10 },
55
+ data: { filter: {}, page: { limit: 10 } },
56
56
  });
57
57
  (0, test_1.expect)([200, 405]).toContain(response.status());
58
58
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1300",
3
+ "version": "0.0.1302",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",