@camunda/e2e-test-suite 0.0.1338 → 0.0.1340

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.
@@ -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.1338",
3
+ "version": "0.0.1340",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",