@camunda/e2e-test-suite 0.0.1676 → 0.0.1677

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.
@@ -98,7 +98,13 @@ declare class ClusterDetailsPage {
98
98
  createAPIClientAndReturnVariables(name: string, setEnvVariables?: boolean, clusterType?: string): Promise<{
99
99
  [key: string]: string;
100
100
  }>;
101
- createAPIClient(name: string): Promise<void>;
101
+ /**
102
+ * Returns the name the client was really created with, which is `name`
103
+ * unless an attempt failed and the retry suffixed it. A caller that
104
+ * asserts against the requested name instead would miss the client on
105
+ * every retried create.
106
+ */
107
+ createAPIClient(name: string): Promise<string>;
102
108
  clickEnvVarsButton(): Promise<void>;
103
109
  clientCredentialsText(regex: RegExp): Promise<string>;
104
110
  checkTasklistCheckbox(): Promise<void>;
@@ -807,6 +807,12 @@ class ClusterDetailsPage {
807
807
  }
808
808
  return variables;
809
809
  }
810
+ /**
811
+ * Returns the name the client was really created with, which is `name`
812
+ * unless an attempt failed and the retry suffixed it. A caller that
813
+ * asserts against the requested name instead would miss the client on
814
+ * every retried create.
815
+ */
810
816
  async createAPIClient(name) {
811
817
  const maxRetries = 3;
812
818
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -862,7 +868,7 @@ class ClusterDetailsPage {
862
868
  // round the retry loop, which both left orphan clients behind and
863
869
  // discarded the credentials the caller has yet to read.
864
870
  this.pendingClientScopeCheck = attemptName;
865
- return;
871
+ return attemptName;
866
872
  }
867
873
  catch (error) {
868
874
  if (attempt < maxRetries - 1) {
@@ -885,6 +891,9 @@ class ClusterDetailsPage {
885
891
  }
886
892
  }
887
893
  }
894
+ // Unreachable: every iteration returns or throws. Stated so the compiler
895
+ // can see the function never falls out of the loop without a name.
896
+ throw new Error(`Creating API client "${name}" exhausted ${maxRetries} attempts without a result`);
888
897
  }
889
898
  async clickEnvVarsButton() {
890
899
  await (0, test_1.expect)(this.envVarsTab).toBeVisible({ timeout: 40000 });
@@ -56,31 +56,25 @@ declare class ClusterPage {
56
56
  clickClusterTab(): Promise<void>;
57
57
  clickCreateNewClusterButton(): Promise<void>;
58
58
  /**
59
- * `recoverViaClusterList` decides what happens after a failed click:
60
- * clickLocatorWithRetry runs it as the recovery between attempts, and it
61
- * navigates to the cluster list.
59
+ * No recovery between attempts, deliberately.
62
60
  *
63
- * On the duplication form that is fatal. The form is reached from a
64
- * cluster's own overflow menu, so navigating away abandons it: the name
65
- * input no longer exists, and attempts 2 and 3 cannot find it however long
66
- * they wait. One recoverable slow render therefore became "Failed to click
67
- * locator getByPlaceholder('Enter a name for the cluster') after 3
68
- * attempts" — which is why DUP-01 failed on a run where the same form
69
- * worked for DUP-04 minutes earlier.
61
+ * clickLocatorWithRetry used to run clickClusterBanner() here, which
62
+ * navigates to the cluster list. That cannot help on either form this is
63
+ * reached from, because the retry loop retries only the click and never
64
+ * reopens the form it navigated away from:
70
65
  *
71
- * The default is true to preserve existing behaviour, NOT because the
72
- * recovery works on the create-cluster form. It does not: createCluster()
73
- * opens that form once before awaiting this helper, and the retry loop
74
- * never reopens it, so returning to the list strands those attempts the
75
- * same way. It is simply rarely reached there — the create form renders
76
- * synchronously after its button click, where the duplication form waits
77
- * on a menu and a navigation. Turning it off for every caller is the real
78
- * fix and belongs in its own change, with a run behind it: createCluster()
79
- * is on the critical path of every spec in this suite.
66
+ * - the duplication form is reached from a cluster's overflow menu, so
67
+ * the list is a different page and the input is gone (DUP-01, run
68
+ * 41840910661);
69
+ * - createCluster() opens the create form once before awaiting this, so
70
+ * the list is a different page there too (DUP-02, run 41988552631).
71
+ *
72
+ * Both failed as "Failed to click locator getByPlaceholder('Enter a name
73
+ * for the cluster') after 3 attempts": one recoverable slow render, then
74
+ * two attempts that could not succeed. Retrying in place costs the same
75
+ * time and can actually find the input.
80
76
  */
81
- clickClusterNameInput(options?: {
82
- recoverViaClusterList?: boolean;
83
- }): Promise<void>;
77
+ clickClusterNameInput(): Promise<void>;
84
78
  cloudProviderOption(region: string): Locator;
85
79
  fillClusterNameInput(name: string): Promise<void>;
86
80
  private extractClusterIdFromUrl;
@@ -364,39 +364,26 @@ class ClusterPage {
364
364
  });
365
365
  }
366
366
  /**
367
- * `recoverViaClusterList` decides what happens after a failed click:
368
- * clickLocatorWithRetry runs it as the recovery between attempts, and it
369
- * navigates to the cluster list.
367
+ * No recovery between attempts, deliberately.
370
368
  *
371
- * On the duplication form that is fatal. The form is reached from a
372
- * cluster's own overflow menu, so navigating away abandons it: the name
373
- * input no longer exists, and attempts 2 and 3 cannot find it however long
374
- * they wait. One recoverable slow render therefore became "Failed to click
375
- * locator getByPlaceholder('Enter a name for the cluster') after 3
376
- * attempts" — which is why DUP-01 failed on a run where the same form
377
- * worked for DUP-04 minutes earlier.
369
+ * clickLocatorWithRetry used to run clickClusterBanner() here, which
370
+ * navigates to the cluster list. That cannot help on either form this is
371
+ * reached from, because the retry loop retries only the click and never
372
+ * reopens the form it navigated away from:
378
373
  *
379
- * The default is true to preserve existing behaviour, NOT because the
380
- * recovery works on the create-cluster form. It does not: createCluster()
381
- * opens that form once before awaiting this helper, and the retry loop
382
- * never reopens it, so returning to the list strands those attempts the
383
- * same way. It is simply rarely reached there — the create form renders
384
- * synchronously after its button click, where the duplication form waits
385
- * on a menu and a navigation. Turning it off for every caller is the real
386
- * fix and belongs in its own change, with a run behind it: createCluster()
387
- * is on the critical path of every spec in this suite.
374
+ * - the duplication form is reached from a cluster's overflow menu, so
375
+ * the list is a different page and the input is gone (DUP-01, run
376
+ * 41840910661);
377
+ * - createCluster() opens the create form once before awaiting this, so
378
+ * the list is a different page there too (DUP-02, run 41988552631).
379
+ *
380
+ * Both failed as "Failed to click locator getByPlaceholder('Enter a name
381
+ * for the cluster') after 3 attempts": one recoverable slow render, then
382
+ * two attempts that could not succeed. Retrying in place costs the same
383
+ * time and can actually find the input.
388
384
  */
389
- async clickClusterNameInput(options = {}) {
390
- const { recoverViaClusterList = true } = options;
391
- await (0, clickLocatorWithRetry_1.clickLocatorWithRetry)(this.page, this.clusterNameInput, {
392
- ...(recoverViaClusterList
393
- ? {
394
- postAction: async () => {
395
- await this.clickClusterBanner();
396
- },
397
- }
398
- : {}),
399
- });
385
+ async clickClusterNameInput() {
386
+ await (0, clickLocatorWithRetry_1.clickLocatorWithRetry)(this.page, this.clusterNameInput);
400
387
  }
401
388
  // The Console's "Select cloud provider" radiogroup now names its options
402
389
  // by the provider's full name with the short code in parentheses ("Google
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_1 = require("@playwright/test");
4
+ const _8_10_1 = require("../../fixtures/8.10");
5
+ const _setup_1 = require("../../test-setup.js");
6
+ const UtilitiesPage_1 = require("../../pages/8.10/UtilitiesPage");
7
+ const users_1 = require("../../utils/users");
8
+ const testUser = (0, users_1.getTestUser)('mainUser');
9
+ /**
10
+ * Epic: camunda/product-hub#3824 - Console cluster duplication.
11
+ *
12
+ * Preconditions:
13
+ * - feature flag `console.clusterDuplication` is enabled for the organization
14
+ * - environment: saas-preprod
15
+ * - the test user is an organization admin
16
+ *
17
+ * API client carry-over. Split from the main duplication spec because these
18
+ * cases need an API client on the source cluster, which costs a second create
19
+ * and a second health wait on top of the two clusters every case here already
20
+ * builds.
21
+ *
22
+ * Surface. The plan called DUP-06 an API case on the grounds that a client's
23
+ * id and secret are rendered nowhere a UI test can read them. That is true of
24
+ * the id and the secret - DUP-07's subject - but not of what DUP-06 asserts.
25
+ * The clients table renders a client's name and its scopes, and this suite
26
+ * already reads both: assertAPIClientScopes() filters clientsList by name and
27
+ * matches the row's scopes. So DUP-06 is asserted through the UI, against the
28
+ * cluster duplication really created.
29
+ *
30
+ * Isolation: every case creates its own source cluster with a randomised name
31
+ * and deletes every cluster it created in teardown - a leaked cluster consumes
32
+ * a reservation and would make the reservation cases pass for the wrong reason.
33
+ */
34
+ _8_10_1.test.describe.configure({ mode: 'serial' });
35
+ _8_10_1.test.describe('Console cluster duplication - API client carry-over', () => {
36
+ // Everything this spec creates is tracked here so teardown runs even on failure.
37
+ const createdClusterNames = [];
38
+ _8_10_1.test.beforeEach(async ({ page, loginPage, homePage }, testInfo) => {
39
+ await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
40
+ await homePage.clickClusters();
41
+ });
42
+ _8_10_1.test.afterEach(async ({ page, loginPage, homePage, clusterPage }, testInfo) => {
43
+ await (0, _setup_1.captureScreenshot)(page, testInfo);
44
+ // Postcondition: no cluster left behind, source or duplicate.
45
+ const namesToDelete = [...createdClusterNames].reverse();
46
+ createdClusterNames.length = 0;
47
+ // A body that failed because the Hub session dropped ends on the identity
48
+ // provider's login form, where clickClusters() finds no navigation and
49
+ // every cluster below would leak.
50
+ if (namesToDelete.length > 0 &&
51
+ /^(weblogin|login|auth)\./.test(new URL(page.url()).host)) {
52
+ await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, 0, 3);
53
+ }
54
+ const undeleted = [];
55
+ for (const clusterName of namesToDelete) {
56
+ try {
57
+ await homePage.clickClusters();
58
+ await clusterPage.deleteCluster(clusterName);
59
+ }
60
+ catch (error) {
61
+ // Collect rather than throw: one cluster that will not delete must
62
+ // not stop the others being deleted.
63
+ undeleted.push(`${clusterName} (${String(error)})`);
64
+ }
65
+ }
66
+ test_1.expect.soft(undeleted, 'Teardown left clusters behind').toEqual([]);
67
+ // Last: captureFailureVideo closes the page to flush the video, so every
68
+ // deletion above would run against a closed page and leak its cluster.
69
+ await (0, _setup_1.captureFailureVideo)(page, testInfo);
70
+ });
71
+ // DUP-06. The claim is about the duplicate the product created, so the
72
+ // client is read off that cluster's own API tab - never off the duplication
73
+ // form, which only carries the test's own input.
74
+ (0, _8_10_1.test)('DUP-06: each API client carries over with its name and permissions', async ({ page, homePage, clusterPage, clusterDetailsPage, }) => {
75
+ // Two cluster creations plus health polling - this case is long by nature.
76
+ _8_10_1.test.setTimeout(60 * 60 * 1000);
77
+ const randomSuffix = await (0, _setup_1.generateRandomStringAsync)(6);
78
+ const sourceClusterName = `dup06-src-${randomSuffix}`;
79
+ const duplicateClusterName = `dup06-copy-${randomSuffix}`;
80
+ const apiClientName = `dup06-client-${randomSuffix}`;
81
+ let createdClientName = apiClientName;
82
+ await _8_10_1.test.step('given a healthy source cluster carrying a named API client', async () => {
83
+ await clusterPage.clickClusterTab();
84
+ createdClusterNames.push(sourceClusterName);
85
+ await clusterPage.createCluster(sourceClusterName);
86
+ await clusterPage.assertClusterHealthyStatusWithRetry(sourceClusterName);
87
+ await homePage.clickClusters();
88
+ await clusterPage.clickClusterLink(sourceClusterName);
89
+ await clusterDetailsPage.dismissOopsIfPresent();
90
+ await clusterDetailsPage.clickAPITab();
91
+ // The name the client is really created with: createAPIClient() suffixes
92
+ // it when an attempt failed, and asserting the requested name instead
93
+ // would miss the client on every retried create.
94
+ createdClientName =
95
+ await clusterDetailsPage.createAPIClient(apiClientName);
96
+ // The source really holds the client before anything is duplicated.
97
+ // Without this, a missing client on the duplicate below would be
98
+ // indistinguishable from one that was never created at all.
99
+ //
100
+ // clickCloseModalButton() rather than assertAPIClientScopes() directly:
101
+ // the credentials modal is still open here, and createAPIClient() says
102
+ // why the list behind it cannot answer the scope check -- it can still
103
+ // be rendering its pre-create state, and the modal blocks the pointer
104
+ // events a reload would need. Closing it runs the same check.
105
+ await clusterDetailsPage.clickCloseModalButton();
106
+ });
107
+ await _8_10_1.test.step('when I duplicate that cluster, changing only its name', async () => {
108
+ await homePage.clickClusters();
109
+ await clusterPage.clickClusterLink(sourceClusterName);
110
+ await clusterDetailsPage.dismissOopsIfPresent();
111
+ await (0, UtilitiesPage_1.waitForLoadingToFinish)(page);
112
+ await page.getByRole('button', { name: 'cluster operations' }).click();
113
+ const duplicateAction = page
114
+ .getByRole('menuitem', { name: /duplicate/i })
115
+ .or(page.getByRole('button', { name: /duplicate/i }));
116
+ await (0, test_1.expect)(duplicateAction).toBeVisible({ timeout: 30000 });
117
+ await duplicateAction.click();
118
+ await clusterPage.clickClusterNameInput();
119
+ await clusterPage.fillClusterNameInput(duplicateClusterName);
120
+ createdClusterNames.push(duplicateClusterName);
121
+ const submitDuplicate = page.getByRole('button', {
122
+ name: 'Duplicate cluster',
123
+ exact: true,
124
+ });
125
+ await (0, test_1.expect)(submitDuplicate).toBeEnabled({ timeout: 30000 });
126
+ // Same as DUP-01/DUP-02/DUP-04: hold the page until the duplicate POST
127
+ // has answered, otherwise navigating away aborts the in-flight request.
128
+ const duplicateResponse = page.waitForResponse((response) => response.request().method() === 'POST' &&
129
+ /\/clusters\/[^/]+\/duplicate$/.test(new URL(response.url()).pathname), { timeout: 60000 });
130
+ await submitDuplicate.click();
131
+ const duplicate = await duplicateResponse;
132
+ (0, test_1.expect)(duplicate.ok()).toBe(true);
133
+ const { clusterId } = await duplicate.json();
134
+ await page.waitForURL(new RegExp(`/cluster/${clusterId}`), {
135
+ timeout: 60000,
136
+ });
137
+ });
138
+ await _8_10_1.test.step('then the duplicate comes up healthy', async () => {
139
+ await homePage.clickClusters();
140
+ await (0, UtilitiesPage_1.waitForLoadingToFinish)(page);
141
+ // Completion rule: a client read off a cluster that never started would
142
+ // say nothing about carry-over, so health is asserted before it.
143
+ await clusterPage.assertClusterHealthyStatusWithRetry(duplicateClusterName);
144
+ });
145
+ await _8_10_1.test.step('and the API client of the source is on the duplicate, with its name and permissions', async () => {
146
+ await homePage.clickClusters();
147
+ await clusterPage.clickClusterLink(duplicateClusterName);
148
+ await clusterDetailsPage.dismissOopsIfPresent();
149
+ await clusterDetailsPage.clickAPITab();
150
+ // Scoped to the duplicate's own API tab, and to the name the source's
151
+ // client was really created with. assertAPIClientScopes filters the
152
+ // clients table down to that name and matches the row's scopes.
153
+ await clusterDetailsPage.assertAPIClientScopes(createdClientName);
154
+ });
155
+ });
156
+ });
@@ -124,11 +124,7 @@ _8_10_1.test.describe('Console cluster duplication', () => {
124
124
  await duplicateAction.click();
125
125
  // The pre-fill itself is covered a layer down (DUP-03); here we only rename
126
126
  // the duplicate so it is uniquely identifiable and deletable.
127
- // No cluster-list recovery here: this form is reached from the
128
- // cluster's overflow menu, so navigating away abandons it.
129
- await clusterPage.clickClusterNameInput({
130
- recoverViaClusterList: false,
131
- });
127
+ await clusterPage.clickClusterNameInput();
132
128
  await clusterPage.fillClusterNameInput(duplicateClusterName);
133
129
  createdClusterNames.push(duplicateClusterName);
134
130
  // Duplicate opens a "Duplicate a cluster" page (not a dialog) that submits
@@ -209,11 +205,7 @@ _8_10_1.test.describe('Console cluster duplication', () => {
209
205
  await duplicateAction.click();
210
206
  // Every editable field of the duplication form, changed away from the
211
207
  // value the form carried over from the source cluster.
212
- // No cluster-list recovery here: this form is reached from the
213
- // cluster's overflow menu, so navigating away abandons it.
214
- await clusterPage.clickClusterNameInput({
215
- recoverViaClusterList: false,
216
- });
208
+ await clusterPage.clickClusterNameInput();
217
209
  await clusterPage.fillClusterNameInput(duplicateClusterName);
218
210
  // clickGCPRegion only acts when REGION_SELECTION is set, so the tile
219
211
  // click below is what actually moves the region either way.
@@ -441,11 +433,7 @@ _8_10_1.test.describe('Console cluster duplication', () => {
441
433
  await (0, test_1.expect)(submitDuplicate).toBeVisible({ timeout: 30000 });
442
434
  });
443
435
  await _8_10_1.test.step('and submitting that form creates a duplicate that reaches a healthy running state', async () => {
444
- // No cluster-list recovery here: this form is reached from the
445
- // cluster's overflow menu, so navigating away abandons it.
446
- await clusterPage.clickClusterNameInput({
447
- recoverViaClusterList: false,
448
- });
436
+ await clusterPage.clickClusterNameInput();
449
437
  await clusterPage.fillClusterNameInput(duplicateClusterName);
450
438
  createdClusterNames.push(duplicateClusterName);
451
439
  const submitDuplicate = page.getByRole('button', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1676",
3
+ "version": "0.0.1677",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",