@camunda/e2e-test-suite 0.0.1587 → 0.0.1588

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.
@@ -90,20 +90,42 @@ class ConnectorTemplatePage {
90
90
  await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
91
91
  return null;
92
92
  }
93
- // Replace the whole content of the open template file. Monaco only picks up
94
- // real input events, so the old content is selected and deleted via the
95
- // keyboard and the new JSON is inserted as a single input.
93
+ // Replace the whole content of the open template file. Web Modeler's Monaco
94
+ // editor uses the EditContext API, under which keyboard.insertText of a
95
+ // multi-line string is re-indented line by line (and can end up as invalid
96
+ // JSON, which disables Publish). Pasting is applied verbatim, so the new
97
+ // JSON goes through the clipboard instead.
96
98
  async replaceTemplateJson(json, expectedText) {
97
99
  const editor = this.page.locator('.monaco-editor').first();
98
100
  await (0, test_1.expect)(editor).toBeVisible({ timeout: 90000 });
99
- await editor.locator('.view-lines').click();
101
+ await this.page
102
+ .context()
103
+ .grantPermissions(['clipboard-read', 'clipboard-write']);
104
+ await this.page.evaluate(async (text) => await navigator.clipboard.writeText(text), json);
105
+ // Click inside the visible text area, just right of the line numbers:
106
+ // clicking the centre of `.view-lines` can land far right on a long line
107
+ // and miss the editor, so the shortcuts below would act on the page
108
+ // instead. Monaco marks the editor `focused` once it owns the keyboard.
109
+ await (0, test_1.expect)(async () => {
110
+ const box = await editor.boundingBox();
111
+ if (!box) {
112
+ throw new Error('Template editor has no bounding box');
113
+ }
114
+ await editor.click({
115
+ position: { x: Math.min(120, box.width / 2), y: box.height / 2 },
116
+ timeout: 10000,
117
+ });
118
+ await (0, test_1.expect)(editor).toHaveClass(/\bfocused\b/, { timeout: 5000 });
119
+ }).toPass({ timeout: 60000 });
100
120
  await this.page.keyboard.press('ControlOrMeta+A');
101
- await this.page.keyboard.press('Delete');
102
- await this.page.keyboard.insertText(json);
121
+ await this.page.keyboard.press('ControlOrMeta+V');
103
122
  await this.page.keyboard.press('ControlOrMeta+Home');
104
123
  await (0, test_1.expect)(editor.locator('.view-lines')).toContainText(expectedText, {
105
124
  timeout: 30000,
106
125
  });
126
+ await (0, test_1.expect)(this.page.getByText('Your JSON is invalid')).toBeHidden({
127
+ timeout: 30000,
128
+ });
107
129
  }
108
130
  async publishConnector() {
109
131
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1587",
3
+ "version": "0.0.1588",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",