@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
@@ -0,0 +1,468 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const SM_8_10_1 = require("../../fixtures/SM-8.10");
4
+ const test_1 = require("@playwright/test");
5
+ const apiHelpers_1 = require("../../utils/apiHelpers");
6
+ const randomName_1 = require("../../utils/randomName");
7
+ SM_8_10_1.test.describe.configure({ mode: 'parallel' });
8
+ SM_8_10_1.test.describe('API optimize SM Tests', () => {
9
+ const baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
10
+ (0, SM_8_10_1.test)('Dashboard Scenarios Flow Tests', async ({ request, browser }) => {
11
+ const page = await browser.newPage();
12
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
13
+ await page.close();
14
+ const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
15
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
16
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
17
+ optimizeCookie,
18
+ csrfToken,
19
+ });
20
+ await (0, apiHelpers_1.updateCollectionScope)(request, {
21
+ optimizeCookie,
22
+ csrfToken,
23
+ collectionId: collectionIdValue,
24
+ data: [
25
+ {
26
+ definitionKey: 'customer_onboarding_en',
27
+ definitionType: 'process',
28
+ tenants: ['<default>'],
29
+ },
30
+ ],
31
+ });
32
+ const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
33
+ name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
34
+ optimizeCookie,
35
+ csrfToken,
36
+ collectionId: collectionIdValue,
37
+ });
38
+ await SM_8_10_1.test.step('Get dashboards successfully (200)', async () => {
39
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
40
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
41
+ const body = await response.json();
42
+ (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
43
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
44
+ const dashboard = body[0];
45
+ (0, test_1.expect)(dashboard).toHaveProperty('id');
46
+ });
47
+ await SM_8_10_1.test.step('Get dashboards without token (401)', async () => {
48
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`);
49
+ (0, test_1.expect)(response.status()).toBe(401);
50
+ });
51
+ await SM_8_10_1.test.step('Get dashboards with invalid token (401)', async () => {
52
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
53
+ (0, test_1.expect)(response.status()).toBe(401);
54
+ });
55
+ await SM_8_10_1.test.step('Force internal server error (500)', async () => {
56
+ const response = await request.get(`${baseUrl}/api/public/dashboard/force-internal-error`, { headers: { Authorization: optimizeBearerToken } });
57
+ (0, test_1.expect)(response.status()).toBe(500);
58
+ });
59
+ await SM_8_10_1.test.step('Export dashboard definitions successfully (200)', async () => {
60
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
61
+ headers: {
62
+ Authorization: optimizeBearerToken,
63
+ 'Content-Type': 'application/json',
64
+ },
65
+ data: [dashboardIdValue],
66
+ });
67
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
68
+ const body = await response.json();
69
+ (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
70
+ });
71
+ await SM_8_10_1.test.step('Export dashboards without token (401)', async () => {
72
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
73
+ headers: { 'Content-Type': 'application/json' },
74
+ data: [dashboardIdValue],
75
+ });
76
+ (0, test_1.expect)(response.status()).toBe(401);
77
+ });
78
+ await SM_8_10_1.test.step('Export dashboards with invalid token (401)', async () => {
79
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
80
+ headers: {
81
+ Authorization: 'Bearer invalid_token',
82
+ 'Content-Type': 'application/json',
83
+ },
84
+ data: [dashboardIdValue],
85
+ });
86
+ (0, test_1.expect)(response.status()).toBe(401);
87
+ });
88
+ await SM_8_10_1.test.step('Export dashboard with invalid body (400)', async () => {
89
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
90
+ headers: {
91
+ Authorization: optimizeBearerToken,
92
+ 'Content-Type': 'application/json',
93
+ },
94
+ data: [{}],
95
+ });
96
+ (0, test_1.expect)(response.status()).toBe(400);
97
+ });
98
+ await SM_8_10_1.test.step('Export non-existent dashboard (404)', async () => {
99
+ const fakeDashboardId = 'nonexistent-dashboard-id';
100
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
101
+ headers: {
102
+ Authorization: optimizeBearerToken,
103
+ 'Content-Type': 'application/json',
104
+ },
105
+ data: [fakeDashboardId],
106
+ });
107
+ (0, test_1.expect)([401, 404]).toContain(response.status());
108
+ });
109
+ await SM_8_10_1.test.step('Export existing dashboard successfully (200)', async () => {
110
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
111
+ headers: {
112
+ Authorization: optimizeBearerToken,
113
+ 'Content-Type': 'application/json',
114
+ },
115
+ data: [dashboardIdValue],
116
+ });
117
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
118
+ });
119
+ await SM_8_10_1.test.step('Delete dashboard successfully (200)', async () => {
120
+ const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: optimizeBearerToken } });
121
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
122
+ });
123
+ await SM_8_10_1.test.step('Verify dashboard is gone from the collection listing', async () => {
124
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
125
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
126
+ const ids = (await response.json()).map((entity) => entity.id);
127
+ (0, test_1.expect)(ids).not.toContain(dashboardIdValue);
128
+ });
129
+ await SM_8_10_1.test.step('Delete dashboard with invalid token (401)', async () => {
130
+ const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
131
+ (0, test_1.expect)(response.status()).toBe(401);
132
+ });
133
+ await SM_8_10_1.test.step('Delete non-existent dashboard (404)', async () => {
134
+ const fakeDashboardId = 'nonexistent-dashboard-id';
135
+ const response = await request.delete(`${baseUrl}/api/public/dashboard/${fakeDashboardId}`, { headers: { Authorization: optimizeBearerToken } });
136
+ (0, test_1.expect)(response.status()).toBe(404);
137
+ });
138
+ });
139
+ (0, SM_8_10_1.test)('Reports Scenarios Flow Tests', async ({ request, browser }) => {
140
+ const page = await browser.newPage();
141
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
142
+ await page.close();
143
+ const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
144
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
145
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
146
+ optimizeCookie,
147
+ csrfToken,
148
+ });
149
+ await (0, apiHelpers_1.updateCollectionScope)(request, {
150
+ optimizeCookie,
151
+ csrfToken,
152
+ collectionId: collectionIdValue,
153
+ data: [
154
+ {
155
+ definitionKey: 'customer_onboarding_en',
156
+ definitionType: 'process',
157
+ tenants: ['<default>'],
158
+ },
159
+ ],
160
+ });
161
+ const reportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
162
+ optimizeCookie,
163
+ csrfToken,
164
+ collectionId: collectionIdValue,
165
+ name: 'Blank report',
166
+ definitions: [
167
+ {
168
+ key: 'aProcess',
169
+ filter: [],
170
+ groupBy: { type: 'flowNodes', value: null },
171
+ distributedBy: { type: 'none', value: null },
172
+ view: { entity: 'flowNode', properties: ['duration'] },
173
+ },
174
+ ],
175
+ });
176
+ await SM_8_10_1.test.step('Get reports successfully (200)', async () => {
177
+ const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
178
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
179
+ });
180
+ await SM_8_10_1.test.step('Get reports with invalid/missing token (401)', async () => {
181
+ const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
182
+ (0, test_1.expect)(response.status()).toBe(401);
183
+ });
184
+ await SM_8_10_1.test.step('Export reports successfully (200)', async () => {
185
+ const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
186
+ headers: {
187
+ Authorization: optimizeBearerToken,
188
+ 'Content-Type': 'application/json',
189
+ },
190
+ data: [reportId],
191
+ });
192
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
193
+ const body = await response.json();
194
+ (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
195
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
196
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
197
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
198
+ (0, test_1.expect)(body[0]).toHaveProperty('name');
199
+ (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
200
+ });
201
+ await SM_8_10_1.test.step('Export reports with invalid token (401)', async () => {
202
+ const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
203
+ headers: {
204
+ Authorization: 'Bearer invalid_token',
205
+ 'Content-Type': 'application/json',
206
+ },
207
+ data: [reportId],
208
+ });
209
+ (0, test_1.expect)(response.status()).toBe(401);
210
+ });
211
+ await SM_8_10_1.test.step('Export non-existent report (404)', async () => {
212
+ const invalidReportId = '11111111-1111-1111-1111-111111111111';
213
+ const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
214
+ headers: {
215
+ Authorization: optimizeBearerToken,
216
+ 'Content-Type': 'application/json',
217
+ },
218
+ data: [invalidReportId],
219
+ });
220
+ await (0, apiHelpers_1.assertResponseStatus)(response, 404);
221
+ });
222
+ await SM_8_10_1.test.step('Delete report successfully (200)', async () => {
223
+ const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: optimizeBearerToken } });
224
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
225
+ });
226
+ await SM_8_10_1.test.step('Verify report is gone from the collection listing', async () => {
227
+ const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
228
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
229
+ const ids = (await response.json()).map((entity) => entity.id);
230
+ (0, test_1.expect)(ids).not.toContain(reportId);
231
+ });
232
+ await SM_8_10_1.test.step('Attempt delete report with invalid token (401)', async () => {
233
+ const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
234
+ (0, test_1.expect)(response.status()).toBe(401);
235
+ });
236
+ });
237
+ (0, SM_8_10_1.test)('Import entities successfully (200)', async ({ request, browser }) => {
238
+ const page = await browser.newPage();
239
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
240
+ await page.close();
241
+ const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
242
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
243
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
244
+ optimizeCookie,
245
+ csrfToken,
246
+ });
247
+ await (0, apiHelpers_1.updateCollectionScope)(request, {
248
+ optimizeCookie,
249
+ csrfToken,
250
+ collectionId: collectionIdValue,
251
+ data: [
252
+ {
253
+ definitionKey: 'customer_onboarding_en',
254
+ definitionType: 'process',
255
+ tenants: ['<default>'],
256
+ },
257
+ ],
258
+ });
259
+ const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
260
+ name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
261
+ optimizeCookie,
262
+ csrfToken,
263
+ collectionId: collectionIdValue,
264
+ });
265
+ const exportedEntities = await (async () => {
266
+ const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
267
+ headers: {
268
+ Authorization: optimizeBearerToken,
269
+ 'Content-Type': 'application/json',
270
+ },
271
+ data: [dashboardIdValue],
272
+ });
273
+ await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
274
+ return await exportResponse.json();
275
+ })();
276
+ const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
277
+ headers: {
278
+ Authorization: optimizeBearerToken,
279
+ 'Content-Type': 'application/json',
280
+ },
281
+ data: exportedEntities,
282
+ });
283
+ await (0, apiHelpers_1.assertResponseStatus)(response, 200);
284
+ });
285
+ (0, SM_8_10_1.test)('Import without token or invalid token (401)', async ({ request, browser, }) => {
286
+ const page = await browser.newPage();
287
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
288
+ await page.close();
289
+ const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
290
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
291
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
292
+ optimizeCookie,
293
+ csrfToken,
294
+ });
295
+ await (0, apiHelpers_1.updateCollectionScope)(request, {
296
+ optimizeCookie,
297
+ csrfToken,
298
+ collectionId: collectionIdValue,
299
+ data: [
300
+ {
301
+ definitionKey: 'customer_onboarding_en',
302
+ definitionType: 'process',
303
+ tenants: ['<default>'],
304
+ },
305
+ ],
306
+ });
307
+ const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
308
+ name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
309
+ optimizeCookie,
310
+ csrfToken,
311
+ collectionId: collectionIdValue,
312
+ });
313
+ const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
314
+ headers: {
315
+ Authorization: optimizeBearerToken,
316
+ 'Content-Type': 'application/json',
317
+ },
318
+ data: [dashboardIdValue],
319
+ });
320
+ await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
321
+ const exportedEntities = await exportResponse.json();
322
+ const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
323
+ headers: {
324
+ Authorization: 'Bearer invalid_token',
325
+ 'Content-Type': 'application/json',
326
+ },
327
+ data: exportedEntities,
328
+ });
329
+ (0, test_1.expect)(response.status()).toBe(401);
330
+ });
331
+ (0, SM_8_10_1.test)('Import to non-existent collection (404)', async ({ request, browser, }) => {
332
+ const page = await browser.newPage();
333
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
334
+ await page.close();
335
+ const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
336
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
337
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
338
+ optimizeCookie,
339
+ csrfToken,
340
+ });
341
+ await (0, apiHelpers_1.updateCollectionScope)(request, {
342
+ optimizeCookie,
343
+ csrfToken,
344
+ collectionId: collectionIdValue,
345
+ data: [
346
+ {
347
+ definitionKey: 'customer_onboarding_en',
348
+ definitionType: 'process',
349
+ tenants: ['<default>'],
350
+ },
351
+ ],
352
+ });
353
+ const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
354
+ name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
355
+ optimizeCookie,
356
+ csrfToken,
357
+ collectionId: collectionIdValue,
358
+ });
359
+ const exportedEntities = await (async () => {
360
+ const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
361
+ headers: {
362
+ Authorization: optimizeBearerToken,
363
+ 'Content-Type': 'application/json',
364
+ },
365
+ data: [dashboardIdValue],
366
+ });
367
+ await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
368
+ return await exportResponse.json();
369
+ })();
370
+ const fakeCollectionId = 'nonexistent-collection-id';
371
+ const response = await request.post(`${baseUrl}/api/public/import?collectionId=${fakeCollectionId}`, {
372
+ headers: {
373
+ Authorization: optimizeBearerToken,
374
+ 'Content-Type': 'application/json',
375
+ },
376
+ data: exportedEntities,
377
+ });
378
+ (0, test_1.expect)(response.status()).toBe(404);
379
+ });
380
+ (0, SM_8_10_1.test)('Authorization Edge Cases Tests (401)', async ({ request, browser }) => {
381
+ const page = await browser.newPage();
382
+ const { optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSessionSm)(page);
383
+ await page.close();
384
+ const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
385
+ name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
386
+ optimizeCookie,
387
+ csrfToken,
388
+ });
389
+ const expiredToken = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0IiwiZXhwIjoxNjA5NDU5MjAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
390
+ const malformedToken = 'Bearer eyJhbGciOiJIUzI1NiJ9.';
391
+ const noPrefixToken = 'raw-token-string-without-bearer-prefix';
392
+ await SM_8_10_1.test.step('Expired JWT token on GET dashboard returns 401', async () => {
393
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: expiredToken } });
394
+ (0, test_1.expect)(response.status()).toBe(401);
395
+ });
396
+ await SM_8_10_1.test.step('Malformed JWT (truncated) on GET dashboard returns 401', async () => {
397
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: malformedToken } });
398
+ (0, test_1.expect)(response.status()).toBe(401);
399
+ });
400
+ await SM_8_10_1.test.step('Token without Bearer prefix on GET dashboard returns 401', async () => {
401
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: noPrefixToken } });
402
+ (0, test_1.expect)(response.status()).toBe(401);
403
+ });
404
+ await SM_8_10_1.test.step('Empty Authorization header on GET dashboard returns 401', async () => {
405
+ const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: '' } });
406
+ (0, test_1.expect)(response.status()).toBe(401);
407
+ });
408
+ await SM_8_10_1.test.step('Missing token on GET reports returns 401', async () => {
409
+ const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`);
410
+ (0, test_1.expect)(response.status()).toBe(401);
411
+ });
412
+ await SM_8_10_1.test.step('Missing token on DELETE dashboard returns 401', async () => {
413
+ const response = await request.delete(`${baseUrl}/api/public/dashboard/nonexistent-id`);
414
+ (0, test_1.expect)(response.status()).toBe(401);
415
+ });
416
+ await SM_8_10_1.test.step('Missing token on DELETE report returns 401', async () => {
417
+ const response = await request.delete(`${baseUrl}/api/public/report/nonexistent-id`);
418
+ (0, test_1.expect)(response.status()).toBe(401);
419
+ });
420
+ await SM_8_10_1.test.step('Missing token on import returns 401', async () => {
421
+ const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
422
+ headers: { 'Content-Type': 'application/json' },
423
+ data: [],
424
+ });
425
+ (0, test_1.expect)(response.status()).toBe(401);
426
+ });
427
+ await SM_8_10_1.test.step('Expired JWT on export dashboard returns 401', async () => {
428
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
429
+ headers: {
430
+ Authorization: expiredToken,
431
+ 'Content-Type': 'application/json',
432
+ },
433
+ data: ['some-dashboard-id'],
434
+ });
435
+ (0, test_1.expect)(response.status()).toBe(401);
436
+ });
437
+ await SM_8_10_1.test.step('Expired JWT on export report returns 401', async () => {
438
+ const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
439
+ headers: {
440
+ Authorization: expiredToken,
441
+ 'Content-Type': 'application/json',
442
+ },
443
+ data: ['some-report-id'],
444
+ });
445
+ (0, test_1.expect)(response.status()).toBe(401);
446
+ });
447
+ await SM_8_10_1.test.step('Malformed JWT on export dashboard returns 401', async () => {
448
+ const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
449
+ headers: {
450
+ Authorization: malformedToken,
451
+ 'Content-Type': 'application/json',
452
+ },
453
+ data: ['some-dashboard-id'],
454
+ });
455
+ (0, test_1.expect)(response.status()).toBe(401);
456
+ });
457
+ await SM_8_10_1.test.step('Malformed JWT on import returns 401', async () => {
458
+ const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
459
+ headers: {
460
+ Authorization: malformedToken,
461
+ 'Content-Type': 'application/json',
462
+ },
463
+ data: [],
464
+ });
465
+ (0, test_1.expect)(response.status()).toBe(401);
466
+ });
467
+ });
468
+ });
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const SM_8_11_1 = require("../../fixtures/SM-8.11");
4
+ const _setup_1 = require("../../test-setup.js");
5
+ const apiHelpers_1 = require("../../utils/apiHelpers");
6
+ const randomName_1 = require("../../utils/randomName");
7
+ const TENANT_ID = '<default>';
8
+ const TENANT_CLUSTER_VAR_NAMES = {
9
+ ORIGINAL_JSON: 'ORIGINAL_API_INFO',
10
+ UPDATABLE_JSON: 'UPDATABLE_API_INFO',
11
+ ORIGINAL_STRING: 'ORIGINAL_APP_VERSION',
12
+ UPDATABLE_STRING: 'UPDATABLE_APP_VERSION',
13
+ };
14
+ const clusterVariableJsonValue = process.env.CLUSTER_VARIABLE_JSON_VALUE || process.env.CLUSTER_VARIABLE_JSON;
15
+ const clusterVariableStringValue = process.env.CLUSTER_VARIABLE_STRING_VALUE || 'v1.0.0';
16
+ function getConfigByType(type) {
17
+ const configs = {
18
+ JSON: {
19
+ processName: 'Tenant Cluster Variable Original JSON',
20
+ processNameUpdatable: 'Tenant Cluster Variable Updatable JSON',
21
+ taskName: 'Preview JSON tenant cluster variables',
22
+ taskElementId: 'Activity_TenantJsonPreview',
23
+ originalVariableName: TENANT_CLUSTER_VAR_NAMES.ORIGINAL_JSON,
24
+ updatableVariableName: TENANT_CLUSTER_VAR_NAMES.UPDATABLE_JSON,
25
+ originalValue: originalJsonClusterVariableValue,
26
+ operateVariableName: 'URL',
27
+ randomValuePrefix: 'https://updated.tenant.api.com',
28
+ },
29
+ String: {
30
+ processName: 'Tenant Cluster Variable Original String',
31
+ processNameUpdatable: 'Tenant Cluster Variable Updatable String',
32
+ taskName: 'Preview String tenant cluster variable',
33
+ taskElementId: 'Activity_TenantStringPreview',
34
+ originalVariableName: TENANT_CLUSTER_VAR_NAMES.ORIGINAL_STRING,
35
+ updatableVariableName: TENANT_CLUSTER_VAR_NAMES.UPDATABLE_STRING,
36
+ originalValue: originalStringClusterVariableValue,
37
+ operateVariableName: 'APP_VERSION_VALUE',
38
+ randomValuePrefix: 'v3.0.0-tenant-updated',
39
+ },
40
+ };
41
+ return configs[type];
42
+ }
43
+ let authToken;
44
+ let originalJsonClusterVariableValue;
45
+ let originalStringClusterVariableValue;
46
+ let jsonProcessKeyDisplay;
47
+ let jsonProcessKeyUpdate;
48
+ let stringProcessKeyDisplay;
49
+ let stringProcessKeyUpdate;
50
+ if (process.env.IS_MT === 'true') {
51
+ SM_8_11_1.test.describe.configure({ mode: 'parallel' });
52
+ SM_8_11_1.test.describe('Tenant-Scoped Cluster Variables User Flows', () => {
53
+ SM_8_11_1.test.beforeAll(async () => {
54
+ authToken = await (0, apiHelpers_1.authSmAPI)();
55
+ if (!clusterVariableJsonValue) {
56
+ throw new Error('Neither CLUSTER_VARIABLE_JSON_VALUE nor CLUSTER_VARIABLE_JSON env var is set');
57
+ }
58
+ const jsonValue = JSON.parse(clusterVariableJsonValue);
59
+ await Promise.all([
60
+ (0, apiHelpers_1.createTenantClusterVariable)(authToken, 'sm', TENANT_ID, TENANT_CLUSTER_VAR_NAMES.ORIGINAL_JSON, jsonValue),
61
+ (0, apiHelpers_1.createTenantClusterVariable)(authToken, 'sm', TENANT_ID, TENANT_CLUSTER_VAR_NAMES.UPDATABLE_JSON, jsonValue),
62
+ (0, apiHelpers_1.createTenantClusterVariable)(authToken, 'sm', TENANT_ID, TENANT_CLUSTER_VAR_NAMES.ORIGINAL_STRING, clusterVariableStringValue),
63
+ (0, apiHelpers_1.createTenantClusterVariable)(authToken, 'sm', TENANT_ID, TENANT_CLUSTER_VAR_NAMES.UPDATABLE_STRING, clusterVariableStringValue),
64
+ ]);
65
+ originalJsonClusterVariableValue = jsonValue;
66
+ originalStringClusterVariableValue = clusterVariableStringValue;
67
+ const deployments = [
68
+ {
69
+ path: './resources/cluster_variables/cluster_variable_tenant_json_readonly.bpmn',
70
+ assignTo: 'jsonProcessKeyDisplay',
71
+ },
72
+ {
73
+ path: './resources/cluster_variables/cluster_variable_tenant_json_mutable.bpmn',
74
+ assignTo: 'jsonProcessKeyUpdate',
75
+ },
76
+ {
77
+ path: './resources/cluster_variables/cluster_variable_json_form.form',
78
+ assignTo: null,
79
+ },
80
+ {
81
+ path: './resources/cluster_variables/cluster_variable_tenant_string_readonly.bpmn',
82
+ assignTo: 'stringProcessKeyDisplay',
83
+ },
84
+ {
85
+ path: './resources/cluster_variables/cluster_variable_tenant_string_mutable.bpmn',
86
+ assignTo: 'stringProcessKeyUpdate',
87
+ },
88
+ {
89
+ path: './resources/cluster_variables/cluster_variable_string_form.form',
90
+ assignTo: null,
91
+ },
92
+ ];
93
+ const deploymentResults = await Promise.all(deployments.map((d) => (0, apiHelpers_1.deployProcess)(d.path, authToken)));
94
+ jsonProcessKeyDisplay = deploymentResults[0];
95
+ jsonProcessKeyUpdate = deploymentResults[1];
96
+ stringProcessKeyDisplay = deploymentResults[3];
97
+ stringProcessKeyUpdate = deploymentResults[4];
98
+ });
99
+ SM_8_11_1.test.beforeEach(async ({ navigationPage }, testInfo) => {
100
+ await navigationPage.goToOperate((testInfo.workerIndex + 1) * 1000);
101
+ });
102
+ SM_8_11_1.test.afterEach(async ({ page }, testInfo) => {
103
+ await (0, _setup_1.captureScreenshot)(page, testInfo);
104
+ await (0, _setup_1.captureFailureVideo)(page, testInfo);
105
+ });
106
+ SM_8_11_1.test.describe('Tenant cluster variable', () => {
107
+ const testConfigs = [
108
+ {
109
+ type: 'JSON',
110
+ processKeyDisplay: () => jsonProcessKeyDisplay,
111
+ processKeyUpdate: () => jsonProcessKeyUpdate,
112
+ },
113
+ {
114
+ type: 'String',
115
+ processKeyDisplay: () => stringProcessKeyDisplay,
116
+ processKeyUpdate: () => stringProcessKeyUpdate,
117
+ },
118
+ ];
119
+ for (const config of testConfigs) {
120
+ (0, SM_8_11_1.test)(`User views ${config.type} tenant cluster variable in Tasklist from readonly process and completes task`, async ({ navigationPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, taskPanelPage, taskDetailsPage, }) => {
121
+ SM_8_11_1.test.slow();
122
+ const derived = getConfigByType(config.type);
123
+ const instanceKey = await (0, apiHelpers_1.createProcessInstance)(String(config.processKeyDisplay()), authToken);
124
+ await SM_8_11_1.test.step('User can access the process on operate', async () => {
125
+ await operateHomePage.clickProcessesTab();
126
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
127
+ await operateProcessesPage.clickProcessInstanceLink(String(instanceKey));
128
+ await operateProcessInstancePage.assertActiveTokenIsPresent();
129
+ });
130
+ await SM_8_11_1.test.step(`User can view the process with ${config.type} tenant cluster variable on tasklist`, async () => {
131
+ await navigationPage.goToTasklist();
132
+ await taskPanelPage.openTask(derived.taskName, true, derived.taskElementId);
133
+ await taskDetailsPage.clickAssignToMeButton();
134
+ });
135
+ await SM_8_11_1.test.step(`User can view the value of ${config.type} tenant 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 SM_8_11_1.test.step('User can assert the process is completed on Operate', async () => {
147
+ await navigationPage.goToOperate();
148
+ await operateHomePage.clickProcessesTab();
149
+ await operateProcessesPage.clickProcessCompletedCheckbox();
150
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
151
+ await operateProcessesPage.clickProcessInstanceLink(String(instanceKey), 'completed');
152
+ await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
153
+ });
154
+ });
155
+ }
156
+ for (const config of testConfigs) {
157
+ (0, SM_8_11_1.test)(`User updates ${config.type} tenant cluster variable in Admin UI and verifies changes in Operate`, async ({ navigationPage, ocIdentityHomePage, ocIdentityClusterVariablesPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
158
+ SM_8_11_1.test.slow();
159
+ const derived = getConfigByType(config.type);
160
+ const randomRawValue = await (0, randomName_1.randomNameAgregator)(derived.randomValuePrefix);
161
+ const newValue = config.type === 'JSON'
162
+ ? JSON.stringify({
163
+ endpoint: randomRawValue,
164
+ timeout_ms: '5000',
165
+ array: ['updated_item1', 'updated_item2'],
166
+ })
167
+ : JSON.stringify(randomRawValue);
168
+ await SM_8_11_1.test.step('User navigates to Admin UI', async () => {
169
+ await navigationPage.goToOCAdmin();
170
+ });
171
+ await SM_8_11_1.test.step('User navigates to Cluster Variables tab', async () => {
172
+ await ocIdentityHomePage.clickClusterVariablesTab();
173
+ });
174
+ await SM_8_11_1.test.step(`User verifies ${config.type} tenant cluster variable exists`, async () => {
175
+ await ocIdentityClusterVariablesPage.assertVariableExists(derived.updatableVariableName, TENANT_ID);
176
+ });
177
+ await SM_8_11_1.test.step(`User updates the ${config.type} tenant cluster variable value`, async () => {
178
+ await ocIdentityClusterVariablesPage.editVariable(derived.updatableVariableName, newValue, TENANT_ID);
179
+ });
180
+ await SM_8_11_1.test.step(`User creates a process instance with the updated ${config.type} tenant cluster variable`, async () => {
181
+ const instanceKey = await (0, apiHelpers_1.createProcessInstance)(String(config.processKeyUpdate()), authToken);
182
+ await SM_8_11_1.test.step('User navigates to the process instance on Operate', async () => {
183
+ await navigationPage.goToOperate();
184
+ await operateHomePage.clickProcessesTab();
185
+ await operateProcessesPage.clickProcessCompletedCheckbox();
186
+ await operateProcessesPage.applyMoreFilters('Process Instance Key(s)', String(instanceKey));
187
+ await operateProcessesPage.clickProcessInstanceLink(String(instanceKey), 'completed');
188
+ await operateProcessInstancePage.assertProcessCompleteStatusWithRetry();
189
+ });
190
+ await SM_8_11_1.test.step(`User verifies the updated ${config.type} tenant cluster variable value is present in process variables`, async () => {
191
+ await operateProcessInstancePage.assertProcessVariableContainsText(derived.operateVariableName, randomRawValue);
192
+ });
193
+ });
194
+ });
195
+ }
196
+ });
197
+ });
198
+ }