@camunda/e2e-test-suite 0.0.688 → 0.0.690

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.
@@ -772,7 +772,7 @@ class ModelerCreatePage {
772
772
  await this.clickMarketPlaceButton();
773
773
  const connectorMarketplacePage = new ConnectorMarketplacePage_1.ConnectorMarketplacePage(this.page);
774
774
  await connectorMarketplacePage.clickSearchForConnectorTextbox();
775
- await connectorMarketplacePage.fillSearchForConnectorTextbox('Public Holiday Connector');
775
+ await connectorMarketplacePage.fillSearchForConnectorTextbox('Worldwide Public Holiday');
776
776
  await (0, sleep_1.sleep)(10000);
777
777
  await connectorMarketplacePage.downloadConnectorToProject();
778
778
  }
@@ -781,7 +781,18 @@ class ModelerCreatePage {
781
781
  await this.secondElement.click({ timeout: 60000 });
782
782
  await this.clickChangeTypeButton();
783
783
  await (0, test_1.expect)(this.marketPlaceButton).toBeVisible({ timeout: 60000 });
784
- await this.publicHolidayConnectorOption.click({ timeout: 120000 });
784
+ // Filter the virtualized change-element popup so the option scrolls into view
785
+ const changeElementSearch = this.page.locator('.djs-popup-search input');
786
+ if (await changeElementSearch
787
+ .isVisible({ timeout: 5000 })
788
+ .catch(() => false)) {
789
+ await changeElementSearch.pressSequentially('Worldwide Public Holiday', { delay: 50 });
790
+ }
791
+ await this.publicHolidayConnectorOption.waitFor({
792
+ state: 'visible',
793
+ timeout: 60000,
794
+ });
795
+ await this.publicHolidayConnectorOption.click({ timeout: 30000 });
785
796
  return;
786
797
  }
787
798
  catch (error) {
@@ -5,11 +5,38 @@ const _8_10_1 = require("../../fixtures/8.10");
5
5
  const apiHelpers_1 = require("../../utils/apiHelpers");
6
6
  const randomName_1 = require("../../utils/randomName");
7
7
  _8_10_1.test.describe.configure({ mode: 'parallel' });
8
+ const expectUnauthorizedErrorBody = (body) => {
9
+ if (body === null || body === undefined)
10
+ return;
11
+ if (typeof body === 'string') {
12
+ return;
13
+ }
14
+ (0, test_1.expect)(typeof body).toBe('object');
15
+ const errorBody = body;
16
+ const errorMessage = errorBody.message ?? errorBody.error ?? errorBody.title ?? errorBody.detail;
17
+ (0, test_1.expect)(typeof errorMessage).toBe('string');
18
+ (0, test_1.expect)(errorMessage.trim().length).toBeGreaterThan(0);
19
+ };
20
+ const assertUnauthorizedResponseBody = async (response) => {
21
+ (0, test_1.expect)(response.status()).toBe(401);
22
+ const rawBody = await response.text();
23
+ if (rawBody.trim().length === 0)
24
+ return;
25
+ let body = rawBody;
26
+ try {
27
+ body = JSON.parse(rawBody);
28
+ }
29
+ catch {
30
+ body = rawBody;
31
+ }
32
+ expectUnauthorizedErrorBody(body);
33
+ };
8
34
  _8_10_1.test.describe('API optimize SaaS Tests', () => {
9
35
  let optimizeCookie;
10
36
  let optimizeBearerToken;
11
37
  let collectionIdValue;
12
38
  let dashboardIdValue;
39
+ let dashboardNameValue;
13
40
  let reportId;
14
41
  let baseUrl;
15
42
  _8_10_1.test.beforeAll(async ({ browser, request }) => {
@@ -33,8 +60,9 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
33
60
  },
34
61
  ],
35
62
  });
63
+ dashboardNameValue = await (0, randomName_1.randomNameAgregator)('Test Dashboard');
36
64
  dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
37
- name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
65
+ name: dashboardNameValue,
38
66
  optimizeCookie,
39
67
  collectionId: collectionIdValue,
40
68
  });
@@ -64,18 +92,22 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
64
92
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
65
93
  const body = await response.json();
66
94
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
95
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
96
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
97
+ const ids = body.map((d) => d.id);
98
+ (0, test_1.expect)(ids).toContain(dashboardIdValue);
67
99
  });
68
100
  });
69
101
  (0, _8_10_1.test)('Get dashboards without token returns 401', async ({ request }) => {
70
102
  await _8_10_1.test.step('GET /api/public/dashboard without token (401)', async () => {
71
103
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`);
72
- (0, test_1.expect)(response.status()).toBe(401);
104
+ await assertUnauthorizedResponseBody(response);
73
105
  });
74
106
  });
75
107
  (0, _8_10_1.test)('Get dashboards with invalid token returns 401', async ({ request }) => {
76
108
  await _8_10_1.test.step('GET /api/public/dashboard with invalid token (401)', async () => {
77
109
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
78
- (0, test_1.expect)(response.status()).toBe(401);
110
+ await assertUnauthorizedResponseBody(response);
79
111
  });
80
112
  });
81
113
  (0, _8_10_1.test)('GET /api/public/dashboard/force-internal-error returns 500', async ({ request, }) => {
@@ -96,6 +128,15 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
96
128
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
97
129
  const body = await response.json();
98
130
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
131
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
132
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
133
+ (0, test_1.expect)(body[0].id).toBe(dashboardIdValue);
134
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
135
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
136
+ (0, test_1.expect)(body[0]).toHaveProperty('name');
137
+ (0, test_1.expect)(body[0].name).toBe(dashboardNameValue);
138
+ (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
139
+ (0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
99
140
  });
100
141
  });
101
142
  (0, _8_10_1.test)('Export dashboards without token returns 401', async ({ request }) => {
@@ -104,7 +145,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
104
145
  headers: { 'Content-Type': 'application/json' },
105
146
  data: [dashboardIdValue],
106
147
  });
107
- (0, test_1.expect)(response.status()).toBe(401);
148
+ await assertUnauthorizedResponseBody(response);
108
149
  });
109
150
  });
110
151
  (0, _8_10_1.test)('Export dashboards with invalid token returns 401', async ({ request, }) => {
@@ -116,7 +157,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
116
157
  },
117
158
  data: [dashboardIdValue],
118
159
  });
119
- (0, test_1.expect)(response.status()).toBe(401);
160
+ await assertUnauthorizedResponseBody(response);
120
161
  });
121
162
  });
122
163
  (0, _8_10_1.test)('Export dashboard with invalid body returns 400', async ({ request }) => {
@@ -162,7 +203,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
162
203
  (0, _8_10_1.test)('Delete dashboard with invalid token returns 401', async ({ request }) => {
163
204
  await _8_10_1.test.step('DELETE /api/public/dashboard with invalid token (401)', async () => {
164
205
  const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
165
- (0, test_1.expect)(response.status()).toBe(401);
206
+ await assertUnauthorizedResponseBody(response);
166
207
  });
167
208
  });
168
209
  (0, _8_10_1.test)('Delete non-existent dashboard returns 404', async ({ request }) => {
@@ -178,12 +219,16 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
178
219
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
179
220
  const body = await response.json();
180
221
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
222
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
223
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
224
+ const ids = body.map((r) => r.id);
225
+ (0, test_1.expect)(ids).toContain(reportId);
181
226
  });
182
227
  });
183
228
  (0, _8_10_1.test)('Get reports with invalid token returns 401', async ({ request }) => {
184
229
  await _8_10_1.test.step('GET /api/public/report with invalid token (401)', async () => {
185
230
  const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
186
- (0, test_1.expect)(response.status()).toBe(401);
231
+ await assertUnauthorizedResponseBody(response);
187
232
  });
188
233
  });
189
234
  (0, _8_10_1.test)('Export reports successfully returns 200 with full payload', async ({ request, }) => {
@@ -200,9 +245,15 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
200
245
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
201
246
  (0, test_1.expect)(body.length).toBeGreaterThan(0);
202
247
  (0, test_1.expect)(body[0]).toHaveProperty('id');
248
+ (0, test_1.expect)(body[0].id).toBe(reportId);
203
249
  (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
250
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
204
251
  (0, test_1.expect)(body[0]).toHaveProperty('name');
252
+ (0, test_1.expect)(body[0].name).toBe('Blank report');
205
253
  (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
254
+ (0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
255
+ (0, test_1.expect)(body[0]).toHaveProperty('data');
256
+ (0, test_1.expect)(body[0].data).toBeTruthy();
206
257
  });
207
258
  });
208
259
  (0, _8_10_1.test)('Export reports with invalid token returns 401', async ({ request }) => {
@@ -214,7 +265,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
214
265
  },
215
266
  data: [reportId],
216
267
  });
217
- (0, test_1.expect)(response.status()).toBe(401);
268
+ await assertUnauthorizedResponseBody(response);
218
269
  });
219
270
  });
220
271
  (0, _8_10_1.test)('Export non-existent report returns 404', async ({ request }) => {
@@ -257,7 +308,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
257
308
  (0, _8_10_1.test)('Delete report with invalid token returns 401', async ({ request }) => {
258
309
  await _8_10_1.test.step('DELETE /api/public/report with invalid token (401)', async () => {
259
310
  const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
260
- (0, test_1.expect)(response.status()).toBe(401);
311
+ await assertUnauthorizedResponseBody(response);
261
312
  });
262
313
  });
263
314
  (0, _8_10_1.test)('Import entities successfully (200)', async ({ request }) => {
@@ -278,6 +329,9 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
278
329
  data: entitiesToImport,
279
330
  });
280
331
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
332
+ const importResult = await response.json();
333
+ (0, test_1.expect)(Array.isArray(importResult)).toBeTruthy();
334
+ (0, test_1.expect)(importResult.length).toBeGreaterThan(0);
281
335
  });
282
336
  (0, _8_10_1.test)('Import without token or invalid token returns 401', async ({ request, }) => {
283
337
  const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
@@ -296,7 +350,7 @@ _8_10_1.test.describe('API optimize SaaS Tests', () => {
296
350
  },
297
351
  data: entitiesToImport,
298
352
  });
299
- (0, test_1.expect)(response.status()).toBe(401);
353
+ await assertUnauthorizedResponseBody(response);
300
354
  });
301
355
  // Skipped due to bug 40497: https://github.com/camunda/camunda/issues/40497
302
356
  _8_10_1.test.skip('Import to non-existent collection (404)', async ({ request }) => {
@@ -325,6 +379,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
325
379
  let optimizeBearerToken;
326
380
  let conditionalEventsCollectionId;
327
381
  let conditionalEventsReportId;
382
+ let conditionalEventsReportName;
328
383
  let baseUrl;
329
384
  const CONDITIONAL_EVENTS_PROCESS_KEY = 'conditional-events-auto-process';
330
385
  _8_10_1.test.beforeAll(async ({ browser, request }) => {
@@ -347,10 +402,11 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
347
402
  },
348
403
  ],
349
404
  });
405
+ conditionalEventsReportName = await (0, randomName_1.randomNameAgregator)('Conditional Events Report');
350
406
  conditionalEventsReportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
351
407
  optimizeCookie,
352
408
  collectionId: conditionalEventsCollectionId,
353
- name: await (0, randomName_1.randomNameAgregator)('Conditional Events Report'),
409
+ name: conditionalEventsReportName,
354
410
  definitions: [
355
411
  {
356
412
  key: CONDITIONAL_EVENTS_PROCESS_KEY,
@@ -417,9 +473,15 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
417
473
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
418
474
  (0, test_1.expect)(body.length).toBeGreaterThan(0);
419
475
  (0, test_1.expect)(body[0]).toHaveProperty('id');
476
+ (0, test_1.expect)(body[0].id).toBe(conditionalEventsReportId);
420
477
  (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
478
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
421
479
  (0, test_1.expect)(body[0]).toHaveProperty('name');
480
+ (0, test_1.expect)(body[0].name).toBe(conditionalEventsReportName);
422
481
  (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
482
+ (0, test_1.expect)(body[0].collectionId).toBe(conditionalEventsCollectionId);
483
+ (0, test_1.expect)(body[0]).toHaveProperty('data');
484
+ (0, test_1.expect)(body[0].data).toBeTruthy();
423
485
  });
424
486
  });
425
487
  (0, _8_10_1.test)('CE-OPT-11: Exporting the Conditional Events report without a token returns 401', async ({ request, }) => {
@@ -428,7 +490,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
428
490
  headers: { 'Content-Type': 'application/json' },
429
491
  data: [conditionalEventsReportId],
430
492
  });
431
- (0, test_1.expect)(response.status()).toBe(401);
493
+ await assertUnauthorizedResponseBody(response);
432
494
  });
433
495
  });
434
496
  (0, _8_10_1.test)('CE-OPT-12: Exporting the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
@@ -440,7 +502,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
440
502
  },
441
503
  data: [conditionalEventsReportId],
442
504
  });
443
- (0, test_1.expect)(response.status()).toBe(401);
505
+ await assertUnauthorizedResponseBody(response);
444
506
  });
445
507
  });
446
508
  (0, _8_10_1.test)('CE-OPT-13: Deleting the Conditional Events report via API succeeds with HTTP 200', async ({ request, }) => {
@@ -490,7 +552,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
490
552
  (0, _8_10_1.test)('CE-OPT-15: Attempting to delete the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
491
553
  await _8_10_1.test.step('Delete report with invalid token (401)', async () => {
492
554
  const response = await request.delete(`${baseUrl}/api/public/report/${conditionalEventsReportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
493
- (0, test_1.expect)(response.status()).toBe(401);
555
+ await assertUnauthorizedResponseBody(response);
494
556
  });
495
557
  });
496
558
  });
@@ -531,13 +593,13 @@ _8_10_1.test.describe('API optimize SaaS Tests - Sharing', () => {
531
593
  (0, _8_10_1.test)('Enable sharing without token returns 401', async ({ request }) => {
532
594
  await _8_10_1.test.step('POST /api/public/share/enable without token (401)', async () => {
533
595
  const response = await request.post(`${baseUrl}/api/public/share/enable`);
534
- (0, test_1.expect)(response.status()).toBe(401);
596
+ await assertUnauthorizedResponseBody(response);
535
597
  });
536
598
  });
537
599
  (0, _8_10_1.test)('Enable sharing with invalid token returns 401', async ({ request }) => {
538
600
  await _8_10_1.test.step('POST /api/public/share/enable with invalid token (401)', async () => {
539
601
  const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: 'Bearer invalid_token' } });
540
- (0, test_1.expect)(response.status()).toBe(401);
602
+ await assertUnauthorizedResponseBody(response);
541
603
  });
542
604
  });
543
605
  (0, _8_10_1.test)('Disable sharing with valid token returns 200 or 204', async ({ request, }) => {
@@ -549,13 +611,13 @@ _8_10_1.test.describe('API optimize SaaS Tests - Sharing', () => {
549
611
  (0, _8_10_1.test)('Disable sharing without token returns 401', async ({ request }) => {
550
612
  await _8_10_1.test.step('POST /api/public/share/disable without token (401)', async () => {
551
613
  const response = await request.post(`${baseUrl}/api/public/share/disable`);
552
- (0, test_1.expect)(response.status()).toBe(401);
614
+ await assertUnauthorizedResponseBody(response);
553
615
  });
554
616
  });
555
617
  (0, _8_10_1.test)('Disable sharing with invalid token returns 401', async ({ request }) => {
556
618
  await _8_10_1.test.step('POST /api/public/share/disable with invalid token (401)', async () => {
557
619
  const response = await request.post(`${baseUrl}/api/public/share/disable`, { headers: { Authorization: 'Bearer invalid_token' } });
558
- (0, test_1.expect)(response.status()).toBe(401);
620
+ await assertUnauthorizedResponseBody(response);
559
621
  });
560
622
  });
561
623
  (0, _8_10_1.test)('Sharing toggle cycle: enable then disable is idempotent', async ({ request, }) => {
@@ -602,6 +664,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Dashboard and Report GET edge c
602
664
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
603
665
  const body = await response.json();
604
666
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
667
+ (0, test_1.expect)(body.every((dashboard) => typeof dashboard.id === 'string' && dashboard.id.length > 0)).toBeTruthy();
605
668
  });
606
669
  });
607
670
  (0, _8_10_1.test)('GET dashboards without collectionId param returns 400 or 500', async ({ request, }) => {
@@ -618,6 +681,7 @@ _8_10_1.test.describe('API optimize SaaS Tests - Dashboard and Report GET edge c
618
681
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
619
682
  const body = await response.json();
620
683
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
684
+ (0, test_1.expect)(body.length).toBe(0);
621
685
  });
622
686
  });
623
687
  (0, _8_10_1.test)('GET reports without collectionId param returns 400 or 500', async ({ request, }) => {
@@ -707,6 +771,11 @@ _8_10_1.test.describe('API optimize SaaS Tests - Export edge cases', () => {
707
771
  const body = await response.json();
708
772
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
709
773
  (0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
774
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
775
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
776
+ const exportedIds = body.map((d) => d.id);
777
+ (0, test_1.expect)(exportedIds).toContain(dashboardId1);
778
+ (0, test_1.expect)(exportedIds).toContain(dashboardId2);
710
779
  });
711
780
  });
712
781
  (0, _8_10_1.test)('Export multiple reports in a single call returns 200 with all definitions', async ({ request, }) => {
@@ -722,6 +791,11 @@ _8_10_1.test.describe('API optimize SaaS Tests - Export edge cases', () => {
722
791
  const body = await response.json();
723
792
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
724
793
  (0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
794
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
795
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
796
+ const exportedIds = body.map((d) => d.id);
797
+ (0, test_1.expect)(exportedIds).toContain(reportId1);
798
+ (0, test_1.expect)(exportedIds).toContain(reportId2);
725
799
  });
726
800
  });
727
801
  (0, _8_10_1.test)('Export reports with empty array body returns 200 with empty array', async ({ request, }) => {
@@ -766,20 +840,20 @@ _8_10_1.test.describe('API optimize SaaS Tests - Auth edge cases', () => {
766
840
  'invalidsignature';
767
841
  await _8_10_1.test.step('GET /api/public/dashboard with expired token returns 401', async () => {
768
842
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: expiredToken } });
769
- (0, test_1.expect)(response.status()).toBe(401);
843
+ await assertUnauthorizedResponseBody(response);
770
844
  });
771
845
  });
772
846
  (0, _8_10_1.test)('Malformed Bearer value (empty string) returns 401 on dashboard endpoint', async ({ request, }) => {
773
847
  await _8_10_1.test.step('GET /api/public/dashboard with empty Bearer value returns 401', async () => {
774
848
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: 'Bearer ' } });
775
- (0, test_1.expect)(response.status()).toBe(401);
849
+ await assertUnauthorizedResponseBody(response);
776
850
  });
777
851
  });
778
852
  (0, _8_10_1.test)('Token with wrong audience returns 401 on dashboard endpoint', async ({ request, }) => {
779
853
  await _8_10_1.test.step('Use a Zeebe-audience token against Optimize API and expect 401', async () => {
780
854
  const wrongAudienceToken = await (0, apiHelpers_1.authSaasAPI)();
781
855
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: wrongAudienceToken } });
782
- (0, test_1.expect)(response.status()).toBe(401);
856
+ await assertUnauthorizedResponseBody(response);
783
857
  });
784
858
  });
785
859
  });
@@ -799,7 +873,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
799
873
  const response = await request.get(`${apiUrl()}/v2/topology`, {
800
874
  headers: { 'Content-Type': 'application/json' },
801
875
  });
802
- (0, test_1.expect)(response.status()).toBe(401);
876
+ await assertUnauthorizedResponseBody(response);
803
877
  });
804
878
  (0, _8_10_1.test)('POST /v2/process-definitions/search returns 200 with items array', async ({ request, }) => {
805
879
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -821,7 +895,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
821
895
  headers: { 'Content-Type': 'application/json' },
822
896
  data: { filter: {}, size: 10 },
823
897
  });
824
- (0, test_1.expect)(response.status()).toBe(401);
898
+ await assertUnauthorizedResponseBody(response);
825
899
  });
826
900
  (0, _8_10_1.test)('POST /v2/process-definitions/search with invalid token returns 401', async ({ request, }) => {
827
901
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -831,7 +905,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
831
905
  },
832
906
  data: { filter: {}, size: 10 },
833
907
  });
834
- (0, test_1.expect)(response.status()).toBe(401);
908
+ await assertUnauthorizedResponseBody(response);
835
909
  });
836
910
  (0, _8_10_1.test)('POST /v2/process-definitions/search with size 1 returns pagination cursor', async ({ request, }) => {
837
911
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -885,7 +959,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
885
959
  headers: { 'Content-Type': 'application/json' },
886
960
  data: { filter: {}, size: 10 },
887
961
  });
888
- (0, test_1.expect)(response.status()).toBe(401);
962
+ await assertUnauthorizedResponseBody(response);
889
963
  });
890
964
  (0, _8_10_1.test)('POST /v2/process-instances/search with invalid token returns 401', async ({ request, }) => {
891
965
  const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
@@ -895,7 +969,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
895
969
  },
896
970
  data: { filter: {}, size: 10 },
897
971
  });
898
- (0, test_1.expect)(response.status()).toBe(401);
972
+ await assertUnauthorizedResponseBody(response);
899
973
  });
900
974
  (0, _8_10_1.test)('POST /v2/user-tasks/search returns 200 with items array', async ({ request, }) => {
901
975
  const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
@@ -914,7 +988,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
914
988
  headers: { 'Content-Type': 'application/json' },
915
989
  data: { filter: {}, size: 10 },
916
990
  });
917
- (0, test_1.expect)(response.status()).toBe(401);
991
+ await assertUnauthorizedResponseBody(response);
918
992
  });
919
993
  (0, _8_10_1.test)('POST /v2/user-tasks/search with invalid token returns 401', async ({ request, }) => {
920
994
  const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
@@ -924,7 +998,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
924
998
  },
925
999
  data: { filter: {}, size: 10 },
926
1000
  });
927
- (0, test_1.expect)(response.status()).toBe(401);
1001
+ await assertUnauthorizedResponseBody(response);
928
1002
  });
929
1003
  (0, _8_10_1.test)('POST /v2/variables/search returns 200 with items array', async ({ request, }) => {
930
1004
  const response = await request.post(`${apiUrl()}/v2/variables/search`, {
@@ -943,7 +1017,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
943
1017
  headers: { 'Content-Type': 'application/json' },
944
1018
  data: { filter: {}, size: 10 },
945
1019
  });
946
- (0, test_1.expect)(response.status()).toBe(401);
1020
+ await assertUnauthorizedResponseBody(response);
947
1021
  });
948
1022
  (0, _8_10_1.test)('POST /v2/variables/search with invalid token returns 401', async ({ request, }) => {
949
1023
  const response = await request.post(`${apiUrl()}/v2/variables/search`, {
@@ -953,7 +1027,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
953
1027
  },
954
1028
  data: { filter: {}, size: 10 },
955
1029
  });
956
- (0, test_1.expect)(response.status()).toBe(401);
1030
+ await assertUnauthorizedResponseBody(response);
957
1031
  });
958
1032
  (0, _8_10_1.test)('POST /v2/incidents/search returns 200 with items array', async ({ request, }) => {
959
1033
  const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
@@ -972,7 +1046,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
972
1046
  headers: { 'Content-Type': 'application/json' },
973
1047
  data: { filter: {}, size: 10 },
974
1048
  });
975
- (0, test_1.expect)(response.status()).toBe(401);
1049
+ await assertUnauthorizedResponseBody(response);
976
1050
  });
977
1051
  (0, _8_10_1.test)('POST /v2/incidents/search with invalid token returns 401', async ({ request, }) => {
978
1052
  const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
@@ -982,7 +1056,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
982
1056
  },
983
1057
  data: { filter: {}, size: 10 },
984
1058
  });
985
- (0, test_1.expect)(response.status()).toBe(401);
1059
+ await assertUnauthorizedResponseBody(response);
986
1060
  });
987
1061
  (0, _8_10_1.test)('POST /v2/decision-definitions/search returns 200 with items array', async ({ request, }) => {
988
1062
  const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
@@ -1004,7 +1078,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1004
1078
  headers: { 'Content-Type': 'application/json' },
1005
1079
  data: { filter: {}, size: 10 },
1006
1080
  });
1007
- (0, test_1.expect)(response.status()).toBe(401);
1081
+ await assertUnauthorizedResponseBody(response);
1008
1082
  });
1009
1083
  (0, _8_10_1.test)('POST /v2/decision-definitions/search with invalid token returns 401', async ({ request, }) => {
1010
1084
  const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
@@ -1014,7 +1088,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1014
1088
  },
1015
1089
  data: { filter: {}, size: 10 },
1016
1090
  });
1017
- (0, test_1.expect)(response.status()).toBe(401);
1091
+ await assertUnauthorizedResponseBody(response);
1018
1092
  });
1019
1093
  (0, _8_10_1.test)('POST /v2/decision-instances/search returns 200 with items array', async ({ request, }) => {
1020
1094
  const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
@@ -1036,7 +1110,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1036
1110
  headers: { 'Content-Type': 'application/json' },
1037
1111
  data: { filter: {}, size: 10 },
1038
1112
  });
1039
- (0, test_1.expect)(response.status()).toBe(401);
1113
+ await assertUnauthorizedResponseBody(response);
1040
1114
  });
1041
1115
  (0, _8_10_1.test)('POST /v2/decision-instances/search with invalid token returns 401', async ({ request, }) => {
1042
1116
  const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
@@ -1046,7 +1120,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1046
1120
  },
1047
1121
  data: { filter: {}, size: 10 },
1048
1122
  });
1049
- (0, test_1.expect)(response.status()).toBe(401);
1123
+ await assertUnauthorizedResponseBody(response);
1050
1124
  });
1051
1125
  (0, _8_10_1.test)('POST /v2/flownode-instances/search returns 200 with items array', async ({ request, }) => {
1052
1126
  const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
@@ -1068,7 +1142,7 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1068
1142
  headers: { 'Content-Type': 'application/json' },
1069
1143
  data: { filter: {}, size: 10 },
1070
1144
  });
1071
- (0, test_1.expect)(response.status()).toBe(401);
1145
+ await assertUnauthorizedResponseBody(response);
1072
1146
  });
1073
1147
  (0, _8_10_1.test)('POST /v2/flownode-instances/search with invalid token returns 401', async ({ request, }) => {
1074
1148
  const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
@@ -1078,6 +1152,6 @@ _8_10_1.test.describe('API V2 tests on SaaS cluster', () => {
1078
1152
  },
1079
1153
  data: { filter: {}, size: 10 },
1080
1154
  });
1081
- (0, test_1.expect)(response.status()).toBe(401);
1155
+ await assertUnauthorizedResponseBody(response);
1082
1156
  });
1083
1157
  });
@@ -6,11 +6,38 @@ const constants_1 = require("../../utils/constants");
6
6
  const apiHelpers_1 = require("../../utils/apiHelpers");
7
7
  const randomName_1 = require("../../utils/randomName");
8
8
  _8_9_1.test.describe.configure({ mode: 'parallel' });
9
+ const expectUnauthorizedErrorBody = (body) => {
10
+ if (body === null || body === undefined)
11
+ return;
12
+ if (typeof body === 'string') {
13
+ return;
14
+ }
15
+ (0, test_1.expect)(typeof body).toBe('object');
16
+ const errorBody = body;
17
+ const errorMessage = errorBody.message ?? errorBody.error ?? errorBody.title ?? errorBody.detail;
18
+ (0, test_1.expect)(typeof errorMessage).toBe('string');
19
+ (0, test_1.expect)(errorMessage.trim().length).toBeGreaterThan(0);
20
+ };
21
+ const assertUnauthorizedResponseBody = async (response) => {
22
+ (0, test_1.expect)(response.status()).toBe(401);
23
+ const rawBody = await response.text();
24
+ if (rawBody.trim().length === 0)
25
+ return;
26
+ let body = rawBody;
27
+ try {
28
+ body = JSON.parse(rawBody);
29
+ }
30
+ catch {
31
+ body = rawBody;
32
+ }
33
+ expectUnauthorizedErrorBody(body);
34
+ };
9
35
  _8_9_1.test.describe('API optimize SaaS Tests', () => {
10
36
  let optimizeCookie;
11
37
  let optimizeBearerToken;
12
38
  let collectionIdValue;
13
39
  let dashboardIdValue;
40
+ let dashboardNameValue;
14
41
  let reportId;
15
42
  let baseUrl;
16
43
  _8_9_1.test.beforeAll(async ({ browser, request }) => {
@@ -34,8 +61,9 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
34
61
  },
35
62
  ],
36
63
  });
64
+ dashboardNameValue = await (0, randomName_1.randomNameAgregator)('Test Dashboard');
37
65
  dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
38
- name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
66
+ name: dashboardNameValue,
39
67
  optimizeCookie,
40
68
  collectionId: collectionIdValue,
41
69
  });
@@ -68,18 +96,20 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
68
96
  (0, test_1.expect)(body.length).toBeGreaterThan(0);
69
97
  const dashboard = body[0];
70
98
  (0, test_1.expect)(dashboard).toHaveProperty('id');
99
+ const ids = body.map((d) => d.id);
100
+ (0, test_1.expect)(ids).toContain(dashboardIdValue);
71
101
  });
72
102
  });
73
103
  (0, _8_9_1.test)('Get dashboards without token returns 401', async ({ request }) => {
74
104
  await _8_9_1.test.step('GET /api/public/dashboard without token (401)', async () => {
75
105
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`);
76
- (0, test_1.expect)(response.status()).toBe(401);
106
+ await assertUnauthorizedResponseBody(response);
77
107
  });
78
108
  });
79
109
  (0, _8_9_1.test)('Get dashboards with invalid token returns 401', async ({ request }) => {
80
110
  await _8_9_1.test.step('GET /api/public/dashboard with invalid token (401)', async () => {
81
111
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
82
- (0, test_1.expect)(response.status()).toBe(401);
112
+ await assertUnauthorizedResponseBody(response);
83
113
  });
84
114
  });
85
115
  (0, _8_9_1.test)('GET /api/public/dashboard/force-internal-error returns 500', async ({ request, }) => {
@@ -100,6 +130,15 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
100
130
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
101
131
  const body = await response.json();
102
132
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
133
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
134
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
135
+ (0, test_1.expect)(body[0].id).toBe(dashboardIdValue);
136
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
137
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
138
+ (0, test_1.expect)(body[0]).toHaveProperty('name');
139
+ (0, test_1.expect)(body[0].name).toBe(dashboardNameValue);
140
+ (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
141
+ (0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
103
142
  });
104
143
  });
105
144
  (0, _8_9_1.test)('Export dashboards without token returns 401', async ({ request }) => {
@@ -108,7 +147,7 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
108
147
  headers: { 'Content-Type': 'application/json' },
109
148
  data: [dashboardIdValue],
110
149
  });
111
- (0, test_1.expect)(response.status()).toBe(401);
150
+ await assertUnauthorizedResponseBody(response);
112
151
  });
113
152
  });
114
153
  (0, _8_9_1.test)('Export dashboards with invalid token returns 401', async ({ request, }) => {
@@ -120,7 +159,7 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
120
159
  },
121
160
  data: [dashboardIdValue],
122
161
  });
123
- (0, test_1.expect)(response.status()).toBe(401);
162
+ await assertUnauthorizedResponseBody(response);
124
163
  });
125
164
  });
126
165
  (0, _8_9_1.test)('Export dashboard with invalid body returns 400', async ({ request }) => {
@@ -168,7 +207,7 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
168
207
  (0, _8_9_1.test)('Delete dashboard with invalid token returns 401', async ({ request }) => {
169
208
  await _8_9_1.test.step('DELETE /api/public/dashboard with invalid token (401)', async () => {
170
209
  const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
171
- (0, test_1.expect)(response.status()).toBe(401);
210
+ await assertUnauthorizedResponseBody(response);
172
211
  });
173
212
  });
174
213
  (0, _8_9_1.test)('Delete non-existent dashboard returns 404', async ({ request }) => {
@@ -184,12 +223,16 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
184
223
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
185
224
  const body = await response.json();
186
225
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
226
+ (0, test_1.expect)(body.length).toBeGreaterThan(0);
227
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
228
+ const ids = body.map((r) => r.id);
229
+ (0, test_1.expect)(ids).toContain(reportId);
187
230
  });
188
231
  });
189
232
  (0, _8_9_1.test)('Get reports with invalid token returns 401', async ({ request }) => {
190
233
  await _8_9_1.test.step('GET /api/public/report with invalid token (401)', async () => {
191
234
  const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
192
- (0, test_1.expect)(response.status()).toBe(401);
235
+ await assertUnauthorizedResponseBody(response);
193
236
  });
194
237
  });
195
238
  (0, _8_9_1.test)('Export reports successfully returns 200 with full payload', async ({ request, }) => {
@@ -206,9 +249,15 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
206
249
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
207
250
  (0, test_1.expect)(body.length).toBeGreaterThan(0);
208
251
  (0, test_1.expect)(body[0]).toHaveProperty('id');
252
+ (0, test_1.expect)(body[0].id).toBe(reportId);
209
253
  (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
254
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
210
255
  (0, test_1.expect)(body[0]).toHaveProperty('name');
256
+ (0, test_1.expect)(body[0].name).toBe('Blank report');
211
257
  (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
258
+ (0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
259
+ (0, test_1.expect)(body[0]).toHaveProperty('data');
260
+ (0, test_1.expect)(body[0].data).toBeTruthy();
212
261
  });
213
262
  });
214
263
  (0, _8_9_1.test)('Export reports with invalid token returns 401', async ({ request }) => {
@@ -220,7 +269,7 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
220
269
  },
221
270
  data: [reportId],
222
271
  });
223
- (0, test_1.expect)(response.status()).toBe(401);
272
+ await assertUnauthorizedResponseBody(response);
224
273
  });
225
274
  });
226
275
  (0, _8_9_1.test)('Export non-existent report returns 404', async ({ request }) => {
@@ -278,6 +327,9 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
278
327
  data: entitiesToImport,
279
328
  });
280
329
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
330
+ const importResult = await response.json();
331
+ (0, test_1.expect)(Array.isArray(importResult)).toBeTruthy();
332
+ (0, test_1.expect)(importResult.length).toBeGreaterThan(0);
281
333
  });
282
334
  (0, _8_9_1.test)('Import without token or invalid token returns 401', async ({ request, }) => {
283
335
  const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
@@ -296,7 +348,7 @@ _8_9_1.test.describe('API optimize SaaS Tests', () => {
296
348
  },
297
349
  data: entitiesToImport,
298
350
  });
299
- (0, test_1.expect)(response.status()).toBe(401);
351
+ await assertUnauthorizedResponseBody(response);
300
352
  });
301
353
  // Skipped due to bug 40497: https://github.com/camunda/camunda/issues/40497
302
354
  _8_9_1.test.skip('Import to non-existent collection (404)', async ({ request }) => {
@@ -325,6 +377,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
325
377
  let optimizeBearerToken;
326
378
  let conditionalEventsCollectionId;
327
379
  let conditionalEventsReportId;
380
+ let conditionalEventsReportName;
328
381
  let baseUrl;
329
382
  const CONDITIONAL_EVENTS_PROCESS_KEY = 'conditional-events-auto-process';
330
383
  _8_9_1.test.beforeAll(async ({ browser, request }) => {
@@ -347,10 +400,11 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
347
400
  },
348
401
  ],
349
402
  });
403
+ conditionalEventsReportName = await (0, randomName_1.randomNameAgregator)('Conditional Events Report');
350
404
  conditionalEventsReportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
351
405
  optimizeCookie,
352
406
  collectionId: conditionalEventsCollectionId,
353
- name: await (0, randomName_1.randomNameAgregator)('Conditional Events Report'),
407
+ name: conditionalEventsReportName,
354
408
  definitions: [
355
409
  {
356
410
  key: CONDITIONAL_EVENTS_PROCESS_KEY,
@@ -417,9 +471,15 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
417
471
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
418
472
  (0, test_1.expect)(body.length).toBeGreaterThan(0);
419
473
  (0, test_1.expect)(body[0]).toHaveProperty('id');
474
+ (0, test_1.expect)(body[0].id).toBe(conditionalEventsReportId);
420
475
  (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
476
+ (0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
421
477
  (0, test_1.expect)(body[0]).toHaveProperty('name');
478
+ (0, test_1.expect)(body[0].name).toBe(conditionalEventsReportName);
422
479
  (0, test_1.expect)(body[0]).toHaveProperty('collectionId');
480
+ (0, test_1.expect)(body[0].collectionId).toBe(conditionalEventsCollectionId);
481
+ (0, test_1.expect)(body[0]).toHaveProperty('data');
482
+ (0, test_1.expect)(body[0].data).toBeTruthy();
423
483
  });
424
484
  });
425
485
  (0, _8_9_1.test)('CE-OPT-11: Exporting the Conditional Events report without a token returns 401', async ({ request, }) => {
@@ -428,7 +488,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
428
488
  headers: { 'Content-Type': 'application/json' },
429
489
  data: [conditionalEventsReportId],
430
490
  });
431
- (0, test_1.expect)(response.status()).toBe(401);
491
+ await assertUnauthorizedResponseBody(response);
432
492
  });
433
493
  });
434
494
  (0, _8_9_1.test)('CE-OPT-12: Exporting the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
@@ -440,7 +500,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
440
500
  },
441
501
  data: [conditionalEventsReportId],
442
502
  });
443
- (0, test_1.expect)(response.status()).toBe(401);
503
+ await assertUnauthorizedResponseBody(response);
444
504
  });
445
505
  });
446
506
  (0, _8_9_1.test)('CE-OPT-13: Deleting the Conditional Events report via API succeeds with HTTP 200', async ({ request, }) => {
@@ -490,7 +550,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
490
550
  (0, _8_9_1.test)('CE-OPT-15: Attempting to delete the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
491
551
  await _8_9_1.test.step('Delete report with invalid token (401)', async () => {
492
552
  const response = await request.delete(`${baseUrl}/api/public/report/${conditionalEventsReportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
493
- (0, test_1.expect)(response.status()).toBe(401);
553
+ await assertUnauthorizedResponseBody(response);
494
554
  });
495
555
  });
496
556
  });
@@ -531,13 +591,13 @@ _8_9_1.test.describe('API optimize SaaS Tests - Sharing', () => {
531
591
  (0, _8_9_1.test)('Enable sharing without token returns 401', async ({ request }) => {
532
592
  await _8_9_1.test.step('POST /api/public/share/enable without token (401)', async () => {
533
593
  const response = await request.post(`${baseUrl}/api/public/share/enable`);
534
- (0, test_1.expect)(response.status()).toBe(401);
594
+ await assertUnauthorizedResponseBody(response);
535
595
  });
536
596
  });
537
597
  (0, _8_9_1.test)('Enable sharing with invalid token returns 401', async ({ request }) => {
538
598
  await _8_9_1.test.step('POST /api/public/share/enable with invalid token (401)', async () => {
539
599
  const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: 'Bearer invalid_token' } });
540
- (0, test_1.expect)(response.status()).toBe(401);
600
+ await assertUnauthorizedResponseBody(response);
541
601
  });
542
602
  });
543
603
  (0, _8_9_1.test)('Disable sharing with valid token returns 200 or 204', async ({ request, }) => {
@@ -549,13 +609,13 @@ _8_9_1.test.describe('API optimize SaaS Tests - Sharing', () => {
549
609
  (0, _8_9_1.test)('Disable sharing without token returns 401', async ({ request }) => {
550
610
  await _8_9_1.test.step('POST /api/public/share/disable without token (401)', async () => {
551
611
  const response = await request.post(`${baseUrl}/api/public/share/disable`);
552
- (0, test_1.expect)(response.status()).toBe(401);
612
+ await assertUnauthorizedResponseBody(response);
553
613
  });
554
614
  });
555
615
  (0, _8_9_1.test)('Disable sharing with invalid token returns 401', async ({ request }) => {
556
616
  await _8_9_1.test.step('POST /api/public/share/disable with invalid token (401)', async () => {
557
617
  const response = await request.post(`${baseUrl}/api/public/share/disable`, { headers: { Authorization: 'Bearer invalid_token' } });
558
- (0, test_1.expect)(response.status()).toBe(401);
618
+ await assertUnauthorizedResponseBody(response);
559
619
  });
560
620
  });
561
621
  (0, _8_9_1.test)('Sharing toggle cycle: enable then disable is idempotent', async ({ request, }) => {
@@ -602,6 +662,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Dashboard and Report GET edge ca
602
662
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
603
663
  const body = await response.json();
604
664
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
665
+ (0, test_1.expect)(body.every((dashboard) => typeof dashboard.id === 'string' && dashboard.id.length > 0)).toBeTruthy();
605
666
  });
606
667
  });
607
668
  (0, _8_9_1.test)('GET dashboards without collectionId param returns 400 or 500', async ({ request, }) => {
@@ -618,6 +679,7 @@ _8_9_1.test.describe('API optimize SaaS Tests - Dashboard and Report GET edge ca
618
679
  await (0, apiHelpers_1.assertResponseStatus)(response, 200);
619
680
  const body = await response.json();
620
681
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
682
+ (0, test_1.expect)(body.length).toBe(0);
621
683
  });
622
684
  });
623
685
  (0, _8_9_1.test)('GET reports without collectionId param returns 400 or 500', async ({ request, }) => {
@@ -707,6 +769,11 @@ _8_9_1.test.describe('API optimize SaaS Tests - Export edge cases', () => {
707
769
  const body = await response.json();
708
770
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
709
771
  (0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
772
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
773
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
774
+ const exportedIds = body.map((d) => d.id);
775
+ (0, test_1.expect)(exportedIds).toContain(dashboardId1);
776
+ (0, test_1.expect)(exportedIds).toContain(dashboardId2);
710
777
  });
711
778
  });
712
779
  (0, _8_9_1.test)('Export multiple reports in a single call returns 200 with all definitions', async ({ request, }) => {
@@ -722,6 +789,11 @@ _8_9_1.test.describe('API optimize SaaS Tests - Export edge cases', () => {
722
789
  const body = await response.json();
723
790
  (0, test_1.expect)(Array.isArray(body)).toBeTruthy();
724
791
  (0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
792
+ (0, test_1.expect)(body[0]).toHaveProperty('id');
793
+ (0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
794
+ const exportedIds = body.map((d) => d.id);
795
+ (0, test_1.expect)(exportedIds).toContain(reportId1);
796
+ (0, test_1.expect)(exportedIds).toContain(reportId2);
725
797
  });
726
798
  });
727
799
  (0, _8_9_1.test)('Export reports with empty array body returns 200 with empty array', async ({ request, }) => {
@@ -766,20 +838,20 @@ _8_9_1.test.describe('API optimize SaaS Tests - Auth edge cases', () => {
766
838
  'invalidsignature';
767
839
  await _8_9_1.test.step('GET /api/public/dashboard with expired token returns 401', async () => {
768
840
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: expiredToken } });
769
- (0, test_1.expect)(response.status()).toBe(401);
841
+ await assertUnauthorizedResponseBody(response);
770
842
  });
771
843
  });
772
844
  (0, _8_9_1.test)('Malformed Bearer value (empty string) returns 401 on dashboard endpoint', async ({ request, }) => {
773
845
  await _8_9_1.test.step('GET /api/public/dashboard with empty Bearer value returns 401', async () => {
774
846
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: 'Bearer ' } });
775
- (0, test_1.expect)(response.status()).toBe(401);
847
+ await assertUnauthorizedResponseBody(response);
776
848
  });
777
849
  });
778
850
  (0, _8_9_1.test)('Token with wrong audience returns 401 on dashboard endpoint', async ({ request, }) => {
779
851
  await _8_9_1.test.step('Use a Zeebe-audience token against Optimize API and expect 401', async () => {
780
852
  const wrongAudienceToken = await (0, apiHelpers_1.authSaasAPI)();
781
853
  const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: wrongAudienceToken } });
782
- (0, test_1.expect)(response.status()).toBe(401);
854
+ await assertUnauthorizedResponseBody(response);
783
855
  });
784
856
  });
785
857
  });
@@ -799,7 +871,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
799
871
  const response = await request.get(`${apiUrl()}/v2/topology`, {
800
872
  headers: { 'Content-Type': 'application/json' },
801
873
  });
802
- (0, test_1.expect)(response.status()).toBe(401);
874
+ await assertUnauthorizedResponseBody(response);
803
875
  });
804
876
  (0, _8_9_1.test)('POST /v2/process-definitions/search returns 200 with items array', async ({ request, }) => {
805
877
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -821,7 +893,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
821
893
  headers: { 'Content-Type': 'application/json' },
822
894
  data: { filter: {}, size: 10 },
823
895
  });
824
- (0, test_1.expect)(response.status()).toBe(401);
896
+ await assertUnauthorizedResponseBody(response);
825
897
  });
826
898
  (0, _8_9_1.test)('POST /v2/process-definitions/search with invalid token returns 401', async ({ request, }) => {
827
899
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -831,7 +903,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
831
903
  },
832
904
  data: { filter: {}, size: 10 },
833
905
  });
834
- (0, test_1.expect)(response.status()).toBe(401);
906
+ await assertUnauthorizedResponseBody(response);
835
907
  });
836
908
  (0, _8_9_1.test)('POST /v2/process-definitions/search with size 1 returns pagination cursor', async ({ request, }) => {
837
909
  const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
@@ -885,7 +957,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
885
957
  headers: { 'Content-Type': 'application/json' },
886
958
  data: { filter: {}, size: 10 },
887
959
  });
888
- (0, test_1.expect)(response.status()).toBe(401);
960
+ await assertUnauthorizedResponseBody(response);
889
961
  });
890
962
  (0, _8_9_1.test)('POST /v2/process-instances/search with invalid token returns 401', async ({ request, }) => {
891
963
  const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
@@ -895,7 +967,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
895
967
  },
896
968
  data: { filter: {}, size: 10 },
897
969
  });
898
- (0, test_1.expect)(response.status()).toBe(401);
970
+ await assertUnauthorizedResponseBody(response);
899
971
  });
900
972
  (0, _8_9_1.test)('POST /v2/user-tasks/search returns 200 with items array', async ({ request, }) => {
901
973
  const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
@@ -914,7 +986,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
914
986
  headers: { 'Content-Type': 'application/json' },
915
987
  data: { filter: {}, size: 10 },
916
988
  });
917
- (0, test_1.expect)(response.status()).toBe(401);
989
+ await assertUnauthorizedResponseBody(response);
918
990
  });
919
991
  (0, _8_9_1.test)('POST /v2/user-tasks/search with invalid token returns 401', async ({ request, }) => {
920
992
  const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
@@ -924,7 +996,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
924
996
  },
925
997
  data: { filter: {}, size: 10 },
926
998
  });
927
- (0, test_1.expect)(response.status()).toBe(401);
999
+ await assertUnauthorizedResponseBody(response);
928
1000
  });
929
1001
  (0, _8_9_1.test)('POST /v2/variables/search returns 200 with items array', async ({ request, }) => {
930
1002
  const response = await request.post(`${apiUrl()}/v2/variables/search`, {
@@ -943,7 +1015,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
943
1015
  headers: { 'Content-Type': 'application/json' },
944
1016
  data: { filter: {}, size: 10 },
945
1017
  });
946
- (0, test_1.expect)(response.status()).toBe(401);
1018
+ await assertUnauthorizedResponseBody(response);
947
1019
  });
948
1020
  (0, _8_9_1.test)('POST /v2/variables/search with invalid token returns 401', async ({ request, }) => {
949
1021
  const response = await request.post(`${apiUrl()}/v2/variables/search`, {
@@ -953,7 +1025,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
953
1025
  },
954
1026
  data: { filter: {}, size: 10 },
955
1027
  });
956
- (0, test_1.expect)(response.status()).toBe(401);
1028
+ await assertUnauthorizedResponseBody(response);
957
1029
  });
958
1030
  (0, _8_9_1.test)('POST /v2/incidents/search returns 200 with items array', async ({ request, }) => {
959
1031
  const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
@@ -972,7 +1044,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
972
1044
  headers: { 'Content-Type': 'application/json' },
973
1045
  data: { filter: {}, size: 10 },
974
1046
  });
975
- (0, test_1.expect)(response.status()).toBe(401);
1047
+ await assertUnauthorizedResponseBody(response);
976
1048
  });
977
1049
  (0, _8_9_1.test)('POST /v2/incidents/search with invalid token returns 401', async ({ request, }) => {
978
1050
  const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
@@ -982,7 +1054,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
982
1054
  },
983
1055
  data: { filter: {}, size: 10 },
984
1056
  });
985
- (0, test_1.expect)(response.status()).toBe(401);
1057
+ await assertUnauthorizedResponseBody(response);
986
1058
  });
987
1059
  (0, _8_9_1.test)('POST /v2/decision-definitions/search returns 200 with items array', async ({ request, }) => {
988
1060
  const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
@@ -1004,7 +1076,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1004
1076
  headers: { 'Content-Type': 'application/json' },
1005
1077
  data: { filter: {}, size: 10 },
1006
1078
  });
1007
- (0, test_1.expect)(response.status()).toBe(401);
1079
+ await assertUnauthorizedResponseBody(response);
1008
1080
  });
1009
1081
  (0, _8_9_1.test)('POST /v2/decision-definitions/search with invalid token returns 401', async ({ request, }) => {
1010
1082
  const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
@@ -1014,7 +1086,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1014
1086
  },
1015
1087
  data: { filter: {}, size: 10 },
1016
1088
  });
1017
- (0, test_1.expect)(response.status()).toBe(401);
1089
+ await assertUnauthorizedResponseBody(response);
1018
1090
  });
1019
1091
  (0, _8_9_1.test)('POST /v2/decision-instances/search returns 200 with items array', async ({ request, }) => {
1020
1092
  const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
@@ -1036,7 +1108,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1036
1108
  headers: { 'Content-Type': 'application/json' },
1037
1109
  data: { filter: {}, size: 10 },
1038
1110
  });
1039
- (0, test_1.expect)(response.status()).toBe(401);
1111
+ await assertUnauthorizedResponseBody(response);
1040
1112
  });
1041
1113
  (0, _8_9_1.test)('POST /v2/decision-instances/search with invalid token returns 401', async ({ request, }) => {
1042
1114
  const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
@@ -1046,7 +1118,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1046
1118
  },
1047
1119
  data: { filter: {}, size: 10 },
1048
1120
  });
1049
- (0, test_1.expect)(response.status()).toBe(401);
1121
+ await assertUnauthorizedResponseBody(response);
1050
1122
  });
1051
1123
  (0, _8_9_1.test)('POST /v2/flownode-instances/search returns 200 with items array', async ({ request, }) => {
1052
1124
  const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
@@ -1068,7 +1140,7 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1068
1140
  headers: { 'Content-Type': 'application/json' },
1069
1141
  data: { filter: {}, size: 10 },
1070
1142
  });
1071
- (0, test_1.expect)(response.status()).toBe(401);
1143
+ await assertUnauthorizedResponseBody(response);
1072
1144
  });
1073
1145
  (0, _8_9_1.test)('POST /v2/flownode-instances/search with invalid token returns 401', async ({ request, }) => {
1074
1146
  const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
@@ -1078,6 +1150,6 @@ _8_9_1.test.describe('API V2 tests on SaaS cluster', () => {
1078
1150
  },
1079
1151
  data: { filter: {}, size: 10 },
1080
1152
  });
1081
- (0, test_1.expect)(response.status()).toBe(401);
1153
+ await assertUnauthorizedResponseBody(response);
1082
1154
  });
1083
1155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.688",
3
+ "version": "0.0.690",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",