@camunda/e2e-test-suite 0.0.1797 → 0.0.1799
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/api/cross-component/hub-orchestration-journey.spec.d.ts +1 -0
- package/dist/tests/api/cross-component/hub-orchestration-journey.spec.js +86 -0
- package/dist/tests/api/projects.js +6 -1
- package/dist/utils/api/hub.d.ts +29 -0
- package/dist/utils/api/hub.js +66 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const api_1 = require("../../../fixtures/api");
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const assertions_1 = require("../../../utils/api/assertions");
|
|
6
|
+
const deployments_1 = require("../../../utils/api/deployments");
|
|
7
|
+
const bpmn_1 = require("../../../utils/api/bpmn");
|
|
8
|
+
const eventually_1 = require("../../../utils/api/eventually");
|
|
9
|
+
const hub_1 = require("../../../utils/api/hub");
|
|
10
|
+
/**
|
|
11
|
+
* PILOT — Hub ↔ Orchestration cross-component journey at API level.
|
|
12
|
+
* Epic: camunda/team-test-automation#246 · Sub-issue #4652 · Assessment #4651.
|
|
13
|
+
*
|
|
14
|
+
* Journey: a process file stored in Hub can be deployed to and run on the
|
|
15
|
+
* cluster.
|
|
16
|
+
* 1. Create a workspace, project and BPMN file in Hub.
|
|
17
|
+
* 2. Read the file back from Hub.
|
|
18
|
+
* 3. Deploy that content to the cluster.
|
|
19
|
+
* 4. Start an instance and read it back.
|
|
20
|
+
*
|
|
21
|
+
* Only public APIs (confirmed with the Hub team, Dec 2026):
|
|
22
|
+
* - Hub side: the public Hub API v2, through the official `@camunda8/hub-api`
|
|
23
|
+
* SDK (see utils/api/hub.ts).
|
|
24
|
+
* - Cluster side: the Orchestration Cluster `/v2` API, directly.
|
|
25
|
+
* Hub's own "deploy to cluster" goes through its internal UI API, which is not
|
|
26
|
+
* a public contract and has no public equivalent, so the test performs the
|
|
27
|
+
* deployment itself with the content Hub returned. It does NOT use Hub's
|
|
28
|
+
* internal API, its cluster proxy, or Hub's SM-only
|
|
29
|
+
* `OrchestrationClusterApiClient`.
|
|
30
|
+
*/
|
|
31
|
+
api_1.test.describe('Hub <-> Orchestration | Hub file -> deploy -> start -> read back', () => {
|
|
32
|
+
const unavailable = (0, hub_1.hubUnavailable)();
|
|
33
|
+
api_1.test.skip(!!unavailable, unavailable || '');
|
|
34
|
+
(0, api_1.test)('a process file stored in Hub can be deployed and run on the cluster', async ({ api, request, resources, }) => {
|
|
35
|
+
const hub = (0, hub_1.hubClient)(request);
|
|
36
|
+
const processId = (0, bpmn_1.uniqueId)('hub-orch-pilot');
|
|
37
|
+
const workspace = await hub.createWorkspace({
|
|
38
|
+
name: (0, bpmn_1.uniqueId)('hub-orch-workspace'),
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
// 1. Create the project and the BPMN file in Hub.
|
|
42
|
+
const project = await hub.createProject({
|
|
43
|
+
name: (0, bpmn_1.uniqueId)('hub-orch-project'),
|
|
44
|
+
workspaceKey: workspace.workspaceKey,
|
|
45
|
+
});
|
|
46
|
+
const file = await hub.createFile({
|
|
47
|
+
name: processId,
|
|
48
|
+
projectKey: project.projectKey,
|
|
49
|
+
type: 'bpmn',
|
|
50
|
+
content: (0, bpmn_1.linearProcess)(processId, bpmn_1.element.serviceTask((0, bpmn_1.uniqueId)('job'))),
|
|
51
|
+
});
|
|
52
|
+
// 2. Read the file back from Hub; this is the content that gets deployed.
|
|
53
|
+
const stored = await hub.getFile({ fileKey: file.fileKey });
|
|
54
|
+
(0, test_1.expect)(stored.content).toBeTruthy();
|
|
55
|
+
// 3. Deploy the content Hub returned to the cluster.
|
|
56
|
+
const deployResponse = await (0, deployments_1.deployResources)(api, resources, [
|
|
57
|
+
{ name: `${processId}.bpmn`, content: stored.content },
|
|
58
|
+
]);
|
|
59
|
+
const deployed = (await (0, assertions_1.assertOk)(deployResponse));
|
|
60
|
+
(0, test_1.expect)(deployed.deployments[0].processDefinition.processDefinitionId).toBe(processId);
|
|
61
|
+
// 4. Start an instance and read it back from the cluster.
|
|
62
|
+
const startResponse = await api.post('/process-instances', {
|
|
63
|
+
body: { processDefinitionId: processId },
|
|
64
|
+
tenant: 'root',
|
|
65
|
+
});
|
|
66
|
+
const instance = (await (0, assertions_1.assertOk)(startResponse));
|
|
67
|
+
(0, test_1.expect)(instance.processInstanceKey).toBeTruthy();
|
|
68
|
+
// The process waits at its worker-less service task, so the instance
|
|
69
|
+
// stays ACTIVE; track it so teardown cancels it. Deleting only the
|
|
70
|
+
// definition would leave it draining (see utils/api/cleanup.ts).
|
|
71
|
+
resources.track('processInstance', instance.processInstanceKey);
|
|
72
|
+
await (0, eventually_1.eventually)(async () => {
|
|
73
|
+
const search = await api.post('/process-instances/search', {
|
|
74
|
+
body: { filter: { processInstanceKey: instance.processInstanceKey } },
|
|
75
|
+
});
|
|
76
|
+
const page = (await (0, assertions_1.assertOk)(search));
|
|
77
|
+
(0, test_1.expect)(page.items.length).toBe(1);
|
|
78
|
+
(0, test_1.expect)(page.items[0].state).toBe('ACTIVE');
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
// Removes the project and file with it.
|
|
83
|
+
await (0, hub_1.removeWorkspace)(hub, workspace.workspaceKey);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -16,7 +16,12 @@ exports.apiProjects = [
|
|
|
16
16
|
{
|
|
17
17
|
name: 'api',
|
|
18
18
|
testDir: __dirname,
|
|
19
|
-
|
|
19
|
+
// Excludes the clock tests (their own serial project is below) and the
|
|
20
|
+
// Hub <-> Orchestration cross-component journey. The journey ships opt-in
|
|
21
|
+
// via playwright.cross-component.config.ts and must NOT run in this shared
|
|
22
|
+
// `api` project, which the Helm chart configs publish to AlwaysGreen
|
|
23
|
+
// consumers (epic team-test-automation#246 / #4652).
|
|
24
|
+
testIgnore: /clock-api-tests\.spec\.[jt]s$|[\\/]cross-component[\\/]/,
|
|
20
25
|
// Safe for every spec except the clock, which the `clock` project below
|
|
21
26
|
// keeps out of this window: identity resources, processes and decisions are
|
|
22
27
|
// randomised per test, so nothing else one file creates is visible to
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camunda Hub public API (v2) client for the cross-component journey.
|
|
3
|
+
*
|
|
4
|
+
* Uses the official `@camunda8/hub-api` SDK — the public, versioned contract
|
|
5
|
+
* the Hub team asked QA suites to use — never Hub's internal UI API or its
|
|
6
|
+
* cluster proxy, which change without notice. Authentication reuses the
|
|
7
|
+
* suite's own `authHeader`, so Hub sees the same token the Web Modeler public
|
|
8
|
+
* API smoke (`tests/api/components/web-modeler-api-tests.spec.ts`) already
|
|
9
|
+
* relies on: the `web-modeler-public-api` audience, provided by the run.
|
|
10
|
+
*/
|
|
11
|
+
import type { APIRequestContext } from '@playwright/test';
|
|
12
|
+
import { createHubClient } from '@camunda8/hub-api';
|
|
13
|
+
export type HubClient = ReturnType<typeof createHubClient>;
|
|
14
|
+
type WorkspaceKey = Parameters<HubClient['deleteWorkspace']>[0]['workspaceKey'];
|
|
15
|
+
/**
|
|
16
|
+
* Reason text when this run cannot reach Hub's public API v2, or `false`.
|
|
17
|
+
*
|
|
18
|
+
* Needs `API_WEB_MODELER_URL` (Hub's base URL, context path included) and
|
|
19
|
+
* 8.10 or later: Hub serves the v2 public API from `self-managed/8.10` on.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hubUnavailable(): string | false;
|
|
22
|
+
/** A Hub client that authenticates with the suite's own token. */
|
|
23
|
+
export declare function hubClient(request: APIRequestContext): HubClient;
|
|
24
|
+
/**
|
|
25
|
+
* Deletes a workspace and everything in it. Never throws: a cleanup failure is
|
|
26
|
+
* logged, because failing here would mask the result of the test that ran.
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeWorkspace(hub: HubClient, workspaceKey: WorkspaceKey): Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Camunda Hub public API (v2) client for the cross-component journey.
|
|
4
|
+
*
|
|
5
|
+
* Uses the official `@camunda8/hub-api` SDK — the public, versioned contract
|
|
6
|
+
* the Hub team asked QA suites to use — never Hub's internal UI API or its
|
|
7
|
+
* cluster proxy, which change without notice. Authentication reuses the
|
|
8
|
+
* suite's own `authHeader`, so Hub sees the same token the Web Modeler public
|
|
9
|
+
* API smoke (`tests/api/components/web-modeler-api-tests.spec.ts`) already
|
|
10
|
+
* relies on: the `web-modeler-public-api` audience, provided by the run.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.removeWorkspace = exports.hubClient = exports.hubUnavailable = void 0;
|
|
14
|
+
const hub_api_1 = require("@camunda8/hub-api");
|
|
15
|
+
const auth_1 = require("./auth");
|
|
16
|
+
const config_1 = require("./config");
|
|
17
|
+
const capabilities_1 = require("./capabilities");
|
|
18
|
+
/**
|
|
19
|
+
* Reason text when this run cannot reach Hub's public API v2, or `false`.
|
|
20
|
+
*
|
|
21
|
+
* Needs `API_WEB_MODELER_URL` (Hub's base URL, context path included) and
|
|
22
|
+
* 8.10 or later: Hub serves the v2 public API from `self-managed/8.10` on.
|
|
23
|
+
*/
|
|
24
|
+
function hubUnavailable() {
|
|
25
|
+
const component = (0, capabilities_1.componentUnavailable)('webModeler');
|
|
26
|
+
if (component)
|
|
27
|
+
return component;
|
|
28
|
+
if (!(0, config_1.atLeastVersion)('8.10')) {
|
|
29
|
+
return 'Hub serves its public API v2 from 8.10 onwards';
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
exports.hubUnavailable = hubUnavailable;
|
|
34
|
+
/** A Hub client that authenticates with the suite's own token. */
|
|
35
|
+
function hubClient(request) {
|
|
36
|
+
return (0, hub_api_1.createHubClient)({
|
|
37
|
+
config: {
|
|
38
|
+
// The SDK appends `/api/v2` to this address.
|
|
39
|
+
CAMUNDA_HUB_ADDRESS: config_1.apiConfig.components.webModeler,
|
|
40
|
+
CAMUNDA_AUTH_STRATEGY: 'NONE',
|
|
41
|
+
},
|
|
42
|
+
// The SDK passes a single prebuilt Request carrying Content-Type and the
|
|
43
|
+
// body, so copy its headers: replacing them dropped Content-Type (415).
|
|
44
|
+
fetch: async (input, init) => {
|
|
45
|
+
const original = new Request(input, init);
|
|
46
|
+
const headers = new Headers(original.headers);
|
|
47
|
+
headers.set('Authorization', await (0, auth_1.authHeader)(request));
|
|
48
|
+
return fetch(new Request(original, { headers }));
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.hubClient = hubClient;
|
|
53
|
+
/**
|
|
54
|
+
* Deletes a workspace and everything in it. Never throws: a cleanup failure is
|
|
55
|
+
* logged, because failing here would mask the result of the test that ran.
|
|
56
|
+
*/
|
|
57
|
+
async function removeWorkspace(hub, workspaceKey) {
|
|
58
|
+
try {
|
|
59
|
+
await hub.deleteWorkspace({ workspaceKey });
|
|
60
|
+
await hub.permanentlyDeleteWorkspace({ workspaceKey });
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.warn(`Cleanup: Hub workspace ${workspaceKey} not removed: ${error}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.removeWorkspace = removeWorkspace;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/e2e-test-suite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1799",
|
|
4
4
|
"description": "End-to-end test helpers for Camunda 8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@axe-core/playwright": "^4.7.3",
|
|
77
|
+
"@camunda8/hub-api": "0.2.0",
|
|
77
78
|
"axios": "^1.5.0",
|
|
78
79
|
"dotenv": "^16.3.1",
|
|
79
80
|
"mailslurp-client": "^15.20.2",
|