@camunda/e2e-test-suite 0.0.1572 → 0.0.1574

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.
@@ -206,8 +206,26 @@ class TaskDetailsPage {
206
206
  async clickRadioButton(radioBtnLabel) {
207
207
  await this.page.getByText(radioBtnLabel).click();
208
208
  }
209
+ // Tasklist renders the task form `readonly` until the details panel shows
210
+ // the task as assigned. The nightly trace showed the task list already
211
+ // reporting "Task assigned to me" while the details panel had re-fetched a
212
+ // stale "Unassigned" state, so the form stayed readonly and `check()` timed
213
+ // out on the overlaying `.fjs-element`. Wait for the checkbox to become
214
+ // editable and reload to pick up the current task state if it does not;
215
+ // the task is never re-assigned here and `check()` still verifies the
216
+ // resulting checked state.
209
217
  async checkChecklistBox(label) {
210
- await this.page.getByLabel(label).check();
218
+ const checkbox = this.page.getByLabel(label);
219
+ await (0, test_1.expect)(async () => {
220
+ try {
221
+ await (0, test_1.expect)(checkbox).toBeEditable({ timeout: 20000 });
222
+ }
223
+ catch (error) {
224
+ await this.page.reload();
225
+ throw error;
226
+ }
227
+ await checkbox.check({ timeout: 10000 });
228
+ }).toPass({ timeout: 150000, intervals: [1000, 2000, 5000] });
211
229
  }
212
230
  async enterTwoValuesInTagList(value1, value2) {
213
231
  await this.tagList.click();
@@ -6,7 +6,8 @@ declare class ConnectorTemplatePage {
6
6
  constructor(page: Page);
7
7
  clickPublishToOrgButton(): Promise<void>;
8
8
  clickPublishButton(): Promise<void>;
9
- publishToProject(): Promise<void>;
9
+ publishToProject(): Promise<string | null>;
10
+ replaceTemplateJson(json: string, expectedText: string): Promise<void>;
10
11
  publishConnector(): Promise<void>;
11
12
  }
12
13
  export { ConnectorTemplatePage };
@@ -24,6 +24,12 @@ class ConnectorTemplatePage {
24
24
  // that never was has a single "Publish to project" button, while one that
25
25
  // already was has a "Publish" dropdown holding "Publish to project" and
26
26
  // "Publish to organization". The dropdown items only exist once it is open.
27
+ //
28
+ // Returns the name of the template file that already owns this template's ID
29
+ // when Web Modeler refuses to publish because of it, or null otherwise. A
30
+ // template ID can only be published from one file, so a different file that
31
+ // already published it (e.g. an older template version uploaded before a
32
+ // minor upgrade) blocks the publication.
27
33
  async publishToProject() {
28
34
  const directButton = this.page.getByRole('button', {
29
35
  name: 'Publish to project',
@@ -48,27 +54,56 @@ class ConnectorTemplatePage {
48
54
  .then(() => true)
49
55
  .catch(() => false);
50
56
  if (!confirmShown) {
51
- return;
57
+ return null;
52
58
  }
53
59
  // The version field is prefilled with the template's own version. When that
54
60
  // version is already published, the form rejects it, so there is nothing
55
61
  // left to publish.
56
- const alreadyPublished = await dialog
57
- .getByText(/Enter a version number greater than/)
62
+ const alreadyPublishedText = dialog.getByText(/Enter a version number greater than/);
63
+ const idConflictText = dialog.getByText(/is already used in:/);
64
+ await alreadyPublishedText
65
+ .or(idConflictText)
66
+ .first()
58
67
  .waitFor({ state: 'visible', timeout: 5000 })
59
- .then(() => true)
60
- .catch(() => false);
61
- if (alreadyPublished) {
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();
62
74
  await dialog
63
75
  .getByRole('button', { name: 'Cancel', exact: true })
64
76
  .click({ timeout: 30000 });
65
77
  await (0, test_1.expect)(dialog).toBeHidden({ timeout: 30000 });
66
- return;
78
+ return conflictingFile;
79
+ }
80
+ 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
+ return null;
67
86
  }
68
87
  await dialog
69
88
  .getByRole('button', { name: 'Publish', exact: true })
70
89
  .click({ timeout: 30000 });
71
90
  await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
91
+ return null;
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.
96
+ async replaceTemplateJson(json, expectedText) {
97
+ const editor = this.page.locator('.monaco-editor').first();
98
+ await (0, test_1.expect)(editor).toBeVisible({ timeout: 90000 });
99
+ await editor.locator('.view-lines').click();
100
+ await this.page.keyboard.press('ControlOrMeta+A');
101
+ await this.page.keyboard.press('Delete');
102
+ await this.page.keyboard.insertText(json);
103
+ await this.page.keyboard.press('ControlOrMeta+Home');
104
+ await (0, test_1.expect)(editor.locator('.view-lines')).toContainText(expectedText, {
105
+ timeout: 30000,
106
+ });
72
107
  }
73
108
  async publishConnector() {
74
109
  try {
@@ -150,6 +150,39 @@ const REST_CONNECTOR_TEMPLATE_RESOURCE = 'http-json-connector-13';
150
150
  // camunda/connectors#9966). v13 is the newest REST template whose engine
151
151
  // constraint (^8.9) an 8.9 Web Modeler satisfies.
152
152
  const REST_CONNECTOR_TEMPLATE_V13_URL = 'https://raw.githubusercontent.com/camunda/connectors/e0977665e7e64ac786a51b34106a3581a24f92ed/connectors/http/rest/element-templates/versioned/http-json-connector-13.json';
153
+ async function fetchRestConnectorTemplateV13(page) {
154
+ const response = await page.request.get(REST_CONNECTOR_TEMPLATE_V13_URL);
155
+ (0, test_1.expect)(response.ok(), `Fetching the REST connector template failed with ${response.status()}`).toBeTruthy();
156
+ const buffer = await response.body();
157
+ (0, test_1.expect)(JSON.parse(buffer.toString('utf-8'))).toMatchObject({
158
+ id: 'io.camunda.connectors.HttpJson.v2',
159
+ name: REST_CONNECTOR_TEMPLATE_NAME,
160
+ version: 13,
161
+ });
162
+ return buffer;
163
+ }
164
+ // Publish the uploaded v13 REST template to the project. Web Modeler lets only
165
+ // one file publish a given template ID, so when another file already published
166
+ // `io.camunda.connectors.HttpJson.v2` (the upgrade-minor flow uploads
167
+ // http-json-connector-12 in its 8.8 phase into the same project), the v13 file
168
+ // cannot be published. Follow the documented resolution instead: replace the
169
+ // conflicting file's content with the v13 template and publish it from there.
170
+ // https://docs.camunda.io/docs/8.9/components/modeler/web-modeler/modeling/importing-resources/#manually-upgrade-a-conflicting-template
171
+ async function publishRestConnectorTemplateFile(page, modelerHomePage) {
172
+ const connectorTemplatePage = new ConnectorTemplatePage_1.ConnectorTemplatePage(page);
173
+ await modelerHomePage.clickProcessDiagram(REST_CONNECTOR_TEMPLATE_RESOURCE);
174
+ const conflictingFile = await connectorTemplatePage.publishToProject();
175
+ if (!conflictingFile) {
176
+ return;
177
+ }
178
+ const template = JSON.parse((await fetchRestConnectorTemplateV13(page)).toString('utf-8'));
179
+ await modelerHomePage.clickProjectBreadcrumb();
180
+ await page.getByPlaceholder('Filter table').fill(conflictingFile);
181
+ await modelerHomePage.clickProcessDiagram(conflictingFile);
182
+ await connectorTemplatePage.replaceTemplateJson(JSON.stringify(template, null, 2), '"version": 13');
183
+ (0, test_1.expect)(await connectorTemplatePage.publishToProject(), `The REST connector template ID is still owned by another file after ` +
184
+ `upgrading ${conflictingFile} to v13`).toBeNull();
185
+ }
153
186
  // Skipped due to bug 320: https://github.com/camunda/marketplace-api/issues/320
154
187
  // Workaround so the REST connector template is imported correctly: the
155
188
  // Marketplace only serves `latest`, which an 8.9 Web Modeler cannot import.
@@ -176,14 +209,7 @@ async function uploadRestConnectorTemplate(page, modelerHomePage) {
176
209
  return;
177
210
  }
178
211
  await filterInput.fill('');
179
- const response = await page.request.get(REST_CONNECTOR_TEMPLATE_V13_URL);
180
- (0, test_1.expect)(response.ok(), `Fetching the REST connector template failed with ${response.status()}`).toBeTruthy();
181
- const buffer = await response.body();
182
- (0, test_1.expect)(JSON.parse(buffer.toString('utf-8'))).toMatchObject({
183
- id: 'io.camunda.connectors.HttpJson.v2',
184
- name: REST_CONNECTOR_TEMPLATE_NAME,
185
- version: 13,
186
- });
212
+ const buffer = await fetchRestConnectorTemplateV13(page);
187
213
  await modelerHomePage.clickDiagramTypeDropdown();
188
214
  await modelerHomePage.clickUploadFilesButton();
189
215
  await (0, fileUpload_1.uploadFileContent)(page, {
@@ -235,9 +261,7 @@ async function modelRestConnector(modelerCreatePage, connectorSettingsPage, conn
235
261
  }
236
262
  await modelerHomePage.clickProjectBreadcrumb();
237
263
  await uploadRestConnectorTemplate(page, modelerHomePage);
238
- const connectorTemplatePage = new ConnectorTemplatePage_1.ConnectorTemplatePage(page);
239
- await modelerHomePage.clickProcessDiagram(REST_CONNECTOR_TEMPLATE_RESOURCE);
240
- await connectorTemplatePage.publishToProject();
264
+ await publishRestConnectorTemplateFile(page, modelerHomePage);
241
265
  await modelerHomePage.clickProjectBreadcrumb();
242
266
  await page.getByPlaceholder('Filter table').fill(processName);
243
267
  await modelerHomePage.clickProcessDiagram(processName);
@@ -503,8 +527,7 @@ exports.expectTextWithPagination = expectTextWithPagination;
503
527
  // Web Modeler cannot import (camunda/connectors#9966).
504
528
  async function publishRestConnectorTemplateToProject(page, modelerHomePage) {
505
529
  await uploadRestConnectorTemplate(page, modelerHomePage);
506
- await modelerHomePage.clickProcessDiagram(REST_CONNECTOR_TEMPLATE_RESOURCE);
507
- await new ConnectorTemplatePage_1.ConnectorTemplatePage(page).publishToProject();
530
+ await publishRestConnectorTemplateFile(page, modelerHomePage);
508
531
  await modelerHomePage.clickProjectBreadcrumb();
509
532
  }
510
533
  async function modelAndRunConnectorsDocHandlingDiagram(modelerCreatePage, modelerHomePage, processName, page, connectorMarketplacePage, zeebeUrl, zeebeClientId, zeebeClientSecret, endpoint, tenant = '') {
@@ -85,7 +85,11 @@ const aiAgentSubProcessTestCases = [
85
85
  ];
86
86
  const regexTestCases = [
87
87
  {
88
- regex_ai_agent_time: /The current date and time in \[?([A-Za-zÀ-ÿ .,'-]+(?:, [A-Za-zÀ-ÿ .,'-]+)*)\]?,? is approximately ((?:0?[1-9]|1[0-2]):[0-5][0-9] (?:AM|PM)) on ([A-Z][a-z]+ (?:[1-9]|[12][0-9]|3[01]), \d{4})\./,
88
+ // The agent prompt's answer template is "{City, Country} ... {h:mm AM/PM}
89
+ // on {Month day, year}" and the model sometimes echoes the placeholder
90
+ // brackets/braces around the values, so tolerate them. Each value's own
91
+ // format is still asserted.
92
+ regex_ai_agent_time: /The current date and time in [[{]?([A-Za-zÀ-ÿ .,'-]+(?:, [A-Za-zÀ-ÿ .,'-]+)*)[\]}]?,? is approximately \{?((?:0?[1-9]|1[0-2]):[0-5][0-9] (?:AM|PM))\}? on \{?([A-Z][a-z]+ (?:[1-9]|[12][0-9]|3[01]), \d{4})\}?\./,
89
93
  regex_db_vector: /Color and Varieties:\s*While orange is the most common color today, carrots can also be found in purple, red, yellow, and white varieties\. The orange color comes from beta-carotene, a pigment that the body converts into vitamin A\. Different colors may contain other antioxidants:\s*Purple carrots are rich in anthocyanins\s*Red carrots contain lycopene\s*Yellow carrots have lutein/,
90
94
  },
91
95
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1572",
3
+ "version": "0.0.1574",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",