@camunda/e2e-test-suite 0.0.231 → 0.0.232

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.
@@ -32,6 +32,7 @@ import { OCIdentityHomePage } from '../pages/8.9/OCIdentityHomePage';
32
32
  import { OCIdentityMappingRulesPage } from '../pages/8.9/OCIdentityMappingRulesPage';
33
33
  import { OCIdentityRolesPage } from '../pages/8.9/OCIdentityRolesPage';
34
34
  import { OCIdentityAuthorizationsPage } from '../pages/8.9/OCIdentityAuthorizationsPage';
35
+ import { OCIdentityClusterVariablesPage } from '../pages/8.9/OCIdentityClusterVariablesPage';
35
36
  import { ClientCredentialsDetailsPage } from '../pages/8.9/ClientCredentialsDetailsPage';
36
37
  type PlaywrightFixtures = {
37
38
  makeAxeBuilder: () => AxeBuilder;
@@ -68,6 +69,7 @@ type PlaywrightFixtures = {
68
69
  ocIdentityMappingRulesPage: OCIdentityMappingRulesPage;
69
70
  ocIdentityRolesPage: OCIdentityRolesPage;
70
71
  ocIdentityAuthorizationsPage: OCIdentityAuthorizationsPage;
72
+ ocIdentityClusterVariablesPage: OCIdentityClusterVariablesPage;
71
73
  clientCredentialsDetailsPage: ClientCredentialsDetailsPage;
72
74
  overrideTrackingScripts: void;
73
75
  };
@@ -39,6 +39,7 @@ const OCIdentityHomePage_1 = require("../pages/8.9/OCIdentityHomePage");
39
39
  const OCIdentityMappingRulesPage_1 = require("../pages/8.9/OCIdentityMappingRulesPage");
40
40
  const OCIdentityRolesPage_1 = require("../pages/8.9/OCIdentityRolesPage");
41
41
  const OCIdentityAuthorizationsPage_1 = require("../pages/8.9/OCIdentityAuthorizationsPage");
42
+ const OCIdentityClusterVariablesPage_1 = require("../pages/8.9/OCIdentityClusterVariablesPage");
42
43
  const ClientCredentialsDetailsPage_1 = require("../pages/8.9/ClientCredentialsDetailsPage");
43
44
  const test = test_1.test.extend({
44
45
  makeAxeBuilder: async ({ page }, use) => {
@@ -151,6 +152,9 @@ const test = test_1.test.extend({
151
152
  ocIdentityGroupsPage: async ({ page }, use) => {
152
153
  await use(new OCIdentityGroupsPage_1.OCIdentityGroupsPage(page));
153
154
  },
155
+ ocIdentityClusterVariablesPage: async ({ page }, use) => {
156
+ await use(new OCIdentityClusterVariablesPage_1.OCIdentityClusterVariablesPage(page));
157
+ },
154
158
  clientCredentialsDetailsPage: async ({ page }, use) => {
155
159
  await use(new ClientCredentialsDetailsPage_1.ClientCredentialsDetailsPage(page));
156
160
  },
@@ -0,0 +1,20 @@
1
+ import { Page, Locator } from '@playwright/test';
2
+ export declare class OCIdentityClusterVariablesPage {
3
+ private page;
4
+ readonly variablesList: Locator;
5
+ readonly editVariableButton: (variableName: string) => Locator;
6
+ readonly editVariableModal: Locator;
7
+ readonly variableValueField: Locator;
8
+ readonly saveVariableButton: Locator;
9
+ readonly closeEditVariableModal: Locator;
10
+ readonly cancelButton: Locator;
11
+ readonly variableRow: (variableName: string) => Locator;
12
+ readonly monacoEditor: Locator;
13
+ readonly monacoEditorTextArea: Locator;
14
+ readonly successMessage: Locator;
15
+ readonly editMenuItem: Locator;
16
+ constructor(page: Page);
17
+ editVariable(variableName: string, newValue: string): Promise<void>;
18
+ assertVariableExists(variableName: string): Promise<void>;
19
+ assertVariableValue(variableName: string, expectedValue: string): Promise<void>;
20
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OCIdentityClusterVariablesPage = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ class OCIdentityClusterVariablesPage {
6
+ page;
7
+ variablesList;
8
+ editVariableButton;
9
+ editVariableModal;
10
+ variableValueField;
11
+ saveVariableButton;
12
+ closeEditVariableModal;
13
+ cancelButton;
14
+ variableRow;
15
+ monacoEditor;
16
+ monacoEditorTextArea;
17
+ successMessage;
18
+ editMenuItem;
19
+ constructor(page) {
20
+ this.page = page;
21
+ this.variablesList = page.locator('table.cds--data-table');
22
+ this.variableRow = (variableName) => this.variablesList
23
+ .locator('tbody')
24
+ .getByRole('row')
25
+ .filter({ hasText: variableName });
26
+ this.editVariableButton = (variableName) => this.variableRow(variableName).getByRole('button', { name: 'Options' });
27
+ this.editVariableModal = page.getByRole('dialog', {
28
+ name: /Edit.*variable/i,
29
+ });
30
+ this.variableValueField = this.editVariableModal.getByRole('textbox', {
31
+ name: 'Editor content',
32
+ });
33
+ this.saveVariableButton = this.editVariableModal.locator('.cds--modal-footer button.cds--btn--primary');
34
+ this.closeEditVariableModal = this.editVariableModal.getByRole('button', {
35
+ name: 'Close',
36
+ });
37
+ this.cancelButton = this.editVariableModal.getByRole('button', {
38
+ name: 'Cancel',
39
+ });
40
+ this.monacoEditor = this.editVariableModal.locator('.monaco-editor');
41
+ this.monacoEditorTextArea = this.monacoEditor.locator('textarea.inputarea');
42
+ this.successMessage = this.page.getByText('Cluster variable updated');
43
+ this.editMenuItem = this.page
44
+ .locator('button[role="menuitem"]')
45
+ .filter({ hasText: /^Edit$/ });
46
+ }
47
+ async editVariable(variableName, newValue) {
48
+ await this.editVariableButton(variableName).click();
49
+ await (0, test_1.expect)(this.editMenuItem).toBeVisible();
50
+ await this.editMenuItem.click();
51
+ await (0, test_1.expect)(this.variableValueField).toBeVisible();
52
+ await (0, test_1.expect)(this.monacoEditor).toBeVisible();
53
+ await this.monacoEditor.click();
54
+ await this.monacoEditorTextArea.clear();
55
+ await this.monacoEditorTextArea.fill(newValue);
56
+ await (0, test_1.expect)(this.saveVariableButton).toBeEnabled();
57
+ await this.saveVariableButton.click();
58
+ await (0, test_1.expect)(this.successMessage).toBeVisible();
59
+ await (0, test_1.expect)(this.editVariableModal).toBeHidden();
60
+ }
61
+ async assertVariableExists(variableName) {
62
+ await (0, test_1.expect)(this.variableRow(variableName)).toBeVisible();
63
+ }
64
+ async assertVariableValue(variableName, expectedValue) {
65
+ const row = this.variableRow(variableName);
66
+ await (0, test_1.expect)(row).toContainText(expectedValue);
67
+ }
68
+ }
69
+ exports.OCIdentityClusterVariablesPage = OCIdentityClusterVariablesPage;
@@ -5,6 +5,7 @@ declare class OCIdentityHomePage {
5
5
  readonly adminBanner: Locator;
6
6
  readonly rolesTab: Locator;
7
7
  readonly authorizationsTab: Locator;
8
+ readonly clusterVariablesTab: Locator;
8
9
  readonly licenseKeyTagNonProduction: Locator;
9
10
  readonly licenseKeyTagNonCommercial: Locator;
10
11
  readonly licenseKeyTagProduction: Locator;
@@ -14,5 +15,6 @@ declare class OCIdentityHomePage {
14
15
  clickAuthorizationsTab(): Promise<void>;
15
16
  clickRolesTab(): Promise<void>;
16
17
  clickGroupsTab(): Promise<void>;
18
+ clickClusterVariablesTab(): Promise<void>;
17
19
  }
18
20
  export { OCIdentityHomePage };
@@ -8,6 +8,7 @@ class OCIdentityHomePage {
8
8
  adminBanner;
9
9
  rolesTab;
10
10
  authorizationsTab;
11
+ clusterVariablesTab;
11
12
  licenseKeyTagNonProduction;
12
13
  licenseKeyTagNonCommercial;
13
14
  licenseKeyTagProduction;
@@ -33,6 +34,16 @@ class OCIdentityHomePage {
33
34
  .getByLabel('Admin')
34
35
  .locator('a')
35
36
  .filter({ hasText: /^Authorizations$/ });
37
+ this.clusterVariablesTab = page
38
+ .getByRole('banner')
39
+ .getByLabel('Admin')
40
+ .locator('a')
41
+ .filter({ hasText: /Cluster variables/i })
42
+ .or(page
43
+ .getByRole('banner')
44
+ .getByLabel('Admin')
45
+ .locator('a')
46
+ .filter({ hasText: /Variables/i }));
36
47
  this.licenseKeyTagNonProduction = page
37
48
  .getByText('Non-production license')
38
49
  .first();
@@ -53,5 +64,9 @@ class OCIdentityHomePage {
53
64
  await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.groupsTab);
54
65
  await this.groupsTab.click({ timeout: 30000 });
55
66
  }
67
+ async clickClusterVariablesTab() {
68
+ await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.clusterVariablesTab);
69
+ await this.clusterVariablesTab.click({ timeout: 30000 });
70
+ }
56
71
  }
57
72
  exports.OCIdentityHomePage = OCIdentityHomePage;
@@ -6,16 +6,91 @@ const _setup_1 = require("../../test-setup.js");
6
6
  const apiHelpers_1 = require("../../utils/apiHelpers");
7
7
  const sleep_1 = require("../../utils/sleep");
8
8
  const users_1 = require("../../utils/users");
9
+ const randomName_1 = require("../../utils/randomName");
10
+ const CLUSTER_VAR_NAMES = {
11
+ ORIGINAL_JSON: 'ORIGINAL_API_INFO',
12
+ UPDATABLE_JSON: 'UPDATABLE_API_INFO',
13
+ ORIGINAL_STRING: 'ORIGINAL_APP_VERSION',
14
+ UPDATABLE_STRING: 'UPDATABLE_APP_VERSION',
15
+ };
16
+ function getConfigByType(type) {
17
+ const configs = {
18
+ JSON: {
19
+ processName: 'Cluster Variable Original JSON',
20
+ processNameUpdatable: 'Cluster Variable Updatable JSON',
21
+ taskName: 'Preview JSON cluster variables',
22
+ originalVariableName: CLUSTER_VAR_NAMES.ORIGINAL_JSON,
23
+ updatableVariableName: CLUSTER_VAR_NAMES.UPDATABLE_JSON,
24
+ originalValue: originalJsonClusterVariableValue,
25
+ operateVariableName: 'URL',
26
+ randomValuePrefix: 'https://updated.api.com',
27
+ },
28
+ String: {
29
+ processName: 'Cluster Variable Original String',
30
+ processNameUpdatable: 'Cluster Variable Updatable String',
31
+ taskName: 'Preview String cluster variable',
32
+ originalVariableName: CLUSTER_VAR_NAMES.ORIGINAL_STRING,
33
+ updatableVariableName: CLUSTER_VAR_NAMES.UPDATABLE_STRING,
34
+ originalValue: originalStringClusterVariableValue,
35
+ operateVariableName: 'APP_VERSION_VALUE',
36
+ randomValuePrefix: 'v3.0.0-updated',
37
+ },
38
+ };
39
+ return configs[type];
40
+ }
9
41
  const testUser = (0, users_1.getTestUser)('sixteenthUser');
10
42
  let authToken;
11
- let jsonClusterVariableValue;
43
+ let originalJsonClusterVariableValue;
44
+ let originalStringClusterVariableValue;
45
+ let jsonProcessKeyDisplay;
46
+ let jsonProcessKeyUpdate;
47
+ let stringProcessKeyDisplay;
48
+ let stringProcessKeyUpdate;
12
49
  _8_9_1.test.describe.configure({ mode: 'parallel' });
13
50
  _8_9_1.test.describe('Cluster Variables User Flows', () => {
14
51
  const clusterName = 'Test Cluster';
15
52
  _8_9_1.test.beforeAll(async () => {
16
53
  authToken = await (0, apiHelpers_1.authSaasAPI)();
17
- await (0, apiHelpers_1.createGlobalClusterVariable)(authToken);
18
- jsonClusterVariableValue = JSON.parse(process.env.CLUSTER_VARIABLE_JSON);
54
+ await Promise.all([
55
+ (0, apiHelpers_1.createJsonClusterVariable)(authToken, 'saas', CLUSTER_VAR_NAMES.ORIGINAL_JSON, process.env.CLUSTER_VARIABLE_JSON_VALUE),
56
+ (0, apiHelpers_1.createJsonClusterVariable)(authToken, 'saas', CLUSTER_VAR_NAMES.UPDATABLE_JSON, process.env.CLUSTER_VARIABLE_JSON_VALUE),
57
+ (0, apiHelpers_1.createStringClusterVariable)(authToken, 'saas', CLUSTER_VAR_NAMES.ORIGINAL_STRING, process.env.CLUSTER_VARIABLE_STRING_VALUE),
58
+ (0, apiHelpers_1.createStringClusterVariable)(authToken, 'saas', CLUSTER_VAR_NAMES.UPDATABLE_STRING, process.env.CLUSTER_VARIABLE_STRING_VALUE),
59
+ ]);
60
+ originalJsonClusterVariableValue = JSON.parse(process.env.CLUSTER_VARIABLE_JSON_VALUE);
61
+ originalStringClusterVariableValue =
62
+ process.env.CLUSTER_VARIABLE_STRING_VALUE;
63
+ const deployments = [
64
+ {
65
+ path: './resources/cluster_variables/cluster_variable_json_readonly.bpmn',
66
+ assignTo: 'jsonProcessKeyDisplay',
67
+ },
68
+ {
69
+ path: './resources/cluster_variables/cluster_variable_json_mutable.bpmn',
70
+ assignTo: 'jsonProcessKeyUpdate',
71
+ },
72
+ {
73
+ path: './resources/cluster_variables/cluster_variable_json_form.form',
74
+ assignTo: null,
75
+ },
76
+ {
77
+ path: './resources/cluster_variables/cluster_variable_string_readonly.bpmn',
78
+ assignTo: 'stringProcessKeyDisplay',
79
+ },
80
+ {
81
+ path: './resources/cluster_variables/cluster_variable_string_mutable.bpmn',
82
+ assignTo: 'stringProcessKeyUpdate',
83
+ },
84
+ {
85
+ path: './resources/cluster_variables/cluster_variable_string_form.form',
86
+ assignTo: null,
87
+ },
88
+ ];
89
+ const deploymentResults = await Promise.all(deployments.map((d) => (0, apiHelpers_1.deployProcess)(d.path, authToken)));
90
+ jsonProcessKeyDisplay = deploymentResults[0];
91
+ jsonProcessKeyUpdate = deploymentResults[1];
92
+ stringProcessKeyDisplay = deploymentResults[3];
93
+ stringProcessKeyUpdate = deploymentResults[4];
19
94
  });
20
95
  _8_9_1.test.beforeEach(async ({ page, appsPage, loginPage }, testInfo) => {
21
96
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
@@ -27,44 +102,99 @@ _8_9_1.test.describe('Cluster Variables User Flows', () => {
27
102
  await (0, _setup_1.captureFailureVideo)(page, testInfo);
28
103
  });
29
104
  _8_9_1.test.describe('Global cluster variable', () => {
30
- (0, _8_9_1.test)('User deploys a process and accesses global cluster variable on Tasklist', async ({ appsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, taskPanelPage, taskDetailsPage, }) => {
31
- _8_9_1.test.slow();
32
- const [processKey] = await Promise.all([
33
- (0, apiHelpers_1.deployProcess)('./resources/cluster_variables/cluster_variable_global_scope.bpmn', authToken),
34
- (0, apiHelpers_1.deployProcess)('./resources/cluster_variables/preview_cluster_variables.form', authToken),
35
- ]);
36
- if (processKey == null) {
37
- throw new Error('Failed to deploy process or missing processDefinitionKey');
38
- }
39
- const instanceKey = await (0, apiHelpers_1.createProcessInstance)(String(processKey), authToken);
40
- await _8_9_1.test.step('User can access the process on operate', async () => {
41
- await operateHomePage.clickProcessesTab();
42
- await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
43
- await operateProcessesPage.clickProcessInstanceLink(`Cluster Variable Global scope - API INFO`);
44
- await operateProcessInstancePage.assertActiveTokenIsPresent();
105
+ const testConfigs = [
106
+ {
107
+ type: 'JSON',
108
+ processKeyDisplay: () => jsonProcessKeyDisplay,
109
+ processKeyUpdate: () => jsonProcessKeyUpdate,
110
+ },
111
+ {
112
+ type: 'String',
113
+ processKeyDisplay: () => stringProcessKeyDisplay,
114
+ processKeyUpdate: () => stringProcessKeyUpdate,
115
+ },
116
+ ];
117
+ for (const config of testConfigs) {
118
+ (0, _8_9_1.test)(`User views ${config.type} cluster variable in Tasklist from readonly process and completes task`, async ({ appsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, taskPanelPage, taskDetailsPage, }) => {
119
+ _8_9_1.test.slow();
120
+ const derived = getConfigByType(config.type);
121
+ const instanceKey = await (0, apiHelpers_1.createProcessInstance)(String(config.processKeyDisplay()), authToken);
122
+ await _8_9_1.test.step('User can access the process on operate', async () => {
123
+ await operateHomePage.clickProcessesTab();
124
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
125
+ await operateProcessesPage.clickProcessInstanceLink(derived.processName);
126
+ await operateProcessInstancePage.assertActiveTokenIsPresent();
127
+ });
128
+ await _8_9_1.test.step(`User can view the process with ${config.type} cluster variable on tasklist`, async () => {
129
+ await appsPage.clickCamundaApps();
130
+ await appsPage.clickTasklist(clusterName);
131
+ await (0, sleep_1.sleep)(5000);
132
+ await taskPanelPage.openTask(derived.taskName);
133
+ await taskDetailsPage.clickAssignToMeButton();
134
+ });
135
+ await _8_9_1.test.step(`User can view the value of ${config.type} cluster variable and complete the task`, async () => {
136
+ if (config.type === 'JSON') {
137
+ for (const value of Object.values(derived.originalValue)) {
138
+ await taskDetailsPage.assertTextIsPresent(String(value));
139
+ }
140
+ }
141
+ else {
142
+ await taskDetailsPage.assertTextIsPresent(String(derived.originalValue));
143
+ }
144
+ await taskDetailsPage.clickCompleteTaskButton();
145
+ });
146
+ await _8_9_1.test.step('User can assert the process is completed on Operate', async () => {
147
+ await appsPage.clickCamundaApps();
148
+ await appsPage.clickOperate(clusterName);
149
+ await operateHomePage.clickProcessesTab();
150
+ await operateProcessesPage.clickProcessCompletedCheckbox();
151
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
152
+ await operateProcessesPage.clickProcessInstanceLink(derived.processName);
153
+ await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
154
+ });
45
155
  });
46
- await _8_9_1.test.step('User can view the process with cluster variables on tasklist', async () => {
47
- await appsPage.clickCamundaApps();
48
- await appsPage.clickTasklist(clusterName);
49
- await (0, sleep_1.sleep)(5000);
50
- await taskPanelPage.openTask(`Preview cluster variables form`);
51
- await taskDetailsPage.clickAssignToMeButton();
156
+ }
157
+ for (const config of testConfigs) {
158
+ (0, _8_9_1.test)(`User updates ${config.type} cluster variable in Admin UI and verifies changes in Operate`, async ({ appsPage, ocIdentityHomePage, ocIdentityClusterVariablesPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
159
+ _8_9_1.test.slow();
160
+ const derived = getConfigByType(config.type);
161
+ const randomRawValue = await (0, randomName_1.randomNameAgregator)(derived.randomValuePrefix);
162
+ const newValue = config.type === 'JSON'
163
+ ? JSON.stringify({
164
+ endpoint: randomRawValue,
165
+ timeout_ms: '5000',
166
+ array: ['updated_item1', 'updated_item2'],
167
+ })
168
+ : JSON.stringify(randomRawValue);
169
+ await _8_9_1.test.step('User navigates to Admin UI', async () => {
170
+ await appsPage.clickCamundaApps();
171
+ await appsPage.clickAdmin(clusterName);
172
+ });
173
+ await _8_9_1.test.step('User navigates to Cluster Variables tab', async () => {
174
+ await ocIdentityHomePage.clickClusterVariablesTab();
175
+ });
176
+ await _8_9_1.test.step(`User verifies ${config.type} cluster variable exists`, async () => {
177
+ await ocIdentityClusterVariablesPage.assertVariableExists(derived.updatableVariableName);
178
+ });
179
+ await _8_9_1.test.step(`User updates the ${config.type} cluster variable value`, async () => {
180
+ await ocIdentityClusterVariablesPage.editVariable(derived.updatableVariableName, newValue);
181
+ });
182
+ await _8_9_1.test.step(`User creates a process instance with the updated ${config.type} cluster variable`, async () => {
183
+ const instanceKey = await (0, apiHelpers_1.createProcessInstance)(String(config.processKeyUpdate()), authToken);
184
+ await _8_9_1.test.step('User navigates to the process instance on Operate', async () => {
185
+ await appsPage.clickCamundaApps();
186
+ await appsPage.clickOperate(clusterName);
187
+ await operateHomePage.clickProcessesTab();
188
+ await operateProcessesPage.clickProcessCompletedCheckbox();
189
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
190
+ await operateProcessesPage.clickProcessInstanceLink(derived.processNameUpdatable);
191
+ await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
192
+ });
193
+ await _8_9_1.test.step(`User verifies the updated ${config.type} cluster variable value is present in process variables`, async () => {
194
+ await operateProcessInstancePage.assertProcessVariableContainsText(derived.operateVariableName, randomRawValue);
195
+ });
196
+ });
52
197
  });
53
- await _8_9_1.test.step('User can view the values of cluster variables and complete the task', async () => {
54
- for (const [, value] of Object.entries(jsonClusterVariableValue)) {
55
- await taskDetailsPage.assertTextIsPresent(String(value));
56
- }
57
- await taskDetailsPage.clickCompleteTaskButton();
58
- });
59
- await _8_9_1.test.step('User can assert the process is completed on Operate', async () => {
60
- await appsPage.clickCamundaApps();
61
- await appsPage.clickOperate(clusterName);
62
- await operateHomePage.clickProcessesTab();
63
- await operateProcessesPage.clickProcessCompletedCheckbox();
64
- await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
65
- await operateProcessesPage.clickProcessInstanceLink(`Cluster Variable Global scope - API INFO`);
66
- await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
67
- });
68
- });
198
+ }
69
199
  });
70
200
  });
@@ -13,7 +13,16 @@ export declare function authC8runAPI(name: string, password: string): Promise<vo
13
13
  export declare function validateMcpServerHealth(serverUrl?: string): Promise<APIResponse>;
14
14
  export declare function deployProcess(filePath: string, authToken?: string, environment?: 'saas' | 'sm'): Promise<number | null>;
15
15
  export declare function createProcessInstance(processDefinitionKey: string, authToken?: string, environment?: 'saas' | 'sm'): Promise<string>;
16
- export declare function createGlobalClusterVariable(authToken?: string, environment?: 'saas' | 'sm'): Promise<void>;
16
+ export declare function createJsonClusterVariable(authToken?: string, environment?: 'saas' | 'sm', customVariableName?: string, customVariableValue?: string): Promise<void>;
17
+ export declare function createStringClusterVariable(authToken?: string, environment?: 'saas' | 'sm', customVariableName?: string, customVariableValue?: string): Promise<void>;
18
+ /**
19
+ * @deprecated This function will be removed when SM-8.9 cluster variables test is updated.
20
+ * Use createJsonClusterVariable() for JSON variables or
21
+ * createStringClusterVariable() for String variables instead.
22
+ *
23
+ * Maintained for backward compatibility with tests/SM-8.9/cluster-variables.spec.ts
24
+ */
25
+ export declare function createGlobalClusterVariable(authToken: string, environment?: 'saas' | 'sm'): Promise<Record<string, unknown>>;
17
26
  interface ReportDefinition {
18
27
  key: string;
19
28
  filter?: unknown[];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCoockie = exports.createGlobalClusterVariable = exports.createProcessInstance = exports.deployProcess = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = void 0;
6
+ exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCoockie = exports.createGlobalClusterVariable = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.createProcessInstance = exports.deployProcess = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = void 0;
7
7
  const test_1 = require("@playwright/test");
8
8
  const sleep_1 = require("./sleep");
9
9
  const fs_1 = __importDefault(require("fs"));
@@ -242,32 +242,65 @@ async function createProcessInstance(processDefinitionKey, authToken, environmen
242
242
  return String(processInstanceKey);
243
243
  }
244
244
  exports.createProcessInstance = createProcessInstance;
245
- async function createGlobalClusterVariable(authToken, environment) {
246
- apiRequestContext = await getApiRequestContext();
247
- const url = buildZeebeApiUrl('/v2/cluster-variables/global', environment);
248
- const response = await apiRequestContext.post(url, {
249
- headers: {
250
- Authorization: authToken ?? '',
251
- },
252
- data: {
253
- name: String(process.env.CLUSTER_VARIABLE_NAME),
254
- value: JSON.parse(process.env.CLUSTER_VARIABLE_JSON),
255
- },
256
- });
257
- const status = response.status();
258
- // Accept common successful statuses
259
- if (status === 200 || status === 201 || status === 204) {
260
- return;
245
+ async function createClusterVariableInternal(authToken, environment, variableName, variableValue, variableType) {
246
+ try {
247
+ apiRequestContext = await getApiRequestContext();
248
+ const url = buildZeebeApiUrl('/v2/cluster-variables/global', environment);
249
+ const response = await apiRequestContext.post(url, {
250
+ headers: {
251
+ Authorization: authToken,
252
+ },
253
+ data: {
254
+ name: variableName,
255
+ value: variableValue,
256
+ },
257
+ });
258
+ const status = response.status();
259
+ if (status === 200 || status === 201 || status === 204) {
260
+ return;
261
+ }
262
+ // Handle "already exists" as a benign condition
263
+ if (status === 409) {
264
+ console.warn(`${variableType} cluster variable "${variableName}" already exists (HTTP 409).`);
265
+ return;
266
+ }
267
+ const bodyText = await response.text();
268
+ throw new Error(`Failed to create ${variableType} cluster variable "${variableName}": HTTP ${status} - ${bodyText}`);
261
269
  }
262
- // Handle "already exists" as a benign condition
263
- if (status === 409) {
264
- console.warn(`Global cluster variable "${process.env
265
- .CLUSTER_VARIABLE_NAME}" already exists (HTTP 409).`);
266
- return;
270
+ catch (error) {
271
+ if (error instanceof Error && error.message.includes('Failed to create')) {
272
+ throw error;
273
+ }
274
+ // Wrap unexpected errors with context
275
+ const errorMessage = error instanceof Error ? error.message : String(error);
276
+ throw new Error(`Unexpected error creating ${variableType} cluster variable "${variableName}": ${errorMessage}`);
267
277
  }
268
- const bodyText = await response.text();
269
- throw new Error(`Failed to create global cluster variable "${process.env
270
- .CLUSTER_VARIABLE_NAME}": HTTP ${status} - ${bodyText}`);
278
+ }
279
+ async function createJsonClusterVariable(authToken, environment = 'saas', customVariableName, customVariableValue) {
280
+ const variableName = customVariableName ?? String(process.env.CLUSTER_VARIABLE_NAME);
281
+ const variableValue = customVariableValue
282
+ ? JSON.parse(customVariableValue)
283
+ : JSON.parse(process.env.CLUSTER_VARIABLE_JSON);
284
+ await createClusterVariableInternal(authToken ?? '', environment, variableName, variableValue, 'JSON');
285
+ }
286
+ exports.createJsonClusterVariable = createJsonClusterVariable;
287
+ async function createStringClusterVariable(authToken, environment = 'saas', customVariableName, customVariableValue) {
288
+ const variableName = customVariableName ?? String(process.env.CLUSTER_VARIABLE_STRING_NAME);
289
+ const variableValue = customVariableValue ?? process.env.CLUSTER_VARIABLE_STRING_VALUE;
290
+ await createClusterVariableInternal(authToken ?? '', environment, variableName, variableValue, 'String');
291
+ }
292
+ exports.createStringClusterVariable = createStringClusterVariable;
293
+ /**
294
+ * @deprecated This function will be removed when SM-8.9 cluster variables test is updated.
295
+ * Use createJsonClusterVariable() for JSON variables or
296
+ * createStringClusterVariable() for String variables instead.
297
+ *
298
+ * Maintained for backward compatibility with tests/SM-8.9/cluster-variables.spec.ts
299
+ */
300
+ async function createGlobalClusterVariable(authToken, environment = 'saas') {
301
+ const variableValue = process.env.CLUSTER_VARIABLE_JSON_VALUE;
302
+ await createJsonClusterVariable(authToken, environment, 'ORIGINAL_API_INFO', variableValue);
303
+ return JSON.parse(variableValue);
271
304
  }
272
305
  exports.createGlobalClusterVariable = createGlobalClusterVariable;
273
306
  async function getOptimizeCoockie(page) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.231",
3
+ "version": "0.0.232",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",