@camunda/e2e-test-suite 0.0.884 → 0.0.885

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.
@@ -33,6 +33,7 @@ declare class ModelerCreatePage {
33
33
  readonly createTask: Locator;
34
34
  readonly createEndEvent: Locator;
35
35
  readonly canvas: Locator;
36
+ readonly zoomOutButton: Locator;
36
37
  readonly endEventCanvas: Locator;
37
38
  readonly connectToOtherElementButton: Locator;
38
39
  readonly firstPlacedElement: Locator;
@@ -162,6 +163,8 @@ declare class ModelerCreatePage {
162
163
  clickDeploySubButtonWithRetry(clusterName: string): Promise<void>;
163
164
  clickCreateTask(): Promise<void>;
164
165
  clickCreateEndEvent(): Promise<void>;
166
+ fitElementIntoCanvas(element: Locator, margin?: number, maxZoomOutSteps?: number): Promise<void>;
167
+ clickShapeBelowContextPad(element: Locator): Promise<void>;
165
168
  clickCanvas(): Promise<void>;
166
169
  clickEndEventCanvas(): Promise<void>;
167
170
  clickConnectToOtherElementButton(): Promise<void>;
@@ -39,6 +39,7 @@ class ModelerCreatePage {
39
39
  createTask;
40
40
  createEndEvent;
41
41
  canvas;
42
+ zoomOutButton;
42
43
  endEventCanvas;
43
44
  connectToOtherElementButton;
44
45
  firstPlacedElement;
@@ -182,6 +183,7 @@ class ModelerCreatePage {
182
183
  this.createTask = page.getByTitle('Create task');
183
184
  this.createEndEvent = page.getByTitle('Create end event');
184
185
  this.canvas = page.locator('.djs-container');
186
+ this.zoomOutButton = page.locator('[data-test="zoom-out"]');
185
187
  this.endEventCanvas = page.locator('[class="bjs-container"]');
186
188
  this.connectToOtherElementButton = page.getByRole('button', {
187
189
  name: 'Connect to other element',
@@ -773,6 +775,39 @@ class ModelerCreatePage {
773
775
  async clickCreateEndEvent() {
774
776
  await this.createEndEvent.click({ timeout: 60000 });
775
777
  }
778
+ // The canvas does not scroll with the DOM, so an element the diagram has
779
+ // pushed past the canvas edge cannot be clicked at all — the hit test returns
780
+ // the canvas container (or the panel toggle bar beside it). Zoom out until
781
+ // the element and one element-width of margin fit inside the canvas.
782
+ async fitElementIntoCanvas(element, margin = 120, maxZoomOutSteps = 3) {
783
+ for (let step = 0; step < maxZoomOutSteps; step++) {
784
+ const canvasBox = await this.canvas.boundingBox();
785
+ const elementBox = await element.boundingBox();
786
+ if (canvasBox === null || elementBox === null) {
787
+ return;
788
+ }
789
+ const elementRightEdge = elementBox.x + elementBox.width + margin;
790
+ if (elementRightEdge <= canvasBox.x + canvasBox.width) {
791
+ return;
792
+ }
793
+ await this.zoomOutButton.click({ timeout: 30000 });
794
+ }
795
+ }
796
+ // A context pad is a fixed-size strip anchored to the top-right of its
797
+ // element, so once the diagram is zoomed out it can reach across the gap and
798
+ // cover the top of the next shape. Click the bottom edge of the target, below
799
+ // the strip, so a neighbour's open pad cannot swallow the click.
800
+ async clickShapeBelowContextPad(element) {
801
+ const box = await element.boundingBox();
802
+ if (box === null) {
803
+ await element.click({ timeout: 60000 });
804
+ return;
805
+ }
806
+ await element.click({
807
+ timeout: 60000,
808
+ position: { x: box.width / 2, y: box.height - 2 },
809
+ });
810
+ }
776
811
  async clickCanvas() {
777
812
  // Clicking the canvas centre lands on a shape (or an open create pad) as
778
813
  // soon as the diagram has more than a couple of elements, and the click is
@@ -1027,16 +1062,22 @@ class ModelerCreatePage {
1027
1062
  }
1028
1063
  async clickSecondPlacedGateway(userTaskId = '') {
1029
1064
  try {
1030
- await this.secondPlacedGateway.click({ timeout: 60000 });
1065
+ await this.clickShapeBelowContextPad(this.secondPlacedGateway);
1031
1066
  }
1032
1067
  catch (error) {
1033
1068
  await this.page.reload();
1034
1069
  await (0, sleep_1.sleep)(10000);
1070
+ // The reload resets the canvas viewbox to the origin, discarding the
1071
+ // auto-scroll that kept the right-most gateway on screen.
1072
+ await this.fitElementIntoCanvas(this.secondPlacedGateway);
1073
+ // Clear any selection the reload restored, so its context pad is closed
1074
+ // before the gateway is clicked.
1075
+ await this.clickCanvas();
1035
1076
  if (userTaskId != '') {
1036
1077
  await this.clickUserTask(userTaskId);
1037
1078
  await this.clickConnectToOtherElementButton();
1038
1079
  }
1039
- await this.secondPlacedGateway.click({ timeout: 60000 });
1080
+ await this.clickShapeBelowContextPad(this.secondPlacedGateway);
1040
1081
  }
1041
1082
  }
1042
1083
  async addParallelUserTasks(numberOfTasks, taskName) {
@@ -1083,6 +1124,7 @@ class ModelerCreatePage {
1083
1124
  await this.clickCanvas();
1084
1125
  await (0, sleep_1.sleep)(1000);
1085
1126
  }
1127
+ await this.fitElementIntoCanvas(this.secondPlacedGateway);
1086
1128
  await this.clickSecondPlacedGateway();
1087
1129
  }
1088
1130
  async clickServiceTaskOption() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.884",
3
+ "version": "0.0.885",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",