@camunda/e2e-test-suite 0.0.615 → 0.0.616

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.
@@ -21,6 +21,7 @@ declare class OperateProcessInstancePage {
21
21
  assertEitherIncidentOrCompletedIconVisible(): Promise<string>;
22
22
  assertProcessCompleteStatusWithRetry(timeout?: number, maxRetries?: number): Promise<void>;
23
23
  assertProcessVariableContainsText(variableName: string, text: string): Promise<void>;
24
+ private captureVariableJsonValue;
24
25
  assertResultVariableVisibleWithRetry(variableName: string): Promise<void>;
25
26
  assertActiveTokenIsPresent(): Promise<void>;
26
27
  assertVariablesListVisible(timeout?: number): Promise<void>;
@@ -162,8 +162,21 @@ class OperateProcessInstancePage {
162
162
  await (0, test_1.expect)(this.page.getByTestId(`variable-${variableName}`)).toContainText(text, { timeout: 8000 });
163
163
  return;
164
164
  }
165
- catch (error) {
166
- console.log(`assertProcessVariableContainsText attempt ${attempt + 1}/${maxRetries} failed: ${error}`);
165
+ catch (uiError) {
166
+ // Document-typed variables render as a compact summary
167
+ // (e.g. "3 documents" or "<docId> <size>") that omits metadata
168
+ // such as filename, storeId, and contentType. Fall back to the
169
+ // raw JSON value from the variables API response.
170
+ try {
171
+ const value = await this.captureVariableJsonValue(variableName);
172
+ if (value != null && value.includes(text)) {
173
+ return;
174
+ }
175
+ }
176
+ catch (apiError) {
177
+ console.log(`captureVariableJsonValue for ${variableName} attempt ${attempt + 1}/${maxRetries} failed: ${apiError}`);
178
+ }
179
+ console.log(`assertProcessVariableContainsText attempt ${attempt + 1}/${maxRetries} failed: ${uiError}`);
167
180
  if (attempt < maxRetries - 1) {
168
181
  await this.page.reload({ timeout: 10000 }).catch(() => { });
169
182
  await this.page.waitForLoadState('domcontentloaded').catch(() => { });
@@ -172,6 +185,34 @@ class OperateProcessInstancePage {
172
185
  }
173
186
  throw new Error(`Failed to assert variable ${variableName} contains "${text}" after ${maxRetries} attempts.`);
174
187
  }
188
+ async captureVariableJsonValue(variableName) {
189
+ let capturedValue = null;
190
+ const responsePromise = this.page
191
+ .waitForResponse(async (resp) => {
192
+ if (!resp.url().includes('/v2/variables/search') ||
193
+ resp.status() !== 200) {
194
+ return false;
195
+ }
196
+ try {
197
+ const body = await resp.text();
198
+ const data = JSON.parse(body);
199
+ const item = data?.items?.find((i) => i.name === variableName);
200
+ if (item?.value != null) {
201
+ capturedValue = String(item.value);
202
+ return true;
203
+ }
204
+ return false;
205
+ }
206
+ catch {
207
+ return false;
208
+ }
209
+ }, { timeout: 15000 })
210
+ .catch(() => null);
211
+ await this.page.reload({ timeout: 10000 }).catch(() => { });
212
+ await this.page.waitForLoadState('domcontentloaded').catch(() => { });
213
+ await responsePromise;
214
+ return capturedValue;
215
+ }
175
216
  async assertResultVariableVisibleWithRetry(variableName) {
176
217
  const maxRetries = 3;
177
218
  for (let attempt = 0; attempt < maxRetries; attempt++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.615",
3
+ "version": "0.0.616",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",