@camunda/e2e-test-suite 0.0.1688 → 0.0.1689

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.
@@ -46,18 +46,41 @@ class OperateHomePage {
46
46
  this.messageBanner = page.getByRole('button', { name: 'Close' });
47
47
  }
48
48
  async clickProcessesTab() {
49
+ // Budgets are derived from what one failed attempt costs, not copied.
50
+ // `clickLocatorWithRetry` stops at whichever of `maxRetries` and
51
+ // `totalTimeout` comes first, and checks elapsed time BEFORE each
52
+ // attempt — so N attempts only need the budget to outlast N-1 failures.
53
+ // A failure here costs ~47s: 15s for the banner pre-action (the banner is
54
+ // usually absent, which is the full wait), 30s for the visibility window,
55
+ // 2s retry delay. 4 x 47s = 188s, so 200s is what lets all 5 configured
56
+ // attempts run. The wider window matters because this method is reached
57
+ // right after switching apps, while the cluster SSO hand-off into Operate
58
+ // is often still in flight.
49
59
  await (0, clickLocatorWithRetry_1.clickLocatorWithRetry)(this.page, this.processesTab, {
50
60
  preAction: async () => {
51
61
  await this.clickMessageBanner();
52
62
  },
63
+ maxRetries: 5,
64
+ totalTimeout: 200000,
65
+ visibilityTimeout: 30000,
53
66
  });
54
67
  await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.processPageHeading, {
55
68
  preAction: async () => {
56
69
  await (0, test_1.expect)(this.processesTab).toBeVisible({ timeout: 10000 });
57
70
  await this.processesTab.click({ timeout: 10000 });
58
71
  },
72
+ // The Processes view routinely needs longer than this helper's 10s
73
+ // default to render on a loaded cluster.
74
+ visibilityTimeout: 30000,
75
+ // Re-clicking the tab cannot help a view that never rendered, so reload
76
+ // between attempts and let each one re-ask Operate for the page.
77
+ postAction: async () => {
78
+ await this.page.reload();
79
+ },
59
80
  maxRetries: 5,
60
- totalTimeout: 120000,
81
+ // ~40s per failed attempt (the pre-action is instant once the tab has
82
+ // rendered, so this is the 30s window plus the reload), 4 x 40s = 160s.
83
+ totalTimeout: 200000,
61
84
  });
62
85
  }
63
86
  async closeInformationDialog() {
@@ -40,7 +40,10 @@ declare class OptimizeReportPage {
40
40
  clearReportName(): Promise<void>;
41
41
  fillReportName(name: string): Promise<void>;
42
42
  clickSaveButton(): Promise<void>;
43
- waitUntilLocatorIsVisible(locator: Locator, tab: Page): Promise<void>;
43
+ waitUntilLocatorIsVisible(locator: Locator, tab: Page, options?: {
44
+ expectedCount?: number;
45
+ totalTimeout?: number;
46
+ }): Promise<void>;
44
47
  waitUntilProcessIsVisible(locator: Locator, tab: Page): Promise<void>;
45
48
  clickBlankReportButton(): Promise<void>;
46
49
  clickSelectDropdown(): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OptimizeReportPage = void 0;
4
+ const test_1 = require("@playwright/test");
4
5
  class OptimizeReportPage {
5
6
  page;
6
7
  processSelectionButton;
@@ -117,19 +118,38 @@ class OptimizeReportPage {
117
118
  async clickSaveButton() {
118
119
  await this.saveButton.click();
119
120
  }
120
- async waitUntilLocatorIsVisible(locator, tab) {
121
- let elapsedTime = 0;
122
- const maxWaitTimeSeconds = 120000;
123
- while (elapsedTime < maxWaitTimeSeconds) {
124
- const element = await locator;
125
- if (await element.isVisible()) {
121
+ async waitUntilLocatorIsVisible(locator, tab, options) {
122
+ // Optimize imports user task data in batches, so the report table can
123
+ // render a partial row set before it is complete. Callers that know how
124
+ // many cells the finished report has pass `expectedCount` and wait for
125
+ // all of them, instead of returning on the first one and leaving the
126
+ // caller's assertion to race the rest of the import.
127
+ // 240s matches `waitUntilProcessIsVisible` below — the same import, one
128
+ // stage earlier — rather than being picked freehand. The caller has
129
+ // already waited `TIMEOUT.optimizeImport` for the process itself to
130
+ // appear, so what is outstanding here is only the user task data.
131
+ const { expectedCount = 1, totalTimeout = 240000 } = options ?? {};
132
+ const attemptTimeout = 10000;
133
+ const deadline = Date.now() + totalTimeout;
134
+ for (;;) {
135
+ try {
136
+ await (0, test_1.expect)(locator).toHaveCount(expectedCount, {
137
+ timeout: attemptTimeout,
138
+ });
126
139
  return;
127
140
  }
128
- await tab.reload();
129
- await tab.waitForTimeout(10 * 1000);
130
- // Update the elapsed time
131
- elapsedTime += 10000;
141
+ catch {
142
+ if (Date.now() >= deadline) {
143
+ break;
144
+ }
145
+ await tab.reload();
146
+ }
132
147
  }
148
+ // Falling out of the loop used to return silently, so the caller's own
149
+ // assertion reported the symptom ("expected 2, received 0") with none of
150
+ // the context that the import never finished within the wait budget.
151
+ throw new Error(`Timed out after ${totalTimeout}ms waiting for ${expectedCount} ` +
152
+ `element(s) matching ${locator} in the Optimize report.`);
133
153
  }
134
154
  async waitUntilProcessIsVisible(locator, tab) {
135
155
  let elapsedTime = 0;
@@ -520,10 +520,19 @@ class ModelerHomePage {
520
520
  .getByRole('tab', { name: 'General', exact: true })
521
521
  .click({ timeout: 15000 });
522
522
  }
523
- await this.page
523
+ // Visiting the workspace URL can trigger a silent OAuth re-login when the
524
+ // session token has expired during a long serial run: the modeler bounces
525
+ // through /login-callback and reloads its shell, so the manage view is not
526
+ // yet mounted when the teardown runs. Gate on the Delete button becoming
527
+ // visible before clicking -- mirroring the readiness-after-navigation wait
528
+ // every other navigation in this page object uses -- so the re-login reload
529
+ // is absorbed on a real readiness signal rather than raced by the click's
530
+ // own 30s navigation wait.
531
+ const deleteWorkspaceButton = this.page
524
532
  .getByRole('tabpanel', { name: 'General', exact: true })
525
- .getByRole('button', { name: 'Delete', exact: true })
526
- .click({ timeout: 30000 });
533
+ .getByRole('button', { name: 'Delete', exact: true });
534
+ await (0, test_1.expect)(deleteWorkspaceButton).toBeVisible({ timeout: 90000 });
535
+ await deleteWorkspaceButton.click({ timeout: 30000 });
527
536
  const dialog = this.page.getByRole('dialog').filter({
528
537
  has: this.page.getByRole('heading', { name: /^Delete workspace(?:\s|$)/ }),
529
538
  });
@@ -38,12 +38,17 @@ declare class IdentityPage {
38
38
  constructor(page: Page);
39
39
  clickUsersLink(): Promise<void>;
40
40
  clickAssignedRolesTab(): Promise<void>;
41
+ clearSession(): Promise<void>;
41
42
  clickDemoUser(): Promise<void>;
42
43
  clickUser(username: string): Promise<void>;
43
44
  clickDeleteAccessButton(accessToDelete: string): Promise<void>;
44
45
  clickConfirmDeleteButton(): Promise<void>;
45
46
  clickAssignRolesButton(): Promise<void>;
46
47
  clickAddButton(): Promise<void>;
48
+ clickAddButtonAndWaitForRoleAssignment(expectedAssignments: number): Promise<{
49
+ ok: boolean;
50
+ failures: string[];
51
+ }>;
47
52
  clickOperateCheckbox(): Promise<void>;
48
53
  clickTasklistCheckbox(): Promise<void>;
49
54
  clickOptimizeCheckbox(): Promise<void>;
@@ -148,6 +148,9 @@ class IdentityPage {
148
148
  }
149
149
  }
150
150
  }
151
+ async clearSession() {
152
+ await this.page.context().clearCookies();
153
+ }
151
154
  async clickDemoUser() {
152
155
  await (0, test_1.expect)(this.demoUser).toBeVisible({ timeout: 60000 });
153
156
  await this.demoUser.click({ timeout: 180000 });
@@ -181,11 +184,14 @@ class IdentityPage {
181
184
  async clickAssignRolesButton() {
182
185
  const rolesLoadError = this.page.getByText('The list of roles could not be loaded.');
183
186
  const retryLink = this.page.getByText('Retry', { exact: true });
187
+ // The fieldset legend renders once the roles list has loaded, even when
188
+ // some roles (e.g. Operate) are already assigned and so not listed.
189
+ const rolesListLoaded = this.page.getByText('Select one or multiple roles');
184
190
  const maxRetries = 3;
185
191
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
186
192
  await this.assignRolesButton.click();
187
193
  try {
188
- await this.operateCheckbox.waitFor({ state: 'visible', timeout: 10000 });
194
+ await rolesListLoaded.waitFor({ state: 'visible', timeout: 10000 });
189
195
  return;
190
196
  }
191
197
  catch {
@@ -193,7 +199,7 @@ class IdentityPage {
193
199
  console.warn(`clickAssignRolesButton attempt ${attempt}: roles list failed to load, clicking Retry`);
194
200
  await retryLink.click();
195
201
  try {
196
- await this.operateCheckbox.waitFor({
202
+ await rolesListLoaded.waitFor({
197
203
  state: 'visible',
198
204
  timeout: 10000,
199
205
  });
@@ -216,6 +222,48 @@ class IdentityPage {
216
222
  async clickAddButton() {
217
223
  await this.addButton.click();
218
224
  }
225
+ // Identity's Assign-roles modal fires one POST /api/users/<id>/roles per
226
+ // selected role and only closes when every one of them succeeds. Clicking
227
+ // "Add" and returning (clickAddButton) lets the caller navigate away before
228
+ // the result is known, so a rejected assignment (e.g. HTTP 401) went
229
+ // unnoticed and the user later reached Console without the Console role
230
+ // ("401 jwt audience invalid. expected: console-api"). Wait for every
231
+ // assignment request and report whether all of them succeeded.
232
+ async clickAddButtonAndWaitForRoleAssignment(expectedAssignments) {
233
+ const responses = [];
234
+ const onResponse = (response) => {
235
+ if (response.request().method() === 'POST' &&
236
+ /\/api\/users\/[^/]+\/roles\/?$/.test(new URL(response.url()).pathname)) {
237
+ responses.push(response);
238
+ }
239
+ };
240
+ this.page.on('response', onResponse);
241
+ try {
242
+ await this.addButton.click();
243
+ await test_1.expect
244
+ .poll(() => responses.length, { timeout: 30000 })
245
+ .toBeGreaterThanOrEqual(expectedAssignments);
246
+ }
247
+ catch (error) {
248
+ return {
249
+ ok: false,
250
+ failures: [
251
+ `received ${responses.length}/${expectedAssignments} role assignment responses: ${error}`,
252
+ ],
253
+ };
254
+ }
255
+ finally {
256
+ this.page.off('response', onResponse);
257
+ }
258
+ const failures = responses
259
+ .filter((response) => !response.ok())
260
+ .map((response) => `HTTP ${response.status()} ${response.url()}`);
261
+ if (failures.length > 0) {
262
+ return { ok: false, failures };
263
+ }
264
+ await (0, test_1.expect)(this.addButton).toBeHidden({ timeout: 30000 });
265
+ return { ok: true, failures };
266
+ }
219
267
  async clickOperateCheckbox() {
220
268
  await this.operateCheckbox.click();
221
269
  }
@@ -49,18 +49,48 @@ const createKeycloakUser = async (navigationPage, keycloakLoginPage, keycloakAdm
49
49
  await keycloakAdminPage.savePassword();
50
50
  };
51
51
  const createIdentityUser = async (navigationPage, identityPage, identityTenantPage, username) => {
52
- await navigationPage.goToIdentity();
53
- await identityPage.clickUsersLink();
54
- await identityPage.clickUser(username);
55
- await identityPage.clickAssignedRolesTab();
56
- await identityPage.clickAssignRolesButton();
57
- await identityPage.clickOperateCheckbox();
58
- await identityPage.clickTasklistCheckbox();
59
- await identityPage.clickOptimizeCheckbox();
60
- await identityPage.clickModelerCheckbox();
61
- await identityPage.clickConsoleCheckbox();
62
- await identityPage.clickZeebeCheckbox();
63
- await identityPage.clickIdentityCheckbox();
64
- await identityPage.clickModelerAdminCheckbox();
65
- await identityPage.clickAddButton();
52
+ const roleCheckboxes = [
53
+ identityPage.operateCheckbox,
54
+ identityPage.tasklistCheckbox,
55
+ identityPage.optimizeCheckbox,
56
+ identityPage.modelerCheckbox,
57
+ identityPage.consoleCheckbox,
58
+ identityPage.zeebeCheckbox,
59
+ identityPage.identityCheckbox,
60
+ identityPage.modelerAdminCheckbox,
61
+ ];
62
+ const maxAttempts = 3;
63
+ let lastFailures = [];
64
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
65
+ if (attempt > 1) {
66
+ // A rejected assignment (seen as HTTP 401 on every role POST) is tied
67
+ // to the Identity session, so start the retry from a fresh login.
68
+ await identityPage.clearSession();
69
+ }
70
+ await navigationPage.goToIdentity();
71
+ await identityPage.clickUsersLink();
72
+ await identityPage.clickUser(username);
73
+ await identityPage.clickAssignedRolesTab();
74
+ await identityPage.clickAssignRolesButton();
75
+ // The modal lists only roles the user does not have yet, so on a retry
76
+ // after a partial success some checkboxes are legitimately absent. Every
77
+ // role is still required on the first attempt.
78
+ let selected = 0;
79
+ for (const checkbox of roleCheckboxes) {
80
+ if (attempt === 1 || (await checkbox.isVisible())) {
81
+ await checkbox.click();
82
+ selected++;
83
+ }
84
+ }
85
+ if (selected === 0) {
86
+ return;
87
+ }
88
+ const result = await identityPage.clickAddButtonAndWaitForRoleAssignment(selected);
89
+ if (result.ok) {
90
+ return;
91
+ }
92
+ lastFailures = result.failures;
93
+ console.warn(`createIdentityUser attempt ${attempt}/${maxAttempts}: role assignment for ${username} failed: ${lastFailures.join('; ')}`);
94
+ }
95
+ throw new Error(`Assigning roles to ${username} in Identity failed after ${maxAttempts} attempts: ${lastFailures.join('; ')}`);
66
96
  };
@@ -97,6 +97,22 @@ class NavigationPage {
97
97
  // first appears (common after context.clearCookies() + long beforeEach)
98
98
  // is caught here and turns into a retry rather than a silent wrong-page return.
99
99
  await (0, test_1.expect)(banner).toBeVisible({ timeout: 30000 });
100
+ // Web Modeler renders its banner before its own session handshake
101
+ // (POST /modeler/internal-api/login) completes. When that handshake is
102
+ // rejected (seen as HTTP 404 for a freshly provisioned user), Modeler
103
+ // logs out and redirects back to the Keycloak login page about a
104
+ // second AFTER the banner check above passed, leaving the caller on
105
+ // the login page. Probe for that bounce and turn it into a retry,
106
+ // which logs in again, instead of returning on the wrong page.
107
+ if (url === '/modeler') {
108
+ const bouncedToLogin = await loginSelector
109
+ .waitFor({ state: 'visible', timeout: 5000 })
110
+ .then(() => true)
111
+ .catch(() => false);
112
+ if (bouncedToLogin) {
113
+ throw new Error('Modeler redirected back to the login page after login');
114
+ }
115
+ }
100
116
  return; // End of successful navigation/login
101
117
  }
102
118
  catch (error) {
@@ -174,7 +174,7 @@ _8_9_1.test.describe('Smoke Tests', () => {
174
174
  timeout: TIMEOUT.medium,
175
175
  });
176
176
  await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
177
- await optimizeReportPage.waitUntilLocatorIsVisible(optimizeReportPage.oneUserTaskInstance.first(), appTab);
177
+ await optimizeReportPage.waitUntilLocatorIsVisible(optimizeReportPage.oneUserTaskInstance, appTab, { expectedCount: 2 });
178
178
  await (0, test_1.expect)(optimizeReportPage.oneUserTaskInstance).toHaveCount(2, {
179
179
  timeout: TIMEOUT.navigation,
180
180
  });
@@ -455,6 +455,15 @@ SM_8_11_1.test.describe('HTO User Flow Tests', () => {
455
455
  });
456
456
  });
457
457
  await SM_8_11_1.test.step('Assert the Open Task Updates In Place to Suspended, Without Reopening It', async () => {
458
+ // Suspend ran on the Operate tab, which left this Tasklist tab hidden.
459
+ // Tasklist's task-detail query (GET /user-tasks/{key}), the source for
460
+ // the action buttons' disabled state, is visibility-gated and does not
461
+ // refetch while the tab is backgrounded: the trace shows the polled list
462
+ // query flipping the side-panel badge to suspended while the detail query
463
+ // stays stale, so the buttons keep their pre-suspend enabled state.
464
+ // Return to this tab as a user would, firing the visibility refetch that
465
+ // updates the open panel in place (no reselection, so still "in place").
466
+ await page.bringToFront();
458
467
  await (0, test_1.expect)(taskPanelPage.taskLink(processName)).toHaveAccessibleName(/\(suspended\)$/, { timeout: 60000 });
459
468
  await (0, test_1.expect)(taskDetailsPage.suspendedLabel(processName)).toBeVisible({
460
469
  timeout: 60000,
@@ -477,6 +486,11 @@ SM_8_11_1.test.describe('HTO User Flow Tests', () => {
477
486
  await (0, test_1.expect)(operateProcessInstancePage.suspendedIcon).toBeHidden({
478
487
  timeout: 60000,
479
488
  });
489
+ // Resuming ran on the Operate tab, hiding this one again; bring Tasklist
490
+ // back to the foreground so the same visibility-gated detail refetch
491
+ // clears the suspended state and re-enables the actions in place (see the
492
+ // suspend step above for why the backgrounded tab does not refetch).
493
+ await page.bringToFront();
480
494
  await (0, test_1.expect)(taskPanelPage.taskLink(processName)).not.toHaveAccessibleName(/\(suspended\)$/, { timeout: 60000 });
481
495
  await (0, test_1.expect)(taskDetailsPage.suspendedLabel(processName)).toBeHidden({
482
496
  timeout: 60000,
@@ -222,6 +222,9 @@ SM_8_7_1.test.describe.parallel('HTO User Flow Tests', () => {
222
222
  await SM_8_7_1.test.step('Logout and Login with "lisa" User and Check Tasks in Tasklist', async () => {
223
223
  await settingsPage.clickOpenSettingsButton();
224
224
  await settingsPage.clickLogoutButton();
225
+ // The logout redirect chain (Tasklist -> Keycloak) can take longer than
226
+ // the 10s action timeout under load; wait for the login form first.
227
+ await (0, test_1.expect)(loginPage.usernameInput).toBeVisible({ timeout: 60000 });
225
228
  await loginPage.fillUsername(navigationPage.user1);
226
229
  await (0, test_1.expect)(loginPage.usernameInput).toHaveValue(navigationPage.user1);
227
230
  await loginPage.fillPassword('lisa');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1688",
3
+ "version": "0.0.1689",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",