@camunda/e2e-test-suite 0.0.1514 → 0.0.1516

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.
@@ -6,6 +6,7 @@ declare class ConnectorTemplatePage {
6
6
  constructor(page: Page);
7
7
  clickPublishToOrgButton(): Promise<void>;
8
8
  clickPublishButton(): Promise<void>;
9
+ publishImportedTemplateToWorkspace(version: number): Promise<void>;
9
10
  publishConnector(): Promise<void>;
10
11
  }
11
12
  export { ConnectorTemplatePage };
@@ -20,6 +20,21 @@ class ConnectorTemplatePage {
20
20
  async clickPublishButton() {
21
21
  await this.publishButton.click({ timeout: 90000 });
22
22
  }
23
+ async publishImportedTemplateToWorkspace(version) {
24
+ await this.page.getByRole('button', { name: 'Publish', exact: true }).click();
25
+ await this.page
26
+ .getByRole('menuitem', { name: 'Publish to workspace', exact: true })
27
+ .click();
28
+ const dialog = this.page.getByRole('dialog').filter({
29
+ has: this.page.getByRole('heading', {
30
+ name: 'Publish version to workspace',
31
+ exact: true,
32
+ }),
33
+ });
34
+ await (0, test_1.expect)(dialog.getByRole('spinbutton', { name: 'Version number', exact: true })).toHaveValue(String(version));
35
+ await dialog.getByRole('button', { name: 'Publish', exact: true }).click();
36
+ await (0, test_1.expect)(dialog).toBeHidden({ timeout: 60000 });
37
+ }
23
38
  async publishConnector() {
24
39
  try {
25
40
  await (0, test_1.expect)(this.publishToOrgButton).toBeVisible({ timeout: 15000 });
@@ -174,6 +174,17 @@ declare class ModelerCreatePage {
174
174
  private openChangeElementPopup;
175
175
  openChangeElementPopupForElement(elementId: string): Promise<void>;
176
176
  assertChangeElementTemplateListed(option: Locator, searchTerm: string, elementId: string): Promise<void>;
177
+ appendTemplateTarget(previousElementId: string, type: 'task' | 'receiveTask' | 'intermediateCatchEvent'): Promise<string>;
178
+ applyImportedTemplate(elementId: string, template: {
179
+ id: string;
180
+ name: string;
181
+ }): Promise<void>;
182
+ assertExportedTemplateBindings(bindings: {
183
+ elementId: string;
184
+ id: string;
185
+ version: number;
186
+ elementType: string;
187
+ }[]): Promise<void>;
177
188
  changeElementToAdHocSubProcess(elementId: string): Promise<void>;
178
189
  applyAiAgentSubProcessTemplate(): Promise<void>;
179
190
  private clickChangeElementTemplateOption;
@@ -1384,6 +1384,84 @@ class ModelerCreatePage {
1384
1384
  await (0, test_1.expect)(option).toBeVisible({ timeout: 30000 });
1385
1385
  await (0, test_1.expect)(option).toBeEnabled({ timeout: 30000 });
1386
1386
  }
1387
+ async appendTemplateTarget(previousElementId, type) {
1388
+ const previous = this.page.locator(`.djs-shape[data-element-id="${previousElementId}"]`);
1389
+ await this.page.keyboard.press('Escape');
1390
+ if (!(await previous.evaluate((shape) => shape.classList.contains('selected')))) {
1391
+ await previous.click();
1392
+ }
1393
+ await this.page
1394
+ .getByRole('button', {
1395
+ name: type === 'intermediateCatchEvent'
1396
+ ? 'Append intermediate/boundary event'
1397
+ : 'Append task',
1398
+ exact: true,
1399
+ })
1400
+ .click();
1401
+ const selected = this.page.locator('.djs-shape.selected');
1402
+ await (0, test_1.expect)(selected).not.toHaveAttribute('data-element-id', previousElementId);
1403
+ const elementId = await selected.getAttribute('data-element-id');
1404
+ if (!elementId)
1405
+ throw new Error('The appended template target has no ID.');
1406
+ if (type !== 'task') {
1407
+ await this.openChangeElementPopupForElement(elementId);
1408
+ await this.changeElementSearchInput.fill('');
1409
+ await this.changeElementSearchInput.pressSequentially(type === 'receiveTask'
1410
+ ? 'Receive task'
1411
+ : 'Message intermediate catch event');
1412
+ const entry = type === 'receiveTask'
1413
+ ? 'replace-with-receive-task'
1414
+ : 'replace-with-message-intermediate-catch';
1415
+ await this.page.locator(`.djs-popup [data-id="${entry}"]`).click();
1416
+ }
1417
+ return elementId;
1418
+ }
1419
+ async applyImportedTemplate(elementId, template) {
1420
+ const option = this.page.locator(`.djs-popup [data-id="replace.template-${template.id}"]`);
1421
+ await this.assertChangeElementTemplateListed(option, template.name, elementId);
1422
+ await option.click();
1423
+ await (0, test_1.expect)(this.changeElementSearchInput).toBeHidden();
1424
+ const selected = this.page.locator(`.djs-shape[data-element-id="${elementId}"]`);
1425
+ await (0, test_1.expect)(selected).toHaveClass(/(?:^|\s)selected(?:\s|$)/);
1426
+ const details = this.page.getByRole('region', { name: 'Details panel' });
1427
+ await (0, test_1.expect)(details
1428
+ .locator('[data-test="properties-panel-header-container"]')
1429
+ .getByText(template.name, { exact: true })).toBeVisible();
1430
+ await (0, test_1.expect)(details.getByText('Applied', { exact: true })).toBeVisible();
1431
+ await (0, test_1.expect)(this.templateNotFoundTag).toBeHidden();
1432
+ }
1433
+ async assertExportedTemplateBindings(bindings) {
1434
+ await this.page
1435
+ .getByRole('button', { name: 'Browse more actions', exact: true })
1436
+ .click();
1437
+ const downloadPromise = this.page.waitForEvent('download');
1438
+ await this.page
1439
+ .getByRole('menuitem', { name: 'Download as BPMN 2.0 XML', exact: true })
1440
+ .click();
1441
+ const download = await downloadPromise;
1442
+ const stream = await download.createReadStream();
1443
+ if (!stream)
1444
+ throw new Error('The BPMN download has no readable content.');
1445
+ const chunks = [];
1446
+ for await (const chunk of stream)
1447
+ chunks.push(Buffer.from(chunk));
1448
+ const xml = Buffer.concat(chunks).toString('utf8');
1449
+ const actual = await this.page.evaluate(({ xml, bindings }) => {
1450
+ const document = new DOMParser().parseFromString(xml, 'application/xml');
1451
+ if (document.querySelector('parsererror'))
1452
+ throw new Error('Invalid BPMN XML.');
1453
+ return bindings.map(({ elementId }) => {
1454
+ const element = Array.from(document.getElementsByTagName('*')).find((element) => element.getAttribute('id') === elementId);
1455
+ return {
1456
+ elementId,
1457
+ id: element?.getAttribute('zeebe:modelerTemplate'),
1458
+ version: Number(element?.getAttribute('zeebe:modelerTemplateVersion')),
1459
+ elementType: element?.localName,
1460
+ };
1461
+ });
1462
+ }, { xml, bindings });
1463
+ (0, test_1.expect)(actual).toEqual(bindings);
1464
+ }
1387
1465
  async changeElementToAdHocSubProcess(elementId) {
1388
1466
  const element = this.page.locator(`.djs-shape[data-element-id="${elementId}"]`);
1389
1467
  await this.openChangeElementPopupForElement(elementId);
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Browser, Page, Locator } from '@playwright/test';
2
3
  declare class ModelerHomePage {
3
4
  private page;
@@ -76,7 +77,7 @@ declare class ModelerHomePage {
76
77
  private openWorkspaceTile;
77
78
  private openOrCreateLegacyFolder;
78
79
  private dismissModals;
79
- clickProcessDiagram(name: string): Promise<void>;
80
+ clickProcessDiagram(name: string, exact?: boolean): Promise<void>;
80
81
  clickHomeBreadcrumb(): Promise<void>;
81
82
  clickChooseBpmnTemplateButton(): Promise<void>;
82
83
  clickDiagramTypeDropdown(): Promise<void>;
@@ -88,6 +89,12 @@ declare class ModelerHomePage {
88
89
  clickProjectBreadcrumb(): Promise<void>;
89
90
  clickWorkspaceBreadcrumb(): Promise<void>;
90
91
  enterResourceContainer(name?: string, assignEnvironment?: boolean): Promise<void>;
92
+ uploadTemplateFiles(files: {
93
+ name: string;
94
+ buffer: Buffer;
95
+ }[]): Promise<void>;
96
+ private importedTemplateRow;
97
+ openImportedTemplate(resourceName: string): Promise<void>;
91
98
  private clickCreateProcessApplication;
92
99
  private ensureInResourceContainer;
93
100
  returnToResourceContainer(): Promise<void>;
@@ -673,16 +673,20 @@ class ModelerHomePage {
673
673
  // entirely (to Optimize, to Operate) and come back via
674
674
  // clickCrossComponentProjectFolder(), which lands at workspace root -- the
675
675
  // resource is one level down, so re-enter the container first.
676
- async clickProcessDiagram(name) {
676
+ async clickProcessDiagram(name, exact = false) {
677
677
  await this.ensureInResourceContainer();
678
678
  // A Design System table row opens through a link laid over the row, which
679
679
  // sits on top of the title text and takes its clicks -- so click the link.
680
680
  // The link comes before the title in DOM order, so `first()` picks it
681
681
  // whenever it exists; the title stays as the fallback for the classic table.
682
- const row = this.rows.filter({ hasText: name });
682
+ const row = exact
683
+ ? this.importedTemplateRow(name)
684
+ : this.rows.filter({ hasText: name });
685
+ if (exact)
686
+ await (0, test_1.expect)(row).toHaveCount(1);
683
687
  const process = row
684
- .getByRole('link', { name })
685
- .or(row.getByTitle(name))
688
+ .getByRole('link', { name, exact })
689
+ .or(row.getByTitle(name, { exact }))
686
690
  .first();
687
691
  await (0, test_1.expect)(process).toBeVisible({ timeout: 90000 });
688
692
  await process.click();
@@ -910,6 +914,38 @@ class ModelerHomePage {
910
914
  await this.processApplicationPage.ensureStageCluster(process.env.MODELER_CLUSTER_NAME);
911
915
  }
912
916
  }
917
+ async uploadTemplateFiles(files) {
918
+ await (0, test_1.expect)(this.processApplicationPage.createNewDropdown).toBeVisible({
919
+ timeout: 30000,
920
+ });
921
+ for (const file of files) {
922
+ await (0, test_1.expect)(this.importedTemplateRow(file.name.replace(/\.json$/, ''))).toHaveCount(0);
923
+ }
924
+ await this.processApplicationPage.createNewDropdown.click();
925
+ const chooserPromise = this.page.waitForEvent('filechooser');
926
+ await this.page
927
+ .getByRole('menuitem', { name: 'Upload files', exact: true })
928
+ .click();
929
+ await (await chooserPromise).setFiles(files.map((file) => ({ ...file, mimeType: 'application/json' })));
930
+ // The batch handler can report success for a partial upload.
931
+ for (const file of files) {
932
+ const row = this.importedTemplateRow(file.name.replace(/\.json$/, ''));
933
+ await (0, test_1.expect)(row).toHaveCount(1, { timeout: 60000 });
934
+ await (0, test_1.expect)(row).toBeVisible({ timeout: 60000 });
935
+ }
936
+ }
937
+ importedTemplateRow(name) {
938
+ return this.rows.filter({
939
+ has: this.page
940
+ .getByRole('link', { name, exact: true })
941
+ .or(this.page.getByTitle(name, { exact: true }))
942
+ .or(this.page.getByRole('cell', { name, exact: true })),
943
+ });
944
+ }
945
+ async openImportedTemplate(resourceName) {
946
+ await this.clickProcessDiagram(resourceName, true);
947
+ await this.page.waitForURL(/\/element-templates\//, { timeout: 30000 });
948
+ }
913
949
  // Which control creates a process application depends on the hub version
914
950
  // under test. Since camunda/camunda-hub#25831 it is a plain primary button on
915
951
  // the workspace root, and the "Create new" menu explicitly hides the item
@@ -343,6 +343,106 @@ test.describe('Connectors User Flow Tests @tasklistV2', () => {
343
343
  await modelerCreatePage.applyAiAgentSubProcessTemplate();
344
344
  });
345
345
  });
346
+ test('Agentic Connector Template File Import User Flow', async ({ request, modelerHomePage, modelerCreatePage, connectorTemplatePage, }) => {
347
+ const suffix = await (0, _setup_1.generateRandomStringAsync)(8);
348
+ const source = 'https://raw.githubusercontent.com/camunda/connectors/' +
349
+ '44784a99762663e60b5224578645ecbff4a1065f/' +
350
+ 'connectors/agentic-ai/connector-agentic-ai/element-templates/';
351
+ const templates = [
352
+ {
353
+ file: 'agenticai-mcp-client-outbound-connector.json',
354
+ id: 'io.camunda.connectors.agenticai.mcp.client.v0',
355
+ name: 'MCP Client',
356
+ version: 3,
357
+ engine: '^8.9',
358
+ target: 'task',
359
+ },
360
+ {
361
+ file: 'agenticai-mcp-remote-client-outbound-connector.json',
362
+ id: 'io.camunda.connectors.agenticai.mcp.remoteclient.v0',
363
+ name: 'MCP Remote Client',
364
+ version: 3,
365
+ engine: '^8.9',
366
+ target: 'task',
367
+ },
368
+ {
369
+ file: 'agenticai-adhoctoolsschema-outbound-connector.json',
370
+ id: 'io.camunda.connectors.agenticai.adhoctoolsschema.v1',
371
+ name: 'Ad-hoc tools schema',
372
+ version: 2,
373
+ engine: '^8.8',
374
+ target: 'task',
375
+ },
376
+ {
377
+ file: 'agenticai-a2a-client-webhook-inbound-connector-receive.json',
378
+ id: 'io.camunda.connectors.agenticai.a2a.client.webhook.receive.v0',
379
+ name: 'A2A Client Webhook Receive Task Connector (early access)',
380
+ version: 1,
381
+ engine: '^8.9',
382
+ target: 'receiveTask',
383
+ },
384
+ {
385
+ file: 'agenticai-a2a-client-webhook-inbound-connector-intermediate.json',
386
+ id: 'io.camunda.connectors.agenticai.a2a.client.webhook.intermediate.v0',
387
+ name: 'A2A Client Webhook Intermediate Catch Event Connector (early access)',
388
+ version: 1,
389
+ engine: '^8.9',
390
+ target: 'intermediateCatchEvent',
391
+ },
392
+ ];
393
+ const files = await test.step('Download pinned compatible template files', async () => {
394
+ const files = [];
395
+ for (const template of templates) {
396
+ const response = await request.get(source + template.file);
397
+ (0, test_1.expect)(response.ok(), `Download ${template.file}: ${response.status()}`).toBe(true);
398
+ const buffer = await response.body();
399
+ const content = JSON.parse(buffer.toString('utf8'));
400
+ (0, test_1.expect)(content).toMatchObject({
401
+ id: template.id,
402
+ name: template.name,
403
+ version: template.version,
404
+ engines: { camunda: template.engine },
405
+ });
406
+ (0, test_1.expect)(content).not.toHaveProperty('deprecated');
407
+ files.push({ name: `${template.id}_${suffix}.json`, buffer });
408
+ }
409
+ return files;
410
+ });
411
+ await test.step('Import files into a fresh Workspace project', async () => {
412
+ await modelerHomePage.createDisposableWorkspace(`Template import ${suffix}`);
413
+ await modelerHomePage.enterResourceContainer(`Template import ${suffix}`, false);
414
+ await modelerHomePage.uploadTemplateFiles(files);
415
+ });
416
+ await test.step('Publish each imported draft to this Workspace only', async () => {
417
+ for (const template of templates) {
418
+ await modelerHomePage.openImportedTemplate(`${template.id}_${suffix}`);
419
+ await connectorTemplatePage.publishImportedTemplateToWorkspace(template.version);
420
+ await modelerHomePage.returnToResourceContainer();
421
+ }
422
+ });
423
+ await modelerHomePage.createBpmnTemplateWithoutEnvironment();
424
+ await modelerCreatePage.enterDiagramName(`Imported templates ${suffix}`);
425
+ // Modeler's diagram targets stop at 8.10; the suite targets SM 8.11.
426
+ await modelerCreatePage.setEngineVersion('8.10');
427
+ let previousElementId = 'StartEvent_1';
428
+ const bindings = [];
429
+ for (const template of templates) {
430
+ await test.step(`Apply ${template.name} to its supported element`, async () => {
431
+ const elementId = await modelerCreatePage.appendTemplateTarget(previousElementId, template.target);
432
+ await modelerCreatePage.applyImportedTemplate(elementId, template);
433
+ bindings.push({
434
+ elementId,
435
+ id: template.id,
436
+ version: template.version,
437
+ elementType: template.target === 'task' ? 'serviceTask' : template.target,
438
+ });
439
+ previousElementId = elementId;
440
+ });
441
+ }
442
+ await test.step('Verify exact template IDs and versions in the exported diagram', async () => {
443
+ await modelerCreatePage.assertExportedTemplateBindings(bindings);
444
+ });
445
+ });
346
446
  //Skipped due to bug 1252: https://github.com/camunda/c8-cross-component-e2e-tests/issues/1252
347
447
  test.skip('Connectors Timer Event User Flow', async ({ page, modelerHomePage, modelerCreatePage, connectorMarketplacePage, connectorTemplatePage, navigationPage, operateProcessInstancePage, operateHomePage, operateProcessesPage, }) => {
348
448
  test.slow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1514",
3
+ "version": "0.0.1516",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",