@camunda/e2e-test-suite 0.0.1495 → 0.0.1496

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.
@@ -200,6 +200,8 @@ declare class ModelerCreatePage {
200
200
  expandAssignmentSection(): Promise<void>;
201
201
  clickAppendElementButton(): Promise<void>;
202
202
  clickParallelGatewayOption(): Promise<void>;
203
+ private gatewayShapeIds;
204
+ private selectReplacedGateway;
203
205
  private pinAppendedGateway;
204
206
  private waitForShapeToSettle;
205
207
  private openReplacePopup;
@@ -1258,14 +1258,23 @@ class ModelerCreatePage {
1258
1258
  // object drives it: click Deploy, then click Configure, with no badge
1259
1259
  // in between). On a build that auto-collapses the overlay the
1260
1260
  // configure-test panel renders instead, so accept either. A failed
1261
- // deploy leaves the button disabled and the panel absent, so this still
1262
- // times out on a real deploy failure rather than masking it.
1261
+ // deploy leaves the Deploy button relabelled "Retry" next to a
1262
+ // "Deployment failed" badge (DeployStepContent.tsx) and nothing
1263
+ // redeploys until it is clicked, so click it; a deploy that keeps
1264
+ // failing still times out here rather than being masked.
1265
+ const deployRetryButton = this.page
1266
+ .getByTestId('test-configuration-deploy-button')
1267
+ .filter({ hasText: /^Retry$/ });
1263
1268
  await (0, test_1.expect)(async () => {
1269
+ if ((await deployRetryButton.isVisible()) &&
1270
+ (await deployRetryButton.isEnabled())) {
1271
+ await deployRetryButton.click({ timeout });
1272
+ }
1264
1273
  const deployComplete = (await configureScenarioButton
1265
1274
  .isEnabled({ timeout: 3000 })
1266
1275
  .catch(() => false)) || (await configureTestPanel.isVisible());
1267
1276
  (0, test_1.expect)(deployComplete).toBe(true);
1268
- }).toPass({ timeout: 90000 });
1277
+ }).toPass({ timeout: 180000 });
1269
1278
  }
1270
1279
  // Step 3: reveal the "Configure test case" section. In the current Test
1271
1280
  // Studio the "Set up environment" panel is an inline accordion, not a
@@ -1624,6 +1633,10 @@ class ModelerCreatePage {
1624
1633
  // can be reopened against the same element instead of a positional one.
1625
1634
  async clickParallelGatewayOption() {
1626
1635
  const element = await this.pinAppendedGateway();
1636
+ const pinnedId = await element
1637
+ .getAttribute('data-element-id', { timeout: 10000 })
1638
+ .catch(() => null);
1639
+ const gatewayIdsBefore = await this.gatewayShapeIds();
1627
1640
  const maxRetries = 3;
1628
1641
  let lastError;
1629
1642
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
@@ -1632,6 +1645,13 @@ class ModelerCreatePage {
1632
1645
  // Drop a popup left open on a stale search filter (or on the wrong
1633
1646
  // element) so the retry reopens a fresh one for `element`.
1634
1647
  await this.page.keyboard.press('Escape');
1648
+ // bpmn-js gives the replacement a fresh id and removes the old
1649
+ // shape, so an attempt that applied the replace but failed its
1650
+ // popup check leaves `element` gone for good: reopening on it can
1651
+ // only time out.
1652
+ if (await this.selectReplacedGateway(pinnedId, gatewayIdsBefore)) {
1653
+ return;
1654
+ }
1635
1655
  }
1636
1656
  await this.openReplacePopup(element, attempt > 1);
1637
1657
  await this.revealReplaceEntry(this.parallelGatewayOption, 'Parallel gateway');
@@ -1652,8 +1672,49 @@ class ModelerCreatePage {
1652
1672
  await (0, sleep_1.sleep)(5000);
1653
1673
  }
1654
1674
  }
1675
+ await this.page.keyboard.press('Escape');
1676
+ if (await this.selectReplacedGateway(pinnedId, gatewayIdsBefore)) {
1677
+ return;
1678
+ }
1655
1679
  throw new Error(`Failed to replace the element with a parallel gateway after ${maxRetries} attempts: ${lastError}`);
1656
1680
  }
1681
+ async gatewayShapeIds() {
1682
+ const ids = await this.page
1683
+ .locator('.djs-shape[data-element-id^="Gateway_"]')
1684
+ .evaluateAll((shapes) => shapes.map((shape) => shape.getAttribute('data-element-id') ?? ''));
1685
+ return ids.filter((id) => id && !id.endsWith('_label'));
1686
+ }
1687
+ // Resolves the shape a completed replace produced: the pinned gateway is
1688
+ // gone and a gateway id absent before the replace has taken its place.
1689
+ // Re-selects it so the next append acts on it.
1690
+ async selectReplacedGateway(pinnedId, gatewayIdsBefore) {
1691
+ if (!pinnedId) {
1692
+ return false;
1693
+ }
1694
+ const pinnedCount = await this.page
1695
+ .locator(`.djs-shape[data-element-id="${pinnedId}"]`)
1696
+ .count();
1697
+ if (pinnedCount > 0) {
1698
+ return false;
1699
+ }
1700
+ const replacementId = (await this.gatewayShapeIds()).find((id) => !gatewayIdsBefore.includes(id));
1701
+ if (!replacementId) {
1702
+ return false;
1703
+ }
1704
+ const replacement = this.page
1705
+ .locator(`.djs-shape[data-element-id="${replacementId}"]`)
1706
+ .first();
1707
+ const isSelected = await replacement
1708
+ .evaluate((node) => node.classList.contains('selected'))
1709
+ .catch(() => false);
1710
+ if (!isSelected) {
1711
+ await replacement.click({ force: true, timeout: 30000 });
1712
+ }
1713
+ await (0, test_1.expect)(replacement).toHaveClass(/(?:^|\s)selected(?:\s|$)/, {
1714
+ timeout: 30000,
1715
+ });
1716
+ return true;
1717
+ }
1657
1718
  // The replace popup lists the "replace-with-parallel-gateway" entry only for
1658
1719
  // a gateway, so it must be opened on the gateway "Append gateway" just added.
1659
1720
  // bpmn-js appends that shape last, so fall back to the last gateway when the
@@ -219,9 +219,22 @@ class PlayPage {
219
219
  }
220
220
  async waitForInstanceDetailsToBeLoaded() {
221
221
  // Do NOT use page.reload() — it destroys Play's embedded context.
222
- await (0, test_1.expect)(this.page.getByText(/process instance key/i)).toBeVisible({
223
- timeout: maxWaitTimeSeconds,
224
- });
222
+ // A start request that fails leaves Test Studio on the definition view with
223
+ // Start still offered (TestMode.tsx only opens instance details on
224
+ // success), so re-issue the start instead of waiting on details that can
225
+ // no longer appear.
226
+ const instanceKey = this.page.getByText(/process instance key/i);
227
+ const startButton = this.configureTestPanelStartButton.first();
228
+ let lastStartAt = Date.now();
229
+ await (0, test_1.expect)(async () => {
230
+ if (Date.now() - lastStartAt > 60000 &&
231
+ !(await instanceKey.isVisible()) &&
232
+ (await startButton.isVisible())) {
233
+ await startButton.click({ timeout: 10000 });
234
+ lastStartAt = Date.now();
235
+ }
236
+ await (0, test_1.expect)(instanceKey).toBeVisible({ timeout: 10000 });
237
+ }).toPass({ timeout: maxWaitTimeSeconds });
225
238
  await (0, test_1.expect)(this.page.getByText(/This process instance has no variables/i)).toBeVisible({
226
239
  timeout: maxWaitTimeSeconds,
227
240
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1495",
3
+ "version": "0.0.1496",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",