@camunda/e2e-test-suite 0.0.1789 → 0.0.1790

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.
@@ -11,6 +11,7 @@ const connectorSecrets_1 = require("../../utils/connectorSecrets");
11
11
  const mcpSecrets_1 = require("../../utils/mcpSecrets");
12
12
  const UtilitiesPage_1 = require("../../pages/8.10/UtilitiesPage");
13
13
  const users_1 = require("../../utils/users");
14
+ const prodClusterCleanup_1 = require("../../utils/prodClusterCleanup");
14
15
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
15
16
  _8_10_1.test.describe.configure({ mode: 'parallel' });
16
17
  _8_10_1.test.describe('Cluster Setup Tests', () => {
@@ -41,6 +42,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
41
42
  const apiClientName = 'Test_API_Client' + (await (0, _setup_1.generateRandomStringAsync)(3));
42
43
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, users_1.testUsers.mainUser, (testInfo.workerIndex + 1) * 1000);
43
44
  if (process.env.IS_PROD === 'true') {
45
+ await (0, prodClusterCleanup_1.assertProdClusterSlotsAvailable)(page);
44
46
  await clusterPage.createCluster(clusterName);
45
47
  await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, 120000, 1500000);
46
48
  }
@@ -150,6 +152,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
150
152
  const clusterName = 'AWS Cluster';
151
153
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, users_1.testUsers.mainUser, (testInfo.workerIndex + 1) * 1000);
152
154
  if (process.env.IS_PROD === 'true') {
155
+ await (0, prodClusterCleanup_1.assertProdClusterSlotsAvailable)(page);
153
156
  await clusterPage.createCluster(clusterName, 'AWS');
154
157
  await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, 120000, 1500000);
155
158
  }
@@ -11,6 +11,7 @@ const connectorSecrets_1 = require("../../utils/connectorSecrets");
11
11
  const mcpSecrets_1 = require("../../utils/mcpSecrets");
12
12
  const UtilitiesPage_1 = require("../../pages/8.9/UtilitiesPage");
13
13
  const users_1 = require("../../utils/users");
14
+ const prodClusterCleanup_1 = require("../../utils/prodClusterCleanup");
14
15
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
15
16
  _8_9_1.test.describe.configure({ mode: 'parallel' });
16
17
  _8_9_1.test.describe('Cluster Setup Tests', () => {
@@ -32,6 +33,7 @@ _8_9_1.test.describe('Cluster Setup Tests', () => {
32
33
  const apiClientName = 'Test_API_Client' + (await (0, _setup_1.generateRandomStringAsync)(3));
33
34
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, users_1.testUsers.mainUser, (testInfo.workerIndex + 1) * 1000);
34
35
  if (process.env.IS_PROD === 'true') {
36
+ await (0, prodClusterCleanup_1.assertProdClusterSlotsAvailable)(page);
35
37
  await clusterPage.createCluster(clusterName);
36
38
  await clusterPage.assertClusterHealthyStatusWithRetry(clusterName);
37
39
  }
@@ -115,6 +117,7 @@ _8_9_1.test.describe('Cluster Setup Tests', () => {
115
117
  const clusterName = 'AWS Cluster';
116
118
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, users_1.testUsers.mainUser, (testInfo.workerIndex + 1) * 1000);
117
119
  if (process.env.IS_PROD === 'true') {
120
+ await (0, prodClusterCleanup_1.assertProdClusterSlotsAvailable)(page);
118
121
  await clusterPage.createCluster(clusterName, 'AWS');
119
122
  // AWS clusters on SaaS INT routinely need 10+ min to reach Healthy.
120
123
  await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, 300000, 1500000);
@@ -4,6 +4,10 @@ export declare function observeBearerTokens(page: Page): void;
4
4
  export declare function resetHubBearerToken(page: Page): void;
5
5
  export declare function isRateLimitedPage(page: Page): Promise<boolean>;
6
6
  export declare function waitForRateLimitToClear(page: Page, hubUrl?: string, timeoutMs?: number): Promise<void>;
7
+ export declare function listClustersViaApi(page: Page): Promise<Array<{
8
+ uuid: string;
9
+ name: string;
10
+ }>>;
7
11
  export declare function getClusterUuidByName(page: Page, clusterName: string): Promise<string>;
8
12
  export declare function deleteClusterViaApi(page: Page, clusterName: string): Promise<void>;
9
13
  export declare function createClusterViaApi(page: Page, clusterName: string, region?: string, tasklistV2Enabled?: boolean): Promise<string>;
@@ -13,6 +17,7 @@ export declare function ensureClientAuditLoggingViaApi(page: Page, clusterUuid:
13
17
  export declare function waitForClusterHealthyViaApi(page: Page, clusterUuid: string, timeoutMs?: number): Promise<void>;
14
18
  export declare function waitForClusterRestartHealthyViaApi(page: Page, clusterUuid: string, timeoutMs?: number): Promise<void>;
15
19
  export declare function areAiFeaturesEnabledViaApi(page: Page): Promise<boolean>;
20
+ export declare function getReservedClusterSlotsViaApi(page: Page): Promise<number>;
16
21
  export declare function waitForAiFeaturesEnabledViaApi(page: Page, timeoutMs?: number): Promise<void>;
17
22
  export declare function linkClusterToWorkspaceViaApi(page: Page, workspaceId: string, clusterName: string): Promise<void>;
18
23
  export declare function rememberHubWorkspaceId(page: Page, workspaceId: string): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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.waitForRateLimitToClear = exports.isRateLimitedPage = 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.getReservedClusterSlotsViaApi = exports.areAiFeaturesEnabledViaApi = exports.waitForClusterRestartHealthyViaApi = exports.waitForClusterHealthyViaApi = exports.ensureClientAuditLoggingViaApi = exports.ensureTasklistV2Enabled = exports.ensureClusterViaApi = exports.createClusterViaApi = exports.deleteClusterViaApi = exports.getClusterUuidByName = exports.listClustersViaApi = exports.waitForRateLimitToClear = exports.isRateLimitedPage = 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 jobSummary_1 = require("./jobSummary");
@@ -247,6 +247,10 @@ async function waitForRateLimitToClear(page, hubUrl = page.url(), timeoutMs = 12
247
247
  }
248
248
  exports.waitForRateLimitToClear = waitForRateLimitToClear;
249
249
  async function findClusterByName(page, clusterName) {
250
+ const clusters = await listClustersViaApi(page);
251
+ return clusters.find((c) => c.name === clusterName);
252
+ }
253
+ async function listClustersViaApi(page) {
250
254
  const orgId = getOrgId();
251
255
  const response = await clusterApiRequest(page, 'GET', `${getConsoleBaseUrl()}/api/orgs/${orgId}/clusters`);
252
256
  // Never report "not found" for a lookup that did not actually complete.
@@ -269,11 +273,9 @@ async function findClusterByName(page, clusterName) {
269
273
  throw new Error(`Cluster listing of org ${orgId} was not valid JSON: ` +
270
274
  `${await response.text()}`);
271
275
  }
272
- const clusters = Array.isArray(data)
273
- ? data
274
- : data.clusters ?? [];
275
- return clusters.find((c) => c.name === clusterName);
276
+ return Array.isArray(data) ? data : data.clusters ?? [];
276
277
  }
278
+ exports.listClustersViaApi = listClustersViaApi;
277
279
  async function getClusterUuidByName(page, clusterName) {
278
280
  const cluster = await findClusterByName(page, clusterName);
279
281
  if (!cluster) {
@@ -847,6 +849,19 @@ async function areAiFeaturesEnabledViaApi(page) {
847
849
  (organization.earlyAccessFeatures ?? []).includes(AI_EARLY_ACCESS_FEATURE));
848
850
  }
849
851
  exports.areAiFeaturesEnabledViaApi = areAiFeaturesEnabledViaApi;
852
+ // Total cluster slots the org's sales plan reserves; Console hides its
853
+ // "Create cluster" button once that many clusters exist.
854
+ async function getReservedClusterSlotsViaApi(page) {
855
+ const response = await clusterApiRequest(page, 'GET', `${getAccountsBaseUrl()}/api/organizations/${getOrgId()}`);
856
+ if (!response.ok()) {
857
+ throw new Error(`Failed to read organization info: HTTP ${response.status()} ` +
858
+ `${await response.text()}`);
859
+ }
860
+ const organization = (await response.json());
861
+ const reserved = organization.organizationToSalesPlan?.clusterPlanTypesToReserved ?? {};
862
+ return Object.values(reserved).reduce((sum, n) => sum + n, 0);
863
+ }
864
+ exports.getReservedClusterSlotsViaApi = getReservedClusterSlotsViaApi;
850
865
  // Console reports the opt-in as done before Accounts serves the updated
851
866
  // organization record, so poll rather than reading once.
852
867
  async function waitForAiFeaturesEnabledViaApi(page, timeoutMs = 180000) {
@@ -1,3 +1,4 @@
1
1
  import type { Page } from '@playwright/test';
2
2
  export declare const PROD_SMOKE_CLUSTER_NAMES: string[];
3
3
  export declare function deleteProdSmokeClusters(page: Page): Promise<void>;
4
+ export declare function assertProdClusterSlotsAvailable(page: Page): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteProdSmokeClusters = exports.PROD_SMOKE_CLUSTER_NAMES = void 0;
3
+ exports.assertProdClusterSlotsAvailable = exports.deleteProdSmokeClusters = exports.PROD_SMOKE_CLUSTER_NAMES = void 0;
4
4
  const consoleApiHelpers_1 = require("./consoleApiHelpers");
5
5
  // The only clusters the prod smoke creates (test-setup.spec.ts). The prod org
6
6
  // allows two trial clusters, so leaving these behind blocks the next run's
@@ -16,3 +16,18 @@ async function deleteProdSmokeClusters(page) {
16
16
  }
17
17
  }
18
18
  exports.deleteProdSmokeClusters = deleteProdSmokeClusters;
19
+ // Clusters this suite did not create can only be freed by a person (see
20
+ // above), so fail with their names instead of timing out on a hidden button.
21
+ async function assertProdClusterSlotsAvailable(page) {
22
+ const reserved = await (0, consoleApiHelpers_1.getReservedClusterSlotsViaApi)(page);
23
+ const foreign = (await (0, consoleApiHelpers_1.listClustersViaApi)(page)).filter((c) => !exports.PROD_SMOKE_CLUSTER_NAMES.includes(c.name));
24
+ if (reserved > 0 &&
25
+ foreign.length + exports.PROD_SMOKE_CLUSTER_NAMES.length > reserved) {
26
+ throw new Error(`The prod smoke org reserves ${reserved} cluster slot(s), and ` +
27
+ `${foreign.length} are held by clusters this suite did not create: ` +
28
+ `${foreign.map((c) => `"${c.name}" (${c.uuid})`).join(', ')}. ` +
29
+ `The smoke needs ${exports.PROD_SMOKE_CLUSTER_NAMES.length}; ask their ` +
30
+ `owner to delete them from the org.`);
31
+ }
32
+ }
33
+ exports.assertProdClusterSlotsAvailable = assertProdClusterSlotsAvailable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1789",
3
+ "version": "0.0.1790",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",