@camunda/e2e-test-suite 0.0.1668 → 0.0.1669
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.
|
@@ -67,7 +67,15 @@ _8_11_1.test.describe('Agentic Control Plane Dashboard API Tests @agentic-dashbo
|
|
|
67
67
|
(0, test_1.expect)(joined.includes(agenticDashboardHelpers_1.LEGACY_TERMINOLOGY)).toBeFalsy();
|
|
68
68
|
});
|
|
69
69
|
(0, _8_11_1.test)('Changing the date range triggers refreshed report API calls', async ({ page, appsPage, optimizeHomePage, }) => {
|
|
70
|
-
await (0, agenticDashboardHelpers_1.
|
|
70
|
+
const initialResponses = await (0, agenticDashboardHelpers_1.captureDashboardResponses)(page, async () => {
|
|
71
|
+
await (0, agenticDashboardHelpers_1.openAgenticControlPlane)(page, appsPage, optimizeHomePage, clusterName);
|
|
72
|
+
}, { includeNonJsonReportEvaluations: true });
|
|
73
|
+
// Precondition: the dashboard must have loaded healthily before the date
|
|
74
|
+
// range is changed, otherwise a backend 5xx burst on the initial load is
|
|
75
|
+
// misattributed to the date-range refresh.
|
|
76
|
+
const initialReports = await (0, agenticDashboardHelpers_1.reloadUntilDashboardReportsHealthy)(page, initialResponses);
|
|
77
|
+
(0, test_1.expect)(initialReports.filter((r) => r.status !== 200).map((r) => r.url), 'initial dashboard report evaluations returned non-200').toEqual([]);
|
|
78
|
+
(0, test_1.expect)(initialReports.length).toBeGreaterThan(0);
|
|
71
79
|
let dateRangeChanged = false;
|
|
72
80
|
const responses = await (0, agenticDashboardHelpers_1.captureDashboardResponses)(page, async () => {
|
|
73
81
|
dateRangeChanged = await (0, agenticDashboardHelpers_1.changeDashboardDateRange)(page);
|
|
@@ -76,7 +84,7 @@ _8_11_1.test.describe('Agentic Control Plane Dashboard API Tests @agentic-dashbo
|
|
|
76
84
|
const reportResponses = responses.filter(agenticDashboardHelpers_1.isReportEvaluateResponse);
|
|
77
85
|
(0, test_1.expect)(reportResponses.length).toBeGreaterThan(0);
|
|
78
86
|
for (const response of reportResponses) {
|
|
79
|
-
(0, test_1.expect)(response.status).toBe(200);
|
|
87
|
+
(0, test_1.expect)(response.status, `${response.method} ${response.url}`).toBe(200);
|
|
80
88
|
}
|
|
81
89
|
});
|
|
82
90
|
(0, _8_11_1.test)('Report payloads do not expose Phase 1 out-of-scope details', async ({ page, appsPage, optimizeHomePage, }) => {
|
|
@@ -29,7 +29,16 @@ export declare function changeDashboardDateRange(page: Page): Promise<boolean>;
|
|
|
29
29
|
export declare function isAgenticDashboardDefinitionResponse(response: CapturedResponse): boolean;
|
|
30
30
|
export declare function isReportEvaluateResponse(response: CapturedResponse): boolean;
|
|
31
31
|
export declare function isLikelyDashboardApiResponse(response: CapturedResponse): boolean;
|
|
32
|
-
export declare function captureDashboardResponses(page: Page, action: () => Promise<void
|
|
32
|
+
export declare function captureDashboardResponses(page: Page, action: () => Promise<void>, options?: {
|
|
33
|
+
includeNonJsonReportEvaluations?: boolean;
|
|
34
|
+
}): Promise<CapturedResponse[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Waits until the agentic dashboard's initial report evaluations all return
|
|
37
|
+
* 200, reloading the page (up to `maxReloads` times) while the Optimize
|
|
38
|
+
* backend is still answering some of them with 5xx. Returns the report
|
|
39
|
+
* evaluate responses of the last load so the caller can assert on them.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reloadUntilDashboardReportsHealthy(page: Page, initialResponses: CapturedResponse[], maxReloads?: number): Promise<CapturedResponse[]>;
|
|
33
42
|
export declare function parseJsonResponseBodies(responses: CapturedResponse[]): unknown[];
|
|
34
43
|
export declare function findReportByName(bodies: unknown[], name: string): unknown;
|
|
35
44
|
export declare function getReportNumericResult(body: unknown): number | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.selectSingleProcessIfPossible = exports.dashboardHasComparisonTile = exports.getReportNumericResult = exports.findReportByName = exports.parseJsonResponseBodies = exports.captureDashboardResponses = exports.isLikelyDashboardApiResponse = exports.isReportEvaluateResponse = exports.isAgenticDashboardDefinitionResponse = exports.changeDashboardDateRange = exports.openAgenticControlPlane = exports.clickFirstVisibleByName = exports.LEGACY_TERMINOLOGY = exports.CURRENT_TERMINOLOGY = exports.EXECUTION_REPORT_NAME = exports.REPORT_EVALUATE_PATH_PATTERN = exports.AGENTIC_DASHBOARD_DEFINITION_PATH = void 0;
|
|
3
|
+
exports.selectSingleProcessIfPossible = exports.dashboardHasComparisonTile = exports.getReportNumericResult = exports.findReportByName = exports.parseJsonResponseBodies = exports.reloadUntilDashboardReportsHealthy = exports.captureDashboardResponses = exports.isLikelyDashboardApiResponse = exports.isReportEvaluateResponse = exports.isAgenticDashboardDefinitionResponse = exports.changeDashboardDateRange = exports.openAgenticControlPlane = exports.clickFirstVisibleByName = exports.LEGACY_TERMINOLOGY = exports.CURRENT_TERMINOLOGY = exports.EXECUTION_REPORT_NAME = exports.REPORT_EVALUATE_PATH_PATTERN = exports.AGENTIC_DASHBOARD_DEFINITION_PATH = void 0;
|
|
4
4
|
const test_1 = require("@playwright/test");
|
|
5
5
|
exports.AGENTIC_DASHBOARD_DEFINITION_PATH = '/api/dashboard/agentic';
|
|
6
6
|
exports.REPORT_EVALUATE_PATH_PATTERN = /\/api\/report\/[^/]+\/evaluate/;
|
|
@@ -90,7 +90,7 @@ function isLikelyDashboardApiResponse(response) {
|
|
|
90
90
|
isReportEvaluateResponse(response));
|
|
91
91
|
}
|
|
92
92
|
exports.isLikelyDashboardApiResponse = isLikelyDashboardApiResponse;
|
|
93
|
-
async function captureDashboardResponses(page, action) {
|
|
93
|
+
async function captureDashboardResponses(page, action, options = {}) {
|
|
94
94
|
const captured = [];
|
|
95
95
|
const listener = async (response) => {
|
|
96
96
|
try {
|
|
@@ -99,7 +99,11 @@ async function captureDashboardResponses(page, action) {
|
|
|
99
99
|
if (method !== 'GET' && method !== 'POST')
|
|
100
100
|
return;
|
|
101
101
|
const contentType = response.headers()['content-type'] || '';
|
|
102
|
-
|
|
102
|
+
// Opt-in: keep non-JSON report evaluations (e.g. a gateway 502 served
|
|
103
|
+
// as text/html) so health checks see the failure instead of dropping it.
|
|
104
|
+
const keepNonJson = options.includeNonJsonReportEvaluations &&
|
|
105
|
+
exports.REPORT_EVALUATE_PATH_PATTERN.test(response.url().toLowerCase());
|
|
106
|
+
if (!contentType.includes('application/json') && !keepNonJson)
|
|
103
107
|
return;
|
|
104
108
|
const bodyText = await response.text();
|
|
105
109
|
captured.push({
|
|
@@ -122,6 +126,24 @@ async function captureDashboardResponses(page, action) {
|
|
|
122
126
|
return captured;
|
|
123
127
|
}
|
|
124
128
|
exports.captureDashboardResponses = captureDashboardResponses;
|
|
129
|
+
/**
|
|
130
|
+
* Waits until the agentic dashboard's initial report evaluations all return
|
|
131
|
+
* 200, reloading the page (up to `maxReloads` times) while the Optimize
|
|
132
|
+
* backend is still answering some of them with 5xx. Returns the report
|
|
133
|
+
* evaluate responses of the last load so the caller can assert on them.
|
|
134
|
+
*/
|
|
135
|
+
async function reloadUntilDashboardReportsHealthy(page, initialResponses, maxReloads = 3) {
|
|
136
|
+
const isHealthy = (reports) => reports.length > 0 && reports.every((r) => r.status === 200);
|
|
137
|
+
let reports = initialResponses.filter(isReportEvaluateResponse);
|
|
138
|
+
for (let attempt = 0; attempt < maxReloads && !isHealthy(reports); attempt++) {
|
|
139
|
+
const responses = await captureDashboardResponses(page, async () => {
|
|
140
|
+
await page.reload({ waitUntil: 'domcontentloaded' });
|
|
141
|
+
}, { includeNonJsonReportEvaluations: true });
|
|
142
|
+
reports = responses.filter(isReportEvaluateResponse);
|
|
143
|
+
}
|
|
144
|
+
return reports;
|
|
145
|
+
}
|
|
146
|
+
exports.reloadUntilDashboardReportsHealthy = reloadUntilDashboardReportsHealthy;
|
|
125
147
|
function parseJsonResponseBodies(responses) {
|
|
126
148
|
const parsed = [];
|
|
127
149
|
for (const response of responses) {
|