@camunda/e2e-test-suite 0.0.502 → 0.0.504

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.
@@ -48,7 +48,11 @@ class KeycloakAdminPage {
48
48
  await this.page.getByTestId('user-creation-save').click();
49
49
  }
50
50
  async fillPassword(password) {
51
+ await (0, test_1.expect)(this.page.getByTestId('credentials')).toBeVisible({
52
+ timeout: 30000,
53
+ });
51
54
  await this.page.getByTestId('credentials').click();
55
+ await (0, test_1.expect)(this.page.getByTestId('no-credentials-empty-action')).toBeVisible({ timeout: 30000 });
52
56
  await this.page.getByTestId('no-credentials-empty-action').click();
53
57
  await this.page.getByTestId('passwordField').fill(password);
54
58
  await this.page.getByTestId('passwordConfirmationField').fill(password);
@@ -32,6 +32,8 @@ declare class ModelerCreatePage {
32
32
  readonly clientIdTextbox: Locator;
33
33
  readonly clientSecretTextbox: Locator;
34
34
  readonly rememberCredentialsCheckbox: Locator;
35
+ readonly deployDialogUsernameInput: Locator;
36
+ readonly deployDialogPasswordInput: Locator;
35
37
  readonly webhookMessageStartEventConnectorOption: Locator;
36
38
  readonly webhookIdInput: Locator;
37
39
  readonly implementationSection: Locator;
@@ -37,6 +37,8 @@ class ModelerCreatePage {
37
37
  clientIdTextbox;
38
38
  clientSecretTextbox;
39
39
  rememberCredentialsCheckbox;
40
+ deployDialogUsernameInput;
41
+ deployDialogPasswordInput;
40
42
  webhookMessageStartEventConnectorOption;
41
43
  webhookIdInput;
42
44
  implementationSection;
@@ -123,10 +125,12 @@ class ModelerCreatePage {
123
125
  name: 'Deploy & run',
124
126
  exact: true,
125
127
  });
126
- this.deployAndRunSubButton = this.dialog.getByRole('button', {
128
+ this.deployAndRunSubButton = this.dialog
129
+ .getByRole('button', {
127
130
  name: 'Deploy & run',
128
131
  exact: true,
129
- });
132
+ })
133
+ .last();
130
134
  this.viewProcessInstanceLink = page.getByRole('link', {
131
135
  name: 'View process instance',
132
136
  });
@@ -151,6 +155,12 @@ class ModelerCreatePage {
151
155
  this.clientIdTextbox = page.getByLabel('Client ID');
152
156
  this.clientSecretTextbox = page.getByLabel('Client secret');
153
157
  this.rememberCredentialsCheckbox = page.getByText('Remember credentials');
158
+ this.deployDialogUsernameInput = page
159
+ .getByRole('dialog')
160
+ .getByLabel('Username');
161
+ this.deployDialogPasswordInput = page
162
+ .getByRole('dialog')
163
+ .getByLabel('Password');
154
164
  this.webhookMessageStartEventConnectorOption = page.getByRole('listitem', {
155
165
  name: 'Webhook Message Start Event Connector',
156
166
  exact: true,
@@ -339,6 +349,24 @@ class ModelerCreatePage {
339
349
  await (0, test_1.expect)(this.dialog).toBeVisible({
340
350
  timeout: 30000,
341
351
  });
352
+ // Fill credentials if the dialog requires them (first run on a fresh
353
+ // cluster). Two auth modes are possible depending on cluster setup:
354
+ // - OAuth2: "Client ID" + "Client secret" fields
355
+ // - Basic / username-password: "Username" + "Password" fields
356
+ const clientIdVisible = await this.clientIdTextbox.isVisible();
357
+ const usernameVisible = await this.deployDialogUsernameInput.isVisible();
358
+ if (clientIdVisible) {
359
+ await this.completeDeploymentEndpointConfiguration();
360
+ }
361
+ else if (usernameVisible) {
362
+ await this.deployDialogUsernameInput.fill(process.env.DEMO_USER_EMAIL || 'demo');
363
+ await this.deployDialogPasswordInput.fill(process.env.DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_PASSWORD || '');
364
+ // "Remember credentials" checkbox may not be present in all SM setups
365
+ const rememberVisible = await this.rememberCredentialsCheckbox.isVisible();
366
+ if (rememberVisible) {
367
+ await this.rememberCredentialsCheckbox.click({ timeout: 30000 });
368
+ }
369
+ }
342
370
  if (variables.length > 0) {
343
371
  await (0, test_1.expect)(this.variableInput).toBeVisible({
344
372
  timeout: 60000,
@@ -356,12 +384,12 @@ class ModelerCreatePage {
356
384
  }
357
385
  catch (error) {
358
386
  if (attempt < maxRetries - 1) {
359
- console.warn(`Attempt ${attempt + 1} failed for deploy & run running process. Retrying...`);
387
+ console.warn(`Attempt ${attempt + 1} failed for deploy & run: ${error}. Retrying...`);
360
388
  await this.page.reload();
361
389
  await (0, sleep_1.sleep)(10000);
362
390
  }
363
391
  else {
364
- throw new Error(`Assertion failed after ${maxRetries} attempts`);
392
+ throw new Error(`Assertion failed after ${maxRetries} attempts: ${error}`);
365
393
  }
366
394
  }
367
395
  }
@@ -732,7 +760,7 @@ class ModelerCreatePage {
732
760
  }
733
761
  async instanceStartedAssertion() {
734
762
  await (0, test_1.expect)(this.page.getByText('Instance started!')).toBeVisible({
735
- timeout: 10000,
763
+ timeout: 60000,
736
764
  });
737
765
  }
738
766
  async assertImplementationOption(implementationType) {
@@ -303,29 +303,61 @@ async function createProcessInstance(processDefinitionKey, authToken, environmen
303
303
  }
304
304
  exports.createProcessInstance = createProcessInstance;
305
305
  async function createClusterVariableInternal(authToken, environment, variableName, variableValue, variableType, clusterType) {
306
+ // Retry on transient ingress / upstream errors (502/503/504) and on
307
+ // network-layer exceptions, which we have observed during nightly runs
308
+ // when the orchestration cluster gateway is in the middle of a rollout.
309
+ // The actual "create" semantics are idempotent because HTTP 409 is
310
+ // already treated as success below.
311
+ const maxAttempts = 5;
312
+ const baseDelayMs = 2000;
313
+ let lastErrorMessage = '';
306
314
  try {
307
315
  apiRequestContext = await getApiRequestContext();
308
316
  const url = buildZeebeApiUrl('/v2/cluster-variables/global', environment, clusterType);
309
- const response = await apiRequestContext.post(url, {
310
- headers: {
311
- Authorization: authToken,
312
- },
313
- data: {
314
- name: variableName,
315
- value: variableValue,
316
- },
317
- });
318
- const status = response.status();
319
- if (status === 200 || status === 201 || status === 204) {
320
- return;
321
- }
322
- // Handle "already exists" as a benign condition
323
- if (status === 409) {
324
- console.warn(`${variableType} cluster variable "${variableName}" already exists (HTTP 409).`);
325
- return;
317
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
318
+ let status;
319
+ let bodyText = '';
320
+ try {
321
+ const response = await apiRequestContext.post(url, {
322
+ headers: {
323
+ Authorization: authToken,
324
+ },
325
+ data: {
326
+ name: variableName,
327
+ value: variableValue,
328
+ },
329
+ });
330
+ status = response.status();
331
+ if (status === 200 || status === 201 || status === 204) {
332
+ return;
333
+ }
334
+ // Handle "already exists" as a benign condition
335
+ if (status === 409) {
336
+ console.warn(`${variableType} cluster variable "${variableName}" already exists (HTTP 409).`);
337
+ return;
338
+ }
339
+ bodyText = await response.text();
340
+ lastErrorMessage = `HTTP ${status} - ${bodyText.slice(0, 200)}`;
341
+ // Retry on transient gateway / upstream errors.
342
+ if (status >= 502 && status <= 504 && attempt < maxAttempts) {
343
+ console.warn(`createClusterVariable "${variableName}" attempt ${attempt}/${maxAttempts} got HTTP ${status}; retrying...`);
344
+ await new Promise((r) => setTimeout(r, baseDelayMs * attempt));
345
+ continue;
346
+ }
347
+ }
348
+ catch (networkErr) {
349
+ // Network-layer error (e.g. ECONNRESET while the gateway is
350
+ // restarting). Retry a few times before giving up.
351
+ lastErrorMessage =
352
+ networkErr instanceof Error ? networkErr.message : String(networkErr);
353
+ if (attempt < maxAttempts) {
354
+ console.warn(`createClusterVariable "${variableName}" attempt ${attempt}/${maxAttempts} threw (${lastErrorMessage}); retrying...`);
355
+ await new Promise((r) => setTimeout(r, baseDelayMs * attempt));
356
+ continue;
357
+ }
358
+ }
359
+ throw new Error(`Failed to create ${variableType} cluster variable "${variableName}": ${lastErrorMessage}`);
326
360
  }
327
- const bodyText = await response.text();
328
- throw new Error(`Failed to create ${variableType} cluster variable "${variableName}": HTTP ${status} - ${bodyText}`);
329
361
  }
330
362
  catch (error) {
331
363
  if (error instanceof Error && error.message.includes('Failed to create')) {
@@ -23,7 +23,15 @@ const clickLocatorWithRetry = async (page, locator, options) => {
23
23
  throw new Error('clickLocatorWithRetry: page is closed, aborting retries');
24
24
  }
25
25
  if (options?.preAction) {
26
- await options?.preAction();
26
+ try {
27
+ await options.preAction();
28
+ }
29
+ catch (preErr) {
30
+ if (isPageClosedError(preErr)) {
31
+ throw preErr;
32
+ }
33
+ console.warn(`clickLocatorWithRetry: preAction (attempt ${attempt}) threw and will be retried:`, preErr instanceof Error ? preErr.message : preErr);
34
+ }
27
35
  }
28
36
  await locator.waitFor({ state: 'visible', timeout: visibilityTimeout });
29
37
  await locator.scrollIntoViewIfNeeded({ timeout: visibilityTimeout });
@@ -39,7 +47,18 @@ const clickLocatorWithRetry = async (page, locator, options) => {
39
47
  }
40
48
  console.log(`Attempt ${attempt} failed for ${locator}, retrying... Error: ${err}`);
41
49
  if (options?.postAction) {
42
- await options.postAction();
50
+ // Swallow transient errors from the recovery action (e.g.
51
+ // `page.reload()` throwing ERR_CONNECTION_REFUSED while the
52
+ // upstream is restarting). Retry the click on the next loop.
53
+ try {
54
+ await options.postAction();
55
+ }
56
+ catch (postErr) {
57
+ if (isPageClosedError(postErr)) {
58
+ throw postErr;
59
+ }
60
+ console.warn(`clickLocatorWithRetry: postAction (attempt ${attempt}) threw and will be retried:`, postErr instanceof Error ? postErr.message : postErr);
61
+ }
43
62
  }
44
63
  await page.waitForTimeout(retryDelayMs);
45
64
  }
@@ -9,7 +9,12 @@ const expectLocatorWithRetry = async (page, item, options) => {
9
9
  attempt++;
10
10
  try {
11
11
  if (options?.preAction) {
12
- await options?.preAction();
12
+ try {
13
+ await options.preAction();
14
+ }
15
+ catch (preErr) {
16
+ console.warn(`expectLocatorWithRetry: preAction (attempt ${attempt}) threw and will be retried:`, preErr instanceof Error ? preErr.message : preErr);
17
+ }
13
18
  }
14
19
  await page.waitForLoadState('domcontentloaded');
15
20
  await item.waitFor({
@@ -21,7 +26,17 @@ const expectLocatorWithRetry = async (page, item, options) => {
21
26
  catch (err) {
22
27
  console.log(`Attempt ${attempt} failed for ${item}, retrying...`, err instanceof Error ? err.message : err);
23
28
  if (options?.postAction) {
24
- await options?.postAction();
29
+ // Swallow transient errors from the recovery action (e.g.
30
+ // `page.reload()` throwing ERR_CONNECTION_REFUSED while the
31
+ // upstream is restarting). The next loop iteration will retry
32
+ // the visibility check itself, which is what we ultimately
33
+ // care about.
34
+ try {
35
+ await options.postAction();
36
+ }
37
+ catch (postErr) {
38
+ console.warn(`expectLocatorWithRetry: postAction (attempt ${attempt}) threw and will be retried:`, postErr instanceof Error ? postErr.message : postErr);
39
+ }
25
40
  }
26
41
  await page.waitForTimeout(500);
27
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.502",
3
+ "version": "0.0.504",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",