@camunda/e2e-test-suite 0.0.463 → 0.0.465
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.
- package/dist/tests/8.10/optimize-api-tests.spec.js +170 -0
- package/dist/tests/SM-8.10/optimize-user-flows.spec.js +281 -0
- package/dist/tests/SM-8.10/web-modeler-user-flows.spec.js +11 -1
- package/dist/tests/SM-8.8/optimize-api-tests.spec.d.ts +1 -0
- package/dist/tests/SM-8.8/optimize-api-tests.spec.js +452 -0
- package/dist/tests/SM-8.9/optimize-api-tests.spec.d.ts +1 -0
- package/dist/tests/SM-8.9/optimize-api-tests.spec.js +448 -0
- package/dist/utils/apiHelpers.d.ts +1 -0
- package/dist/utils/apiHelpers.js +24 -1
- package/package.json +1 -1
- package/playwright.config.ts +5 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const SM_8_9_1 = require("../../fixtures/SM-8.9");
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const apiHelpers_1 = require("../../utils/apiHelpers");
|
|
6
|
+
const randomName_1 = require("../../utils/randomName");
|
|
7
|
+
SM_8_9_1.test.describe.configure({ mode: 'parallel' });
|
|
8
|
+
SM_8_9_1.test.describe('API optimize SM Tests', () => {
|
|
9
|
+
const baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
10
|
+
(0, SM_8_9_1.test)('Dashboard Scenarios Flow Tests', async ({ request, browser }) => {
|
|
11
|
+
const page = await browser.newPage();
|
|
12
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(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
|
+
});
|
|
19
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
20
|
+
optimizeCookie,
|
|
21
|
+
collectionId: collectionIdValue,
|
|
22
|
+
data: [
|
|
23
|
+
{
|
|
24
|
+
definitionKey: 'customer_onboarding_en',
|
|
25
|
+
definitionType: 'process',
|
|
26
|
+
tenants: ['<default>'],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
|
|
31
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
|
|
32
|
+
optimizeCookie,
|
|
33
|
+
collectionId: collectionIdValue,
|
|
34
|
+
});
|
|
35
|
+
await SM_8_9_1.test.step('Get dashboards successfully (200)', async () => {
|
|
36
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
37
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
38
|
+
const body = await response.json();
|
|
39
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
40
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
41
|
+
const dashboard = body[0];
|
|
42
|
+
(0, test_1.expect)(dashboard).toHaveProperty('id');
|
|
43
|
+
});
|
|
44
|
+
await SM_8_9_1.test.step('Get dashboards without token (401)', async () => {
|
|
45
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`);
|
|
46
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
47
|
+
});
|
|
48
|
+
await SM_8_9_1.test.step('Get dashboards with invalid token (401)', async () => {
|
|
49
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
50
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
51
|
+
});
|
|
52
|
+
await SM_8_9_1.test.step('Force internal server error (500)', async () => {
|
|
53
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard/force-internal-error`, { headers: { Authorization: optimizeBearerToken } });
|
|
54
|
+
(0, test_1.expect)(response.status()).toBe(500);
|
|
55
|
+
});
|
|
56
|
+
await SM_8_9_1.test.step('Export dashboard definitions successfully (200)', async () => {
|
|
57
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: optimizeBearerToken,
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
},
|
|
62
|
+
data: [dashboardIdValue],
|
|
63
|
+
});
|
|
64
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
65
|
+
const body = await response.json();
|
|
66
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
67
|
+
});
|
|
68
|
+
await SM_8_9_1.test.step('Export dashboards without token (401)', async () => {
|
|
69
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
70
|
+
headers: { 'Content-Type': 'application/json' },
|
|
71
|
+
data: [dashboardIdValue],
|
|
72
|
+
});
|
|
73
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
74
|
+
});
|
|
75
|
+
await SM_8_9_1.test.step('Export dashboards with invalid token (401)', async () => {
|
|
76
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: 'Bearer invalid_token',
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
},
|
|
81
|
+
data: [dashboardIdValue],
|
|
82
|
+
});
|
|
83
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
84
|
+
});
|
|
85
|
+
await SM_8_9_1.test.step('Export dashboard with invalid body (400)', async () => {
|
|
86
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
87
|
+
headers: {
|
|
88
|
+
Authorization: optimizeBearerToken,
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
},
|
|
91
|
+
data: [{}],
|
|
92
|
+
});
|
|
93
|
+
(0, test_1.expect)(response.status()).toBe(400);
|
|
94
|
+
});
|
|
95
|
+
await SM_8_9_1.test.step('Export non-existent dashboard (404)', async () => {
|
|
96
|
+
const fakeDashboardId = 'nonexistent-dashboard-id';
|
|
97
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
98
|
+
headers: {
|
|
99
|
+
Authorization: optimizeBearerToken,
|
|
100
|
+
'Content-Type': 'application/json',
|
|
101
|
+
},
|
|
102
|
+
data: [fakeDashboardId],
|
|
103
|
+
});
|
|
104
|
+
(0, test_1.expect)([401, 404]).toContain(response.status());
|
|
105
|
+
});
|
|
106
|
+
await SM_8_9_1.test.step('Export existing dashboard successfully (200)', async () => {
|
|
107
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
108
|
+
headers: {
|
|
109
|
+
Authorization: optimizeBearerToken,
|
|
110
|
+
'Content-Type': 'application/json',
|
|
111
|
+
},
|
|
112
|
+
data: [dashboardIdValue],
|
|
113
|
+
});
|
|
114
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
115
|
+
});
|
|
116
|
+
await SM_8_9_1.test.step('Delete dashboard successfully (200)', async () => {
|
|
117
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
118
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
119
|
+
});
|
|
120
|
+
await SM_8_9_1.test.step('Verify dashboard not found after deletion (404/410/500)', async () => {
|
|
121
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
122
|
+
(0, test_1.expect)([404, 410, 500]).toContain(response.status());
|
|
123
|
+
});
|
|
124
|
+
await SM_8_9_1.test.step('Delete dashboard with invalid token (401)', async () => {
|
|
125
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
126
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
127
|
+
});
|
|
128
|
+
await SM_8_9_1.test.step('Delete non-existent dashboard (404)', async () => {
|
|
129
|
+
const fakeDashboardId = 'nonexistent-dashboard-id';
|
|
130
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${fakeDashboardId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
131
|
+
(0, test_1.expect)(response.status()).toBe(404);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
(0, SM_8_9_1.test)('Reports Scenarios Flow Tests', async ({ request, browser }) => {
|
|
135
|
+
const page = await browser.newPage();
|
|
136
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(page);
|
|
137
|
+
await page.close();
|
|
138
|
+
const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
|
|
139
|
+
const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
140
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
141
|
+
optimizeCookie,
|
|
142
|
+
});
|
|
143
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
144
|
+
optimizeCookie,
|
|
145
|
+
collectionId: collectionIdValue,
|
|
146
|
+
data: [
|
|
147
|
+
{
|
|
148
|
+
definitionKey: 'customer_onboarding_en',
|
|
149
|
+
definitionType: 'process',
|
|
150
|
+
tenants: ['<default>'],
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
const reportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
155
|
+
optimizeCookie,
|
|
156
|
+
collectionId: collectionIdValue,
|
|
157
|
+
name: 'Blank report',
|
|
158
|
+
definitions: [
|
|
159
|
+
{
|
|
160
|
+
key: 'aProcess',
|
|
161
|
+
filter: [],
|
|
162
|
+
groupBy: { type: 'flowNodes', value: null },
|
|
163
|
+
distributedBy: { type: 'none', value: null },
|
|
164
|
+
view: { entity: 'flowNode', properties: ['duration'] },
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
});
|
|
168
|
+
await SM_8_9_1.test.step('Get reports successfully (200)', async () => {
|
|
169
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
170
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
171
|
+
});
|
|
172
|
+
await SM_8_9_1.test.step('Get reports with invalid/missing token (401)', async () => {
|
|
173
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
174
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
175
|
+
});
|
|
176
|
+
await SM_8_9_1.test.step('Export reports successfully (200)', async () => {
|
|
177
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
178
|
+
headers: {
|
|
179
|
+
Authorization: optimizeBearerToken,
|
|
180
|
+
'Content-Type': 'application/json',
|
|
181
|
+
},
|
|
182
|
+
data: [reportId],
|
|
183
|
+
});
|
|
184
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
185
|
+
const body = await response.json();
|
|
186
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
187
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
188
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
189
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
190
|
+
(0, test_1.expect)(body[0]).toHaveProperty('name');
|
|
191
|
+
(0, test_1.expect)(body[0]).toHaveProperty('collectionId');
|
|
192
|
+
});
|
|
193
|
+
await SM_8_9_1.test.step('Export reports with invalid token (401)', async () => {
|
|
194
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
195
|
+
headers: {
|
|
196
|
+
Authorization: 'Bearer invalid_token',
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
},
|
|
199
|
+
data: [reportId],
|
|
200
|
+
});
|
|
201
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
202
|
+
});
|
|
203
|
+
await SM_8_9_1.test.step('Export non-existent report (404)', async () => {
|
|
204
|
+
const invalidReportId = '11111111-1111-1111-1111-111111111111';
|
|
205
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
206
|
+
headers: {
|
|
207
|
+
Authorization: optimizeBearerToken,
|
|
208
|
+
'Content-Type': 'application/json',
|
|
209
|
+
},
|
|
210
|
+
data: [invalidReportId],
|
|
211
|
+
});
|
|
212
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 404);
|
|
213
|
+
});
|
|
214
|
+
await SM_8_9_1.test.step('Delete report successfully (200)', async () => {
|
|
215
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
216
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
217
|
+
});
|
|
218
|
+
await SM_8_9_1.test.step('Verify deleted report returns 404 or 500', async () => {
|
|
219
|
+
const response = await request.get(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
220
|
+
(0, test_1.expect)([404, 500]).toContain(response.status());
|
|
221
|
+
});
|
|
222
|
+
await SM_8_9_1.test.step('Attempt delete report with invalid token (401)', async () => {
|
|
223
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
224
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
(0, SM_8_9_1.test)('Import entities successfully (200)', async ({ request, browser }) => {
|
|
228
|
+
const page = await browser.newPage();
|
|
229
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(page);
|
|
230
|
+
await page.close();
|
|
231
|
+
const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
|
|
232
|
+
const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
233
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
234
|
+
optimizeCookie,
|
|
235
|
+
});
|
|
236
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
237
|
+
optimizeCookie,
|
|
238
|
+
collectionId: collectionIdValue,
|
|
239
|
+
data: [
|
|
240
|
+
{
|
|
241
|
+
definitionKey: 'customer_onboarding_en',
|
|
242
|
+
definitionType: 'process',
|
|
243
|
+
tenants: ['<default>'],
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
});
|
|
247
|
+
const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
|
|
248
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
|
|
249
|
+
optimizeCookie,
|
|
250
|
+
collectionId: collectionIdValue,
|
|
251
|
+
});
|
|
252
|
+
const exportedEntities = await (async () => {
|
|
253
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
254
|
+
headers: {
|
|
255
|
+
Authorization: optimizeBearerToken,
|
|
256
|
+
'Content-Type': 'application/json',
|
|
257
|
+
},
|
|
258
|
+
data: [dashboardIdValue],
|
|
259
|
+
});
|
|
260
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
261
|
+
return await exportResponse.json();
|
|
262
|
+
})();
|
|
263
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
264
|
+
headers: {
|
|
265
|
+
Authorization: optimizeBearerToken,
|
|
266
|
+
'Content-Type': 'application/json',
|
|
267
|
+
},
|
|
268
|
+
data: exportedEntities,
|
|
269
|
+
});
|
|
270
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
271
|
+
});
|
|
272
|
+
(0, SM_8_9_1.test)('Import without token or invalid token (401)', async ({ request, browser, }) => {
|
|
273
|
+
const page = await browser.newPage();
|
|
274
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(page);
|
|
275
|
+
await page.close();
|
|
276
|
+
const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
|
|
277
|
+
const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
278
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
279
|
+
optimizeCookie,
|
|
280
|
+
});
|
|
281
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
282
|
+
optimizeCookie,
|
|
283
|
+
collectionId: collectionIdValue,
|
|
284
|
+
data: [
|
|
285
|
+
{
|
|
286
|
+
definitionKey: 'customer_onboarding_en',
|
|
287
|
+
definitionType: 'process',
|
|
288
|
+
tenants: ['<default>'],
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
});
|
|
292
|
+
const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
|
|
293
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
|
|
294
|
+
optimizeCookie,
|
|
295
|
+
collectionId: collectionIdValue,
|
|
296
|
+
});
|
|
297
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
298
|
+
headers: {
|
|
299
|
+
Authorization: optimizeBearerToken,
|
|
300
|
+
'Content-Type': 'application/json',
|
|
301
|
+
},
|
|
302
|
+
data: [dashboardIdValue],
|
|
303
|
+
});
|
|
304
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
305
|
+
const exportedEntities = await exportResponse.json();
|
|
306
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
307
|
+
headers: {
|
|
308
|
+
Authorization: 'Bearer invalid_token',
|
|
309
|
+
'Content-Type': 'application/json',
|
|
310
|
+
},
|
|
311
|
+
data: exportedEntities,
|
|
312
|
+
});
|
|
313
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
314
|
+
});
|
|
315
|
+
(0, SM_8_9_1.test)('Import to non-existent collection (404)', async ({ request, browser, }) => {
|
|
316
|
+
const page = await browser.newPage();
|
|
317
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(page);
|
|
318
|
+
await page.close();
|
|
319
|
+
const optimizeBearerToken = await (0, apiHelpers_1.authSmAPI)();
|
|
320
|
+
const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
321
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
322
|
+
optimizeCookie,
|
|
323
|
+
});
|
|
324
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
325
|
+
optimizeCookie,
|
|
326
|
+
collectionId: collectionIdValue,
|
|
327
|
+
data: [
|
|
328
|
+
{
|
|
329
|
+
definitionKey: 'customer_onboarding_en',
|
|
330
|
+
definitionType: 'process',
|
|
331
|
+
tenants: ['<default>'],
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
});
|
|
335
|
+
const dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
|
|
336
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Dashboard'),
|
|
337
|
+
optimizeCookie,
|
|
338
|
+
collectionId: collectionIdValue,
|
|
339
|
+
});
|
|
340
|
+
const exportedEntities = await (async () => {
|
|
341
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
342
|
+
headers: {
|
|
343
|
+
Authorization: optimizeBearerToken,
|
|
344
|
+
'Content-Type': 'application/json',
|
|
345
|
+
},
|
|
346
|
+
data: [dashboardIdValue],
|
|
347
|
+
});
|
|
348
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
349
|
+
return await exportResponse.json();
|
|
350
|
+
})();
|
|
351
|
+
const fakeCollectionId = 'nonexistent-collection-id';
|
|
352
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${fakeCollectionId}`, {
|
|
353
|
+
headers: {
|
|
354
|
+
Authorization: optimizeBearerToken,
|
|
355
|
+
'Content-Type': 'application/json',
|
|
356
|
+
},
|
|
357
|
+
data: exportedEntities,
|
|
358
|
+
});
|
|
359
|
+
(0, test_1.expect)(response.status()).toBe(404);
|
|
360
|
+
});
|
|
361
|
+
(0, SM_8_9_1.test)('Authorization Edge Cases Tests (401)', async ({ request, browser }) => {
|
|
362
|
+
const page = await browser.newPage();
|
|
363
|
+
const optimizeCookie = await (0, apiHelpers_1.getOptimizeCookieSm)(page);
|
|
364
|
+
await page.close();
|
|
365
|
+
const collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
366
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
367
|
+
optimizeCookie,
|
|
368
|
+
});
|
|
369
|
+
const expiredToken = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0IiwiZXhwIjoxNjA5NDU5MjAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
370
|
+
const malformedToken = 'Bearer eyJhbGciOiJIUzI1NiJ9.';
|
|
371
|
+
const noPrefixToken = 'raw-token-string-without-bearer-prefix';
|
|
372
|
+
await SM_8_9_1.test.step('Expired JWT token on GET dashboard returns 401', async () => {
|
|
373
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: expiredToken } });
|
|
374
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
375
|
+
});
|
|
376
|
+
await SM_8_9_1.test.step('Malformed JWT (truncated) on GET dashboard returns 401', async () => {
|
|
377
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: malformedToken } });
|
|
378
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
379
|
+
});
|
|
380
|
+
await SM_8_9_1.test.step('Token without Bearer prefix on GET dashboard returns 401', async () => {
|
|
381
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: noPrefixToken } });
|
|
382
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
383
|
+
});
|
|
384
|
+
await SM_8_9_1.test.step('Empty Authorization header on GET dashboard returns 401', async () => {
|
|
385
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: '' } });
|
|
386
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
387
|
+
});
|
|
388
|
+
await SM_8_9_1.test.step('Missing token on GET reports returns 401', async () => {
|
|
389
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`);
|
|
390
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
391
|
+
});
|
|
392
|
+
await SM_8_9_1.test.step('Missing token on DELETE dashboard returns 401', async () => {
|
|
393
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/nonexistent-id`);
|
|
394
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
395
|
+
});
|
|
396
|
+
await SM_8_9_1.test.step('Missing token on DELETE report returns 401', async () => {
|
|
397
|
+
const response = await request.delete(`${baseUrl}/api/public/report/nonexistent-id`);
|
|
398
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
399
|
+
});
|
|
400
|
+
await SM_8_9_1.test.step('Missing token on import returns 401', async () => {
|
|
401
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
402
|
+
headers: { 'Content-Type': 'application/json' },
|
|
403
|
+
data: [],
|
|
404
|
+
});
|
|
405
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
406
|
+
});
|
|
407
|
+
await SM_8_9_1.test.step('Expired JWT on export dashboard returns 401', async () => {
|
|
408
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
409
|
+
headers: {
|
|
410
|
+
Authorization: expiredToken,
|
|
411
|
+
'Content-Type': 'application/json',
|
|
412
|
+
},
|
|
413
|
+
data: ['some-dashboard-id'],
|
|
414
|
+
});
|
|
415
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
416
|
+
});
|
|
417
|
+
await SM_8_9_1.test.step('Expired JWT on export report returns 401', async () => {
|
|
418
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
419
|
+
headers: {
|
|
420
|
+
Authorization: expiredToken,
|
|
421
|
+
'Content-Type': 'application/json',
|
|
422
|
+
},
|
|
423
|
+
data: ['some-report-id'],
|
|
424
|
+
});
|
|
425
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
426
|
+
});
|
|
427
|
+
await SM_8_9_1.test.step('Malformed JWT on export dashboard returns 401', async () => {
|
|
428
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
429
|
+
headers: {
|
|
430
|
+
Authorization: malformedToken,
|
|
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_9_1.test.step('Malformed JWT on import returns 401', async () => {
|
|
438
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
439
|
+
headers: {
|
|
440
|
+
Authorization: malformedToken,
|
|
441
|
+
'Content-Type': 'application/json',
|
|
442
|
+
},
|
|
443
|
+
data: [],
|
|
444
|
+
});
|
|
445
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
});
|
|
@@ -35,6 +35,7 @@ interface CreateSingleProcessReportOptions {
|
|
|
35
35
|
configuration?: Record<string, unknown>;
|
|
36
36
|
}
|
|
37
37
|
export declare function getOptimizeCoockie(page: Page): Promise<string>;
|
|
38
|
+
export declare function getOptimizeCookieSm(page: Page): Promise<string>;
|
|
38
39
|
export declare function createCollection(request: APIRequestContext, options: {
|
|
39
40
|
name: string;
|
|
40
41
|
optimizeCookie: string;
|
package/dist/utils/apiHelpers.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCoockie = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.createProcessInstance = exports.deployProcess = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.buildZeebeApiUrl = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
|
|
6
|
+
exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCookieSm = exports.getOptimizeCoockie = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.createProcessInstance = exports.deployProcess = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.buildZeebeApiUrl = exports.sendRequestAndAssertResponse = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
|
|
7
7
|
const test_1 = require("@playwright/test");
|
|
8
8
|
const sleep_1 = require("./sleep");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -363,6 +363,29 @@ async function getOptimizeCoockie(page) {
|
|
|
363
363
|
return optimizeCookie;
|
|
364
364
|
}
|
|
365
365
|
exports.getOptimizeCoockie = getOptimizeCoockie;
|
|
366
|
+
async function getOptimizeCookieSm(page) {
|
|
367
|
+
const optimizeUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
368
|
+
const username = 'demo';
|
|
369
|
+
const password = process.env.DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_PASSWORD;
|
|
370
|
+
await page.goto(optimizeUrl, { timeout: 30000 });
|
|
371
|
+
// Wait for login form and fill credentials (Keycloak login)
|
|
372
|
+
await page.waitForSelector('#username', { timeout: 30000 });
|
|
373
|
+
await page.fill('#username', username);
|
|
374
|
+
await page.fill('#password', password);
|
|
375
|
+
await page.click('button[type="submit"]');
|
|
376
|
+
// Wait for redirect to Optimize after login
|
|
377
|
+
await page.waitForURL(`${optimizeUrl}/**`, { timeout: 30000 });
|
|
378
|
+
const context = page.context();
|
|
379
|
+
await context.storageState({ path: path_1.default.join(__dirname, '.auth_optimize_sm') });
|
|
380
|
+
const authData = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '.auth_optimize_sm'), 'utf8'));
|
|
381
|
+
const serviceTokenCookie = authData.cookies.find((cookie) => cookie.name === 'X-Optimize-Service-Token_0');
|
|
382
|
+
const authTokenCookie = authData.cookies.find((cookie) => cookie.name === 'X-Optimize-Authorization_0');
|
|
383
|
+
const optimizeServiceToken = serviceTokenCookie?.value || '';
|
|
384
|
+
const optimizeAuthToken = authTokenCookie?.value || '';
|
|
385
|
+
const optimizeCookie = `X-Optimize-Service-Token_0=${optimizeServiceToken}; X-Optimize-Authorization_0=${optimizeAuthToken}`;
|
|
386
|
+
return optimizeCookie;
|
|
387
|
+
}
|
|
388
|
+
exports.getOptimizeCookieSm = getOptimizeCookieSm;
|
|
366
389
|
async function createCollection(request, options) {
|
|
367
390
|
const optimizeResponse = await request.post(`${process.env.CAMUNDA_OPTIMIZE_BASE_URL}/api/collection`, {
|
|
368
391
|
headers: {
|
package/package.json
CHANGED
package/playwright.config.ts
CHANGED
|
@@ -3,6 +3,11 @@ import {devices, defineConfig} from '@playwright/test';
|
|
|
3
3
|
import * as dotenv from 'dotenv';
|
|
4
4
|
|
|
5
5
|
dotenv.config();
|
|
6
|
+
|
|
7
|
+
if (!process.env.CAMUNDA_OPTIMIZE_BASE_URL && process.env.BASE_URL) {
|
|
8
|
+
process.env.CAMUNDA_OPTIMIZE_BASE_URL = `https://${process.env.BASE_URL}/optimize`;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
const projectName = process.env.PROJECT! || 'Chromium'; // Default to 'default-project' if PROJECT is not set
|
|
7
12
|
|
|
8
13
|
const testRailOptions = {
|