@camunda/e2e-test-suite 0.0.1652 → 0.0.1654

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.
@@ -40,7 +40,22 @@ class ConnectorTemplatePage {
40
40
  });
41
41
  await (0, test_1.expect)(dialog.getByRole('spinbutton', { name: 'Version number', exact: true })).toHaveValue(String(version));
42
42
  await dialog.getByRole('button', { name: 'Publish', exact: true }).click();
43
- await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
43
+ // Hub reports a failed POST /milestones only as a sonner error toast
44
+ // ("Could not publish ... Try again later.") and leaves the dialog open, so
45
+ // waiting for the dialog alone burns 60s and reports "still visible". Stop
46
+ // as soon as either outcome shows and surface Hub's own error text.
47
+ const publishError = this.page
48
+ .locator('[data-sonner-toast][data-type="error"]')
49
+ .filter({ hasText: 'Could not publish' });
50
+ await test_1.expect
51
+ .poll(async () => (await publishError.first().isVisible()) ||
52
+ !(await dialog.isVisible()), { timeout: 60000, intervals: [500] })
53
+ .toBe(true);
54
+ if (await publishError.first().isVisible()) {
55
+ throw new Error(`Web Modeler rejected the publish: ${await publishError
56
+ .first()
57
+ .innerText()}`);
58
+ }
44
59
  }
45
60
  async publishConnector() {
46
61
  try {
@@ -1501,6 +1501,27 @@ class ModelerCreatePage {
1501
1501
  await (0, test_1.expect)(this.templateNotFoundTag).toBeHidden();
1502
1502
  }
1503
1503
  async assertExportedTemplateBindings(bindings) {
1504
+ // A transient background fetch (the file's comments load was seen to fail
1505
+ // once with net::ERR_FAILED, then succeed on retry) raises a sonner error
1506
+ // toast in the top-right corner, where the "Browse more actions" kebab also
1507
+ // sits. Its subtree then intercepts every click on the kebab for the full
1508
+ // action timeout even though the button is visible and enabled (trace:
1509
+ // `<li data-sonner-toast data-type="error"> intercepts pointer events`).
1510
+ // Dismiss any lingering error toast via its close button first; the
1511
+ // exported-XML assertion below is unaffected, so this clears the incidental
1512
+ // overlay without masking a real failure.
1513
+ const toast = this.page.locator('[data-sonner-toast][data-type="error"]');
1514
+ const toastClose = toast.locator('[data-close-button="true"]');
1515
+ for (let i = 0; i < 5; i++) {
1516
+ if (!(await toastClose
1517
+ .first()
1518
+ .isVisible()
1519
+ .catch(() => false)))
1520
+ break;
1521
+ const before = await toast.count();
1522
+ await toastClose.first().click();
1523
+ await (0, test_1.expect)(toast).toHaveCount(before - 1, { timeout: 5000 });
1524
+ }
1504
1525
  await this.page
1505
1526
  .getByRole('button', { name: 'Browse more actions', exact: true })
1506
1527
  .click();
@@ -21,7 +21,14 @@ class ConnectorTemplatePage {
21
21
  await this.publishButton.click({ timeout: 90000 });
22
22
  }
23
23
  async publishImportedTemplateToWorkspace(version) {
24
- await this.page.getByRole('button', { name: 'Publish', exact: true }).click();
24
+ // openImportedTemplate() only awaits the /element-templates/ URL, which flips
25
+ // before the editor's async load (fetch file + project, validate, mount the
26
+ // code editor) finishes. The Publish control is omitted from the DOM while the
27
+ // editor is loading and disabled until the template validates, so clicking it
28
+ // on the default 10s action timeout races that load. Wait for it to become
29
+ // interactive first; a genuinely broken editor still surfaces as a failure.
30
+ await (0, test_1.expect)(this.publishButton).toBeEnabled({ timeout: 90000 });
31
+ await this.publishButton.click();
25
32
  await this.page
26
33
  .getByRole('menuitem', { name: 'Publish to workspace', exact: true })
27
34
  .click();
@@ -33,7 +40,22 @@ class ConnectorTemplatePage {
33
40
  });
34
41
  await (0, test_1.expect)(dialog.getByRole('spinbutton', { name: 'Version number', exact: true })).toHaveValue(String(version));
35
42
  await dialog.getByRole('button', { name: 'Publish', exact: true }).click();
36
- await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
43
+ // Hub reports a failed POST /milestones only as a sonner error toast
44
+ // ("Could not publish ... Try again later.") and leaves the dialog open, so
45
+ // waiting for the dialog alone burns 60s and reports "still visible". Stop
46
+ // as soon as either outcome shows and surface Hub's own error text.
47
+ const publishError = this.page
48
+ .locator('[data-sonner-toast][data-type="error"]')
49
+ .filter({ hasText: 'Could not publish' });
50
+ await test_1.expect
51
+ .poll(async () => (await publishError.first().isVisible()) ||
52
+ !(await dialog.isVisible()), { timeout: 60000, intervals: [500] })
53
+ .toBe(true);
54
+ if (await publishError.first().isVisible()) {
55
+ throw new Error(`Web Modeler rejected the publish: ${await publishError
56
+ .first()
57
+ .innerText()}`);
58
+ }
37
59
  }
38
60
  async publishConnector() {
39
61
  try {
@@ -66,28 +66,48 @@ class ConnectorTemplatePage {
66
66
  .first()
67
67
  .waitFor({ state: 'visible', timeout: 5000 })
68
68
  .catch(() => { });
69
- if (await idConflictText.isVisible()) {
70
- const conflictingFile = (await dialog
71
- .locator('a[href*="/connector-templates/"]')
72
- .first()
73
- .innerText({ timeout: 30000 })).trim();
69
+ const readConflictingFile = async () => (await dialog
70
+ .locator('a[href*="/connector-templates/"]')
71
+ .first()
72
+ .innerText({ timeout: 30000 })).trim();
73
+ const cancel = async () => {
74
74
  await dialog
75
75
  .getByRole('button', { name: 'Cancel', exact: true })
76
76
  .click({ timeout: 30000 });
77
77
  await (0, test_1.expect)(dialog).toBeHidden({ timeout: 30000 });
78
+ };
79
+ if (await idConflictText.isVisible()) {
80
+ const conflictingFile = await readConflictingFile();
81
+ await cancel();
78
82
  return conflictingFile;
79
83
  }
80
84
  if (await alreadyPublishedText.isVisible()) {
81
- await dialog
82
- .getByRole('button', { name: 'Cancel', exact: true })
83
- .click({ timeout: 30000 });
84
- await (0, test_1.expect)(dialog).toBeHidden({ timeout: 30000 });
85
+ await cancel();
85
86
  return null;
86
87
  }
87
88
  await dialog
88
89
  .getByRole('button', { name: 'Publish', exact: true })
89
90
  .click({ timeout: 30000 });
90
- await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
91
+ // The publish dry run that detects an ID conflict (or an already published
92
+ // version) is asynchronous. When it only resolves after Publish was
93
+ // clicked, the submit handler refuses silently and the dialog stays open
94
+ // showing the reason, so wait for either outcome instead of only for the
95
+ // dialog to close.
96
+ await (0, test_1.expect)(async () => {
97
+ if ((await idConflictText.isVisible()) ||
98
+ (await alreadyPublishedText.isVisible())) {
99
+ return;
100
+ }
101
+ await (0, test_1.expect)(dialog).toBeHidden({ timeout: 2000 });
102
+ }).toPass({ timeout: 60000 });
103
+ if (await idConflictText.isVisible()) {
104
+ const conflictingFile = await readConflictingFile();
105
+ await cancel();
106
+ return conflictingFile;
107
+ }
108
+ if (await alreadyPublishedText.isVisible()) {
109
+ await cancel();
110
+ }
91
111
  return null;
92
112
  }
93
113
  // Replace the whole content of the open template file. Web Modeler's Monaco
@@ -175,6 +175,14 @@ async function publishRestConnectorTemplateFile(page, modelerHomePage) {
175
175
  if (!conflictingFile) {
176
176
  return;
177
177
  }
178
+ // Parallel workers that all find no REST template in the project each
179
+ // upload their own copy, so several files share this name. Only one of them
180
+ // can publish the ID; for every other copy the owner is a sibling holding
181
+ // the same pinned v13 content, which already makes the template available.
182
+ // Replacing "it" by name would just reopen a copy that cannot publish.
183
+ if (conflictingFile === REST_CONNECTOR_TEMPLATE_RESOURCE) {
184
+ return;
185
+ }
178
186
  const template = JSON.parse((await fetchRestConnectorTemplateV13(page)).toString('utf-8'));
179
187
  await modelerHomePage.clickProjectBreadcrumb();
180
188
  await page.getByPlaceholder('Filter table').fill(conflictingFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1652",
3
+ "version": "0.0.1654",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",