@camunda/e2e-test-suite 0.0.1668 → 0.0.1670

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.
@@ -43,7 +43,7 @@
43
43
  source="You are a helpful, generic chat agent which can answer a wide amount of questions based on your knowledge and an optional set of available tools.

If tools are provided, you should prefer them instead of guessing an answer. You can call the same tool multiple times by providing different input values. Don't guess any tools which were not explicitely configured. If no tool matches the request, try to generate an answer. If you're not able to find a good answer, return with a message stating why you're not able to.

If you are prompted to interact with a person, never guess contact details, but use available user/person lookup tools instead and return with an error if you're not able to look up appropriate data.

Thinking, step by step, before you execute your tools, you think using the template `<thinking><context></context><reflection></reflection></thinking>`"
44
44
  target="data.systemPrompt.prompt" />
45
45
  <zeebe:input
46
- source="=&#34;Use your tools to get the current date and time, then write a single sentence in the following exact format, with Berlin, Germany as the city and country:&#10;&#10;The current date and time in Berlin, Germany, is approximately {h:mm AM/PM} on {Month day, year}.&#10;&#10;But only with the sentence/format as above, nothing else&#34;"
46
+ source="=&#34;Use your tools to get the current date and time, then write a single sentence in the following exact format, with Berlin, Germany as the city and country. Use the date and time exactly as the tool returns it; do not convert time zones, do not add caveats, and do not ask any clarifying or confirmation questions:&#10;&#10;The current date and time in Berlin, Germany, is approximately {h:mm AM/PM} on {Month day, year}.&#10;&#10;But only with the sentence/format as above, nothing else&#34;"
47
47
  target="data.userPrompt.prompt" />
48
48
  <zeebe:input
49
49
  source="=if (is defined(followUpInput) or is defined(followUpDocuments)) then followUpDocuments else inputDocuments"
@@ -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.openAgenticControlPlane)(page, appsPage, optimizeHomePage, clusterName);
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>): Promise<CapturedResponse[]>;
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
- if (!contentType.includes('application/json'))
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1668",
3
+ "version": "0.0.1670",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  source="You are a helpful, generic chat agent which can answer a wide amount of questions based on your knowledge and an optional set of available tools.&#10;&#10;If tools are provided, you should prefer them instead of guessing an answer. You can call the same tool multiple times by providing different input values. Don&#39;t guess any tools which were not explicitely configured. If no tool matches the request, try to generate an answer. If you&#39;re not able to find a good answer, return with a message stating why you&#39;re not able to.&#10;&#10;If you are prompted to interact with a person, never guess contact details, but use available user/person lookup tools instead and return with an error if you&#39;re not able to look up appropriate data.&#10;&#10;Thinking, step by step, before you execute your tools, you think using the template `&#60;thinking&#62;&#60;context&#62;&#60;/context&#62;&#60;reflection&#62;&#60;/reflection&#62;&#60;/thinking&#62;`"
44
44
  target="data.systemPrompt.prompt" />
45
45
  <zeebe:input
46
- source="=&#34;Use your tools to get the current date and time, then write a single sentence in the following exact format, with Berlin, Germany as the city and country:&#10;&#10;The current date and time in Berlin, Germany, is approximately {h:mm AM/PM} on {Month day, year}.&#10;&#10;But only with the sentence/format as above, nothing else&#34;"
46
+ source="=&#34;Use your tools to get the current date and time, then write a single sentence in the following exact format, with Berlin, Germany as the city and country. Use the date and time exactly as the tool returns it; do not convert time zones, do not add caveats, and do not ask any clarifying or confirmation questions:&#10;&#10;The current date and time in Berlin, Germany, is approximately {h:mm AM/PM} on {Month day, year}.&#10;&#10;But only with the sentence/format as above, nothing else&#34;"
47
47
  target="data.userPrompt.prompt" />
48
48
  <zeebe:input
49
49
  source="=if (is defined(followUpInput) or is defined(followUpDocuments)) then followUpDocuments else inputDocuments"