@camunda/e2e-test-suite 0.0.1227 → 0.0.1228

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.
@@ -218,6 +218,7 @@ declare class ModelerCreatePage {
218
218
  embedForm(formName: string): Promise<void>;
219
219
  clickFirstPlaceRESTConnector(): Promise<void>;
220
220
  dismissCreatePad(): Promise<void>;
221
+ private isAuthenticationPanelOpen;
221
222
  private openAuthenticationPanel;
222
223
  setOAuthTokenEndpoint(elementToClick: Locator, endpoint: string, options?: {
223
224
  retries?: number;
@@ -324,8 +324,11 @@ class ModelerCreatePage {
324
324
  .getByText('zeebeClientId');
325
325
  this.variableAssignmentValueTextboxThirdVariable = page.locator('#bio-properties-panel-StartEvent_1-output-2-source div');
326
326
  this.firstPlaceRESTConnector = page.locator('g:nth-child(2) > .djs-element > .djs-hit');
327
+ // Scoped to the group header (not any div whose text is "Authentication")
328
+ // so its class list can be read: the header carries `open` exactly while
329
+ // the group is expanded, which openAuthenticationPanel keys on.
327
330
  this.authenticationPanel = page
328
- .locator('div')
331
+ .locator('.bio-properties-panel-group-header')
329
332
  .filter({ hasText: /^Authentication$/ })
330
333
  .first();
331
334
  this.templateNotFoundTag = page
@@ -1739,6 +1742,17 @@ class ModelerCreatePage {
1739
1742
  .waitFor({ state: 'hidden', timeout: 10000 })
1740
1743
  .catch(() => false);
1741
1744
  }
1745
+ async isAuthenticationPanelOpen() {
1746
+ const classes = await this.authenticationPanel
1747
+ .getAttribute('class', { timeout: 5000 })
1748
+ .catch(() => null);
1749
+ return (classes ?? '').split(/\s+/).includes('open');
1750
+ }
1751
+ // The header is a toggle, not an "open" button, and the properties panel
1752
+ // keeps a group's expanded state across element selections — so clicking it
1753
+ // unconditionally collapses a group that a previous element already opened.
1754
+ // Click only while `open` is absent, then wait for it to appear.
1755
+ //
1742
1756
  // The Authentication group is contributed by the REST connector element
1743
1757
  // template, so it renders only while the version the diagram pins in
1744
1758
  // zeebe:modelerTemplateVersion is among the element templates Web Modeler
@@ -1746,22 +1760,30 @@ class ModelerCreatePage {
1746
1760
  // "Template: Not found" and the group can never appear, so report that as
1747
1761
  // its own cause instead of a bare 60s click timeout.
1748
1762
  async openAuthenticationPanel() {
1749
- try {
1750
- await this.authenticationPanel.click({ timeout: 60000 });
1751
- }
1752
- catch (err) {
1753
- const templateMissing = await this.templateNotFoundTag
1754
- .isVisible()
1755
- .catch(() => false);
1756
- if (templateMissing) {
1757
- throw new Error('REST connector element template did not resolve for this element: ' +
1758
- 'the properties panel shows "Template: Not found", so its ' +
1759
- 'Authentication group never renders. The zeebe:modelerTemplateVersion ' +
1760
- 'pinned in the uploaded fixture is no longer one of the element ' +
1761
- 'template versions this Web Modeler offers — re-pin the fixture to ' +
1762
- 'the offered version.');
1763
+ for (let attempt = 1; attempt <= 3; attempt++) {
1764
+ if (await this.isAuthenticationPanelOpen()) {
1765
+ return;
1763
1766
  }
1764
- throw err;
1767
+ try {
1768
+ await this.authenticationPanel.click({ timeout: 60000 });
1769
+ }
1770
+ catch (err) {
1771
+ const templateMissing = await this.templateNotFoundTag
1772
+ .isVisible()
1773
+ .catch(() => false);
1774
+ if (templateMissing) {
1775
+ throw new Error('REST connector element template did not resolve for this element: ' +
1776
+ 'the properties panel shows "Template: Not found", so its ' +
1777
+ 'Authentication group never renders. The zeebe:modelerTemplateVersion ' +
1778
+ 'pinned in the uploaded fixture is no longer one of the element ' +
1779
+ 'template versions this Web Modeler offers — re-pin the fixture to ' +
1780
+ 'the offered version.');
1781
+ }
1782
+ throw err;
1783
+ }
1784
+ await (0, test_1.expect)(this.authenticationPanel)
1785
+ .toHaveClass(/(?:^|\s)open(?:\s|$)/, { timeout: 10000 })
1786
+ .catch(() => false);
1765
1787
  }
1766
1788
  }
1767
1789
  async setOAuthTokenEndpoint(elementToClick, endpoint, options) {
@@ -1792,14 +1814,16 @@ class ModelerCreatePage {
1792
1814
  let lastError;
1793
1815
  for (let attempt = 1; attempt <= retries; attempt++) {
1794
1816
  try {
1795
- await (0, test_1.expect)(this.oauthTokenEndpointInput).toBeVisible({ timeout: 3000 });
1796
- await this.oauthTokenEndpointInput.click({ timeout: 3000 });
1817
+ await (0, test_1.expect)(this.oauthTokenEndpointInput).toBeVisible({
1818
+ timeout: 10000,
1819
+ });
1820
+ await this.oauthTokenEndpointInput.click({ timeout: 10000 });
1797
1821
  await this.oauthTokenEndpointInput.fill(endpoint, { timeout: 30000 });
1798
1822
  return;
1799
1823
  }
1800
1824
  catch (err) {
1801
1825
  lastError = err;
1802
- await this.authenticationPanel.click({ timeout: 60000 });
1826
+ await this.openAuthenticationPanel();
1803
1827
  await (0, sleep_1.sleep)(settleMs);
1804
1828
  }
1805
1829
  }
@@ -546,17 +546,30 @@ async function modelAndRunConnectorsDocHandlingDiagram(modelerCreatePage, modele
546
546
  await page.reload();
547
547
  await page.waitForLoadState('networkidle');
548
548
  await modelerCreatePage.fillStartEventVariablesForDocHandling(zeebeUrl, zeebeClientId, zeebeClientSecret);
549
- await modelerCreatePage.setOAuthTokenEndpoint(page.locator('.djs-hit').first(), endpoint);
549
+ // bpmn-js reorders the canvas `<g>` groups as elements render and get
550
+ // selected, so `g:nth-child(N)` does not keep pointing at the task it was
551
+ // written for. Pin each shape by its BPMN id from the fixture instead: these
552
+ // are exactly the five REST tasks the fixture configures with
553
+ // `authentication.type = oauth-client-credentials-flow`, i.e. the ones that
554
+ // render an "OAuth 2.0 token endpoint" field. The sixth task
555
+ // (Activity_0jxgggi, "Download & store Image as 'doc' storage") is `noAuth`
556
+ // and has no such field.
557
+ const restTaskHit = (elementId) => page
558
+ .locator(`.djs-element[data-element-id="${elementId}"] .djs-hit`)
559
+ .first();
560
+ await modelerCreatePage.setOAuthTokenEndpoint(restTaskHit('Activity_0k0vloc'), endpoint);
550
561
  await (0, sleep_1.sleep)(2000);
551
- await modelerCreatePage.setOAuthTokenEndpoint(page.locator('g:nth-child(3) > .djs-element > .djs-hit'), endpoint);
562
+ await modelerCreatePage.setOAuthTokenEndpoint(restTaskHit('Activity_02hwevk'), endpoint);
552
563
  await (0, sleep_1.sleep)(2000);
553
- await modelerCreatePage.setOAuthTokenEndpoint(page.locator('g:nth-child(6) > .djs-element > .djs-hit'), endpoint);
564
+ await modelerCreatePage.setOAuthTokenEndpoint(restTaskHit('Activity_1oi90zl'), endpoint);
565
+ // The two parallel-branch tasks sit under the Details panel, so it has to be
566
+ // closed before their shape can be clicked and reopened afterwards.
554
567
  await (0, sleep_1.sleep)(2000);
555
568
  await modelerCreatePage.clickCloseDetailsPanel();
556
- await modelerCreatePage.setOAuthTokenEndpoint(page.locator('g:nth-child(7) > .djs-element > .djs-hit'), endpoint, { openPanel: true });
569
+ await modelerCreatePage.setOAuthTokenEndpoint(restTaskHit('Activity_0iyt4gv'), endpoint, { openPanel: true });
557
570
  await (0, sleep_1.sleep)(2000);
558
571
  await modelerCreatePage.clickCloseDetailsPanel();
559
- await modelerCreatePage.setOAuthTokenEndpoint(page.locator('g:nth-child(9) > .djs-element > .djs-hit'), endpoint, { openPanel: true });
572
+ await modelerCreatePage.setOAuthTokenEndpoint(restTaskHit('Activity_1oiegam'), endpoint, { openPanel: true });
560
573
  await (0, sleep_1.sleep)(2000);
561
574
  await modelerCreatePage.runProcessInstance('', tenant);
562
575
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1227",
3
+ "version": "0.0.1228",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",