@camunda/e2e-test-suite 0.0.1329 → 0.0.1330
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/.github/c8_versions.json +1 -0
- package/README.md +1 -0
- package/dist/fixtures/8.11.d.ts +83 -0
- package/dist/fixtures/8.11.js +203 -0
- package/dist/pages/8.11/AppsPage.d.ts +60 -0
- package/dist/pages/8.11/AppsPage.js +1060 -0
- package/dist/pages/8.11/AuditLogPage.d.ts +14 -0
- package/dist/pages/8.11/AuditLogPage.js +69 -0
- package/dist/pages/8.11/Authorization.d.ts +44 -0
- package/dist/pages/8.11/Authorization.js +409 -0
- package/dist/pages/8.11/ClientCredentialsDetailsPage.d.ts +12 -0
- package/dist/pages/8.11/ClientCredentialsDetailsPage.js +36 -0
- package/dist/pages/8.11/ClusterDetailsPage.d.ts +107 -0
- package/dist/pages/8.11/ClusterDetailsPage.js +892 -0
- package/dist/pages/8.11/ClusterPage.d.ts +96 -0
- package/dist/pages/8.11/ClusterPage.js +657 -0
- package/dist/pages/8.11/ClusterSecretsPage.d.ts +48 -0
- package/dist/pages/8.11/ClusterSecretsPage.js +406 -0
- package/dist/pages/8.11/ConnectorMarketplacePage.d.ts +29 -0
- package/dist/pages/8.11/ConnectorMarketplacePage.js +156 -0
- package/dist/pages/8.11/ConnectorSettingsPage.d.ts +39 -0
- package/dist/pages/8.11/ConnectorSettingsPage.js +150 -0
- package/dist/pages/8.11/ConnectorTemplatePage.d.ts +11 -0
- package/dist/pages/8.11/ConnectorTemplatePage.js +34 -0
- package/dist/pages/8.11/ConsoleOrganizationPage.d.ts +77 -0
- package/dist/pages/8.11/ConsoleOrganizationPage.js +457 -0
- package/dist/pages/8.11/DataFiltersPage.d.ts +30 -0
- package/dist/pages/8.11/DataFiltersPage.js +135 -0
- package/dist/pages/8.11/FormJsPage.d.ts +38 -0
- package/dist/pages/8.11/FormJsPage.js +283 -0
- package/dist/pages/8.11/HomePage.d.ts +29 -0
- package/dist/pages/8.11/HomePage.js +176 -0
- package/dist/pages/8.11/IdpCreatePage.d.ts +118 -0
- package/dist/pages/8.11/IdpCreatePage.js +514 -0
- package/dist/pages/8.11/LoginPage.d.ts +45 -0
- package/dist/pages/8.11/LoginPage.js +214 -0
- package/dist/pages/8.11/ModelerCreatePage.d.ts +256 -0
- package/dist/pages/8.11/ModelerCreatePage.js +2272 -0
- package/dist/pages/8.11/ModelerHomePage.d.ts +100 -0
- package/dist/pages/8.11/ModelerHomePage.js +1168 -0
- package/dist/pages/8.11/ModelerUserInvitePage.d.ts +29 -0
- package/dist/pages/8.11/ModelerUserInvitePage.js +136 -0
- package/dist/pages/8.11/OCIdentityAuthorizationsPage.d.ts +11 -0
- package/dist/pages/8.11/OCIdentityAuthorizationsPage.js +25 -0
- package/dist/pages/8.11/OCIdentityClusterVariablesPage.d.ts +21 -0
- package/dist/pages/8.11/OCIdentityClusterVariablesPage.js +128 -0
- package/dist/pages/8.11/OCIdentityGroupsPage.d.ts +38 -0
- package/dist/pages/8.11/OCIdentityGroupsPage.js +176 -0
- package/dist/pages/8.11/OCIdentityHomePage.d.ts +21 -0
- package/dist/pages/8.11/OCIdentityHomePage.js +111 -0
- package/dist/pages/8.11/OCIdentityMappingRulesPage.d.ts +23 -0
- package/dist/pages/8.11/OCIdentityMappingRulesPage.js +124 -0
- package/dist/pages/8.11/OCIdentityRolesPage.d.ts +43 -0
- package/dist/pages/8.11/OCIdentityRolesPage.js +236 -0
- package/dist/pages/8.11/OperateHomePage.d.ts +28 -0
- package/dist/pages/8.11/OperateHomePage.js +150 -0
- package/dist/pages/8.11/OperateProcessInstancePage.d.ts +43 -0
- package/dist/pages/8.11/OperateProcessInstancePage.js +893 -0
- package/dist/pages/8.11/OperateProcessesPage.d.ts +28 -0
- package/dist/pages/8.11/OperateProcessesPage.js +153 -0
- package/dist/pages/8.11/OptimizeCollectionsPage.d.ts +30 -0
- package/dist/pages/8.11/OptimizeCollectionsPage.js +175 -0
- package/dist/pages/8.11/OptimizeDashboardPage.d.ts +11 -0
- package/dist/pages/8.11/OptimizeDashboardPage.js +71 -0
- package/dist/pages/8.11/OptimizeHomePage.d.ts +17 -0
- package/dist/pages/8.11/OptimizeHomePage.js +171 -0
- package/dist/pages/8.11/OptimizeReportPage.d.ts +49 -0
- package/dist/pages/8.11/OptimizeReportPage.js +184 -0
- package/dist/pages/8.11/OptimizeSharePage.d.ts +16 -0
- package/dist/pages/8.11/OptimizeSharePage.js +100 -0
- package/dist/pages/8.11/PlayPage.d.ts +17 -0
- package/dist/pages/8.11/PlayPage.js +157 -0
- package/dist/pages/8.11/ProcessApplicationPage.d.ts +32 -0
- package/dist/pages/8.11/ProcessApplicationPage.js +496 -0
- package/dist/pages/8.11/SettingsPage.d.ts +10 -0
- package/dist/pages/8.11/SettingsPage.js +53 -0
- package/dist/pages/8.11/SignUpPage.d.ts +42 -0
- package/dist/pages/8.11/SignUpPage.js +134 -0
- package/dist/pages/8.11/TaskDetailsPage.d.ts +77 -0
- package/dist/pages/8.11/TaskDetailsPage.js +324 -0
- package/dist/pages/8.11/TaskPanelPage.d.ts +26 -0
- package/dist/pages/8.11/TaskPanelPage.js +245 -0
- package/dist/pages/8.11/TaskProcessesPage.d.ts +18 -0
- package/dist/pages/8.11/TaskProcessesPage.js +134 -0
- package/dist/pages/8.11/UtilitiesPage.d.ts +56 -0
- package/dist/pages/8.11/UtilitiesPage.js +1024 -0
- package/dist/pages/8.11/WorkspaceMembersPage.d.ts +21 -0
- package/dist/pages/8.11/WorkspaceMembersPage.js +268 -0
- package/dist/tests/8.11/access-user-role-management.spec.d.ts +1 -0
- package/dist/tests/8.11/access-user-role-management.spec.js +487 -0
- package/dist/tests/8.11/agentic-ai-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/agentic-ai-user-flows.spec.js +209 -0
- package/dist/tests/8.11/aws-cluster-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/aws-cluster-user-flows.spec.js +188 -0
- package/dist/tests/8.11/aws-connectors-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/aws-connectors-user-flows.spec.js +167 -0
- package/dist/tests/8.11/cluster-variables.spec.d.ts +1 -0
- package/dist/tests/8.11/cluster-variables.spec.js +202 -0
- package/dist/tests/8.11/connectors-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/connectors-user-flows.spec.js +537 -0
- package/dist/tests/8.11/console-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/console-user-flows.spec.js +199 -0
- package/dist/tests/8.11/hto-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/hto-user-flows.spec.js +358 -0
- package/dist/tests/8.11/idp-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/idp-user-flows.spec.js +316 -0
- package/dist/tests/8.11/login-negative-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/login-negative-tests.spec.js +29 -0
- package/dist/tests/8.11/login.spec.d.ts +1 -0
- package/dist/tests/8.11/login.spec.js +29 -0
- package/dist/tests/8.11/navigation.spec.d.ts +1 -0
- package/dist/tests/8.11/navigation.spec.js +59 -0
- package/dist/tests/8.11/operate-access-flow.spec.d.ts +1 -0
- package/dist/tests/8.11/operate-access-flow.spec.js +136 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-api.spec.js +96 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-ui.spec.js +69 -0
- package/dist/tests/8.11/optimize-api-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-api-tests.spec.js +1194 -0
- package/dist/tests/8.11/optimize-collections-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-collections-api.spec.js +184 -0
- package/dist/tests/8.11/optimize-collections-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-collections-ui.spec.js +46 -0
- package/dist/tests/8.11/optimize-data-filters-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-data-filters-api.spec.js +195 -0
- package/dist/tests/8.11/optimize-data-filters-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-data-filters-ui.spec.js +306 -0
- package/dist/tests/8.11/optimize-exporter-filters-importer-e2e.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-exporter-filters-importer-e2e.spec.js +316 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-api.spec.js +337 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-ui.spec.js +198 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-audit-log.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-audit-log.spec.js +146 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-call-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-call-tools.spec.js +208 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-e2e-flow.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-e2e-flow.spec.js +151 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-list-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-list-tools.spec.js +242 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-cluster-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-cluster-tools.spec.js +75 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-incident-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-incident-tools.spec.js +123 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-user-task-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-user-task-tools.spec.js +151 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-variable-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-variable-tools.spec.js +123 -0
- package/dist/tests/8.11/play.spec.d.ts +1 -0
- package/dist/tests/8.11/play.spec.js +93 -0
- package/dist/tests/8.11/rba-enabled-v2-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/rba-enabled-v2-user-flows.spec.js +495 -0
- package/dist/tests/8.11/saas-migration-path-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/saas-migration-path-user-flows.spec.js +133 -0
- package/dist/tests/8.11/smoke-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/smoke-tests.spec.js +339 -0
- package/dist/tests/8.11/test-setup.spec.d.ts +1 -0
- package/dist/tests/8.11/test-setup.spec.js +256 -0
- package/dist/tests/8.11/web-modeler-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/web-modeler-user-flows.spec.js +523 -0
- package/dist/utils/clusterVersions.d.ts +2 -1
- package/dist/utils/clusterVersions.js +1 -0
- package/dist/utils/consoleApiHelpers.js +1 -0
- package/package.json +1 -1
- package/playwright.config.ts +10 -0
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const _8_11_1 = require("../../fixtures/8.11");
|
|
5
|
+
const apiHelpers_1 = require("../../utils/apiHelpers");
|
|
6
|
+
const randomName_1 = require("../../utils/randomName");
|
|
7
|
+
_8_11_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
|
+
};
|
|
34
|
+
_8_11_1.test.describe('API optimize SaaS Tests', () => {
|
|
35
|
+
let optimizeCookie;
|
|
36
|
+
let csrfToken;
|
|
37
|
+
let optimizeBearerToken;
|
|
38
|
+
let collectionIdValue;
|
|
39
|
+
let dashboardIdValue;
|
|
40
|
+
let dashboardNameValue;
|
|
41
|
+
let reportId;
|
|
42
|
+
let baseUrl;
|
|
43
|
+
_8_11_1.test.beforeAll(async ({ browser, request }) => {
|
|
44
|
+
const page = await browser.newPage();
|
|
45
|
+
({ optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSession)(page));
|
|
46
|
+
await page.close();
|
|
47
|
+
optimizeBearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
48
|
+
collectionIdValue = await (0, apiHelpers_1.createCollection)(request, {
|
|
49
|
+
name: await (0, randomName_1.randomNameAgregator)('Test Collection'),
|
|
50
|
+
optimizeCookie,
|
|
51
|
+
csrfToken,
|
|
52
|
+
});
|
|
53
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
54
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
55
|
+
optimizeCookie,
|
|
56
|
+
csrfToken,
|
|
57
|
+
collectionId: collectionIdValue,
|
|
58
|
+
data: [
|
|
59
|
+
{
|
|
60
|
+
definitionKey: 'customer_onboarding_en',
|
|
61
|
+
definitionType: 'process',
|
|
62
|
+
tenants: ['<default>'],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
dashboardNameValue = await (0, randomName_1.randomNameAgregator)('Test Dashboard');
|
|
67
|
+
dashboardIdValue = await (0, apiHelpers_1.createDashboard)(request, {
|
|
68
|
+
name: dashboardNameValue,
|
|
69
|
+
optimizeCookie,
|
|
70
|
+
csrfToken,
|
|
71
|
+
collectionId: collectionIdValue,
|
|
72
|
+
});
|
|
73
|
+
reportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
74
|
+
optimizeCookie,
|
|
75
|
+
csrfToken,
|
|
76
|
+
collectionId: collectionIdValue,
|
|
77
|
+
name: 'Blank report',
|
|
78
|
+
definitions: [
|
|
79
|
+
{
|
|
80
|
+
key: 'aProcess',
|
|
81
|
+
filter: [],
|
|
82
|
+
groupBy: { type: 'flowNodes', value: null },
|
|
83
|
+
distributedBy: { type: 'none', value: null },
|
|
84
|
+
view: { entity: 'flowNode', properties: ['duration'] },
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
_8_11_1.test.afterAll(async ({ request }) => {
|
|
90
|
+
if (collectionIdValue) {
|
|
91
|
+
await request.delete(`${baseUrl}/api/public/collection/${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
(0, _8_11_1.test)('Get dashboard IDs returns 200 with id array', async ({ request }) => {
|
|
95
|
+
await _8_11_1.test.step('GET /api/public/dashboard?collectionId returns 200', async () => {
|
|
96
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
97
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
98
|
+
const body = await response.json();
|
|
99
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
100
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
101
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
102
|
+
const ids = body.map((d) => d.id);
|
|
103
|
+
(0, test_1.expect)(ids).toContain(dashboardIdValue);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
(0, _8_11_1.test)('Get dashboards without token returns 401', async ({ request }) => {
|
|
107
|
+
await _8_11_1.test.step('GET /api/public/dashboard without token (401)', async () => {
|
|
108
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`);
|
|
109
|
+
await assertUnauthorizedResponseBody(response);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
(0, _8_11_1.test)('Get dashboards with invalid token returns 401', async ({ request }) => {
|
|
113
|
+
await _8_11_1.test.step('GET /api/public/dashboard with invalid token (401)', async () => {
|
|
114
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
115
|
+
await assertUnauthorizedResponseBody(response);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
(0, _8_11_1.test)('GET /api/public/dashboard/force-internal-error returns 500', async ({ request, }) => {
|
|
119
|
+
await _8_11_1.test.step('Force internal server error (500)', async () => {
|
|
120
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard/force-internal-error`, { headers: { Authorization: optimizeBearerToken } });
|
|
121
|
+
(0, test_1.expect)(response.status()).toBe(500);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
(0, _8_11_1.test)('Export dashboard definitions successfully returns 200', async ({ request, }) => {
|
|
125
|
+
await _8_11_1.test.step('POST export dashboard definitions (200)', async () => {
|
|
126
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
127
|
+
headers: {
|
|
128
|
+
Authorization: optimizeBearerToken,
|
|
129
|
+
'Content-Type': 'application/json',
|
|
130
|
+
},
|
|
131
|
+
data: [dashboardIdValue],
|
|
132
|
+
});
|
|
133
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
134
|
+
const body = await response.json();
|
|
135
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
136
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
137
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
138
|
+
(0, test_1.expect)(body[0].id).toBe(dashboardIdValue);
|
|
139
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
140
|
+
(0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
|
|
141
|
+
(0, test_1.expect)(body[0]).toHaveProperty('name');
|
|
142
|
+
(0, test_1.expect)(body[0].name).toBe(dashboardNameValue);
|
|
143
|
+
(0, test_1.expect)(body[0]).toHaveProperty('collectionId');
|
|
144
|
+
(0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
(0, _8_11_1.test)('Export dashboards without token returns 401', async ({ request }) => {
|
|
148
|
+
await _8_11_1.test.step('POST export dashboards without token (401)', async () => {
|
|
149
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
150
|
+
headers: { 'Content-Type': 'application/json' },
|
|
151
|
+
data: [dashboardIdValue],
|
|
152
|
+
});
|
|
153
|
+
await assertUnauthorizedResponseBody(response);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
(0, _8_11_1.test)('Export dashboards with invalid token returns 401', async ({ request, }) => {
|
|
157
|
+
await _8_11_1.test.step('POST export dashboards with invalid token (401)', async () => {
|
|
158
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
159
|
+
headers: {
|
|
160
|
+
Authorization: 'Bearer invalid_token',
|
|
161
|
+
'Content-Type': 'application/json',
|
|
162
|
+
},
|
|
163
|
+
data: [dashboardIdValue],
|
|
164
|
+
});
|
|
165
|
+
await assertUnauthorizedResponseBody(response);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
(0, _8_11_1.test)('Export dashboard with invalid body returns 400', async ({ request }) => {
|
|
169
|
+
await _8_11_1.test.step('POST export dashboard with invalid body (400)', async () => {
|
|
170
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
171
|
+
headers: {
|
|
172
|
+
Authorization: optimizeBearerToken,
|
|
173
|
+
'Content-Type': 'application/json',
|
|
174
|
+
},
|
|
175
|
+
data: [{}],
|
|
176
|
+
});
|
|
177
|
+
(0, test_1.expect)(response.status()).toBe(400);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
(0, _8_11_1.test)('Export non-existent dashboard returns 404', async ({ request }) => {
|
|
181
|
+
await _8_11_1.test.step('POST export non-existent dashboard (404)', async () => {
|
|
182
|
+
const fakeDashboardId = 'nonexistent-dashboard-id';
|
|
183
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
184
|
+
headers: {
|
|
185
|
+
Authorization: optimizeBearerToken,
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
},
|
|
188
|
+
data: [fakeDashboardId],
|
|
189
|
+
});
|
|
190
|
+
(0, test_1.expect)([401, 404]).toContain(response.status());
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
(0, _8_11_1.test)('Delete dashboard and verify it is no longer retrievable', async ({ request, }) => {
|
|
194
|
+
const dashboardToDeleteId = await (0, apiHelpers_1.createDashboard)(request, {
|
|
195
|
+
name: await (0, randomName_1.randomNameAgregator)('Dashboard To Delete'),
|
|
196
|
+
optimizeCookie,
|
|
197
|
+
csrfToken,
|
|
198
|
+
collectionId: collectionIdValue,
|
|
199
|
+
});
|
|
200
|
+
await _8_11_1.test.step('Delete dashboard successfully (200)', async () => {
|
|
201
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
202
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
203
|
+
});
|
|
204
|
+
await _8_11_1.test.step('Verify dashboard not found after deletion', async () => {
|
|
205
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard/${dashboardToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
206
|
+
(0, test_1.expect)([200, 404, 410, 500]).toContain(response.status());
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
(0, _8_11_1.test)('Delete dashboard with invalid token returns 401', async ({ request }) => {
|
|
210
|
+
await _8_11_1.test.step('DELETE /api/public/dashboard with invalid token (401)', async () => {
|
|
211
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${dashboardIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
212
|
+
await assertUnauthorizedResponseBody(response);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
(0, _8_11_1.test)('Delete non-existent dashboard returns 404', async ({ request }) => {
|
|
216
|
+
await _8_11_1.test.step('DELETE non-existent dashboard (404)', async () => {
|
|
217
|
+
const fakeDashboardId = 'nonexistent-dashboard-id';
|
|
218
|
+
const response = await request.delete(`${baseUrl}/api/public/dashboard/${fakeDashboardId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
219
|
+
(0, test_1.expect)(response.status()).toBe(404);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
(0, _8_11_1.test)('Get report IDs returns 200 with id array', async ({ request }) => {
|
|
223
|
+
await _8_11_1.test.step('GET /api/public/report?collectionId returns 200', async () => {
|
|
224
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: optimizeBearerToken } });
|
|
225
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
226
|
+
const body = await response.json();
|
|
227
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
228
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
229
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
230
|
+
const ids = body.map((r) => r.id);
|
|
231
|
+
(0, test_1.expect)(ids).toContain(reportId);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
(0, _8_11_1.test)('Get reports with invalid token returns 401', async ({ request }) => {
|
|
235
|
+
await _8_11_1.test.step('GET /api/public/report with invalid token (401)', async () => {
|
|
236
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionIdValue}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
237
|
+
await assertUnauthorizedResponseBody(response);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
(0, _8_11_1.test)('Export reports successfully returns 200 with full payload', async ({ request, }) => {
|
|
241
|
+
await _8_11_1.test.step('POST export report definitions (200)', async () => {
|
|
242
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
243
|
+
headers: {
|
|
244
|
+
Authorization: optimizeBearerToken,
|
|
245
|
+
'Content-Type': 'application/json',
|
|
246
|
+
},
|
|
247
|
+
data: [reportId],
|
|
248
|
+
});
|
|
249
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
250
|
+
const body = await response.json();
|
|
251
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
252
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
253
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
254
|
+
(0, test_1.expect)(body[0].id).toBe(reportId);
|
|
255
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
256
|
+
(0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
|
|
257
|
+
(0, test_1.expect)(body[0]).toHaveProperty('name');
|
|
258
|
+
(0, test_1.expect)(body[0].name).toBe('Blank report');
|
|
259
|
+
(0, test_1.expect)(body[0]).toHaveProperty('collectionId');
|
|
260
|
+
(0, test_1.expect)(body[0].collectionId).toBe(collectionIdValue);
|
|
261
|
+
(0, test_1.expect)(body[0]).toHaveProperty('data');
|
|
262
|
+
(0, test_1.expect)(body[0].data).toBeTruthy();
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
(0, _8_11_1.test)('Export reports with invalid token returns 401', async ({ request }) => {
|
|
266
|
+
await _8_11_1.test.step('POST export reports with invalid token (401)', async () => {
|
|
267
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
268
|
+
headers: {
|
|
269
|
+
Authorization: 'Bearer invalid_token',
|
|
270
|
+
'Content-Type': 'application/json',
|
|
271
|
+
},
|
|
272
|
+
data: [reportId],
|
|
273
|
+
});
|
|
274
|
+
await assertUnauthorizedResponseBody(response);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
(0, _8_11_1.test)('Export non-existent report returns 404', async ({ request }) => {
|
|
278
|
+
await _8_11_1.test.step('POST export non-existent report (404)', async () => {
|
|
279
|
+
const invalidReportId = '11111111-1111-1111-1111-111111111111';
|
|
280
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
281
|
+
headers: {
|
|
282
|
+
Authorization: optimizeBearerToken,
|
|
283
|
+
'Content-Type': 'application/json',
|
|
284
|
+
},
|
|
285
|
+
data: [invalidReportId],
|
|
286
|
+
});
|
|
287
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 404);
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
(0, _8_11_1.test)('Delete report and verify it is no longer retrievable', async ({ request, }) => {
|
|
291
|
+
const reportToDeleteId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
292
|
+
optimizeCookie,
|
|
293
|
+
csrfToken,
|
|
294
|
+
collectionId: collectionIdValue,
|
|
295
|
+
name: await (0, randomName_1.randomNameAgregator)('Report To Delete'),
|
|
296
|
+
definitions: [
|
|
297
|
+
{
|
|
298
|
+
key: 'aProcess',
|
|
299
|
+
filter: [],
|
|
300
|
+
groupBy: { type: 'flowNodes', value: null },
|
|
301
|
+
distributedBy: { type: 'none', value: null },
|
|
302
|
+
view: { entity: 'flowNode', properties: ['duration'] },
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
await _8_11_1.test.step('Delete report successfully (200)', async () => {
|
|
307
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${reportToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
308
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
309
|
+
});
|
|
310
|
+
await _8_11_1.test.step('Verify deleted report is no longer retrievable (404 or 500)', async () => {
|
|
311
|
+
const response = await request.get(`${baseUrl}/api/public/report/${reportToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
312
|
+
(0, test_1.expect)([404, 500]).toContain(response.status());
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
(0, _8_11_1.test)('Delete report with invalid token returns 401', async ({ request }) => {
|
|
316
|
+
await _8_11_1.test.step('DELETE /api/public/report with invalid token (401)', async () => {
|
|
317
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${reportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
318
|
+
await assertUnauthorizedResponseBody(response);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
(0, _8_11_1.test)('Import entities successfully (200)', async ({ request }) => {
|
|
322
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: optimizeBearerToken,
|
|
325
|
+
'Content-Type': 'application/json',
|
|
326
|
+
},
|
|
327
|
+
data: [dashboardIdValue],
|
|
328
|
+
});
|
|
329
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
330
|
+
const entitiesToImport = await exportResponse.json();
|
|
331
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
332
|
+
headers: {
|
|
333
|
+
Authorization: optimizeBearerToken,
|
|
334
|
+
'Content-Type': 'application/json',
|
|
335
|
+
},
|
|
336
|
+
data: entitiesToImport,
|
|
337
|
+
});
|
|
338
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
339
|
+
const importResult = await response.json();
|
|
340
|
+
(0, test_1.expect)(Array.isArray(importResult)).toBeTruthy();
|
|
341
|
+
(0, test_1.expect)(importResult.length).toBeGreaterThan(0);
|
|
342
|
+
});
|
|
343
|
+
(0, _8_11_1.test)('Import without token or invalid token returns 401', async ({ request, }) => {
|
|
344
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
345
|
+
headers: {
|
|
346
|
+
Authorization: optimizeBearerToken,
|
|
347
|
+
'Content-Type': 'application/json',
|
|
348
|
+
},
|
|
349
|
+
data: [dashboardIdValue],
|
|
350
|
+
});
|
|
351
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
352
|
+
const entitiesToImport = await exportResponse.json();
|
|
353
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${collectionIdValue}`, {
|
|
354
|
+
headers: {
|
|
355
|
+
Authorization: 'Bearer invalid_token',
|
|
356
|
+
'Content-Type': 'application/json',
|
|
357
|
+
},
|
|
358
|
+
data: entitiesToImport,
|
|
359
|
+
});
|
|
360
|
+
await assertUnauthorizedResponseBody(response);
|
|
361
|
+
});
|
|
362
|
+
(0, _8_11_1.test)('Import to non-existent collection (404)', async ({ request }) => {
|
|
363
|
+
const exportResponse = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
364
|
+
headers: {
|
|
365
|
+
Authorization: optimizeBearerToken,
|
|
366
|
+
'Content-Type': 'application/json',
|
|
367
|
+
},
|
|
368
|
+
data: [dashboardIdValue],
|
|
369
|
+
});
|
|
370
|
+
await (0, apiHelpers_1.assertResponseStatus)(exportResponse, 200);
|
|
371
|
+
const entitiesToImport = await exportResponse.json();
|
|
372
|
+
const fakeCollectionId = 'nonexistent-collection-id';
|
|
373
|
+
const response = await request.post(`${baseUrl}/api/public/import?collectionId=${fakeCollectionId}`, {
|
|
374
|
+
headers: {
|
|
375
|
+
Authorization: optimizeBearerToken,
|
|
376
|
+
'Content-Type': 'application/json',
|
|
377
|
+
},
|
|
378
|
+
data: entitiesToImport,
|
|
379
|
+
});
|
|
380
|
+
(0, test_1.expect)(response.status()).toBe(404);
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Conditional Events', () => {
|
|
384
|
+
let optimizeCookie;
|
|
385
|
+
let csrfToken;
|
|
386
|
+
let optimizeBearerToken;
|
|
387
|
+
let conditionalEventsCollectionId;
|
|
388
|
+
let conditionalEventsReportId;
|
|
389
|
+
let conditionalEventsReportName;
|
|
390
|
+
let baseUrl;
|
|
391
|
+
const CONDITIONAL_EVENTS_PROCESS_KEY = 'conditional-events-auto-process';
|
|
392
|
+
_8_11_1.test.beforeAll(async ({ browser, request }) => {
|
|
393
|
+
const page = await browser.newPage();
|
|
394
|
+
({ optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSession)(page));
|
|
395
|
+
await page.close();
|
|
396
|
+
optimizeBearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
397
|
+
conditionalEventsCollectionId = await (0, apiHelpers_1.createCollection)(request, {
|
|
398
|
+
name: await (0, randomName_1.randomNameAgregator)('Conditional Events Collection'),
|
|
399
|
+
optimizeCookie,
|
|
400
|
+
csrfToken,
|
|
401
|
+
});
|
|
402
|
+
await (0, apiHelpers_1.updateCollectionScope)(request, {
|
|
403
|
+
optimizeCookie,
|
|
404
|
+
csrfToken,
|
|
405
|
+
collectionId: conditionalEventsCollectionId,
|
|
406
|
+
data: [
|
|
407
|
+
{
|
|
408
|
+
definitionKey: CONDITIONAL_EVENTS_PROCESS_KEY,
|
|
409
|
+
definitionType: 'process',
|
|
410
|
+
tenants: ['<default>'],
|
|
411
|
+
},
|
|
412
|
+
],
|
|
413
|
+
});
|
|
414
|
+
conditionalEventsReportName = await (0, randomName_1.randomNameAgregator)('Conditional Events Report');
|
|
415
|
+
conditionalEventsReportId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
416
|
+
optimizeCookie,
|
|
417
|
+
csrfToken,
|
|
418
|
+
collectionId: conditionalEventsCollectionId,
|
|
419
|
+
name: conditionalEventsReportName,
|
|
420
|
+
definitions: [
|
|
421
|
+
{
|
|
422
|
+
key: CONDITIONAL_EVENTS_PROCESS_KEY,
|
|
423
|
+
filter: [],
|
|
424
|
+
groupBy: { type: 'none', value: null },
|
|
425
|
+
distributedBy: { type: 'none', value: null },
|
|
426
|
+
view: { entity: 'processInstance', properties: ['frequency'] },
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
});
|
|
430
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
431
|
+
});
|
|
432
|
+
_8_11_1.test.afterAll(async ({ request }) => {
|
|
433
|
+
if (conditionalEventsCollectionId) {
|
|
434
|
+
await request.delete(`${baseUrl}/api/public/collection/${conditionalEventsCollectionId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
(0, _8_11_1.test)('CE-OPT-09: Creating a Process Report for Conditional Events via API returns HTTP 200', async ({ request, }) => {
|
|
438
|
+
await _8_11_1.test.step('Create a process report for conditional-events-auto-process (200)', async () => {
|
|
439
|
+
const response = await request.post(`${baseUrl}/api/report/process/single`, {
|
|
440
|
+
headers: {
|
|
441
|
+
Cookie: optimizeCookie,
|
|
442
|
+
'X-CSRF-TOKEN': csrfToken,
|
|
443
|
+
'Content-Type': 'application/json',
|
|
444
|
+
},
|
|
445
|
+
data: {
|
|
446
|
+
collectionId: conditionalEventsCollectionId,
|
|
447
|
+
name: await (0, randomName_1.randomNameAgregator)('CE Report Inline'),
|
|
448
|
+
description: null,
|
|
449
|
+
data: {},
|
|
450
|
+
configuration: {
|
|
451
|
+
definitions: [
|
|
452
|
+
{
|
|
453
|
+
key: CONDITIONAL_EVENTS_PROCESS_KEY,
|
|
454
|
+
filter: [],
|
|
455
|
+
groupBy: { type: 'none', value: null },
|
|
456
|
+
distributedBy: { type: 'none', value: null },
|
|
457
|
+
view: {
|
|
458
|
+
entity: 'processInstance',
|
|
459
|
+
properties: ['frequency'],
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
],
|
|
463
|
+
visualization: null,
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
468
|
+
const body = await response.json();
|
|
469
|
+
(0, test_1.expect)(body).toHaveProperty('id');
|
|
470
|
+
(0, test_1.expect)(body.id).toBeTruthy();
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
(0, _8_11_1.test)('CE-OPT-10: Exporting the Conditional Events report definition via API returns the full report payload', async ({ request, }) => {
|
|
474
|
+
await _8_11_1.test.step('Export report definition successfully (200)', async () => {
|
|
475
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
476
|
+
headers: {
|
|
477
|
+
Authorization: optimizeBearerToken,
|
|
478
|
+
'Content-Type': 'application/json',
|
|
479
|
+
},
|
|
480
|
+
data: [conditionalEventsReportId],
|
|
481
|
+
});
|
|
482
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
483
|
+
const body = await response.json();
|
|
484
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
485
|
+
(0, test_1.expect)(body.length).toBeGreaterThan(0);
|
|
486
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
487
|
+
(0, test_1.expect)(body[0].id).toBe(conditionalEventsReportId);
|
|
488
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
489
|
+
(0, test_1.expect)(body[0].exportEntityType).toBeTruthy();
|
|
490
|
+
(0, test_1.expect)(body[0]).toHaveProperty('name');
|
|
491
|
+
(0, test_1.expect)(body[0].name).toBe(conditionalEventsReportName);
|
|
492
|
+
(0, test_1.expect)(body[0]).toHaveProperty('collectionId');
|
|
493
|
+
(0, test_1.expect)(body[0].collectionId).toBe(conditionalEventsCollectionId);
|
|
494
|
+
(0, test_1.expect)(body[0]).toHaveProperty('data');
|
|
495
|
+
(0, test_1.expect)(body[0].data).toBeTruthy();
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
(0, _8_11_1.test)('CE-OPT-11: Exporting the Conditional Events report without a token returns 401', async ({ request, }) => {
|
|
499
|
+
await _8_11_1.test.step('Export report definition without Authorization header (401)', async () => {
|
|
500
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
501
|
+
headers: { 'Content-Type': 'application/json' },
|
|
502
|
+
data: [conditionalEventsReportId],
|
|
503
|
+
});
|
|
504
|
+
await assertUnauthorizedResponseBody(response);
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
(0, _8_11_1.test)('CE-OPT-12: Exporting the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
|
|
508
|
+
await _8_11_1.test.step('Export report definition with invalid token (401)', async () => {
|
|
509
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
510
|
+
headers: {
|
|
511
|
+
Authorization: 'Bearer invalid_token',
|
|
512
|
+
'Content-Type': 'application/json',
|
|
513
|
+
},
|
|
514
|
+
data: [conditionalEventsReportId],
|
|
515
|
+
});
|
|
516
|
+
await assertUnauthorizedResponseBody(response);
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
(0, _8_11_1.test)('CE-OPT-13: Deleting the Conditional Events report via API succeeds with HTTP 200', async ({ request, }) => {
|
|
520
|
+
const reportToDeleteId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
521
|
+
optimizeCookie,
|
|
522
|
+
csrfToken,
|
|
523
|
+
collectionId: conditionalEventsCollectionId,
|
|
524
|
+
name: await (0, randomName_1.randomNameAgregator)('CE Report To Delete'),
|
|
525
|
+
definitions: [
|
|
526
|
+
{
|
|
527
|
+
key: CONDITIONAL_EVENTS_PROCESS_KEY,
|
|
528
|
+
filter: [],
|
|
529
|
+
groupBy: { type: 'none', value: null },
|
|
530
|
+
distributedBy: { type: 'none', value: null },
|
|
531
|
+
view: { entity: 'processInstance', properties: ['frequency'] },
|
|
532
|
+
},
|
|
533
|
+
],
|
|
534
|
+
});
|
|
535
|
+
await _8_11_1.test.step('Delete report successfully (200)', async () => {
|
|
536
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${reportToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
537
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
(0, _8_11_1.test)('CE-OPT-14: A deleted Conditional Events report is no longer retrievable via the API', async ({ request, }) => {
|
|
541
|
+
const reportToDeleteId = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
542
|
+
optimizeCookie,
|
|
543
|
+
csrfToken,
|
|
544
|
+
collectionId: conditionalEventsCollectionId,
|
|
545
|
+
name: await (0, randomName_1.randomNameAgregator)('CE Report Delete Verify'),
|
|
546
|
+
definitions: [
|
|
547
|
+
{
|
|
548
|
+
key: CONDITIONAL_EVENTS_PROCESS_KEY,
|
|
549
|
+
filter: [],
|
|
550
|
+
groupBy: { type: 'none', value: null },
|
|
551
|
+
distributedBy: { type: 'none', value: null },
|
|
552
|
+
view: { entity: 'processInstance', properties: ['frequency'] },
|
|
553
|
+
},
|
|
554
|
+
],
|
|
555
|
+
});
|
|
556
|
+
await _8_11_1.test.step('Delete the report', async () => {
|
|
557
|
+
const deleteResponse = await request.delete(`${baseUrl}/api/public/report/${reportToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
558
|
+
await (0, apiHelpers_1.assertResponseStatus)(deleteResponse, 200);
|
|
559
|
+
});
|
|
560
|
+
await _8_11_1.test.step('Verify deleted report is no longer retrievable (404 or 500)', async () => {
|
|
561
|
+
const getResponse = await request.get(`${baseUrl}/api/public/report/${reportToDeleteId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
562
|
+
(0, test_1.expect)([404, 500]).toContain(getResponse.status());
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
(0, _8_11_1.test)('CE-OPT-15: Attempting to delete the Conditional Events report with an invalid token returns 401', async ({ request, }) => {
|
|
566
|
+
await _8_11_1.test.step('Delete report with invalid token (401)', async () => {
|
|
567
|
+
const response = await request.delete(`${baseUrl}/api/public/report/${conditionalEventsReportId}`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
568
|
+
await assertUnauthorizedResponseBody(response);
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Health Readiness', () => {
|
|
573
|
+
let baseUrl;
|
|
574
|
+
_8_11_1.test.beforeAll(async () => {
|
|
575
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
576
|
+
});
|
|
577
|
+
(0, _8_11_1.test)('Health readiness returns 200 when Optimize is ready', async ({ request, }) => {
|
|
578
|
+
await _8_11_1.test.step('GET /api/readyz returns 200 (no auth required)', async () => {
|
|
579
|
+
const response = await request.get(`${baseUrl}/api/readyz`);
|
|
580
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
(0, _8_11_1.test)('Health readiness returns 200 when request includes an Authorization header', async ({ request, }) => {
|
|
584
|
+
await _8_11_1.test.step('GET /api/readyz with Authorization header still returns 200', async () => {
|
|
585
|
+
const token = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
586
|
+
const response = await request.get(`${baseUrl}/api/readyz`, {
|
|
587
|
+
headers: { Authorization: token },
|
|
588
|
+
});
|
|
589
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Sharing', () => {
|
|
594
|
+
let optimizeBearerToken;
|
|
595
|
+
let baseUrl;
|
|
596
|
+
_8_11_1.test.beforeAll(async () => {
|
|
597
|
+
optimizeBearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
598
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
599
|
+
});
|
|
600
|
+
// Sharing is cluster-global, so leaving it off would break every
|
|
601
|
+
// concurrently running spec that shares a report or dashboard.
|
|
602
|
+
_8_11_1.test.afterAll(async ({ request }) => {
|
|
603
|
+
await (0, apiHelpers_1.setOptimizeSharing)(request, {
|
|
604
|
+
baseUrl,
|
|
605
|
+
bearerToken: optimizeBearerToken,
|
|
606
|
+
enabled: true,
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
(0, _8_11_1.test)('Enable sharing with valid token returns 200 or 204', async ({ request, }) => {
|
|
610
|
+
await _8_11_1.test.step('POST /api/public/share/enable with valid token (200 or 204)', async () => {
|
|
611
|
+
const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: optimizeBearerToken } });
|
|
612
|
+
(0, test_1.expect)([200, 204]).toContain(response.status());
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
(0, _8_11_1.test)('Enable sharing without token returns 401', async ({ request }) => {
|
|
616
|
+
await _8_11_1.test.step('POST /api/public/share/enable without token (401)', async () => {
|
|
617
|
+
const response = await request.post(`${baseUrl}/api/public/share/enable`);
|
|
618
|
+
await assertUnauthorizedResponseBody(response);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
(0, _8_11_1.test)('Enable sharing with invalid token returns 401', async ({ request }) => {
|
|
622
|
+
await _8_11_1.test.step('POST /api/public/share/enable with invalid token (401)', async () => {
|
|
623
|
+
const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
624
|
+
await assertUnauthorizedResponseBody(response);
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
(0, _8_11_1.test)('Disable sharing with valid token returns 200 or 204', async ({ request, }) => {
|
|
628
|
+
await _8_11_1.test.step('POST /api/public/share/disable with valid token (200 or 204)', async () => {
|
|
629
|
+
const response = await request.post(`${baseUrl}/api/public/share/disable`, { headers: { Authorization: optimizeBearerToken } });
|
|
630
|
+
(0, test_1.expect)([200, 204]).toContain(response.status());
|
|
631
|
+
});
|
|
632
|
+
await _8_11_1.test.step('Re-enable sharing to restore the cluster-wide setting', async () => {
|
|
633
|
+
await (0, apiHelpers_1.setOptimizeSharing)(request, {
|
|
634
|
+
baseUrl,
|
|
635
|
+
bearerToken: optimizeBearerToken,
|
|
636
|
+
enabled: true,
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
(0, _8_11_1.test)('Disable sharing without token returns 401', async ({ request }) => {
|
|
641
|
+
await _8_11_1.test.step('POST /api/public/share/disable without token (401)', async () => {
|
|
642
|
+
const response = await request.post(`${baseUrl}/api/public/share/disable`);
|
|
643
|
+
await assertUnauthorizedResponseBody(response);
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
(0, _8_11_1.test)('Disable sharing with invalid token returns 401', async ({ request }) => {
|
|
647
|
+
await _8_11_1.test.step('POST /api/public/share/disable with invalid token (401)', async () => {
|
|
648
|
+
const response = await request.post(`${baseUrl}/api/public/share/disable`, { headers: { Authorization: 'Bearer invalid_token' } });
|
|
649
|
+
await assertUnauthorizedResponseBody(response);
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
(0, _8_11_1.test)('Sharing toggle cycle: enable then disable is idempotent', async ({ request, }) => {
|
|
653
|
+
await _8_11_1.test.step('Enable sharing (200 or 204)', async () => {
|
|
654
|
+
const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: optimizeBearerToken } });
|
|
655
|
+
(0, test_1.expect)([200, 204]).toContain(response.status());
|
|
656
|
+
});
|
|
657
|
+
await _8_11_1.test.step('Disable sharing (200 or 204)', async () => {
|
|
658
|
+
const response = await request.post(`${baseUrl}/api/public/share/disable`, { headers: { Authorization: optimizeBearerToken } });
|
|
659
|
+
(0, test_1.expect)([200, 204]).toContain(response.status());
|
|
660
|
+
});
|
|
661
|
+
await _8_11_1.test.step('Re-enable sharing returns 200 or 204 (idempotent)', async () => {
|
|
662
|
+
const response = await request.post(`${baseUrl}/api/public/share/enable`, { headers: { Authorization: optimizeBearerToken } });
|
|
663
|
+
(0, test_1.expect)([200, 204]).toContain(response.status());
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Dashboard and Report GET edge cases', () => {
|
|
668
|
+
let optimizeBearerToken;
|
|
669
|
+
let optimizeCookie;
|
|
670
|
+
let csrfToken;
|
|
671
|
+
let collectionId;
|
|
672
|
+
let baseUrl;
|
|
673
|
+
_8_11_1.test.beforeAll(async ({ browser, request }) => {
|
|
674
|
+
const page = await browser.newPage();
|
|
675
|
+
({ optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSession)(page));
|
|
676
|
+
await page.close();
|
|
677
|
+
optimizeBearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
678
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
679
|
+
collectionId = await (0, apiHelpers_1.createCollection)(request, {
|
|
680
|
+
name: await (0, randomName_1.randomNameAgregator)('GET Edge Cases Collection'),
|
|
681
|
+
optimizeCookie,
|
|
682
|
+
csrfToken,
|
|
683
|
+
});
|
|
684
|
+
});
|
|
685
|
+
_8_11_1.test.afterAll(async ({ request }) => {
|
|
686
|
+
if (collectionId) {
|
|
687
|
+
await request.delete(`${baseUrl}/api/public/collection/${collectionId}`, {
|
|
688
|
+
headers: { Authorization: optimizeBearerToken },
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
(0, _8_11_1.test)('GET dashboards with valid token and collectionId returns 200 with id array', async ({ request, }) => {
|
|
693
|
+
await _8_11_1.test.step('GET /api/public/dashboard?collectionId returns 200', async () => {
|
|
694
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=${collectionId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
695
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
696
|
+
const body = await response.json();
|
|
697
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
698
|
+
(0, test_1.expect)(body.every((dashboard) => typeof dashboard.id === 'string' && dashboard.id.length > 0)).toBeTruthy();
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
(0, _8_11_1.test)('GET dashboards without collectionId param returns 400 or 500', async ({ request, }) => {
|
|
702
|
+
await _8_11_1.test.step('GET /api/public/dashboard without collectionId', async () => {
|
|
703
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard`, {
|
|
704
|
+
headers: { Authorization: optimizeBearerToken },
|
|
705
|
+
});
|
|
706
|
+
(0, test_1.expect)([400, 500]).toContain(response.status());
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
(0, _8_11_1.test)('GET reports with valid token and collectionId returns 200 with id array', async ({ request, }) => {
|
|
710
|
+
await _8_11_1.test.step('GET /api/public/report?collectionId returns 200', async () => {
|
|
711
|
+
const response = await request.get(`${baseUrl}/api/public/report?collectionId=${collectionId}`, { headers: { Authorization: optimizeBearerToken } });
|
|
712
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
713
|
+
const body = await response.json();
|
|
714
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
715
|
+
(0, test_1.expect)(body.length).toBe(0);
|
|
716
|
+
});
|
|
717
|
+
});
|
|
718
|
+
(0, _8_11_1.test)('GET reports without collectionId param returns 400 or 500', async ({ request, }) => {
|
|
719
|
+
await _8_11_1.test.step('GET /api/public/report without collectionId', async () => {
|
|
720
|
+
const response = await request.get(`${baseUrl}/api/public/report`, {
|
|
721
|
+
headers: { Authorization: optimizeBearerToken },
|
|
722
|
+
});
|
|
723
|
+
(0, test_1.expect)([400, 500]).toContain(response.status());
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Export edge cases', () => {
|
|
728
|
+
let optimizeBearerToken;
|
|
729
|
+
let optimizeCookie;
|
|
730
|
+
let csrfToken;
|
|
731
|
+
let collectionId;
|
|
732
|
+
let dashboardId1;
|
|
733
|
+
let dashboardId2;
|
|
734
|
+
let reportId1;
|
|
735
|
+
let reportId2;
|
|
736
|
+
let baseUrl;
|
|
737
|
+
_8_11_1.test.beforeAll(async ({ browser, request }) => {
|
|
738
|
+
const page = await browser.newPage();
|
|
739
|
+
({ optimizeCookie, csrfToken } = await (0, apiHelpers_1.loginToOptimizeSession)(page));
|
|
740
|
+
await page.close();
|
|
741
|
+
optimizeBearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
742
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
743
|
+
collectionId = await (0, apiHelpers_1.createCollection)(request, {
|
|
744
|
+
name: await (0, randomName_1.randomNameAgregator)('Export Edge Cases Collection'),
|
|
745
|
+
optimizeCookie,
|
|
746
|
+
csrfToken,
|
|
747
|
+
});
|
|
748
|
+
dashboardId1 = await (0, apiHelpers_1.createDashboard)(request, {
|
|
749
|
+
name: await (0, randomName_1.randomNameAgregator)('Export Dashboard 1'),
|
|
750
|
+
optimizeCookie,
|
|
751
|
+
csrfToken,
|
|
752
|
+
collectionId,
|
|
753
|
+
});
|
|
754
|
+
dashboardId2 = await (0, apiHelpers_1.createDashboard)(request, {
|
|
755
|
+
name: await (0, randomName_1.randomNameAgregator)('Export Dashboard 2'),
|
|
756
|
+
optimizeCookie,
|
|
757
|
+
csrfToken,
|
|
758
|
+
collectionId,
|
|
759
|
+
});
|
|
760
|
+
reportId1 = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
761
|
+
optimizeCookie,
|
|
762
|
+
csrfToken,
|
|
763
|
+
collectionId,
|
|
764
|
+
name: await (0, randomName_1.randomNameAgregator)('Export Report 1'),
|
|
765
|
+
definitions: [
|
|
766
|
+
{
|
|
767
|
+
key: 'aProcess',
|
|
768
|
+
filter: [],
|
|
769
|
+
groupBy: { type: 'none', value: null },
|
|
770
|
+
distributedBy: { type: 'none', value: null },
|
|
771
|
+
view: { entity: 'processInstance', properties: ['frequency'] },
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
});
|
|
775
|
+
reportId2 = await (0, apiHelpers_1.createSingleProcessReport)(request, {
|
|
776
|
+
optimizeCookie,
|
|
777
|
+
csrfToken,
|
|
778
|
+
collectionId,
|
|
779
|
+
name: await (0, randomName_1.randomNameAgregator)('Export Report 2'),
|
|
780
|
+
definitions: [
|
|
781
|
+
{
|
|
782
|
+
key: 'aProcess',
|
|
783
|
+
filter: [],
|
|
784
|
+
groupBy: { type: 'none', value: null },
|
|
785
|
+
distributedBy: { type: 'none', value: null },
|
|
786
|
+
view: { entity: 'processInstance', properties: ['frequency'] },
|
|
787
|
+
},
|
|
788
|
+
],
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
_8_11_1.test.afterAll(async ({ request }) => {
|
|
792
|
+
if (collectionId) {
|
|
793
|
+
await request.delete(`${baseUrl}/api/public/collection/${collectionId}`, {
|
|
794
|
+
headers: { Authorization: optimizeBearerToken },
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
(0, _8_11_1.test)('Export multiple dashboards in a single call returns 200 with all definitions', async ({ request, }) => {
|
|
799
|
+
await _8_11_1.test.step('POST export with two dashboard IDs returns array of 2', async () => {
|
|
800
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
801
|
+
headers: {
|
|
802
|
+
Authorization: optimizeBearerToken,
|
|
803
|
+
'Content-Type': 'application/json',
|
|
804
|
+
},
|
|
805
|
+
data: [dashboardId1, dashboardId2],
|
|
806
|
+
});
|
|
807
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
808
|
+
const body = await response.json();
|
|
809
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
810
|
+
(0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
|
|
811
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
812
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
813
|
+
const exportedIds = body.map((d) => d.id);
|
|
814
|
+
(0, test_1.expect)(exportedIds).toContain(dashboardId1);
|
|
815
|
+
(0, test_1.expect)(exportedIds).toContain(dashboardId2);
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
(0, _8_11_1.test)('Export multiple reports in a single call returns 200 with all definitions', async ({ request, }) => {
|
|
819
|
+
await _8_11_1.test.step('POST export with two report IDs returns array of 2', async () => {
|
|
820
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
821
|
+
headers: {
|
|
822
|
+
Authorization: optimizeBearerToken,
|
|
823
|
+
'Content-Type': 'application/json',
|
|
824
|
+
},
|
|
825
|
+
data: [reportId1, reportId2],
|
|
826
|
+
});
|
|
827
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
828
|
+
const body = await response.json();
|
|
829
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
830
|
+
(0, test_1.expect)(body.length).toBeGreaterThanOrEqual(2);
|
|
831
|
+
(0, test_1.expect)(body[0]).toHaveProperty('id');
|
|
832
|
+
(0, test_1.expect)(body[0]).toHaveProperty('exportEntityType');
|
|
833
|
+
const exportedIds = body.map((d) => d.id);
|
|
834
|
+
(0, test_1.expect)(exportedIds).toContain(reportId1);
|
|
835
|
+
(0, test_1.expect)(exportedIds).toContain(reportId2);
|
|
836
|
+
});
|
|
837
|
+
});
|
|
838
|
+
(0, _8_11_1.test)('Export reports with empty array body returns 200 with empty array', async ({ request, }) => {
|
|
839
|
+
await _8_11_1.test.step('POST export/report with empty array body returns 200 []', async () => {
|
|
840
|
+
const response = await request.post(`${baseUrl}/api/public/export/report/definition/json`, {
|
|
841
|
+
headers: {
|
|
842
|
+
Authorization: optimizeBearerToken,
|
|
843
|
+
'Content-Type': 'application/json',
|
|
844
|
+
},
|
|
845
|
+
data: [],
|
|
846
|
+
});
|
|
847
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
848
|
+
const body = await response.json();
|
|
849
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
850
|
+
(0, test_1.expect)(body.length).toBe(0);
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
(0, _8_11_1.test)('Export dashboards with empty array body returns 200 with empty array', async ({ request, }) => {
|
|
854
|
+
await _8_11_1.test.step('POST export/dashboard with empty array body returns 200 []', async () => {
|
|
855
|
+
const response = await request.post(`${baseUrl}/api/public/export/dashboard/definition/json`, {
|
|
856
|
+
headers: {
|
|
857
|
+
Authorization: optimizeBearerToken,
|
|
858
|
+
'Content-Type': 'application/json',
|
|
859
|
+
},
|
|
860
|
+
data: [],
|
|
861
|
+
});
|
|
862
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
863
|
+
const body = await response.json();
|
|
864
|
+
(0, test_1.expect)(Array.isArray(body)).toBeTruthy();
|
|
865
|
+
(0, test_1.expect)(body.length).toBe(0);
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
_8_11_1.test.describe('API optimize SaaS Tests - Auth edge cases', () => {
|
|
870
|
+
let baseUrl;
|
|
871
|
+
_8_11_1.test.beforeAll(async () => {
|
|
872
|
+
baseUrl = process.env.CAMUNDA_OPTIMIZE_BASE_URL;
|
|
873
|
+
});
|
|
874
|
+
(0, _8_11_1.test)('Expired JWT token returns 401 on dashboard endpoint', async ({ request, }) => {
|
|
875
|
+
const expiredToken = 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.' +
|
|
876
|
+
'eyJzdWIiOiJ0ZXN0IiwiZXhwIjoxfQ.' +
|
|
877
|
+
'invalidsignature';
|
|
878
|
+
await _8_11_1.test.step('GET /api/public/dashboard with expired token returns 401', async () => {
|
|
879
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: expiredToken } });
|
|
880
|
+
await assertUnauthorizedResponseBody(response);
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
(0, _8_11_1.test)('Malformed Bearer value (empty string) returns 401 on dashboard endpoint', async ({ request, }) => {
|
|
884
|
+
await _8_11_1.test.step('GET /api/public/dashboard with empty Bearer value returns 401', async () => {
|
|
885
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: 'Bearer ' } });
|
|
886
|
+
await assertUnauthorizedResponseBody(response);
|
|
887
|
+
});
|
|
888
|
+
});
|
|
889
|
+
(0, _8_11_1.test)('Token with wrong audience returns 401 on dashboard endpoint', async ({ request, }) => {
|
|
890
|
+
await _8_11_1.test.step('Use a Zeebe-audience token against Optimize API and expect 401', async () => {
|
|
891
|
+
const wrongAudienceToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
892
|
+
const response = await request.get(`${baseUrl}/api/public/dashboard?collectionId=any`, { headers: { Authorization: wrongAudienceToken } });
|
|
893
|
+
await assertUnauthorizedResponseBody(response);
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
});
|
|
897
|
+
_8_11_1.test.describe('API V2 tests on SaaS cluster', () => {
|
|
898
|
+
let bearerToken;
|
|
899
|
+
const apiUrl = () => process.env.ZEEBE_API_URL;
|
|
900
|
+
_8_11_1.test.beforeAll(async () => {
|
|
901
|
+
bearerToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
902
|
+
});
|
|
903
|
+
(0, _8_11_1.test)('GET /v2/topology returns 200', async ({ request }) => {
|
|
904
|
+
const response = await request.get(`${apiUrl()}/v2/topology`, {
|
|
905
|
+
headers: { Authorization: bearerToken, 'Content-Type': 'application/json' },
|
|
906
|
+
});
|
|
907
|
+
await (0, apiHelpers_1.assertResponseStatus)(response, 200);
|
|
908
|
+
});
|
|
909
|
+
(0, _8_11_1.test)('GET /v2/topology without token returns 401', async ({ request }) => {
|
|
910
|
+
const response = await request.get(`${apiUrl()}/v2/topology`, {
|
|
911
|
+
headers: { 'Content-Type': 'application/json' },
|
|
912
|
+
});
|
|
913
|
+
await assertUnauthorizedResponseBody(response);
|
|
914
|
+
});
|
|
915
|
+
(0, _8_11_1.test)('POST /v2/process-definitions/search returns 200 with items array', async ({ request, }) => {
|
|
916
|
+
const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
|
|
917
|
+
headers: {
|
|
918
|
+
Authorization: bearerToken,
|
|
919
|
+
'Content-Type': 'application/json',
|
|
920
|
+
},
|
|
921
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
922
|
+
});
|
|
923
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
924
|
+
if (response.status() === 200) {
|
|
925
|
+
const body = await response.json();
|
|
926
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
927
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
(0, _8_11_1.test)('POST /v2/process-definitions/search without token returns 401', async ({ request, }) => {
|
|
931
|
+
const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
|
|
932
|
+
headers: { 'Content-Type': 'application/json' },
|
|
933
|
+
data: { filter: {}, size: 10 },
|
|
934
|
+
});
|
|
935
|
+
await assertUnauthorizedResponseBody(response);
|
|
936
|
+
});
|
|
937
|
+
(0, _8_11_1.test)('POST /v2/process-definitions/search with invalid token returns 401', async ({ request, }) => {
|
|
938
|
+
const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
|
|
939
|
+
headers: {
|
|
940
|
+
Authorization: 'Bearer invalid_token',
|
|
941
|
+
'Content-Type': 'application/json',
|
|
942
|
+
},
|
|
943
|
+
data: { filter: {}, size: 10 },
|
|
944
|
+
});
|
|
945
|
+
await assertUnauthorizedResponseBody(response);
|
|
946
|
+
});
|
|
947
|
+
(0, _8_11_1.test)('POST /v2/process-definitions/search with size 1 returns pagination cursor', async ({ request, }) => {
|
|
948
|
+
const response = await request.post(`${apiUrl()}/v2/process-definitions/search`, {
|
|
949
|
+
headers: {
|
|
950
|
+
Authorization: bearerToken,
|
|
951
|
+
'Content-Type': 'application/json',
|
|
952
|
+
},
|
|
953
|
+
data: { filter: {}, page: { limit: 1 } },
|
|
954
|
+
});
|
|
955
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
956
|
+
if (response.status() === 200) {
|
|
957
|
+
const body = await response.json();
|
|
958
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
959
|
+
(0, test_1.expect)(body.items.length).toBeLessThanOrEqual(1);
|
|
960
|
+
if (body.page?.totalItems > 1) {
|
|
961
|
+
(0, test_1.expect)(body).toHaveProperty('page');
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
(0, _8_11_1.test)('POST /v2/process-instances/search returns 200 with items array', async ({ request, }) => {
|
|
966
|
+
const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
|
|
967
|
+
headers: {
|
|
968
|
+
Authorization: bearerToken,
|
|
969
|
+
'Content-Type': 'application/json',
|
|
970
|
+
},
|
|
971
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
972
|
+
});
|
|
973
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
974
|
+
if (response.status() === 200) {
|
|
975
|
+
const body = await response.json();
|
|
976
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
977
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
(0, _8_11_1.test)('POST /v2/process-instances/search filtered by state ACTIVE returns 200', async ({ request, }) => {
|
|
981
|
+
const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
|
|
982
|
+
headers: {
|
|
983
|
+
Authorization: bearerToken,
|
|
984
|
+
'Content-Type': 'application/json',
|
|
985
|
+
},
|
|
986
|
+
data: { filter: { state: 'ACTIVE' }, page: { limit: 10 } },
|
|
987
|
+
});
|
|
988
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
989
|
+
if (response.status() === 200) {
|
|
990
|
+
const body = await response.json();
|
|
991
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
(0, _8_11_1.test)('POST /v2/process-instances/search without token returns 401', async ({ request, }) => {
|
|
995
|
+
const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
|
|
996
|
+
headers: { 'Content-Type': 'application/json' },
|
|
997
|
+
data: { filter: {}, size: 10 },
|
|
998
|
+
});
|
|
999
|
+
await assertUnauthorizedResponseBody(response);
|
|
1000
|
+
});
|
|
1001
|
+
(0, _8_11_1.test)('POST /v2/process-instances/search with invalid token returns 401', async ({ request, }) => {
|
|
1002
|
+
const response = await request.post(`${apiUrl()}/v2/process-instances/search`, {
|
|
1003
|
+
headers: {
|
|
1004
|
+
Authorization: 'Bearer invalid_token',
|
|
1005
|
+
'Content-Type': 'application/json',
|
|
1006
|
+
},
|
|
1007
|
+
data: { filter: {}, size: 10 },
|
|
1008
|
+
});
|
|
1009
|
+
await assertUnauthorizedResponseBody(response);
|
|
1010
|
+
});
|
|
1011
|
+
(0, _8_11_1.test)('POST /v2/user-tasks/search returns 200 with items array', async ({ request, }) => {
|
|
1012
|
+
const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
|
|
1013
|
+
headers: { Authorization: bearerToken, 'Content-Type': 'application/json' },
|
|
1014
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1015
|
+
});
|
|
1016
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
1017
|
+
if (response.status() === 200) {
|
|
1018
|
+
const body = await response.json();
|
|
1019
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1020
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
(0, _8_11_1.test)('POST /v2/user-tasks/search without token returns 401', async ({ request, }) => {
|
|
1024
|
+
const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
|
|
1025
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1026
|
+
data: { filter: {}, size: 10 },
|
|
1027
|
+
});
|
|
1028
|
+
await assertUnauthorizedResponseBody(response);
|
|
1029
|
+
});
|
|
1030
|
+
(0, _8_11_1.test)('POST /v2/user-tasks/search with invalid token returns 401', async ({ request, }) => {
|
|
1031
|
+
const response = await request.post(`${apiUrl()}/v2/user-tasks/search`, {
|
|
1032
|
+
headers: {
|
|
1033
|
+
Authorization: 'Bearer invalid_token',
|
|
1034
|
+
'Content-Type': 'application/json',
|
|
1035
|
+
},
|
|
1036
|
+
data: { filter: {}, size: 10 },
|
|
1037
|
+
});
|
|
1038
|
+
await assertUnauthorizedResponseBody(response);
|
|
1039
|
+
});
|
|
1040
|
+
(0, _8_11_1.test)('POST /v2/variables/search returns 200 with items array', async ({ request, }) => {
|
|
1041
|
+
const response = await request.post(`${apiUrl()}/v2/variables/search`, {
|
|
1042
|
+
headers: { Authorization: bearerToken, 'Content-Type': 'application/json' },
|
|
1043
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1044
|
+
});
|
|
1045
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
1046
|
+
if (response.status() === 200) {
|
|
1047
|
+
const body = await response.json();
|
|
1048
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1049
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
(0, _8_11_1.test)('POST /v2/variables/search without token returns 401', async ({ request, }) => {
|
|
1053
|
+
const response = await request.post(`${apiUrl()}/v2/variables/search`, {
|
|
1054
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1055
|
+
data: { filter: {}, size: 10 },
|
|
1056
|
+
});
|
|
1057
|
+
await assertUnauthorizedResponseBody(response);
|
|
1058
|
+
});
|
|
1059
|
+
(0, _8_11_1.test)('POST /v2/variables/search with invalid token returns 401', async ({ request, }) => {
|
|
1060
|
+
const response = await request.post(`${apiUrl()}/v2/variables/search`, {
|
|
1061
|
+
headers: {
|
|
1062
|
+
Authorization: 'Bearer invalid_token',
|
|
1063
|
+
'Content-Type': 'application/json',
|
|
1064
|
+
},
|
|
1065
|
+
data: { filter: {}, size: 10 },
|
|
1066
|
+
});
|
|
1067
|
+
await assertUnauthorizedResponseBody(response);
|
|
1068
|
+
});
|
|
1069
|
+
(0, _8_11_1.test)('POST /v2/incidents/search returns 200 with items array', async ({ request, }) => {
|
|
1070
|
+
const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
|
|
1071
|
+
headers: { Authorization: bearerToken, 'Content-Type': 'application/json' },
|
|
1072
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1073
|
+
});
|
|
1074
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
1075
|
+
if (response.status() === 200) {
|
|
1076
|
+
const body = await response.json();
|
|
1077
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1078
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
(0, _8_11_1.test)('POST /v2/incidents/search without token returns 401', async ({ request, }) => {
|
|
1082
|
+
const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
|
|
1083
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1084
|
+
data: { filter: {}, size: 10 },
|
|
1085
|
+
});
|
|
1086
|
+
await assertUnauthorizedResponseBody(response);
|
|
1087
|
+
});
|
|
1088
|
+
(0, _8_11_1.test)('POST /v2/incidents/search with invalid token returns 401', async ({ request, }) => {
|
|
1089
|
+
const response = await request.post(`${apiUrl()}/v2/incidents/search`, {
|
|
1090
|
+
headers: {
|
|
1091
|
+
Authorization: 'Bearer invalid_token',
|
|
1092
|
+
'Content-Type': 'application/json',
|
|
1093
|
+
},
|
|
1094
|
+
data: { filter: {}, size: 10 },
|
|
1095
|
+
});
|
|
1096
|
+
await assertUnauthorizedResponseBody(response);
|
|
1097
|
+
});
|
|
1098
|
+
(0, _8_11_1.test)('POST /v2/decision-definitions/search returns 200 with items array', async ({ request, }) => {
|
|
1099
|
+
const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
|
|
1100
|
+
headers: {
|
|
1101
|
+
Authorization: bearerToken,
|
|
1102
|
+
'Content-Type': 'application/json',
|
|
1103
|
+
},
|
|
1104
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1105
|
+
});
|
|
1106
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
1107
|
+
if (response.status() === 200) {
|
|
1108
|
+
const body = await response.json();
|
|
1109
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1110
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
(0, _8_11_1.test)('POST /v2/decision-definitions/search without token returns 401', async ({ request, }) => {
|
|
1114
|
+
const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
|
|
1115
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1116
|
+
data: { filter: {}, size: 10 },
|
|
1117
|
+
});
|
|
1118
|
+
await assertUnauthorizedResponseBody(response);
|
|
1119
|
+
});
|
|
1120
|
+
(0, _8_11_1.test)('POST /v2/decision-definitions/search with invalid token returns 401', async ({ request, }) => {
|
|
1121
|
+
const response = await request.post(`${apiUrl()}/v2/decision-definitions/search`, {
|
|
1122
|
+
headers: {
|
|
1123
|
+
Authorization: 'Bearer invalid_token',
|
|
1124
|
+
'Content-Type': 'application/json',
|
|
1125
|
+
},
|
|
1126
|
+
data: { filter: {}, size: 10 },
|
|
1127
|
+
});
|
|
1128
|
+
await assertUnauthorizedResponseBody(response);
|
|
1129
|
+
});
|
|
1130
|
+
(0, _8_11_1.test)('POST /v2/decision-instances/search returns 200 with items array', async ({ request, }) => {
|
|
1131
|
+
const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
|
|
1132
|
+
headers: {
|
|
1133
|
+
Authorization: bearerToken,
|
|
1134
|
+
'Content-Type': 'application/json',
|
|
1135
|
+
},
|
|
1136
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1137
|
+
});
|
|
1138
|
+
(0, test_1.expect)([200, 400, 405]).toContain(response.status());
|
|
1139
|
+
if (response.status() === 200) {
|
|
1140
|
+
const body = await response.json();
|
|
1141
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1142
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
(0, _8_11_1.test)('POST /v2/decision-instances/search without token returns 401', async ({ request, }) => {
|
|
1146
|
+
const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
|
|
1147
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1148
|
+
data: { filter: {}, size: 10 },
|
|
1149
|
+
});
|
|
1150
|
+
await assertUnauthorizedResponseBody(response);
|
|
1151
|
+
});
|
|
1152
|
+
(0, _8_11_1.test)('POST /v2/decision-instances/search with invalid token returns 401', async ({ request, }) => {
|
|
1153
|
+
const response = await request.post(`${apiUrl()}/v2/decision-instances/search`, {
|
|
1154
|
+
headers: {
|
|
1155
|
+
Authorization: 'Bearer invalid_token',
|
|
1156
|
+
'Content-Type': 'application/json',
|
|
1157
|
+
},
|
|
1158
|
+
data: { filter: {}, size: 10 },
|
|
1159
|
+
});
|
|
1160
|
+
await assertUnauthorizedResponseBody(response);
|
|
1161
|
+
});
|
|
1162
|
+
(0, _8_11_1.test)('POST /v2/flownode-instances/search returns 200 with items array', async ({ request, }) => {
|
|
1163
|
+
const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
|
|
1164
|
+
headers: {
|
|
1165
|
+
Authorization: bearerToken,
|
|
1166
|
+
'Content-Type': 'application/json',
|
|
1167
|
+
},
|
|
1168
|
+
data: { filter: {}, page: { limit: 10 } },
|
|
1169
|
+
});
|
|
1170
|
+
(0, test_1.expect)([200, 404, 405]).toContain(response.status());
|
|
1171
|
+
if (response.status() === 200) {
|
|
1172
|
+
const body = await response.json();
|
|
1173
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
1174
|
+
(0, test_1.expect)(Array.isArray(body.items)).toBeTruthy();
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
(0, _8_11_1.test)('POST /v2/flownode-instances/search without token returns 401', async ({ request, }) => {
|
|
1178
|
+
const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
|
|
1179
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1180
|
+
data: { filter: {}, size: 10 },
|
|
1181
|
+
});
|
|
1182
|
+
await assertUnauthorizedResponseBody(response);
|
|
1183
|
+
});
|
|
1184
|
+
(0, _8_11_1.test)('POST /v2/flownode-instances/search with invalid token returns 401', async ({ request, }) => {
|
|
1185
|
+
const response = await request.post(`${apiUrl()}/v2/flownode-instances/search`, {
|
|
1186
|
+
headers: {
|
|
1187
|
+
Authorization: 'Bearer invalid_token',
|
|
1188
|
+
'Content-Type': 'application/json',
|
|
1189
|
+
},
|
|
1190
|
+
data: { filter: {}, size: 10 },
|
|
1191
|
+
});
|
|
1192
|
+
await assertUnauthorizedResponseBody(response);
|
|
1193
|
+
});
|
|
1194
|
+
});
|