@camunda/e2e-test-suite 0.0.1502 → 0.0.1504

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.
@@ -43,6 +43,14 @@ declare class ClusterPage {
43
43
  constructor(page: Page, testInfo?: TestInfo);
44
44
  clickClusterBanner(): Promise<void>;
45
45
  private confirmClusterDeletion;
46
+ /**
47
+ * Opens the delete dialog for one cluster row. The legacy Console table has
48
+ * an inline "Delete" button per row; Camunda Hub's Clusters table moved it
49
+ * behind the row's "Row actions" kebab -> "Delete" menu item (same shape as
50
+ * Hub's Alerts and Users tables), so a row-scoped Delete button never
51
+ * resolves there and every click timed out.
52
+ */
53
+ private openRowDeleteDialog;
46
54
  private dismissOpenDialog;
47
55
  deleteCluster(name: string): Promise<void>;
48
56
  clickClusterTab(): Promise<void>;
@@ -204,6 +204,31 @@ class ClusterPage {
204
204
  });
205
205
  await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 60000 });
206
206
  }
207
+ /**
208
+ * Opens the delete dialog for one cluster row. The legacy Console table has
209
+ * an inline "Delete" button per row; Camunda Hub's Clusters table moved it
210
+ * behind the row's "Row actions" kebab -> "Delete" menu item (same shape as
211
+ * Hub's Alerts and Users tables), so a row-scoped Delete button never
212
+ * resolves there and every click timed out.
213
+ */
214
+ async openRowDeleteDialog(row) {
215
+ const inlineDelete = row.getByRole('button', { name: 'Delete' });
216
+ const rowActions = row.getByRole('button', {
217
+ name: 'Row actions',
218
+ exact: true,
219
+ });
220
+ await (0, test_1.expect)(inlineDelete.or(rowActions).first()).toBeVisible({
221
+ timeout: 60000,
222
+ });
223
+ if (await inlineDelete.isVisible().catch(() => false)) {
224
+ await inlineDelete.click({ force: true, timeout: 60000 });
225
+ return;
226
+ }
227
+ await rowActions.click({ timeout: 60000 });
228
+ await this.page
229
+ .getByRole('menuitem', { name: 'Delete', exact: true })
230
+ .click({ timeout: 60000 });
231
+ }
207
232
  async dismissOpenDialog() {
208
233
  const cancelButton = this.dialog
209
234
  .first()
@@ -574,17 +599,18 @@ class ClusterPage {
574
599
  */
575
600
  async pruneDuplicateClusters(clusterName) {
576
601
  const rows = this.cluster(clusterName);
577
- const maxAttempts = 4;
602
+ // One deletion per attempt, so the budget has to cover every surplus row
603
+ // (a night of overlapping workers left 8), plus a few for failed clicks.
604
+ let maxAttempts = 4;
578
605
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
579
606
  const total = await this.countClusters(clusterName);
580
607
  if (total <= 1)
581
608
  return;
609
+ if (attempt === 1)
610
+ maxAttempts = Math.max(maxAttempts, total + 2);
582
611
  console.warn(`pruneDuplicateClusters: found ${total} clusters named '${clusterName}'; deleting the surplus row (attempt ${attempt}/${maxAttempts}).`);
583
612
  try {
584
- await rows
585
- .nth(total - 1)
586
- .getByRole('button', { name: 'Delete' })
587
- .click({ force: true, timeout: 60000 });
613
+ await this.openRowDeleteDialog(rows.nth(total - 1));
588
614
  await this.confirmClusterDeletion();
589
615
  }
590
616
  catch (error) {
@@ -25,6 +25,7 @@ export declare class OCIdentityGroupsPage {
25
25
  readonly emptyState: Locator;
26
26
  readonly assignUserButton: Locator;
27
27
  readonly searchBox: Locator;
28
+ readonly groupSearchInput: Locator;
28
29
  readonly assignUserButtonModal: Locator;
29
30
  readonly selectGroupRow: (name: string) => Locator;
30
31
  readonly groupCell: (name: string) => Locator;
@@ -30,6 +30,7 @@ class OCIdentityGroupsPage {
30
30
  emptyState;
31
31
  assignUserButton;
32
32
  searchBox;
33
+ groupSearchInput;
33
34
  assignUserButtonModal;
34
35
  selectGroupRow;
35
36
  groupCell;
@@ -97,6 +98,7 @@ class OCIdentityGroupsPage {
97
98
  this.emptyState = page.getByText('No groups created yet');
98
99
  this.assignUserButton = page.getByRole('button', { name: 'Assign user' });
99
100
  this.searchBox = page.getByTitle('Username');
101
+ this.groupSearchInput = page.getByPlaceholder('Search by group ID');
100
102
  this.assignUserButtonModal = page
101
103
  .getByLabel('Assign user')
102
104
  .getByRole('button', { name: 'Assign user' });
@@ -105,17 +107,29 @@ class OCIdentityGroupsPage {
105
107
  await (0, test_1.expect)(this.createGroupButton).toBeVisible({ timeout: 10000 });
106
108
  await this.createGroupButton.click();
107
109
  await (0, test_1.expect)(this.createGroupIdField).toBeVisible({ timeout: 10000 });
108
- await this.createGroupIdField.click();
109
- await this.createGroupIdField.fill(groupId);
110
110
  await (0, test_1.expect)(this.createNameField).toBeVisible({ timeout: 10000 });
111
- await this.createNameField.click();
112
- await this.createNameField.fill(groupName);
111
+ // The modal's react-hook-form inputs can drop a value typed while the
112
+ // dialog is still settling (nightly: Group ID filled, then submitted
113
+ // empty -> "Group ID is required"). Re-fill until both values stick.
114
+ await (0, test_1.expect)(async () => {
115
+ await this.createGroupIdField.click();
116
+ await this.createGroupIdField.fill(groupId);
117
+ await this.createNameField.click();
118
+ await this.createNameField.fill(groupName);
119
+ await (0, test_1.expect)(this.createGroupIdField).toHaveValue(groupId, {
120
+ timeout: 2000,
121
+ });
122
+ await (0, test_1.expect)(this.createNameField).toHaveValue(groupName, {
123
+ timeout: 2000,
124
+ });
125
+ }).toPass({ timeout: 30000 });
113
126
  if (description) {
114
127
  await (0, test_1.expect)(this.createDescriptionField).toBeVisible({ timeout: 10000 });
115
128
  await this.createDescriptionField.fill(description);
116
129
  }
130
+ await (0, test_1.expect)(this.createGroupIdField).toHaveValue(groupId);
117
131
  await this.createGroupModalCreateButton.click();
118
- await (0, test_1.expect)(this.createGroupModal).toBeHidden();
132
+ await (0, test_1.expect)(this.createGroupModal).toBeHidden({ timeout: 15000 });
119
133
  }
120
134
  async editGroup(currentName, newName, newDescription) {
121
135
  await this.editGroupButton(currentName).click();
@@ -142,6 +156,11 @@ class OCIdentityGroupsPage {
142
156
  const retryDelay = 5000;
143
157
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
144
158
  try {
159
+ // The list renders only the first page of groups, so a freshly
160
+ // created group can be off-screen; filter by its ID first.
161
+ if (await this.groupSearchInput.isVisible().catch(() => false)) {
162
+ await this.groupSearchInput.fill(groupName);
163
+ }
145
164
  const groupRow = await this.selectGroupRow(groupName);
146
165
  await groupRow.click();
147
166
  return;
@@ -199,6 +199,19 @@ _8_10_1.test.describe('User Roles User Flow', () => {
199
199
  password: process.env.C8_PASSWORD_TEST_9,
200
200
  });
201
201
  });
202
+ await _8_10_1.test.step('Delete any workspace the analyst created in an earlier run', async () => {
203
+ // The analyst must start with no workspace for the gate below to mean
204
+ // anything. One that an earlier attempt created as this user (the last
205
+ // step used to fall back to creating "Cross Component Test Project"
206
+ // when it could not find it) persists in the org and made that
207
+ // assertion fail on every later run, so clear it as the analyst --
208
+ // the only user who administers it -- before asserting.
209
+ const deleted = await (0, consoleApiHelpers_1.deleteOwnHubWorkspacesViaApi)(page);
210
+ if (deleted.length > 0) {
211
+ await page.reload();
212
+ await page.waitForLoadState('domcontentloaded');
213
+ }
214
+ });
202
215
  // Every SaaS organization member sees every environment in the
203
216
  // organization, whether or not they belong to a workspace. Hub decided
204
217
  // this in camunda-hub#30270 and shipped it in camunda-hub#30271; the bug
@@ -314,7 +327,11 @@ _8_10_1.test.describe('User Roles User Flow', () => {
314
327
  await appsPage.clickCamundaApps();
315
328
  await appsPage.clickModeler();
316
329
  await homePage.clickSkipCustomization();
317
- await modelerHomePage.createCrossComponentProjectFolder();
330
+ // Open the shared workspace the analyst was made Editor on, never
331
+ // createCrossComponentProjectFolder(): when that cannot find the tile
332
+ // it creates a new workspace as the analyst, which is permanent and
333
+ // breaks the "no workspace" assertion above on every later run.
334
+ await modelerHomePage.clickCrossComponentProjectFolder();
318
335
  await modelerHomePage.clickDiagramTypeDropdown();
319
336
  await modelerHomePage.clickBpmnTemplateOption();
320
337
  await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
@@ -18,3 +18,4 @@ export declare function getHubWorkspaceId(page: Page): string | undefined;
18
18
  export declare function linkClusterToSharedWorkspaceViaApi(page: Page, clusterName: string): Promise<void>;
19
19
  export declare function linkClusterToWorkspacesNamedViaApi(page: Page, clusterName: string, workspaceName?: string): Promise<void>;
20
20
  export declare function ensureClusterLinkedToSharedWorkspace(page: Page, clusterName: string): Promise<void>;
21
+ export declare function deleteOwnHubWorkspacesViaApi(page: Page): Promise<string[]>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureClusterLinkedToSharedWorkspace = exports.linkClusterToWorkspacesNamedViaApi = exports.linkClusterToSharedWorkspaceViaApi = exports.getHubWorkspaceId = exports.rememberHubWorkspaceId = exports.linkClusterToWorkspaceViaApi = exports.waitForAiFeaturesEnabledViaApi = exports.areAiFeaturesEnabledViaApi = exports.waitForClusterRestartHealthyViaApi = exports.waitForClusterHealthyViaApi = exports.ensureClientAuditLoggingViaApi = exports.ensureTasklistV2Enabled = exports.ensureClusterViaApi = exports.createClusterViaApi = exports.deleteClusterViaApi = exports.getClusterUuidByName = exports.resetHubBearerToken = exports.observeBearerTokens = exports.getOrgId = void 0;
3
+ exports.deleteOwnHubWorkspacesViaApi = exports.ensureClusterLinkedToSharedWorkspace = exports.linkClusterToWorkspacesNamedViaApi = exports.linkClusterToSharedWorkspaceViaApi = exports.getHubWorkspaceId = exports.rememberHubWorkspaceId = exports.linkClusterToWorkspaceViaApi = exports.waitForAiFeaturesEnabledViaApi = exports.areAiFeaturesEnabledViaApi = exports.waitForClusterRestartHealthyViaApi = exports.waitForClusterHealthyViaApi = exports.ensureClientAuditLoggingViaApi = exports.ensureTasklistV2Enabled = exports.ensureClusterViaApi = exports.createClusterViaApi = exports.deleteClusterViaApi = exports.getClusterUuidByName = exports.resetHubBearerToken = exports.observeBearerTokens = exports.getOrgId = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const sleep_1 = require("./sleep");
6
6
  const PLAN_TYPE_ID = '574cde5f-54ae-43c1-851a-e6fb4f03423a';
@@ -1055,3 +1055,38 @@ async function ensureClusterLinkedToSharedWorkspace(page, clusterName) {
1055
1055
  await linkClusterToSharedWorkspaceViaApi(page, clusterName);
1056
1056
  }
1057
1057
  exports.ensureClusterLinkedToSharedWorkspace = ensureClusterLinkedToSharedWorkspace;
1058
+ // Deletes every Hub workspace the signed-in user is Workspace Admin of. A
1059
+ // workspace is a Hub project (camunda-hub ProjectClient.deleteProject), so it
1060
+ // goes through DELETE /api/internal/projects/<id>.
1061
+ //
1062
+ // For a restricted user whose flow asserts it holds no workspace at all: one
1063
+ // it created by accident is durable org state that fails that assertion on
1064
+ // every later run against the same org, long after the test that created it.
1065
+ // Only ADMIN memberships are removed -- a role flow only ever grants Editor,
1066
+ // so an ADMIN row can only be a workspace this user created itself.
1067
+ async function deleteOwnHubWorkspacesViaApi(page) {
1068
+ const origin = await hubApiOrigin(page);
1069
+ const response = await clusterApiRequest(page, 'GET', `${origin}/api/internal/v2/organizations/${encodeURIComponent(process.env.ORG_ID)}/workspaces?sort=name,asc&offset=0&limit=100&membersOnly=true`);
1070
+ if (!response.ok()) {
1071
+ throw new Error(`Failed to list the current user's workspaces: ` +
1072
+ `${response.status()} ${response.statusText()}`);
1073
+ }
1074
+ const body = (await response.json());
1075
+ const data = (body.data ?? body);
1076
+ const items = Array.isArray(data.items) ? data.items : [];
1077
+ const ownedIds = items
1078
+ .map((item) => (item ?? {}))
1079
+ .filter((item) => item.currentUserRole === 'ADMIN')
1080
+ .map((item) => item.id)
1081
+ .filter((id) => typeof id === 'string');
1082
+ for (const workspaceId of ownedIds) {
1083
+ const deletion = await clusterApiRequest(page, 'DELETE', `${origin}/api/internal/projects/${encodeURIComponent(workspaceId)}`);
1084
+ if (!deletion.ok() && deletion.status() !== 404) {
1085
+ throw new Error(`Failed to delete workspace ${workspaceId}: ` +
1086
+ `${deletion.status()} ${deletion.statusText()}`);
1087
+ }
1088
+ console.log(`Deleted stray workspace ${workspaceId} owned by this user`);
1089
+ }
1090
+ return ownedIds;
1091
+ }
1092
+ exports.deleteOwnHubWorkspacesViaApi = deleteOwnHubWorkspacesViaApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1502",
3
+ "version": "0.0.1504",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",