@camunda/e2e-test-suite 0.0.1647 → 0.0.1649

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.
@@ -81,6 +81,7 @@ declare class ClusterPage {
81
81
  clickClusterNameInput(options?: {
82
82
  recoverViaClusterList?: boolean;
83
83
  }): Promise<void>;
84
+ cloudProviderOption(region: string): Locator;
84
85
  fillClusterNameInput(name: string): Promise<void>;
85
86
  private extractClusterIdFromUrl;
86
87
  private logClusterCreationInfo;
@@ -114,7 +114,7 @@ class ClusterPage {
114
114
  this.devTab = choice(page.getByRole('tab', { name: 'Internal Dev' }), 'Internal Dev');
115
115
  this.stableTab = choice(page.getByRole('tab', { name: 'Stable' }), 'Stable');
116
116
  this.qaGenerationsTab = choice(page.getByRole('tab', { name: 'QA Generations' }), 'QA Generations');
117
- this.gcpRegion = choice(page.getByRole('tab', { name: 'GCP' }), 'GCP');
117
+ this.gcpRegion = this.cloudProviderOption('GCP');
118
118
  this.clustersList = page
119
119
  .getByRole('row')
120
120
  .filter({ hasNotText: 'Generation' }); //Filter out header row
@@ -398,6 +398,16 @@ class ClusterPage {
398
398
  : {}),
399
399
  });
400
400
  }
401
+ // The Console's "Select cloud provider" radiogroup now names its options
402
+ // by the provider's full name with the short code in parentheses ("Google
403
+ // Cloud (GCP)", "Amazon Web Services (AWS)"); older builds named them
404
+ // "GCP"/"AWS" (or rendered Carbon tabs). Accept all three shapes. Ported
405
+ // from pages/8.9/ClusterPage.ts.
406
+ cloudProviderOption(region) {
407
+ return this.page.getByRole('tab', { name: region }).or(this.page.getByRole('radio', {
408
+ name: new RegExp(`^(${region}|.+ \\(${region}\\))$`),
409
+ }));
410
+ }
401
411
  async fillClusterNameInput(name) {
402
412
  await this.clusterNameInput.fill(name);
403
413
  }
@@ -423,14 +433,7 @@ class ClusterPage {
423
433
  await this.clickClusterNameInput();
424
434
  await this.fillClusterNameInput(name);
425
435
  await this.clickClusterType();
426
- // Same design-system role="radio" fallback as the choice()-wrapped
427
- // locators above -- `region` is a runtime parameter ('GCP'/'AWS') so
428
- // this can't reuse a named locator directly. Ported from
429
- // pages/8.9/ClusterPage.ts.
430
- await this.page
431
- .getByRole('tab', { name: region })
432
- .or(this.page.getByRole('radio', { name: region, exact: true }))
433
- .click();
436
+ await this.cloudProviderOption(region).click();
434
437
  await this.selectSubRegion(region, subRegion);
435
438
  await this.clickClusterOption();
436
439
  await this.determineTasklistAPI(tasklistV1Api);
@@ -46,6 +46,7 @@ declare class ClusterPage {
46
46
  clickClusterTab(): Promise<void>;
47
47
  clickCreateNewClusterButton(): Promise<void>;
48
48
  clickClusterNameInput(): Promise<void>;
49
+ cloudProviderOption(region: string): Locator;
49
50
  fillClusterNameInput(name: string): Promise<void>;
50
51
  private extractClusterIdFromUrl;
51
52
  private logClusterCreationInfo;
@@ -105,7 +105,7 @@ class ClusterPage {
105
105
  this.devTab = choice(page.getByRole('tab', { name: 'Internal Dev' }), 'Internal Dev');
106
106
  this.stableTab = choice(page.getByRole('tab', { name: 'Stable' }), 'Stable');
107
107
  this.qaGenerationsTab = choice(page.getByRole('tab', { name: 'QA Generations' }), 'QA Generations');
108
- this.gcpRegion = choice(page.getByRole('tab', { name: 'GCP' }), 'GCP');
108
+ this.gcpRegion = this.cloudProviderOption('GCP');
109
109
  this.clustersList = page
110
110
  .getByRole('row')
111
111
  .filter({ hasNotText: 'Generation' }); //Filter out header row
@@ -255,6 +255,16 @@ class ClusterPage {
255
255
  },
256
256
  });
257
257
  }
258
+ // The Console's "Select cloud provider" radiogroup now names its options
259
+ // by the provider's full name with the short code in parentheses ("Google
260
+ // Cloud (GCP)", "Amazon Web Services (AWS)"); older builds named them
261
+ // "GCP"/"AWS" (or rendered Carbon tabs). Accept all three shapes. Ported
262
+ // from pages/8.9/ClusterPage.ts.
263
+ cloudProviderOption(region) {
264
+ return this.page.getByRole('tab', { name: region }).or(this.page.getByRole('radio', {
265
+ name: new RegExp(`^(${region}|.+ \\(${region}\\))$`),
266
+ }));
267
+ }
258
268
  async fillClusterNameInput(name) {
259
269
  await this.clusterNameInput.fill(name);
260
270
  }
@@ -280,14 +290,7 @@ class ClusterPage {
280
290
  await this.clickClusterNameInput();
281
291
  await this.fillClusterNameInput(name);
282
292
  await this.clickClusterType();
283
- // Same design-system role="radio" fallback as the choice()-wrapped
284
- // locators above -- `region` is a runtime parameter ('GCP'/'AWS') so
285
- // this can't reuse a named locator directly. Ported from
286
- // pages/8.9/ClusterPage.ts.
287
- await this.page
288
- .getByRole('tab', { name: region })
289
- .or(this.page.getByRole('radio', { name: region, exact: true }))
290
- .click();
293
+ await this.cloudProviderOption(region).click();
291
294
  await this.selectSubRegion(region);
292
295
  await this.clickClusterOption();
293
296
  await this.determineTasklistAPI(tasklistV1Api);
@@ -9,6 +9,9 @@ const clusterVersions_1 = require("../../utils/clusterVersions");
9
9
  // Classic Console renders the status as "Creating"; Camunda Hub's cluster
10
10
  // table renders "Creating…" (Unicode ellipsis), which an exact match misses.
11
11
  const CREATING_STATUS = /^Creating(…|\.\.\.)?$/;
12
+ // Accessible name of a cloud-provider radio: the bare code ("GCP") or the
13
+ // full name ending with the code in parentheses ("Google Cloud (GCP)").
14
+ const providerName = (code) => new RegExp(`^(?:${code}|.*\\(${code}\\))$`);
12
15
  class ClusterPage {
13
16
  page;
14
17
  defaultClusterType = 'G3-Dev';
@@ -110,7 +113,11 @@ class ClusterPage {
110
113
  // a nightly trace's DOM has
111
114
  // <button role="radio" aria-checked="true" data-slot="toggle-group-item">GCP</button>
112
115
  // inside a role="radiogroup", and no role="tab" anywhere on the form.
113
- this.gcpRegion = choice(page.getByRole('tab', { name: 'GCP' }), 'GCP');
116
+ // The radio was later renamed from "GCP" to "Google Cloud (GCP)" (and
117
+ // "AWS" to "Amazon Web Services (AWS)"), so match either name.
118
+ this.gcpRegion = page
119
+ .getByRole('tab', { name: 'GCP' })
120
+ .or(page.getByRole('radio', { name: providerName('GCP') }));
114
121
  this.clustersList = page
115
122
  .getByRole('row')
116
123
  .filter({ hasNotText: 'Generation' }); //Filter out header row
@@ -313,10 +320,14 @@ class ClusterPage {
313
320
  // GCP already selected -- so a `role=tab` click both targeted nothing and
314
321
  // was unnecessary. Accept either shape and skip the click when the option is
315
322
  // already the selected one.
323
+ //
324
+ // The provider radios are now named "Google Cloud (GCP)" / "Amazon Web
325
+ // Services (AWS)" instead of the bare "GCP" / "AWS", so match the bare code
326
+ // or the code in trailing parentheses.
316
327
  async clickProviderOption(region) {
317
328
  const providerOption = this.page
318
329
  .getByRole('tab', { name: region })
319
- .or(this.page.getByRole('radio', { name: region, exact: true }))
330
+ .or(this.page.getByRole('radio', { name: providerName(region) }))
320
331
  .first();
321
332
  await (0, test_1.expect)(providerOption).toBeVisible({ timeout: 40000 });
322
333
  if ((await providerOption.getAttribute('aria-checked')) === 'true') {
@@ -29,6 +29,7 @@ declare class ManagementIdentityPage {
29
29
  clickDemoUser(): Promise<void>;
30
30
  clickDeleteAccessButton(accessToDelete: string | string[]): Promise<void>;
31
31
  clickConfirmDeleteButton(): Promise<void>;
32
+ removeAssignedRole(accessToDelete: string | string[], reopenUserRoles: () => Promise<void>): Promise<void>;
32
33
  clickAssignRolesButton(): Promise<void>;
33
34
  clickAddButton(): Promise<void>;
34
35
  clickOptimizeCheckbox(): Promise<void>;
@@ -139,6 +139,52 @@ class ManagementIdentityPage {
139
139
  await (0, test_1.expect)(this.confirmDeleteButton, 'The delete-role confirmation dialog did not appear.').toBeVisible({ timeout: 60000 });
140
140
  await this.confirmDeleteButton.click();
141
141
  }
142
+ // A user removing roles from their own account changes the claims behind
143
+ // their IDENTITY_JWT session. Nightly run 42734128630 deleted Optimize (204)
144
+ // and, 400 ms later, sent the Hub delete without the IDENTITY_JWT cookie, got
145
+ // a 401, and the UI dropped it silently — Hub stayed assigned, so the later
146
+ // "assign Hub" step found no Hub checkbox (assigned roles are not offered).
147
+ // Confirm each removal actually landed in the assigned-roles table, and
148
+ // re-open the user's roles (re-authenticating via `reopenUserRoles`) to retry
149
+ // when it did not.
150
+ async removeAssignedRole(accessToDelete, reopenUserRoles) {
151
+ const candidates = typeof accessToDelete === 'string' ? [accessToDelete] : accessToDelete;
152
+ const rowSelector = candidates.map((c) => `:text("${c}")`).join(', ');
153
+ const rolesTable = this.page.getByRole('table', {
154
+ name: 'Roles assigned to user',
155
+ });
156
+ const roleRow = rolesTable.locator(rowSelector).first();
157
+ const maxAttempts = 3;
158
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
159
+ if (attempt > 1) {
160
+ await reopenUserRoles();
161
+ // The user keeps ManagementIdentity throughout, so its row proves the
162
+ // table has rendered before we read the target role's absence.
163
+ await (0, test_1.expect)(rolesTable.getByText('Provides full access to Management Identity')).toBeVisible({ timeout: 60000 });
164
+ const stillAssigned = await roleRow
165
+ .waitFor({ state: 'visible', timeout: 10000 })
166
+ .then(() => true)
167
+ .catch(() => false);
168
+ if (!stillAssigned) {
169
+ return;
170
+ }
171
+ }
172
+ await this.clickDeleteAccessButton(candidates);
173
+ await this.clickConfirmDeleteButton();
174
+ const removed = await roleRow
175
+ .waitFor({ state: 'hidden', timeout: 30000 })
176
+ .then(() => true)
177
+ .catch(() => false);
178
+ if (removed) {
179
+ return;
180
+ }
181
+ console.log(`Attempt ${attempt} to remove role ${candidates.join(' / ')} did ` +
182
+ 'not take effect; re-opening the user roles and retrying...');
183
+ }
184
+ await (0, test_1.expect)(roleRow, `Role matching ${candidates
185
+ .map((c) => `"${c}"`)
186
+ .join(' or ')} is still assigned after ${maxAttempts} removal attempts.`).toBeHidden({ timeout: 30000 });
187
+ }
142
188
  async clickAssignRolesButton() {
143
189
  await this.assignRolesButton.click();
144
190
  }
@@ -62,6 +62,7 @@ declare class OCTenantPage {
62
62
  clickRoleIdSearchBox(): Promise<void>;
63
63
  fillRoleIdSearchBox(roleId: string, roleIdentifier: string): Promise<void>;
64
64
  clickAssignRoleSubButton(): Promise<void>;
65
+ private isRoleAssigned;
65
66
  assignRoleToTenant(roleId: string, roleIdentifier: string): Promise<void>;
66
67
  }
67
68
  export { OCTenantPage };
@@ -268,10 +268,21 @@ class OCTenantPage {
268
268
  async clickAssignRoleSubButton() {
269
269
  await this.assignRoleSubButton.click();
270
270
  }
271
+ async isRoleAssigned(roleId) {
272
+ return this.row(roleId)
273
+ .waitFor({ state: 'visible', timeout: 15000 })
274
+ .then(() => true)
275
+ .catch(() => false);
276
+ }
271
277
  async assignRoleToTenant(roleId, roleIdentifier) {
272
278
  await this.clickRolesTab();
273
279
  await this.page.waitForLoadState('networkidle');
274
- if (await this.row(roleId).isVisible()) {
280
+ // The roles table renders from its own fetch, which `networkidle` can
281
+ // resolve ahead of, so an immediate `isVisible()` reads the table as empty
282
+ // and reopens the modal for a role that is already assigned. The assign
283
+ // dropdown never offers an already-assigned role, so "Assign role" stays
284
+ // disabled and that attempt can never converge.
285
+ if (await this.isRoleAssigned(roleId)) {
275
286
  console.log(`Role ${roleId} is already assigned to tenant`);
276
287
  return;
277
288
  }
@@ -46,20 +46,24 @@ SM_8_11_1.test.describe('Identity User Flow Tests', () => {
46
46
  await managementIdentityPage.clickUser(testUser);
47
47
  await managementIdentityPage.clickAssignedRolesTab();
48
48
  });
49
+ // The test user removes roles from its own account, which can drop its
50
+ // Management Identity session mid-flow; this re-opens the roles tab with a
51
+ // fresh login so `removeAssignedRole` can confirm/retry each removal.
52
+ const reopenUserRoles = async () => {
53
+ await navigationPage.goToManagementIdentity(undefined, credentials);
54
+ await managementIdentityPage.clickUsersLink();
55
+ await managementIdentityPage.clickUser(testUser);
56
+ await managementIdentityPage.clickAssignedRolesTab();
57
+ };
49
58
  if (node_process_1.default.env.IS_OPTIMIZE !== 'false') {
50
59
  await SM_8_11_1.test.step('Remove Access from Optimize', async () => {
51
- await managementIdentityPage.clickDeleteAccessButton('Grants full access to Optimize');
52
- await managementIdentityPage.clickConfirmDeleteButton();
60
+ await managementIdentityPage.removeAssignedRole('Grants full access to Optimize', reopenUserRoles);
53
61
  });
54
62
  }
55
63
  await SM_8_11_1.test.step('Remove Access from Hub', async () => {
56
64
  // Either wording, for the same Web Modeler → Hub rename straddle the
57
65
  // `modelerCheckbox` locator documents.
58
- await managementIdentityPage.clickDeleteAccessButton([
59
- 'Grants full access to Hub',
60
- 'Grants full access to Web Modeler',
61
- ]);
62
- await managementIdentityPage.clickConfirmDeleteButton();
66
+ await managementIdentityPage.removeAssignedRole(['Grants full access to Hub', 'Grants full access to Web Modeler'], reopenUserRoles);
63
67
  });
64
68
  await SM_8_11_1.test.step('Reset Session', async () => {
65
69
  await (0, resetSession_1.resetSession)(browser, page);
@@ -313,8 +313,16 @@ if (process.env.IS_MT === 'true') {
313
313
  await operateHomePage.clickProcessesTab();
314
314
  await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
315
315
  await operateProcessInstancePage.completedIconAssertion();
316
- await (0, test_1.expect)(page.getByTestId('variables-list')).toBeVisible({
317
- timeout: 30000,
316
+ // Operate can show the instance as completed before its variables are
317
+ // imported ("The Flow Node has no Variables"), and it does not poll
318
+ // variables of a finished instance, so reload until they arrive.
319
+ await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(page, page.getByTestId('variables-list'), {
320
+ totalTimeout: 120000,
321
+ visibilityTimeout: 30000,
322
+ maxRetries: 4,
323
+ postAction: async () => {
324
+ await page.reload();
325
+ },
318
326
  });
319
327
  await (0, test_1.expect)(page.getByText('"Awesome!"')).toBeVisible({
320
328
  timeout: 60000,
@@ -26,26 +26,58 @@ function cacheKey(clientId, subject = '') {
26
26
  function basicHeader(username, password) {
27
27
  return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
28
28
  }
29
+ /**
30
+ * Attempts per token request. The identity provider is shared by the whole
31
+ * cluster and, on a freshly upgraded Helm cluster, answers the odd request
32
+ * with a 5xx for a few seconds at a time (Keycloak's `unknown_error`). A
33
+ * single attempt turns that blip into a hard failure for whichever test
34
+ * happens to need a fresh token — typically the first test of a new worker,
35
+ * such as the `clock` project, whose token cache starts empty.
36
+ */
37
+ const TOKEN_FETCH_ATTEMPTS = 5;
38
+ /** Backoff before attempt n+1 is `TOKEN_RETRY_BASE_MS * 2^(n-1)`: 1, 2, 4, 8s. */
39
+ const TOKEN_RETRY_BASE_MS = 1000;
40
+ /** Per-attempt timeout, so a hung endpoint cannot eat the test's budget. */
41
+ const TOKEN_REQUEST_TIMEOUT_MS = 15000;
42
+ /**
43
+ * Only server-side and throttling failures are worth retrying. A 4xx means the
44
+ * credentials or request are wrong — retrying cannot help, and the
45
+ * authorization tests rely on an invalid client failing promptly.
46
+ */
47
+ function isRetryableStatus(status) {
48
+ return status >= 500 || status === 429;
49
+ }
50
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
29
51
  async function fetchToken(request, tokenUrl, form) {
30
52
  let response;
31
- try {
32
- response = await request.post(tokenUrl, {
33
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
34
- form,
35
- });
36
- }
37
- catch (error) {
38
- // An unreachable token endpoint is the single most likely reason a whole
39
- // run fails: on a Helm cluster the identity provider may not be serving
40
- // yet. Reported raw, it surfaces as a Playwright stack inside auth.ts on
41
- // every one of the suite's tests, which says nothing about the cause.
42
- console.error(`Token endpoint ${tokenUrl} is unreachable: ${error instanceof Error ? error.message : String(error)}`);
43
- return undefined;
44
- }
45
- if (!response.ok()) {
53
+ for (let attempt = 1;; attempt++) {
54
+ const isLastAttempt = attempt >= TOKEN_FETCH_ATTEMPTS;
55
+ try {
56
+ response = await request.post(tokenUrl, {
57
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
58
+ form,
59
+ timeout: TOKEN_REQUEST_TIMEOUT_MS,
60
+ });
61
+ }
62
+ catch (error) {
63
+ // An unreachable token endpoint is the single most likely reason a whole
64
+ // run fails: on a Helm cluster the identity provider may not be serving
65
+ // yet. Reported raw, it surfaces as a Playwright stack inside auth.ts on
66
+ // every one of the suite's tests, which says nothing about the cause.
67
+ console.error(`Token endpoint ${tokenUrl} is unreachable (attempt ${attempt}/${TOKEN_FETCH_ATTEMPTS}): ${error instanceof Error ? error.message : String(error)}`);
68
+ if (isLastAttempt)
69
+ return undefined;
70
+ await sleep(TOKEN_RETRY_BASE_MS * 2 ** (attempt - 1));
71
+ continue;
72
+ }
73
+ if (response.ok())
74
+ break;
46
75
  const body = await response.text().catch(() => '<no-body>');
47
- console.error(`Token request to ${tokenUrl} failed with ${response.status()}: ${body}`);
48
- return undefined;
76
+ console.error(`Token request to ${tokenUrl} failed with ${response.status()} (attempt ${attempt}/${TOKEN_FETCH_ATTEMPTS}): ${body}`);
77
+ if (isLastAttempt || !isRetryableStatus(response.status())) {
78
+ return undefined;
79
+ }
80
+ await sleep(TOKEN_RETRY_BASE_MS * 2 ** (attempt - 1));
49
81
  }
50
82
  const json = (await response.json());
51
83
  if (!json.access_token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1647",
3
+ "version": "0.0.1649",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",