@camunda/e2e-test-suite 0.0.1337 → 0.0.1339

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.
@@ -545,10 +545,28 @@ class ModelerCreatePage {
545
545
  }
546
546
  async deployDiagram(clusterName) {
547
547
  await this.processApplicationPage.ensureStageCluster(clusterName);
548
- await this.clickDeployButtonWithRetry();
549
- await (0, test_1.expect)(this.deployDiagramDialog).toBeVisible({
550
- timeout: 30000,
551
- });
548
+ // ensureStageCluster navigates back to the diagram, whose toolbar can
549
+ // take ~50s to boot. A Deploy click that lands before Hub has wired it up
550
+ // registers but never opens the dialog, and the old single check then
551
+ // failed the test outright. Reopen from a fresh page instead.
552
+ const maxOpenAttempts = 3;
553
+ for (let attempt = 1; attempt <= maxOpenAttempts; attempt++) {
554
+ await this.clickDeployButtonWithRetry();
555
+ const opened = await this.deployDiagramDialog
556
+ .waitFor({ state: 'visible', timeout: 30000 })
557
+ .then(() => true)
558
+ .catch(() => false);
559
+ if (opened) {
560
+ break;
561
+ }
562
+ if (attempt === maxOpenAttempts) {
563
+ await (0, test_1.expect)(this.deployDiagramDialog).toBeVisible({ timeout: 30000 });
564
+ }
565
+ console.warn(`Deploy dialog did not open (attempt ${attempt}/${maxOpenAttempts}); reloading.`);
566
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
567
+ await (0, sessionRecovery_1.recoverStuckModelerLogin)(this.page);
568
+ await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
569
+ }
552
570
  // Hub's environment-based deploy dialog (camunda-hub#29210) lists the
553
571
  // Environments assigned to the workspace as a role="radiogroup" under
554
572
  // #environment-selection-heading, one row per
@@ -636,10 +654,15 @@ class ModelerCreatePage {
636
654
  // the same session loss utils/sessionRecovery.ts already recovers
637
655
  // from elsewhere. One retry after recovering; any other cause
638
656
  // rethrows unchanged.
657
+ if (attempt === 1) {
658
+ throw error;
659
+ }
639
660
  const recovered = await (0, sessionRecovery_1.recoverStuckModelerLogin)(this.page);
640
661
  const restored = await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
641
- if ((!recovered && !restored) || attempt === 1) {
642
- throw error;
662
+ // A diagram whose toolbar never booted with the session intact still
663
+ // gets one fresh load, as clickDeployButtonWithRetry already does.
664
+ if (!recovered && !restored) {
665
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
643
666
  }
644
667
  }
645
668
  }
@@ -1734,6 +1757,17 @@ class ModelerCreatePage {
1734
1757
  }
1735
1758
  async selectCluster(clusterName, healthCheckTimeout = 30000) {
1736
1759
  await (0, test_1.expect)(this.dialog).toBeVisible({ timeout: 30000 });
1760
+ // The dialog is visible well before its environment / cluster list has
1761
+ // loaded. On a slow Hub that list outlasted the 10s + 30s windows below,
1762
+ // so a cluster that was bound all along was reported as not offered.
1763
+ // Let any of the dialog's content variants render before branching.
1764
+ await this.dialog
1765
+ .locator('[data-test^="environment-row-"]')
1766
+ .or(this.dialog.getByText('Clusters not configured for stages'))
1767
+ .or(this.dialog.getByText(clusterName, { exact: false }))
1768
+ .first()
1769
+ .waitFor({ state: 'visible', timeout: 60000 })
1770
+ .catch(() => false);
1737
1771
  // Inside a process application the deploy dialog renders
1738
1772
  // ProcessAppClusterSelection, not the per-deploy ClusterSelection toggle
1739
1773
  // list: it shows only clusters assigned to one of the application's stages
@@ -482,6 +482,9 @@ class ModelerHomePage {
482
482
  const rootLoaded = await this.becameVisible(button.or(this.diagramTypeDropdown).first(), 60000);
483
483
  if (!rootLoaded) {
484
484
  await this.page.reload();
485
+ // The 5s probes below assume one branch has already rendered, which
486
+ // is not yet true straight after a reload.
487
+ await this.becameVisible(button.or(this.diagramTypeDropdown).first(), 90000);
485
488
  }
486
489
  // Short: the joint probe above already settled which branch rendered, and
487
490
  // hub renders exactly one of them (EntityTable renders the toolbar's create
@@ -609,6 +612,16 @@ class ModelerHomePage {
609
612
  }
610
613
  await this.clickMessageBanner();
611
614
  },
615
+ // The workspace list can take over a minute to render (see
616
+ // createCrossComponentProjectFolder), which outlasted the default 3 x
617
+ // 10s window. Give each attempt longer and reload between attempts so
618
+ // a list that stalled while loading gets fetched again.
619
+ totalTimeout: 180000,
620
+ visibilityTimeout: 45000,
621
+ postAction: async () => {
622
+ await this.page.reload();
623
+ await this.dismissOverlays();
624
+ },
612
625
  });
613
626
  }
614
627
  // Drives Camunda Hub's workspace-creation wizard. The name is entered on
@@ -185,7 +185,11 @@ class ProcessApplicationPage {
185
185
  await this.nameInput.click({ timeout: 30000 });
186
186
  await this.nameInput.fill(name);
187
187
  await (0, test_1.expect)(this.nameInput).toHaveValue(name, { timeout: 10000 });
188
- await (0, submitModalWithRetry_1.submitModalWithRetry)(this.submitButton, this.creationDialog);
188
+ // A slow Hub took longer than the default 20s per submit to create the
189
+ // application and close the dialog.
190
+ await (0, submitModalWithRetry_1.submitModalWithRetry)(this.submitButton, this.creationDialog, {
191
+ closeTimeout: 60000,
192
+ });
189
193
  await this.waitForProcessApplication();
190
194
  return;
191
195
  }
@@ -180,6 +180,8 @@ declare class ModelerCreatePage {
180
180
  expandAssignmentSection(): Promise<void>;
181
181
  clickAppendElementButton(): Promise<void>;
182
182
  clickParallelGatewayOption(): Promise<void>;
183
+ private pinAppendedGateway;
184
+ private waitForShapeToSettle;
183
185
  private openReplacePopup;
184
186
  private revealReplaceEntry;
185
187
  clickConnectToOtherElementButton(): Promise<void>;
@@ -1322,10 +1322,17 @@ class ModelerCreatePage {
1322
1322
  return;
1323
1323
  }
1324
1324
  // The context pad only renders for a selected element, so "Change element"
1325
- // would otherwise never appear.
1325
+ // would otherwise never appear. Select with a plain (non-force) click: the
1326
+ // hover/selection that mounts a stable context pad only fires on a real
1327
+ // click, and a forced click skips it so the "Change element" entry never
1328
+ // settles and the click below times out. Reuse clickChangeTypeButton for the
1329
+ // open itself -- its 180s wait plus reload/re-select recovery is the proven
1330
+ // path the first change-element click in each flow already uses, whereas a
1331
+ // bare 30s force-click here has no recovery and loses the reopen race on a
1332
+ // freshly installed cluster.
1326
1333
  await (0, test_1.expect)(element).toBeVisible({ timeout: 60000 });
1327
- await element.click({ force: true, timeout: 30000 });
1328
- await this.changeTypeButton.click({ force: true, timeout: 30000 });
1334
+ await element.click({ timeout: 30000 });
1335
+ await this.clickChangeTypeButton();
1329
1336
  }
1330
1337
  async clickChangeElementTemplateOption(option, element, searchTerm) {
1331
1338
  const maxRetries = 3;
@@ -1439,16 +1446,7 @@ class ModelerCreatePage {
1439
1446
  // timeout with nothing on screen. Pin the shape by id up front so the popup
1440
1447
  // can be reopened against the same element instead of a positional one.
1441
1448
  async clickParallelGatewayOption() {
1442
- const selectedId = await this.page
1443
- .locator('.djs-element.selected')
1444
- .first()
1445
- .getAttribute('data-element-id', { timeout: 10000 })
1446
- .catch(() => null);
1447
- const element = selectedId
1448
- ? this.page
1449
- .locator(`.djs-element[data-element-id="${selectedId}"]`)
1450
- .first()
1451
- : this.page.locator('.djs-element.selected').first();
1449
+ const element = await this.pinAppendedGateway();
1452
1450
  const maxRetries = 3;
1453
1451
  let lastError;
1454
1452
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
@@ -1469,19 +1467,70 @@ class ModelerCreatePage {
1469
1467
  }
1470
1468
  catch (error) {
1471
1469
  lastError = error;
1472
- console.error(`Parallel gateway attempt ${attempt} failed: ${error}`);
1470
+ const listed = await this.changeElementResults
1471
+ .locator('[data-id]')
1472
+ .evaluateAll((entries) => entries.map((entry) => entry.getAttribute('data-id')).join(', '))
1473
+ .catch(() => '');
1474
+ console.error(`Parallel gateway attempt ${attempt} failed: ${error}; popup entries: [${listed}]`);
1473
1475
  await (0, sleep_1.sleep)(5000);
1474
1476
  }
1475
1477
  }
1476
1478
  throw new Error(`Failed to replace the element with a parallel gateway after ${maxRetries} attempts: ${lastError}`);
1477
1479
  }
1480
+ // The replace popup lists the "replace-with-parallel-gateway" entry only for
1481
+ // a gateway, so it must be opened on the gateway "Append gateway" just added.
1482
+ // bpmn-js appends that shape last, so fall back to the last gateway when the
1483
+ // selection is not a gateway.
1484
+ async pinAppendedGateway() {
1485
+ const selectedId = await this.page
1486
+ .locator('.djs-element.selected')
1487
+ .first()
1488
+ .getAttribute('data-element-id', { timeout: 10000 })
1489
+ .catch(() => null);
1490
+ if (selectedId && selectedId.includes('Gateway')) {
1491
+ return this.page
1492
+ .locator(`.djs-element[data-element-id="${selectedId}"]`)
1493
+ .first();
1494
+ }
1495
+ const lastGatewayId = await this.secondPlacedGateway
1496
+ .getAttribute('data-element-id', { timeout: 30000 })
1497
+ .catch(() => null);
1498
+ return lastGatewayId
1499
+ ? this.page
1500
+ .locator(`.djs-element[data-element-id="${lastGatewayId}"]`)
1501
+ .first()
1502
+ : this.secondPlacedGateway;
1503
+ }
1504
+ // diagram-js closes the popup on `canvas.viewbox.changing`, so wait for the
1505
+ // post-append auto-scroll to stop moving the shape before opening it.
1506
+ async waitForShapeToSettle(element) {
1507
+ let previous = await element.boundingBox().catch(() => null);
1508
+ for (let check = 0; check < 20; check++) {
1509
+ await (0, sleep_1.sleep)(250);
1510
+ const current = await element.boundingBox().catch(() => null);
1511
+ if (previous &&
1512
+ current &&
1513
+ previous.x === current.x &&
1514
+ previous.y === current.y) {
1515
+ return;
1516
+ }
1517
+ previous = current;
1518
+ }
1519
+ }
1478
1520
  async openReplacePopup(element, force) {
1521
+ await (0, test_1.expect)(element).toBeVisible({ timeout: 30000 });
1522
+ await this.waitForShapeToSettle(element);
1479
1523
  if (await this.isVisibleWithin(this.changeElementResults, 2000)) {
1480
1524
  return;
1481
1525
  }
1482
- // The context pad only renders for a selected element, so "Change element"
1483
- // would otherwise never appear.
1484
- if (!(await this.isVisibleWithin(this.changeTypeButton, 5000))) {
1526
+ // "Change element" acts on the selected element, so select the pinned
1527
+ // gateway first: a context pad left open for another shape would open
1528
+ // that shape's replace menu, which never lists a parallel gateway.
1529
+ const isSelected = await element
1530
+ .evaluate((node) => node.classList.contains('selected'))
1531
+ .catch(() => false);
1532
+ if (!isSelected ||
1533
+ !(await this.isVisibleWithin(this.changeTypeButton, 5000))) {
1485
1534
  await element.click({ force: true, timeout: 30000 });
1486
1535
  }
1487
1536
  await this.changeTypeButton.click({ timeout: 60000, force });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1337",
3
+ "version": "0.0.1339",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",