@camunda/e2e-test-suite 0.0.95 → 0.0.97

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.
@@ -70,5 +70,6 @@ declare class TaskDetailsPage {
70
70
  assertPdfPreviewViewerExists(): Promise<void>;
71
71
  assertAIResponse(expected: RegExp): Promise<void>;
72
72
  clickSubmitButton(): Promise<void>;
73
+ assertTextIsPresent(expectedText: string): Promise<void>;
73
74
  }
74
75
  export { TaskDetailsPage };
@@ -246,5 +246,24 @@ class TaskDetailsPage {
246
246
  async clickSubmitButton() {
247
247
  await this.submitButton.click();
248
248
  }
249
+ async assertTextIsPresent(expectedText) {
250
+ const maxAttempts = 3;
251
+ let attempts = 0;
252
+ while (attempts < maxAttempts) {
253
+ try {
254
+ await (0, test_1.expect)(this.page.getByText(expectedText)).toBeVisible({
255
+ timeout: 60000,
256
+ });
257
+ return;
258
+ }
259
+ catch (error) {
260
+ attempts++;
261
+ if (attempts >= maxAttempts) {
262
+ throw error;
263
+ }
264
+ await this.page.reload();
265
+ }
266
+ }
267
+ }
249
268
  }
250
269
  exports.TaskDetailsPage = TaskDetailsPage;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModelerHomePage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const sleep_1 = require("../../utils/sleep");
6
+ const expectLocatorWithRetry_1 = require("../../utils/assertionHelpers/expectLocatorWithRetry");
6
7
  class ModelerHomePage {
7
8
  page;
8
9
  defaultFolderName = 'Cross Component Test Project';
@@ -129,8 +130,10 @@ class ModelerHomePage {
129
130
  await this.chooseBpmnTemplateButton.click();
130
131
  }
131
132
  async clickDiagramTypeDropdown() {
132
- await (0, test_1.expect)(this.diagramTypeDropdown).toBeVisible({
133
- timeout: 60000,
133
+ await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.diagramTypeDropdown, {
134
+ postAction: async () => {
135
+ await this.page.reload();
136
+ },
134
137
  });
135
138
  await this.diagramTypeDropdown.click();
136
139
  }
@@ -84,6 +84,7 @@ class OperateProcessesPage {
84
84
  }
85
85
  else {
86
86
  await this.checkCheckbox(this.processCompletedCheckbox);
87
+ await (0, sleep_1.sleep)(200);
87
88
  }
88
89
  }
89
90
  async checkTableForProcess(processName) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _8_9_1 = require("../../fixtures/8.9");
4
+ const UtilitiesPage_1 = require("../../pages/8.9/UtilitiesPage");
5
+ const _setup_1 = require("../../test-setup.js");
6
+ const apiHelpers_1 = require("../../utils/apiHelpers");
7
+ const sleep_1 = require("../../utils/sleep");
8
+ let authToken;
9
+ let jsonClusterVariableValue;
10
+ _8_9_1.test.describe.configure({ mode: 'parallel' });
11
+ _8_9_1.test.describe('Cluster Variables User Flows', () => {
12
+ const clusterName = 'Test Cluster';
13
+ _8_9_1.test.beforeAll(async () => {
14
+ authToken = await (0, apiHelpers_1.authSaasAPI)();
15
+ await (0, apiHelpers_1.createGlobalClusterVariableSaaS)(authToken);
16
+ jsonClusterVariableValue = JSON.parse(process.env.CLUSTER_VARIABLE_JSON);
17
+ });
18
+ _8_9_1.test.beforeEach(async ({ page, appsPage, loginPage }, testInfo) => {
19
+ await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, (testInfo.workerIndex + 1) * 1000);
20
+ await appsPage.clickCamundaApps();
21
+ await appsPage.clickOperate(clusterName);
22
+ });
23
+ _8_9_1.test.afterEach(async ({ page }, testInfo) => {
24
+ await (0, _setup_1.captureScreenshot)(page, testInfo);
25
+ await (0, _setup_1.captureFailureVideo)(page, testInfo);
26
+ });
27
+ _8_9_1.test.describe('Global cluster variable', () => {
28
+ (0, _8_9_1.test)('User deploys a process and accesses global cluster variable on Tasklist', async ({ appsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, taskPanelPage, taskDetailsPage, }) => {
29
+ _8_9_1.test.slow();
30
+ const [processKey] = await Promise.all([
31
+ (0, apiHelpers_1.deployProcessSaaS)('./resources/cluster_variables/cluster_variable_global_scope.bpmn', authToken),
32
+ (0, apiHelpers_1.deployProcessSaaS)('./resources/cluster_variables/preview_cluster_variables.form', authToken),
33
+ ]);
34
+ if (processKey == null) {
35
+ throw new Error('Failed to deploy process or missing processDefinitionKey');
36
+ }
37
+ const instanceKey = await (0, apiHelpers_1.createProcessInstanceSaaS)(String(processKey), authToken);
38
+ await _8_9_1.test.step('User can access the process on operate', async () => {
39
+ await operateHomePage.clickProcessesTab();
40
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
41
+ await operateProcessesPage.clickProcessInstanceLink(`Cluster Variable Global scope - API INFO`);
42
+ await operateProcessInstancePage.assertActiveTokenIsPresent();
43
+ });
44
+ await _8_9_1.test.step('User can view the process with cluster variables on tasklist', async () => {
45
+ await appsPage.clickCamundaApps();
46
+ await appsPage.clickTasklist(clusterName);
47
+ await (0, sleep_1.sleep)(5000);
48
+ await taskPanelPage.openTask(`Preview cluster variables form`);
49
+ await taskDetailsPage.clickAssignToMeButton();
50
+ });
51
+ await _8_9_1.test.step('User can view the values of cluster variables and complete the task', async () => {
52
+ for (const [, value] of Object.entries(jsonClusterVariableValue)) {
53
+ await taskDetailsPage.assertTextIsPresent(String(value));
54
+ }
55
+ await taskDetailsPage.clickCompleteTaskButton();
56
+ });
57
+ await _8_9_1.test.step('User can assert the process is completed on Operate', async () => {
58
+ await appsPage.clickCamundaApps();
59
+ await appsPage.clickOperate(clusterName);
60
+ await operateHomePage.clickProcessesTab();
61
+ await operateProcessesPage.clickProcessCompletedCheckbox();
62
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
63
+ await operateProcessesPage.clickProcessInstanceLink(`Cluster Variable Global scope - API INFO`);
64
+ await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
65
+ });
66
+ });
67
+ });
68
+ });
@@ -44,4 +44,5 @@ export declare function updateCollectionScope(request: APIRequestContext, option
44
44
  }): Promise<unknown>;
45
45
  export declare function deployProcessSaaS(filePath: string, authToken?: string): Promise<number | null>;
46
46
  export declare function createProcessInstanceSaaS(processDefinitionKey: string, authToken?: string): Promise<string>;
47
+ export declare function createGlobalClusterVariableSaaS(authToken?: string): Promise<void>;
47
48
  export {};
@@ -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.createProcessInstanceSaaS = exports.deployProcessSaaS = exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCoockie = exports.authSaasAPI = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = exports.authC8runAPI = void 0;
6
+ exports.createGlobalClusterVariableSaaS = exports.createProcessInstanceSaaS = exports.deployProcessSaaS = exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCoockie = exports.authSaasAPI = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = exports.authC8runAPI = 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"));
@@ -270,3 +270,30 @@ async function createProcessInstanceSaaS(processDefinitionKey, authToken) {
270
270
  return String(processInstanceKey);
271
271
  }
272
272
  exports.createProcessInstanceSaaS = createProcessInstanceSaaS;
273
+ async function createGlobalClusterVariableSaaS(authToken) {
274
+ apiRequestContext = await getApiRequestContext();
275
+ const response = await apiRequestContext.post(`${process.env.ZEEBE_API_URL}/v2/cluster-variables/global`, {
276
+ headers: {
277
+ Authorization: authToken ?? '',
278
+ },
279
+ data: {
280
+ name: String(process.env.CLUSTER_VARIABLE_NAME),
281
+ value: JSON.parse(process.env.CLUSTER_VARIABLE_JSON),
282
+ },
283
+ });
284
+ const status = response.status();
285
+ // Accept common successful statuses
286
+ if (status === 200 || status === 201 || status === 204) {
287
+ return;
288
+ }
289
+ // Handle "already exists" as a benign condition
290
+ if (status === 409) {
291
+ console.warn(`Global cluster variable "${process.env
292
+ .CLUSTER_VARIABLE_NAME}" already exists (HTTP 409).`);
293
+ return;
294
+ }
295
+ const bodyText = await response.text();
296
+ throw new Error(`Failed to create global cluster variable "${process.env
297
+ .CLUSTER_VARIABLE_NAME}": ` + `HTTP ${status} - ${bodyText}`);
298
+ }
299
+ exports.createGlobalClusterVariableSaaS = createGlobalClusterVariableSaaS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.95",
3
+ "version": "0.0.97",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",