@camunda/e2e-test-suite 0.0.1723 → 0.0.1724

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.
@@ -56,8 +56,20 @@ _8_11_1.test.describe('Agentic Control Plane Dashboard API Tests @agentic-dashbo
56
56
  (0, _8_11_1.test)('Dashboard API uses current terminology and not legacy wording', async ({ page, appsPage, optimizeHomePage, }) => {
57
57
  const responses = await (0, agenticDashboardHelpers_1.captureDashboardResponses)(page, async () => {
58
58
  await (0, agenticDashboardHelpers_1.openAgenticControlPlane)(page, appsPage, optimizeHomePage, clusterName);
59
- });
60
- const dashboardResponses = responses.filter(agenticDashboardHelpers_1.isLikelyDashboardApiResponse);
59
+ }, { includeNonJsonReportEvaluations: true });
60
+ // The report names (where the terminology lives) are only in successful
61
+ // report evaluations. During an Optimize backend 5xx burst (nightly
62
+ // 45107178172: every agentic report evaluation returned 500 for ~2 min)
63
+ // the captured bodies are error payloads and the terminology check fails
64
+ // for the wrong reason. Wait for a healthy load first, and assert it, so a
65
+ // persistent 5xx still fails here with an explicit message.
66
+ const reportResponses = await (0, agenticDashboardHelpers_1.reloadUntilDashboardReportsHealthy)(page, responses, 6, 10000);
67
+ (0, test_1.expect)(reportResponses.filter((r) => r.status !== 200).map((r) => r.url), 'dashboard report evaluations returned non-200').toEqual([]);
68
+ (0, test_1.expect)(reportResponses.length).toBeGreaterThan(0);
69
+ const dashboardResponses = [
70
+ ...responses.filter(agenticDashboardHelpers_1.isAgenticDashboardDefinitionResponse),
71
+ ...reportResponses,
72
+ ];
61
73
  (0, test_1.expect)(dashboardResponses.length).toBeGreaterThan(0);
62
74
  const joined = dashboardResponses
63
75
  .map((r) => r.bodyText)
@@ -41,11 +41,12 @@ export declare function captureDashboardResponses(page: Page, action: () => Prom
41
41
  }): Promise<CapturedResponse[]>;
42
42
  /**
43
43
  * Waits until the agentic dashboard's initial report evaluations all return
44
- * 200, reloading the page (up to `maxReloads` times) while the Optimize
45
- * backend is still answering some of them with 5xx. Returns the report
46
- * evaluate responses of the last load so the caller can assert on them.
44
+ * 200, reloading the page (up to `maxReloads` times, polling with a
45
+ * `backoffMs * n` interval after the n-th reload) while the Optimize backend
46
+ * is still answering some of them with 5xx. Returns the report evaluate
47
+ * responses of the last load so the caller can assert on them.
47
48
  */
48
- export declare function reloadUntilDashboardReportsHealthy(page: Page, initialResponses: CapturedResponse[], maxReloads?: number): Promise<CapturedResponse[]>;
49
+ export declare function reloadUntilDashboardReportsHealthy(page: Page, initialResponses: CapturedResponse[], maxReloads?: number, backoffMs?: number): Promise<CapturedResponse[]>;
49
50
  export declare function parseJsonResponseBodies(responses: CapturedResponse[]): unknown[];
50
51
  export declare function findReportByName(bodies: unknown[], name: string): unknown;
51
52
  export declare function getReportNumericResult(body: unknown): number | undefined;
@@ -145,19 +145,33 @@ async function captureDashboardResponses(page, action, options = {}) {
145
145
  exports.captureDashboardResponses = captureDashboardResponses;
146
146
  /**
147
147
  * Waits until the agentic dashboard's initial report evaluations all return
148
- * 200, reloading the page (up to `maxReloads` times) while the Optimize
149
- * backend is still answering some of them with 5xx. Returns the report
150
- * evaluate responses of the last load so the caller can assert on them.
148
+ * 200, reloading the page (up to `maxReloads` times, polling with a
149
+ * `backoffMs * n` interval after the n-th reload) while the Optimize backend
150
+ * is still answering some of them with 5xx. Returns the report evaluate
151
+ * responses of the last load so the caller can assert on them.
151
152
  */
152
- async function reloadUntilDashboardReportsHealthy(page, initialResponses, maxReloads = 3) {
153
+ async function reloadUntilDashboardReportsHealthy(page, initialResponses, maxReloads = 3, backoffMs = 0) {
153
154
  const isHealthy = (reports) => reports.length > 0 && reports.every((r) => r.status === 200);
154
155
  let reports = initialResponses.filter(isReportEvaluateResponse);
155
- for (let attempt = 0; attempt < maxReloads && !isHealthy(reports); attempt++) {
156
+ if (maxReloads <= 0 || isHealthy(reports))
157
+ return reports;
158
+ // Bounded by count, not by toPass's timeout: the block passes once the
159
+ // reports are healthy OR the reload budget is spent, so on exhaustion the
160
+ // last load is returned and the caller's own assertion names the failure.
161
+ // Optional linear backoff between reloads: a 5xx burst can outlast a few
162
+ // quick reloads.
163
+ const intervals = backoffMs > 0
164
+ ? Array.from({ length: maxReloads }, (_, i) => backoffMs * (i + 1))
165
+ : [0];
166
+ let reloads = 0;
167
+ await (0, test_1.expect)(async () => {
168
+ reloads++;
156
169
  const responses = await captureDashboardResponses(page, async () => {
157
170
  await page.reload({ waitUntil: 'domcontentloaded' });
158
171
  }, { includeNonJsonReportEvaluations: true });
159
172
  reports = responses.filter(isReportEvaluateResponse);
160
- }
173
+ (0, test_1.expect)(isHealthy(reports) || reloads >= maxReloads, 'dashboard report evaluations not yet healthy').toBe(true);
174
+ }).toPass({ intervals, timeout: 0 });
161
175
  return reports;
162
176
  }
163
177
  exports.reloadUntilDashboardReportsHealthy = reloadUntilDashboardReportsHealthy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1723",
3
+ "version": "0.0.1724",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",