@camunda/e2e-test-suite 0.0.1695 → 0.0.1697

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.
Files changed (41) hide show
  1. package/dist/pages/8.11/ClusterDetailsPage.d.ts +8 -1
  2. package/dist/pages/8.11/ClusterDetailsPage.js +32 -5
  3. package/dist/pages/8.11/ClusterPage.d.ts +42 -2
  4. package/dist/pages/8.11/ClusterPage.js +228 -31
  5. package/dist/pages/SM-8.10/OCIdentityClusterVariablesPage.d.ts +5 -5
  6. package/dist/pages/SM-8.10/OCIdentityClusterVariablesPage.js +19 -11
  7. package/dist/pages/SM-8.10/TaskPanelPage.d.ts +1 -1
  8. package/dist/pages/SM-8.10/TaskPanelPage.js +6 -5
  9. package/dist/pages/SM-8.11/OCIdentityClusterVariablesPage.d.ts +5 -5
  10. package/dist/pages/SM-8.11/OCIdentityClusterVariablesPage.js +19 -11
  11. package/dist/pages/SM-8.11/TaskPanelPage.d.ts +1 -1
  12. package/dist/pages/SM-8.11/TaskPanelPage.js +6 -5
  13. package/dist/resources/cluster_variables/cluster_variable_global_scope.bpmn +4 -4
  14. package/dist/resources/cluster_variables/cluster_variable_json_readonly.bpmn +4 -4
  15. package/dist/resources/cluster_variables/cluster_variable_string_readonly.bpmn +4 -4
  16. package/dist/resources/cluster_variables/cluster_variable_tenant_json_readonly.bpmn +4 -4
  17. package/dist/resources/cluster_variables/cluster_variable_tenant_string_readonly.bpmn +4 -4
  18. package/dist/tests/8.11/console-cluster-duplication-api-clients.spec.d.ts +1 -0
  19. package/dist/tests/8.11/console-cluster-duplication-api-clients.spec.js +154 -0
  20. package/dist/tests/8.11/console-cluster-duplication.spec.d.ts +1 -0
  21. package/dist/tests/8.11/console-cluster-duplication.spec.js +460 -0
  22. package/dist/tests/SM-8.10/cluster-variables-tenant.spec.d.ts +1 -0
  23. package/dist/tests/SM-8.10/cluster-variables-tenant.spec.js +198 -0
  24. package/dist/tests/SM-8.10/cluster-variables.spec.js +2 -2
  25. package/dist/tests/SM-8.10/optimize-api-tests.spec.d.ts +1 -0
  26. package/dist/tests/SM-8.10/optimize-api-tests.spec.js +468 -0
  27. package/dist/tests/SM-8.11/cluster-variables-tenant.spec.d.ts +1 -0
  28. package/dist/tests/SM-8.11/cluster-variables-tenant.spec.js +198 -0
  29. package/dist/tests/SM-8.11/cluster-variables.spec.js +2 -2
  30. package/dist/tests/SM-8.11/optimize-api-tests.spec.d.ts +1 -0
  31. package/dist/tests/SM-8.11/optimize-api-tests.spec.js +468 -0
  32. package/dist/tests/SM-8.9/cluster-variables-tenant.spec.js +2 -2
  33. package/dist/tests/SM-8.9/cluster-variables.spec.js +2 -2
  34. package/dist/utils/apiHelpers.d.ts +4 -0
  35. package/dist/utils/apiHelpers.js +29 -4
  36. package/package.json +1 -1
  37. package/resources/cluster_variables/cluster_variable_global_scope.bpmn +4 -4
  38. package/resources/cluster_variables/cluster_variable_json_readonly.bpmn +4 -4
  39. package/resources/cluster_variables/cluster_variable_string_readonly.bpmn +4 -4
  40. package/resources/cluster_variables/cluster_variable_tenant_json_readonly.bpmn +4 -4
  41. package/resources/cluster_variables/cluster_variable_tenant_string_readonly.bpmn +4 -4
@@ -64,6 +64,7 @@ declare class ClusterDetailsPage {
64
64
  clickAPITab(): Promise<void>;
65
65
  dismissOopsIfPresent(): Promise<void>;
66
66
  clickCreateClientButton(): Promise<void>;
67
+ openCreateClientDialog(): Promise<void>;
67
68
  clickClientNameTextbox(): Promise<void>;
68
69
  fillClientNameTextbox(name: string): Promise<void>;
69
70
  clickTasklistCheckbox(): Promise<void>;
@@ -96,7 +97,13 @@ declare class ClusterDetailsPage {
96
97
  createAPIClientAndReturnVariables(name: string, setEnvVariables?: boolean, clusterType?: string): Promise<{
97
98
  [key: string]: string;
98
99
  }>;
99
- createAPIClient(name: string): Promise<void>;
100
+ /**
101
+ * Returns the name the client was really created with, which is `name`
102
+ * unless an attempt failed and the retry suffixed it. A caller that
103
+ * asserts against the requested name instead would miss the client on
104
+ * every retried create.
105
+ */
106
+ createAPIClient(name: string): Promise<string>;
100
107
  clickEnvVarsButton(): Promise<void>;
101
108
  clientCredentialsText(regex: RegExp): Promise<string>;
102
109
  checkTasklistCheckbox(): Promise<void>;
@@ -286,6 +286,27 @@ class ClusterDetailsPage {
286
286
  },
287
287
  });
288
288
  }
289
+ // Right after the API tab mounts, Console refetches the cluster, clients
290
+ // and alerts queries; that re-render unmounts a create dialog opened in the
291
+ // meantime about a second later. Reloading the page restarts the same
292
+ // race, so reopen the dialog in place until it survives the settle window.
293
+ async openCreateClientDialog() {
294
+ const maxOpens = 4;
295
+ for (let open = 1; open <= maxOpens; open++) {
296
+ await this.clickCreateClientButton();
297
+ await (0, test_1.expect)(this.createClientCredentialsDialog).toBeVisible({
298
+ timeout: 30000,
299
+ });
300
+ const closedOnItsOwn = await this.createClientCredentialsDialog
301
+ .waitFor({ state: 'hidden', timeout: 5000 })
302
+ .then(() => true, () => false);
303
+ if (!closedOnItsOwn) {
304
+ return;
305
+ }
306
+ console.warn(`openCreateClientDialog: dialog closed on its own (open ${open}/${maxOpens}); reopening`);
307
+ }
308
+ throw new Error(`Create client dialog closed on its own after ${maxOpens} opens`);
309
+ }
289
310
  async clickClientNameTextbox() {
290
311
  await this.clientNameTextbox.click({ timeout: 60000 });
291
312
  }
@@ -760,6 +781,12 @@ class ClusterDetailsPage {
760
781
  }
761
782
  return variables;
762
783
  }
784
+ /**
785
+ * Returns the name the client was really created with, which is `name`
786
+ * unless an attempt failed and the retry suffixed it. A caller that
787
+ * asserts against the requested name instead would miss the client on
788
+ * every retried create.
789
+ */
763
790
  async createAPIClient(name) {
764
791
  const maxRetries = 3;
765
792
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -768,10 +795,7 @@ class ClusterDetailsPage {
768
795
  // have created the client before we could detect the credentials dialog.
769
796
  const attemptName = attempt === 0 ? name : `${name}-r${attempt}`;
770
797
  try {
771
- await this.clickCreateClientButton();
772
- await (0, test_1.expect)(this.createClientCredentialsDialog).toBeVisible({
773
- timeout: 30000,
774
- });
798
+ await this.openCreateClientDialog();
775
799
  await this.fillAPIClientName(attemptName);
776
800
  await this.checkOrchestrationClusterCheckbox();
777
801
  await this.checkOptimizeCheckbox();
@@ -818,7 +842,7 @@ class ClusterDetailsPage {
818
842
  // round the retry loop, which both left orphan clients behind and
819
843
  // discarded the credentials the caller has yet to read.
820
844
  this.pendingClientScopeCheck = attemptName;
821
- return;
845
+ return attemptName;
822
846
  }
823
847
  catch (error) {
824
848
  if (attempt < maxRetries - 1) {
@@ -841,6 +865,9 @@ class ClusterDetailsPage {
841
865
  }
842
866
  }
843
867
  }
868
+ // Unreachable: every iteration returns or throws. Stated so the compiler
869
+ // can see the function never falls out of the loop without a name.
870
+ throw new Error(`Creating API client "${name}" exhausted ${maxRetries} attempts without a result`);
844
871
  }
845
872
  async clickEnvVarsButton() {
846
873
  await (0, test_1.expect)(this.envVarsTab).toBeVisible({ timeout: 40000 });
@@ -24,6 +24,7 @@ declare class ClusterPage {
24
24
  readonly clusterVersionOption: Locator;
25
25
  readonly generationSearchInput: Locator;
26
26
  readonly g3DevClusterType: Locator;
27
+ readonly clusterRegion: (clusterName: string, regionText: string) => Locator;
27
28
  readonly alphaTab: Locator;
28
29
  readonly devTab: Locator;
29
30
  readonly stableTab: Locator;
@@ -45,15 +46,54 @@ declare class ClusterPage {
45
46
  deleteCluster(name: string): Promise<void>;
46
47
  clickClusterTab(): Promise<void>;
47
48
  clickCreateNewClusterButton(): Promise<void>;
49
+ /**
50
+ * No recovery between attempts, deliberately.
51
+ *
52
+ * clickLocatorWithRetry used to run clickClusterBanner() here, which
53
+ * navigates to the cluster list. That cannot help on either form this is
54
+ * reached from, because the retry loop retries only the click and never
55
+ * reopens the form it navigated away from:
56
+ *
57
+ * - the duplication form is reached from a cluster's overflow menu, so
58
+ * the list is a different page and the input is gone (DUP-01, run
59
+ * 41840910661);
60
+ * - createCluster() opens the create form once before awaiting this, so
61
+ * the list is a different page there too (DUP-02, run 41988552631).
62
+ *
63
+ * Both failed as "Failed to click locator getByPlaceholder('Enter a name
64
+ * for the cluster') after 3 attempts": one recoverable slow render, then
65
+ * two attempts that could not succeed. Retrying in place costs the same
66
+ * time and can actually find the input.
67
+ */
48
68
  clickClusterNameInput(): Promise<void>;
69
+ /**
70
+ * Runs `open` until the cluster form's name input is on screen and stays
71
+ * there. A Console refetch can re-render the page right after the form
72
+ * opens and drop it again (DUP-02/DUP-06, run 44125578620: the snapshot
73
+ * shows the clusters list, no form), and clicking the input in place
74
+ * cannot bring the form back, so the opener itself is retried.
75
+ */
76
+ openClusterForm(open: () => Promise<void>): Promise<void>;
77
+ /**
78
+ * Opens the duplication form of `sourceClusterName` from its details page.
79
+ * When the details page is gone (the form dropped back to the list), it is
80
+ * reached again first; `onDetailsPage` runs once it has loaded.
81
+ */
82
+ openDuplicateClusterForm(sourceClusterName: string, onDetailsPage?: () => Promise<void>): Promise<void>;
49
83
  cloudProviderOption(region: string): Locator;
50
84
  fillClusterNameInput(name: string): Promise<void>;
51
85
  private extractClusterIdFromUrl;
52
86
  private logClusterCreationInfo;
53
- createCluster(name: string, region?: string, tasklistV1Api?: boolean): Promise<void>;
87
+ createCluster(name: string, region?: string, tasklistV1Api?: boolean, subRegion?: string): Promise<void>;
54
88
  determineTasklistAPI(tasklistV1Api?: boolean): Promise<void>;
55
89
  clickClusterType(): Promise<void>;
56
90
  clickCreateClusterButton(): Promise<void>;
91
+ /**
92
+ * Fails at the submit when the create form is still open a minute later,
93
+ * with the form's own error text, instead of letting clickClustersBreadcrumb
94
+ * wait out 90s for a row that was never created.
95
+ */
96
+ private assertClusterFormSubmitted;
57
97
  clickClustersBreadcrumb(clusterName: string): Promise<void>;
58
98
  clickClusterLink(name: string): Promise<void>;
59
99
  clickConnectorSecretsTab(clusterName: string): Promise<void>;
@@ -90,7 +130,7 @@ declare class ClusterPage {
90
130
  clickDevTab(): Promise<void>;
91
131
  clickStableTab(): Promise<void>;
92
132
  clickQAGenerationsTab(): Promise<void>;
93
- selectSubRegion(region: string): Promise<void>;
133
+ selectSubRegion(region: string, subRegion?: string): Promise<void>;
94
134
  clickGCPRegion(): Promise<void>;
95
135
  clickTasklistV1Api(): Promise<void>;
96
136
  }
@@ -4,6 +4,7 @@ exports.ClusterPage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const sleep_1 = require("../../utils/sleep");
6
6
  const clickLocatorWithRetry_1 = require("../../utils/assertionHelpers/clickLocatorWithRetry");
7
+ const findLocatorWithPagination_1 = require("../../utils/assertionHelpers/findLocatorWithPagination");
7
8
  class ClusterPage {
8
9
  page;
9
10
  defaultClusterType = 'G3-Dev';
@@ -29,6 +30,7 @@ class ClusterPage {
29
30
  clusterVersionOption;
30
31
  generationSearchInput;
31
32
  g3DevClusterType;
33
+ clusterRegion;
32
34
  alphaTab;
33
35
  devTab;
34
36
  stableTab;
@@ -131,7 +133,12 @@ class ClusterPage {
131
133
  // deleteCluster needs it -- while everything that means "the one cluster
132
134
  // under test" goes through this single row, so a duplicate can no longer
133
135
  // turn an ordinary visibility check into a strict-mode violation.
134
- this.clusterRow = (clusterName) => this.cluster(clusterName).first();
136
+ // createCluster's pre-clean leaves same-named rows in "Deleting" for
137
+ // minutes, and they can sort above the new cluster; that row never shows
138
+ // Creating/Healthy, so it must not be picked as the cluster under test.
139
+ this.clusterRow = (clusterName) => this.cluster(clusterName)
140
+ .filter({ hasNotText: /Deleting/ })
141
+ .first();
135
142
  this.clusterHealthiness = (clusterName) => this.clusterRow(clusterName).getByText(`Healthy`, {
136
143
  exact: true,
137
144
  });
@@ -141,6 +148,7 @@ class ClusterPage {
141
148
  });
142
149
  this.dialog = page.getByRole('dialog');
143
150
  this.clusterVersion = (clusterName, versionText) => this.clusterRow(clusterName).getByText(versionText, { exact: false });
151
+ this.clusterRegion = (clusterName, regionText) => this.clusterRow(clusterName).getByText(regionText, { exact: false });
144
152
  }
145
153
  async clickClusterBanner() {
146
154
  // Camunda Hub has no `banner` landmark; "Clusters" instead lives in its
@@ -201,35 +209,118 @@ class ClusterPage {
201
209
  }
202
210
  }
203
211
  async deleteCluster(name) {
204
- await this.page.waitForTimeout(1000);
205
- const clusterInstance = this.cluster(name).first();
206
- if ((await clusterInstance.count()) <= 0) {
212
+ // A full reload in the Hub shell bounces through /login, the identity
213
+ // provider and /login-callback (~35s) before the SPA pushes its returnUrl
214
+ // back to /clusters. Counting rows mid-bounce throws "Execution context
215
+ // was destroyed", so wait for the clusters page to have settled first.
216
+ await this.page.waitForURL((url) => /\/clusters\/?$/.test(url.pathname), {
217
+ timeout: 120000,
218
+ });
219
+ await (0, test_1.expect)(this.createNewClusterButton).toBeVisible({ timeout: 60000 });
220
+ // Hub's clusters data table renders skeleton rows (no links) while it
221
+ // fetches, and the "Create new cluster" button is visible before the data
222
+ // arrives. Counting matching rows at that point always returned 0, so the
223
+ // pre-clean was skipped and every run left one more same-named cluster
224
+ // behind until the org ran out of G3-Dev reservations (the type tile then
225
+ // renders disabled). Wait for the first loaded row before counting.
226
+ await this.clustersList
227
+ .getByRole('link')
228
+ .first()
229
+ .waitFor({ timeout: 30000 })
230
+ .catch(() => false);
231
+ // Rows whose deletion is already in progress keep the name until the
232
+ // backend removes them; exclude them so the loop does not revisit them.
233
+ const deletableRows = () => this.clustersList
234
+ .filter({
235
+ has: this.page.getByRole('link', { name, exact: true }),
236
+ })
237
+ .filter({ hasNotText: /Deleting/ });
238
+ // The table only renders one page, so a matching row on a later page
239
+ // counts as 0 here. Walk forward through the pages before concluding the
240
+ // cluster is absent; rows on pages already walked cannot gain a match,
241
+ // because deleting a row only pulls later rows back onto the current page.
242
+ const hasDeletableRow = async () => (await deletableRows().count()) > 0 ||
243
+ (0, findLocatorWithPagination_1.findLocatorWithPagination)(this.page, deletableRows().first(), {
244
+ timeout: 60000,
245
+ });
246
+ if (!(await hasDeletableRow())) {
207
247
  console.log(`No clusters found with name ${name}, skipping deletion.`);
208
248
  return;
209
249
  }
210
- await clusterInstance.waitFor({ timeout: 10000 });
211
- let deleteButtons = this.cluster(name).getByRole('button', {
212
- name: 'Delete',
213
- });
214
- while ((await deleteButtons.count()) > 0) {
215
- const deleteButton = deleteButtons.nth(0);
216
- if (await deleteButton.isVisible()) {
217
- try {
218
- await deleteButton.click({ force: true, timeout: 60000 });
219
- }
220
- catch (error) {
221
- await this.clickClusterBanner();
222
- await (0, test_1.expect)(deleteButton).toBeVisible({ timeout: 60000 });
223
- await deleteButton.click({ force: true, timeout: 60000 });
224
- }
225
- await this.confirmClusterDeletion();
226
- // Refresh the list of delete buttons
227
- deleteButtons = this.cluster(name).getByRole('button', {
228
- name: 'Delete',
250
+ // Legacy Console rendered a per-row "Delete" button; Hub's design-system
251
+ // data table instead puts it in the row's "Row actions" kebab menu.
252
+ const deleteMenuItem = this.page.getByRole('menuitem', { name: /^Delete/ });
253
+ const confirmInput = this.confirmDeleteInput.or(this.dialog.getByRole('textbox'));
254
+ const maxDeletions = 50;
255
+ for (let i = 0; i < maxDeletions; i++) {
256
+ if (!(await hasDeletableRow()))
257
+ break;
258
+ const row = deletableRows().first();
259
+ const rowAction = row
260
+ .getByRole('button', { name: 'Delete' })
261
+ .or(row.getByRole('button', { name: 'Row actions', exact: true }));
262
+ try {
263
+ await (0, test_1.expect)(rowAction).toBeVisible({ timeout: 10000 });
264
+ }
265
+ catch {
266
+ // A cluster in a transient state (e.g. just created by a concurrent
267
+ // setup worker) may have its row present before the action renders.
268
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
269
+ await this.clustersList.getByRole('link').first().waitFor({
270
+ timeout: 30000,
229
271
  });
272
+ continue;
273
+ }
274
+ // Rows share the cluster name, so remember this row's unique link (it
275
+ // carries the cluster id) to recognise when this cluster is gone.
276
+ const clusterHref = await row
277
+ .getByRole('link', { name, exact: true })
278
+ .getAttribute('href');
279
+ await rowAction.click({ timeout: 60000 });
280
+ // isVisible() does not wait, so a kebab menu that opens a moment after
281
+ // the click was missed and the confirm dialog never appeared. Wait for
282
+ // either the menu item (Hub) or the dialog (legacy per-row button).
283
+ await (0, test_1.expect)(deleteMenuItem.or(this.dialog)).toBeVisible({
284
+ timeout: 30000,
285
+ });
286
+ if (await deleteMenuItem.isVisible()) {
287
+ // Radix renders the menu at `translate(0, -200%)` until it has
288
+ // positioned it against the trigger (@radix-ui/react-popper). When
289
+ // that never happens the item is visible but outside the viewport, and
290
+ // a pointer click retried for the full 30s without landing. Enter on
291
+ // the item is the same selection: Radix's MenuItem turns it into a
292
+ // click.
293
+ await deleteMenuItem.press('Enter', { timeout: 30000 });
230
294
  }
295
+ await (0, test_1.expect)(this.dialog).toBeVisible({ timeout: 60000 });
296
+ await (0, test_1.expect)(confirmInput.first()).toBeVisible({ timeout: 60000 });
297
+ await confirmInput.first().fill('DELETE', { timeout: 60000 });
298
+ await this.dangerDeleteButton.last().click({ timeout: 60000 });
299
+ // When a concurrent worker already deleted this same cluster, the modal
300
+ // stays open with "We're having trouble deleting the cluster". Close it;
301
+ // the row check below still fails if the cluster was not removed.
302
+ const deleteError = this.dialog.getByText("We're having trouble deleting the cluster");
303
+ // The alert only renders once the delete request fails, so wait for the
304
+ // modal to either close or show it rather than probing once.
305
+ await (0, test_1.expect)(async () => {
306
+ const closed = !(await this.dialog.isVisible());
307
+ (0, test_1.expect)(closed || (await deleteError.isVisible())).toBe(true);
308
+ }).toPass({ timeout: 60000 });
309
+ if (await deleteError.isVisible()) {
310
+ await this.dialog.getByRole('button', { name: 'Cancel' }).click();
311
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
312
+ await this.clustersList.getByRole('link').first().waitFor({
313
+ timeout: 120000,
314
+ });
315
+ }
316
+ await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 60000 });
317
+ // Wait until the deleted row is gone or flagged as deleting. The table
318
+ // is paginated, so the row count alone does not drop: the next page's
319
+ // rows slide in to fill the gap.
320
+ await (0, test_1.expect)(this.clustersList
321
+ .filter({ has: this.page.locator(`a[href="${clusterHref}"]`) })
322
+ .filter({ hasNotText: /Deleting/ })).toHaveCount(0, { timeout: 60000 });
231
323
  }
232
- await this.page.waitForTimeout(500);
233
324
  }
234
325
  async clickClusterTab() {
235
326
  await Promise.race([
@@ -248,11 +339,74 @@ class ClusterPage {
248
339
  },
249
340
  });
250
341
  }
342
+ /**
343
+ * No recovery between attempts, deliberately.
344
+ *
345
+ * clickLocatorWithRetry used to run clickClusterBanner() here, which
346
+ * navigates to the cluster list. That cannot help on either form this is
347
+ * reached from, because the retry loop retries only the click and never
348
+ * reopens the form it navigated away from:
349
+ *
350
+ * - the duplication form is reached from a cluster's overflow menu, so
351
+ * the list is a different page and the input is gone (DUP-01, run
352
+ * 41840910661);
353
+ * - createCluster() opens the create form once before awaiting this, so
354
+ * the list is a different page there too (DUP-02, run 41988552631).
355
+ *
356
+ * Both failed as "Failed to click locator getByPlaceholder('Enter a name
357
+ * for the cluster') after 3 attempts": one recoverable slow render, then
358
+ * two attempts that could not succeed. Retrying in place costs the same
359
+ * time and can actually find the input.
360
+ */
251
361
  async clickClusterNameInput() {
252
- await (0, clickLocatorWithRetry_1.clickLocatorWithRetry)(this.page, this.clusterNameInput, {
253
- postAction: async () => {
362
+ await (0, clickLocatorWithRetry_1.clickLocatorWithRetry)(this.page, this.clusterNameInput);
363
+ }
364
+ /**
365
+ * Runs `open` until the cluster form's name input is on screen and stays
366
+ * there. A Console refetch can re-render the page right after the form
367
+ * opens and drop it again (DUP-02/DUP-06, run 44125578620: the snapshot
368
+ * shows the clusters list, no form), and clicking the input in place
369
+ * cannot bring the form back, so the opener itself is retried.
370
+ */
371
+ async openClusterForm(open) {
372
+ const maxOpens = 4;
373
+ for (let attempt = 1; attempt <= maxOpens; attempt++) {
374
+ await open();
375
+ const shown = await this.clusterNameInput
376
+ .waitFor({ state: 'visible', timeout: 30000 })
377
+ .then(() => true, () => false);
378
+ const vanished = shown &&
379
+ (await this.clusterNameInput
380
+ .waitFor({ state: 'hidden', timeout: 5000 })
381
+ .then(() => true, () => false));
382
+ if (shown && !vanished) {
383
+ return;
384
+ }
385
+ console.warn(`openClusterForm: cluster name input ${shown ? 'closed on its own' : 'never appeared'} (open ${attempt}/${maxOpens}); reopening`);
386
+ }
387
+ throw new Error(`Cluster form did not stay open after ${maxOpens} opens`);
388
+ }
389
+ /**
390
+ * Opens the duplication form of `sourceClusterName` from its details page.
391
+ * When the details page is gone (the form dropped back to the list), it is
392
+ * reached again first; `onDetailsPage` runs once it has loaded.
393
+ */
394
+ async openDuplicateClusterForm(sourceClusterName, onDetailsPage = async () => { }) {
395
+ const clusterOperations = this.page.getByRole('button', {
396
+ name: 'cluster operations',
397
+ });
398
+ const duplicateAction = this.page
399
+ .getByRole('menuitem', { name: /duplicate/i })
400
+ .or(this.page.getByRole('button', { name: /duplicate/i }));
401
+ await this.openClusterForm(async () => {
402
+ if (!(await clusterOperations.isVisible())) {
254
403
  await this.clickClusterBanner();
255
- },
404
+ await this.clickClusterLink(sourceClusterName);
405
+ await onDetailsPage();
406
+ }
407
+ await clusterOperations.click({ timeout: 30000 });
408
+ await (0, test_1.expect)(duplicateAction).toBeVisible({ timeout: 30000 });
409
+ await duplicateAction.click();
256
410
  });
257
411
  }
258
412
  // The Console's "Select cloud provider" radiogroup now names its options
@@ -283,18 +437,19 @@ class ClusterPage {
283
437
  console.warn(`⚠️ Could not extract cluster info for "${clusterName}": ${error}`);
284
438
  }
285
439
  }
286
- async createCluster(name, region = 'GCP', tasklistV1Api) {
440
+ async createCluster(name, region = 'GCP', tasklistV1Api, subRegion) {
287
441
  await this.clickClusterTab();
288
442
  await this.deleteCluster(name);
289
- await this.clickCreateNewClusterButton();
443
+ await this.openClusterForm(() => this.clickCreateNewClusterButton());
290
444
  await this.clickClusterNameInput();
291
445
  await this.fillClusterNameInput(name);
292
446
  await this.clickClusterType();
293
447
  await this.cloudProviderOption(region).click();
294
- await this.selectSubRegion(region);
448
+ await this.selectSubRegion(region, subRegion);
295
449
  await this.clickClusterOption();
296
450
  await this.determineTasklistAPI(tasklistV1Api);
297
451
  await this.clickCreateClusterButton();
452
+ await this.assertClusterFormSubmitted(name);
298
453
  await this.logClusterCreationInfo(name);
299
454
  await this.clickClustersBreadcrumb(name);
300
455
  }
@@ -319,6 +474,26 @@ class ClusterPage {
319
474
  async clickCreateClusterButton() {
320
475
  await this.createClusterButton.click();
321
476
  }
477
+ /**
478
+ * Fails at the submit when the create form is still open a minute later,
479
+ * with the form's own error text, instead of letting clickClustersBreadcrumb
480
+ * wait out 90s for a row that was never created.
481
+ */
482
+ async assertClusterFormSubmitted(name) {
483
+ const closed = await this.clusterNameInput
484
+ .waitFor({ state: 'hidden', timeout: 60000 })
485
+ .then(() => true, () => false);
486
+ if (closed) {
487
+ return;
488
+ }
489
+ const formErrors = await this.page
490
+ .getByRole('alert')
491
+ .or(this.page.locator('.cds--form-requirement'))
492
+ .allInnerTexts()
493
+ .catch(() => []);
494
+ const detail = formErrors.map((text) => text.trim()).filter(Boolean);
495
+ throw new Error(`Create cluster form for "${name}" was still open 60s after submit: ${detail.length > 0 ? detail.join(' | ') : 'no form error shown'}`);
496
+ }
322
497
  async clickClustersBreadcrumb(clusterName) {
323
498
  // Scope the status check to the cluster's own row instead of matching the
324
499
  // status text anywhere on the page: a page-wide `getByText` regex also
@@ -618,7 +793,29 @@ class ClusterPage {
618
793
  async clickQAGenerationsTab() {
619
794
  await this.qaGenerationsTab.click();
620
795
  }
621
- async selectSubRegion(region) {
796
+ async selectSubRegion(region, subRegion) {
797
+ // An explicit sub-region makes the choice reproducible. The default below
798
+ // picks at random, which is right for a test that only needs *a* cluster
799
+ // but wrong for one that has to know which region the cluster is in --
800
+ // console-cluster-duplication asserts that an overridden region beat the
801
+ // carried-over one, and a random source region can collide with the
802
+ // override and make that assertion vacuous.
803
+ if (subRegion) {
804
+ const known = {
805
+ Belgium: this.belgiumRegion,
806
+ Finland: this.finlandRegion,
807
+ London: this.londonRegion,
808
+ Ohio: this.ohioRegion,
809
+ };
810
+ const locator = known[subRegion];
811
+ if (!locator) {
812
+ throw new Error(`Unknown sub-region "${subRegion}". Known: ${Object.keys(known).join(', ')}`);
813
+ }
814
+ console.log(`Selected region: ${subRegion}`);
815
+ await (0, test_1.expect)(locator).toBeVisible({ timeout: 20000 });
816
+ await locator.click();
817
+ return;
818
+ }
622
819
  if (region === 'GCP') {
623
820
  if (process.env.IS_PROD == 'true') {
624
821
  await (0, test_1.expect)(this.londonRegion).toBeVisible({ timeout: 20000 });
@@ -2,13 +2,13 @@ import { Page, Locator } from '@playwright/test';
2
2
  export declare class OCIdentityClusterVariablesPage {
3
3
  private page;
4
4
  readonly variablesList: Locator;
5
- readonly editVariableButton: (variableName: string) => Locator;
5
+ readonly editVariableButton: (variableName: string, scope?: string) => Locator;
6
6
  readonly editVariableModal: Locator;
7
7
  readonly variableValueField: Locator;
8
8
  readonly saveVariableButton: Locator;
9
9
  readonly closeEditVariableModal: Locator;
10
10
  readonly cancelButton: Locator;
11
- readonly variableRow: (variableName: string) => Locator;
11
+ readonly variableRow: (variableName: string, scope?: string) => Locator;
12
12
  readonly monacoEditor: Locator;
13
13
  readonly monacoEditorTextArea: Locator;
14
14
  readonly monacoSuggestWidget: Locator;
@@ -16,7 +16,7 @@ export declare class OCIdentityClusterVariablesPage {
16
16
  readonly editMenuItem: Locator;
17
17
  readonly editModalHeading: Locator;
18
18
  constructor(page: Page);
19
- editVariable(variableName: string, newValue: string): Promise<void>;
20
- assertVariableExists(variableName: string): Promise<void>;
21
- assertVariableValue(variableName: string, expectedValue: string): Promise<void>;
19
+ editVariable(variableName: string, newValue: string, scope?: string): Promise<void>;
20
+ assertVariableExists(variableName: string, scope?: string): Promise<void>;
21
+ assertVariableValue(variableName: string, expectedValue: string, scope?: string): Promise<void>;
22
22
  }
@@ -29,13 +29,21 @@ class OCIdentityClusterVariablesPage {
29
29
  // ListV2 and still render Carbon, so the locators that differ between the
30
30
  // two DOMs accept either.
31
31
  this.variablesList = page.locator('table.cds--data-table, table[data-slot="table"]');
32
- this.variableRow = (variableName) => this.variablesList
33
- .locator('tbody')
34
- .getByRole('row')
35
- .filter({ hasText: variableName });
32
+ this.variableRow = (variableName, scope) => {
33
+ const rows = this.variablesList
34
+ .locator('tbody')
35
+ .getByRole('row')
36
+ .filter({ hasText: variableName });
37
+ if (!scope) {
38
+ return rows;
39
+ }
40
+ return rows.filter({
41
+ has: page.getByRole('cell', { name: `Tenant: ${scope}`, exact: true }),
42
+ });
43
+ };
36
44
  // Carbon's OverflowMenu labels its trigger "Options"; the design-system
37
45
  // DataTable labels it "Row actions".
38
- this.editVariableButton = (variableName) => this.variableRow(variableName).getByRole('button', {
46
+ this.editVariableButton = (variableName, scope) => this.variableRow(variableName, scope).getByRole('button', {
39
47
  name: /^(Options|Row actions)$/,
40
48
  });
41
49
  this.editVariableModal = page.getByRole('dialog', {
@@ -69,8 +77,8 @@ class OCIdentityClusterVariablesPage {
69
77
  exact: true,
70
78
  });
71
79
  }
72
- async editVariable(variableName, newValue) {
73
- await this.editVariableButton(variableName).click();
80
+ async editVariable(variableName, newValue, scope) {
81
+ await this.editVariableButton(variableName, scope).click();
74
82
  await (0, test_1.expect)(this.editMenuItem).toBeVisible();
75
83
  await this.editMenuItem.click();
76
84
  // Firefox renders Monaco's input as a zero-height textarea, which
@@ -111,11 +119,11 @@ class OCIdentityClusterVariablesPage {
111
119
  await (0, test_1.expect)(this.successMessage).toBeVisible();
112
120
  await (0, test_1.expect)(this.editVariableModal).toBeHidden();
113
121
  }
114
- async assertVariableExists(variableName) {
115
- await (0, test_1.expect)(this.variableRow(variableName)).toBeVisible();
122
+ async assertVariableExists(variableName, scope) {
123
+ await (0, test_1.expect)(this.variableRow(variableName, scope)).toBeVisible();
116
124
  }
117
- async assertVariableValue(variableName, expectedValue) {
118
- const row = this.variableRow(variableName);
125
+ async assertVariableValue(variableName, expectedValue, scope) {
126
+ const row = this.variableRow(variableName, scope);
119
127
  await (0, test_1.expect)(row).toContainText(expectedValue);
120
128
  }
121
129
  }
@@ -14,7 +14,7 @@ declare class TaskPanelPage {
14
14
  readonly licenseKeyTagNonProduction: Locator;
15
15
  readonly licenseKeyTagProduction: Locator;
16
16
  constructor(page: Page);
17
- openTask(name: string, assignButton?: boolean): Promise<void>;
17
+ openTask(name: string, assignButton?: boolean, fallbackName?: string): Promise<void>;
18
18
  filterBy(option: 'All open' | 'Unassigned' | 'Assigned to me' | 'Completed'): Promise<void>;
19
19
  private openFilterControls;
20
20
  private static appliedFilterUrl;
@@ -79,17 +79,18 @@ class TaskPanelPage {
79
79
  exact: true,
80
80
  });
81
81
  }
82
- async openTask(name, assignButton = true) {
82
+ async openTask(name, assignButton = true, fallbackName) {
83
83
  const maxAttempts = 10;
84
+ const taskByName = this.availableTasks.getByText(name, { exact: true });
85
+ const taskLocator = fallbackName
86
+ ? taskByName.or(this.availableTasks.getByText(fallbackName, { exact: true }))
87
+ : taskByName;
84
88
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
85
89
  try {
86
90
  // Removed waitForLoadState('networkidle') — Tasklist polls
87
91
  // continuously, so networkidle never fires; the click below
88
92
  // already has a 4s timeout that auto-waits for the locator.
89
- await this.availableTasks
90
- .getByText(name, { exact: true })
91
- .nth(0)
92
- .click({ timeout: constants_1._1_SECOND_IN_MS * 4 });
93
+ await taskLocator.nth(0).click({ timeout: constants_1._1_SECOND_IN_MS * 4 });
93
94
  if (assignButton) {
94
95
  await (0, test_1.expect)(this.assignToMeButton).toBeVisible({
95
96
  timeout: constants_1._1_SECOND_IN_MS * 10,
@@ -2,13 +2,13 @@ import { Page, Locator } from '@playwright/test';
2
2
  export declare class OCIdentityClusterVariablesPage {
3
3
  private page;
4
4
  readonly variablesList: Locator;
5
- readonly editVariableButton: (variableName: string) => Locator;
5
+ readonly editVariableButton: (variableName: string, scope?: string) => Locator;
6
6
  readonly editVariableModal: Locator;
7
7
  readonly variableValueField: Locator;
8
8
  readonly saveVariableButton: Locator;
9
9
  readonly closeEditVariableModal: Locator;
10
10
  readonly cancelButton: Locator;
11
- readonly variableRow: (variableName: string) => Locator;
11
+ readonly variableRow: (variableName: string, scope?: string) => Locator;
12
12
  readonly monacoEditor: Locator;
13
13
  readonly monacoEditorTextArea: Locator;
14
14
  readonly monacoSuggestWidget: Locator;
@@ -16,7 +16,7 @@ export declare class OCIdentityClusterVariablesPage {
16
16
  readonly editMenuItem: Locator;
17
17
  readonly editModalHeading: Locator;
18
18
  constructor(page: Page);
19
- editVariable(variableName: string, newValue: string): Promise<void>;
20
- assertVariableExists(variableName: string): Promise<void>;
21
- assertVariableValue(variableName: string, expectedValue: string): Promise<void>;
19
+ editVariable(variableName: string, newValue: string, scope?: string): Promise<void>;
20
+ assertVariableExists(variableName: string, scope?: string): Promise<void>;
21
+ assertVariableValue(variableName: string, expectedValue: string, scope?: string): Promise<void>;
22
22
  }