@camunda/e2e-test-suite 0.0.1016 → 0.0.1017

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.
@@ -1,6 +1,7 @@
1
1
  import { Page, Locator } from '@playwright/test';
2
2
  declare class ModelerCreatePage {
3
3
  private page;
4
+ private processApplicationPage;
4
5
  readonly generalPanel: Locator;
5
6
  readonly taskDefinitionPanel: Locator;
6
7
  readonly processIdInput: Locator;
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModelerCreatePage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const ConnectorMarketplacePage_1 = require("./ConnectorMarketplacePage");
6
+ const ProcessApplicationPage_1 = require("./ProcessApplicationPage");
6
7
  const sleep_1 = require("../../utils/sleep");
7
8
  const modelerCluster_1 = require("../../utils/modelerCluster");
8
9
  class ModelerCreatePage {
9
10
  page;
11
+ processApplicationPage;
10
12
  generalPanel;
11
13
  taskDefinitionPanel;
12
14
  processIdInput;
@@ -103,6 +105,7 @@ class ModelerCreatePage {
103
105
  openDetailsPanel;
104
106
  constructor(page) {
105
107
  this.page = page;
108
+ this.processApplicationPage = new ProcessApplicationPage_1.ProcessApplicationPage(page);
106
109
  this.generalPanel = page.locator('[data-group-id="group-general"]');
107
110
  this.taskDefinitionPanel = page
108
111
  .locator('div')
@@ -396,6 +399,7 @@ class ModelerCreatePage {
396
399
  .click({ timeout: 90000 });
397
400
  }
398
401
  async runProcessInstance(variables = '', tenant = '', businessId = '') {
402
+ await this.processApplicationPage.ensureStageCluster(process.env.MODELER_CLUSTER_NAME);
399
403
  await this.page.waitForTimeout(2000); // the canvas autosaves. This can take a second to save.
400
404
  const maxRetries = 3;
401
405
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -392,6 +392,7 @@ class ModelerHomePage {
392
392
  await this.clickCreateProcessApplication();
393
393
  await this.processApplicationPage.nameNewProcessApplication(this.processApplicationName);
394
394
  this.processApplicationUrl = this.page.url();
395
+ this.processApplicationPage.rememberResourceContainer(this.processApplicationUrl);
395
396
  }
396
397
  // Which control creates a process application depends on the hub version
397
398
  // under test. Since camunda/camunda-hub#25831 it is a plain primary button on
@@ -12,12 +12,19 @@ declare class ProcessApplicationPage {
12
12
  readonly titleBar: Locator;
13
13
  readonly createNewDropdown: Locator;
14
14
  readonly inlineNameInput: Locator;
15
+ readonly defineStagesDialog: Locator;
16
+ readonly developmentClusterSelect: Locator;
17
+ readonly defineStagesSaveButton: Locator;
15
18
  constructor(page: Page);
16
19
  private pageReady;
17
20
  waitForProcessApplication(timeout?: number): Promise<void>;
18
21
  clickCreateProcessApplicationButton(): Promise<void>;
19
22
  clickCreateProcessApplicationOption(): Promise<void>;
20
23
  nameNewProcessApplication(name: string): Promise<void>;
24
+ private defineDevelopmentStage;
25
+ rememberResourceContainer(url: string): void;
26
+ ensureStageCluster(clusterName?: string): Promise<void>;
27
+ private openStageDefinition;
21
28
  openByName(name: string): Promise<void>;
22
29
  }
23
30
  export { ProcessApplicationPage };
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProcessApplicationPage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const submitModalWithRetry_1 = require("../../utils/assertionHelpers/submitModalWithRetry");
6
+ // ModelerHomePage creates the container, while ModelerCreatePage later binds
7
+ // its stage. Both page objects share the same Playwright Page.
8
+ const resourceContainers = new WeakMap();
6
9
  // Since camunda/camunda-hub#25831 a process application is a first-class
7
10
  // container rather than a folder, and a workspace root ("project" in today's
8
11
  // UI) holds nothing but process applications and IDP applications. Every file
@@ -29,6 +32,9 @@ class ProcessApplicationPage {
29
32
  titleBar;
30
33
  createNewDropdown;
31
34
  inlineNameInput;
35
+ defineStagesDialog;
36
+ developmentClusterSelect;
37
+ defineStagesSaveButton;
32
38
  constructor(page) {
33
39
  this.page = page;
34
40
  // .first() defensively only: hub renders exactly one of these today, in the
@@ -72,6 +78,14 @@ class ProcessApplicationPage {
72
78
  .locator('[data-test="diagram-dropdown"]')
73
79
  .first();
74
80
  this.inlineNameInput = page.locator('[data-test="editable-input"]');
81
+ this.defineStagesDialog = page
82
+ .getByRole('dialog')
83
+ .filter({ hasText: 'Define stages' });
84
+ this.developmentClusterSelect = this.defineStagesDialog.locator('#dropdown-development-cluster');
85
+ this.defineStagesSaveButton = this.defineStagesDialog.getByRole('button', {
86
+ name: 'Save',
87
+ exact: true,
88
+ });
75
89
  }
76
90
  // Any one of the title bar, the resource region or the breadcrumb proves we
77
91
  // are on the process application page. Three branches because the Design
@@ -118,6 +132,68 @@ class ProcessApplicationPage {
118
132
  await this.inlineNameInput.press('Enter');
119
133
  await this.waitForProcessApplication();
120
134
  }
135
+ async defineDevelopmentStage(clusterName) {
136
+ await (0, test_1.expect)(this.defineStagesDialog).toBeVisible({ timeout: 60000 });
137
+ await this.developmentClusterSelect.click({ timeout: 30000 });
138
+ const escapedClusterName = clusterName?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
139
+ const option = clusterName
140
+ ? this.page
141
+ .getByRole('option', { name: new RegExp(`^${escapedClusterName}`) })
142
+ .first()
143
+ : this.page
144
+ .getByRole('option')
145
+ .filter({ hasNotText: 'Select a development cluster' })
146
+ .first();
147
+ await option.click({ timeout: 30000 });
148
+ await this.defineStagesSaveButton.click({ timeout: 30000 });
149
+ await (0, test_1.expect)(this.defineStagesDialog).toBeHidden({ timeout: 60000 });
150
+ }
151
+ rememberResourceContainer(url) {
152
+ resourceContainers.set(this.page, { url });
153
+ }
154
+ async ensureStageCluster(clusterName) {
155
+ const container = resourceContainers.get(this.page);
156
+ if (!container ||
157
+ (container.stageBound && container.developmentCluster === clusterName)) {
158
+ return;
159
+ }
160
+ const returnTo = this.page.url();
161
+ const processApplicationUrl = container.url
162
+ .replace(/[?#].*$/, '')
163
+ .replace(/\/$/, '');
164
+ await (0, test_1.expect)(async () => {
165
+ await this.page.goto(`${processApplicationUrl}/connected-clusters`, {
166
+ waitUntil: 'domcontentloaded',
167
+ });
168
+ await this.openStageDefinition();
169
+ await this.defineDevelopmentStage(clusterName);
170
+ }).toPass({ timeout: 240000, intervals: [1000, 2000, 5000] });
171
+ container.stageBound = true;
172
+ container.developmentCluster = clusterName;
173
+ await this.page.goto(returnTo, { waitUntil: 'domcontentloaded' });
174
+ }
175
+ async openStageDefinition() {
176
+ const opened = await this.defineStagesDialog
177
+ .waitFor({ state: 'visible', timeout: 15000 })
178
+ .then(() => true)
179
+ .catch(() => false);
180
+ if (opened) {
181
+ return;
182
+ }
183
+ const reopen = this.page
184
+ .getByRole('button', { name: /define stages|edit stages|configure/i })
185
+ .first();
186
+ const canReopen = await reopen
187
+ .waitFor({ state: 'visible', timeout: 10000 })
188
+ .then(() => true)
189
+ .catch(() => false);
190
+ if (!canReopen) {
191
+ throw new Error('Could not open the "Define stages" dialog on /connected-clusters: it ' +
192
+ 'did not open by itself and no "Define stages" / "Edit stages" / ' +
193
+ '"Configure" control was found.');
194
+ }
195
+ await reopen.click({ timeout: 30000 });
196
+ }
121
197
  async openByName(name) {
122
198
  const processApplication = this.page
123
199
  .getByRole('row')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1016",
3
+ "version": "0.0.1017",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",