@camunda/e2e-test-suite 0.0.1014 → 0.0.1016

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.
@@ -4,10 +4,25 @@ exports.ModelerHomePage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const sleep_1 = require("../../utils/sleep");
6
6
  const clickLocatorWithRetry_1 = require("../../utils/assertionHelpers/clickLocatorWithRetry");
7
+ const randomName_1 = require("../../utils/randomName");
8
+ const ProcessApplicationPage_1 = require("./ProcessApplicationPage");
7
9
  const expectLocatorWithRetry_1 = require("../../utils/assertionHelpers/expectLocatorWithRetry");
8
10
  class ModelerHomePage {
9
11
  defaultFolderName = 'Cross Component Test Project';
10
12
  page;
13
+ // Since camunda/camunda-hub#25831 files and folders cannot sit at a
14
+ // workspace ("project" in today's UI) root -- only process applications and
15
+ // IDP applications can. The container is therefore entered lazily, at the
16
+ // point a resource is created, and remembered for the lifetime of this page
17
+ // object (one instance per test, see fixtures/8.7.ts). Specs that only
18
+ // need the workspace itself -- collaborators, IDP applications -- never
19
+ // trigger the hop.
20
+ processApplicationPage;
21
+ // Load-bearing: hub renders no process-application breadcrumb on a diagram
22
+ // page at container root, so the remembered URL -- not a breadcrumb click --
23
+ // is how we get back. Hub's own Playwright suite does the same.
24
+ processApplicationUrl;
25
+ processApplicationName;
11
26
  modelerPageBanner;
12
27
  createNewProjectButton;
13
28
  projectNameInput;
@@ -20,6 +35,7 @@ class ModelerHomePage {
20
35
  idpApplicationNameInput;
21
36
  createIdpApplicationButton;
22
37
  projectBreadcrumb;
38
+ workspaceBreadcrumb;
23
39
  openOrganizationsButton;
24
40
  optionsButton;
25
41
  manageButton;
@@ -35,6 +51,7 @@ class ModelerHomePage {
35
51
  renameFormMenuItem;
36
52
  constructor(page) {
37
53
  this.page = page;
54
+ this.processApplicationPage = new ProcessApplicationPage_1.ProcessApplicationPage(page);
38
55
  this.modelerPageBanner = page.getByRole('banner', {
39
56
  name: 'Camunda Modeler',
40
57
  });
@@ -52,16 +69,23 @@ class ModelerHomePage {
52
69
  name: 'Choose BPMN template',
53
70
  });
54
71
  this.diagramTypeDropdown = page.locator('[data-test="diagram-dropdown"]');
55
- this.bpmnTemplateOption = page
56
- .locator('[data-test="create-bpmn-diagram"]')
57
- .getByText('BPMN Diagram');
58
- this.formTemplateOption = page
59
- .locator('[data-test="create-form"]')
60
- .getByText('Form');
72
+ // Matched on the test id alone: hub's design-system variant of the create
73
+ // menu renders "BPMN diagram" (lowercase d), so a text filter breaks the
74
+ // day that variant ships.
75
+ this.bpmnTemplateOption = page.locator('[data-test="create-bpmn-diagram"]');
76
+ this.formTemplateOption = page.locator('[data-test="create-form"]');
61
77
  this.idpTemplateOption = page
62
78
  .locator('[data-test="create-idp-application"]')
63
79
  .getByText('IDP Application');
64
80
  this.projectBreadcrumb = page.locator('[data-test="breadcrumb-project"]');
81
+ // Kept separate from projectBreadcrumb, which now means "the container my
82
+ // resources live in". When hub's workspaces terminology flag flips,
83
+ // breadcrumb-project comes to denote the process application, so the
84
+ // workspace level needs its own name from the start.
85
+ this.workspaceBreadcrumb = page
86
+ .locator('[data-test="breadcrumb-project"]')
87
+ .or(page.locator('[data-test="breadcrumb-workspace"]'))
88
+ .first();
65
89
  this.homeBreadcrumb = page.locator('[data-test="breadcrumb-home"]');
66
90
  this.openOrganizationsButton = page.getByLabel('Open Organizations');
67
91
  this.manageButton = page.getByRole('menuitem', { name: 'Manage' });
@@ -154,12 +178,32 @@ class ModelerHomePage {
154
178
  .map((el) => el.textContent || '')
155
179
  .filter((text) => text !== ''));
156
180
  }
181
+ // Opens a resource where this test put it. Several specs leave Modeler
182
+ // entirely (to Operate, to Optimize) and come back via
183
+ // clickCrossComponentProjectFolder(), which lands at workspace root -- the
184
+ // resource is one level down, so re-enter the container first.
157
185
  async clickProcessDiagram(name) {
186
+ await this.ensureInResourceContainer();
158
187
  const process = this.rows.filter({ hasText: name }).getByTitle(name).first();
159
188
  await (0, test_1.expect)(process).toBeVisible({ timeout: 90000 });
160
189
  await process.click();
161
190
  }
191
+ // Opens the create menu inside this test's process application. The menu at
192
+ // workspace root no longer offers BPMN, Form or Upload -- those resources
193
+ // cannot live there -- so the container is entered first. Callers are
194
+ // unchanged, which is why the existing spec call sites need no edit.
162
195
  async clickDiagramTypeDropdown() {
196
+ await this.enterResourceContainer();
197
+ const dropdown = this.processApplicationPage.createNewDropdown;
198
+ await (0, test_1.expect)(dropdown).toBeVisible({
199
+ timeout: 60000,
200
+ });
201
+ await dropdown.click({ timeout: 120000 });
202
+ }
203
+ // Opens the create menu at workspace root, which is the only place process
204
+ // applications and IDP applications can be created. Everything else has to
205
+ // go through clickDiagramTypeDropdown().
206
+ async clickWorkspaceDiagramTypeDropdown() {
163
207
  await (0, test_1.expect)(this.diagramTypeDropdown).toBeVisible({
164
208
  timeout: 60000,
165
209
  });
@@ -222,8 +266,109 @@ class ModelerHomePage {
222
266
  await this.formBreadcrumbButton.click({ timeout: 60000 });
223
267
  await this.renameFormMenuItem.click({ timeout: 30000 });
224
268
  }
269
+ // Kept under its original name because it is what the existing call sites
270
+ // already mean: "go back to where my resources live". That is now the
271
+ // process application, not the workspace root.
225
272
  async clickProjectBreadcrumb() {
226
- await this.projectBreadcrumb.click({ timeout: 60000 });
273
+ await this.returnToResourceContainer();
274
+ }
275
+ // The workspace ("project") level itself, for the surfaces that genuinely
276
+ // live there -- collaborators, IDP applications, published element
277
+ // templates.
278
+ async clickWorkspaceBreadcrumb() {
279
+ await this.workspaceBreadcrumb.click({ timeout: 60000 });
280
+ }
281
+ // Creates, once per test, the process application that holds this test's
282
+ // resources, and leaves the browser inside it. Idempotent: called again while
283
+ // already in the container it is a no-op, so a spec that creates several
284
+ // resources in a row pays for the container once.
285
+ //
286
+ // One container per test rather than one shared with the seeded workspace:
287
+ // deploying is process-application-wide, so a shared container would let one
288
+ // spec's deploy pick up every other spec's half-modelled diagram.
289
+ async enterResourceContainer(name) {
290
+ if (this.processApplicationUrl) {
291
+ const stillInside = await this.becameVisible(this.processApplicationPage.breadcrumb, 5000);
292
+ if (!stillInside) {
293
+ await this.returnToResourceContainer();
294
+ }
295
+ return;
296
+ }
297
+ this.processApplicationName =
298
+ name ??
299
+ (await (0, randomName_1.randomNameAgregator)('Cross Component Process Application'));
300
+ console.log(`Creating process application ${this.processApplicationName} inside ${this.defaultFolderName}`);
301
+ await this.clickCreateProcessApplication();
302
+ await this.processApplicationPage.nameNewProcessApplication(this.processApplicationName);
303
+ this.processApplicationUrl = this.page.url();
304
+ // Remember the container; its stage cluster is bound on the first deploy,
305
+ // by ProcessApplicationPage.ensureStageCluster, which -- unlike this point
306
+ // in the flow -- knows which cluster the test is going to deploy to.
307
+ this.processApplicationPage.rememberResourceContainer(this.processApplicationUrl);
308
+ }
309
+ // Which control creates a process application depends on the hub version
310
+ // under test. Since camunda/camunda-hub#25831 it is a plain primary button on
311
+ // the workspace root, and the "Create new" menu explicitly hides the item
312
+ // (hideProcessApplication) because a process application is no longer just
313
+ // another resource. Before that change the menu item was the only way in.
314
+ // Race both entry points so neither version pays a full timeout, then use
315
+ // whichever one rendered.
316
+ async clickCreateProcessApplication() {
317
+ const button = this.processApplicationPage.createProcessApplicationButton;
318
+ const rootLoaded = await this.becameVisible(button.or(this.diagramTypeDropdown).first(), 60000);
319
+ if (!rootLoaded) {
320
+ await this.page.reload();
321
+ }
322
+ // Short: the joint probe above already settled which branch rendered, and
323
+ // hub renders exactly one of them (EntityTable renders the toolbar's create
324
+ // menu OR the empty state, never both), so this only confirms which.
325
+ if (await this.becameVisible(button, 5000)) {
326
+ await this.processApplicationPage.clickCreateProcessApplicationButton();
327
+ return;
328
+ }
329
+ await this.clickWorkspaceDiagramTypeDropdown();
330
+ await this.processApplicationPage.clickCreateProcessApplicationOption();
331
+ }
332
+ // Re-enters this test's container if it already has one, without creating
333
+ // one: opening an existing resource must not have the side effect of
334
+ // creating a container for a spec that never asked for it.
335
+ async ensureInResourceContainer() {
336
+ if (!this.processApplicationUrl) {
337
+ return;
338
+ }
339
+ await this.enterResourceContainer();
340
+ }
341
+ // Navigates back to this test's process application by the remembered URL
342
+ // rather than by a breadcrumb click: hub renders no process-application
343
+ // breadcrumb on a diagram page at container root, and the breadcrumb that
344
+ // does exist on the container page doubles as its rename control. Hub's own
345
+ // Playwright suite navigates back the same way.
346
+ async returnToResourceContainer() {
347
+ if (!this.processApplicationUrl) {
348
+ await this.clickWorkspaceBreadcrumb();
349
+ return;
350
+ }
351
+ await this.page.goto(this.processApplicationUrl, {
352
+ waitUntil: 'domcontentloaded',
353
+ });
354
+ await this.processApplicationPage.waitForProcessApplication();
355
+ await this.dismissOverlays();
356
+ }
357
+ // Single seam for "give me an empty BPMN diagram in this test's container".
358
+ // A process application always ships an auto-created main process; this adds
359
+ // a new diagram rather than adopting that one, so every existing modelling
360
+ // assertion keeps its current subject.
361
+ async startBlankBpmnDiagram() {
362
+ await this.clickDiagramTypeDropdown();
363
+ await this.clickBpmnTemplateOption();
364
+ }
365
+ // Boolean visibility probe. waitFor rather than isVisible, which resolves
366
+ // immediately and would report a false negative on a still-rendering page.
367
+ async becameVisible(locator, timeout) {
368
+ return locator
369
+ .waitFor({ state: 'visible', timeout })
370
+ .then(() => true)
371
+ .catch(() => false);
227
372
  }
228
373
  async clickHomeBreadcrumb() {
229
374
  try {
@@ -0,0 +1,30 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ declare class ProcessApplicationPage {
3
+ private page;
4
+ readonly createProcessApplicationButton: Locator;
5
+ readonly createProcessApplicationOption: Locator;
6
+ readonly creationDialog: Locator;
7
+ readonly nameInput: Locator;
8
+ readonly submitButton: Locator;
9
+ readonly cancelButton: Locator;
10
+ readonly breadcrumb: Locator;
11
+ readonly folderExplorer: Locator;
12
+ readonly createNewDropdown: Locator;
13
+ readonly inlineNameInput: Locator;
14
+ readonly defineStagesDialog: Locator;
15
+ readonly developmentClusterSelect: Locator;
16
+ readonly defineStagesSaveButton: Locator;
17
+ constructor(page: Page);
18
+ private pageReady;
19
+ waitForProcessApplication(timeout?: number): Promise<void>;
20
+ clickCreateProcessApplicationButton(): Promise<void>;
21
+ clickCreateProcessApplicationOption(): Promise<void>;
22
+ nameNewProcessApplication(name: string): Promise<void>;
23
+ defineDevelopmentStage(clusterName?: string): Promise<void>;
24
+ rememberResourceContainer(url: string): void;
25
+ forgetStageCluster(): void;
26
+ ensureStageCluster(clusterName: string): Promise<boolean>;
27
+ private openStageDefinition;
28
+ openByName(name: string): Promise<void>;
29
+ }
30
+ export { ProcessApplicationPage };
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProcessApplicationPage = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ const submitModalWithRetry_1 = require("../../utils/assertionHelpers/submitModalWithRetry");
6
+ // Which process application holds the current test's resources, and which
7
+ // cluster its development stage currently points at. Keyed by the Playwright
8
+ // Page because the object that creates the container (ModelerHomePage) and the
9
+ // objects that later need a specific cluster inside it (ModelerCreatePage,
10
+ // FormJsPage) hold separate ProcessApplicationPage instances but share one page.
11
+ const resourceContainers = new WeakMap();
12
+ // Since camunda/camunda-hub#25831 a process application is a first-class
13
+ // container rather than a folder, and a workspace root ("project" in today's
14
+ // UI) holds nothing but process applications and IDP applications. Every file
15
+ // and folder this suite creates therefore has to live inside a process
16
+ // application. This page object owns that container's surface only; entering
17
+ // and leaving it is driven from ModelerHomePage so the ~150 existing spec call
18
+ // sites keep working unchanged.
19
+ class ProcessApplicationPage {
20
+ page;
21
+ // Empty workspace root: a plain primary button rendered next to the "Create
22
+ // new" menu (hub's EmptyStateActionButtons).
23
+ createProcessApplicationButton;
24
+ // Non-empty root: the item inside the "Create new" menu. Hub passes
25
+ // hideProcessApplication at workspace level, so this is the fallback rather
26
+ // than the primary path -- its own unit test asserts the item is absent
27
+ // there. Kept because the Hub PR is still moving this surface.
28
+ createProcessApplicationOption;
29
+ creationDialog;
30
+ nameInput;
31
+ submitButton;
32
+ cancelButton;
33
+ breadcrumb;
34
+ folderExplorer;
35
+ createNewDropdown;
36
+ inlineNameInput;
37
+ // "Define stages" dialog, reached from the process application's "Connected
38
+ // clusters" card (or its /connected-clusters deep link). Assigning a cluster
39
+ // to a stage here is what makes it deployable: DeployModal renders
40
+ // ProcessAppClusterSelection for a process application, and that filters the
41
+ // cluster list through getProcessAppClustersByStage -- so a process
42
+ // application with no stage assigned offers no cluster at all.
43
+ defineStagesDialog;
44
+ developmentClusterSelect;
45
+ defineStagesSaveButton;
46
+ constructor(page) {
47
+ this.page = page;
48
+ // .first() defensively only: hub renders exactly one of these today, in the
49
+ // workspace-root empty state. A future second placement should not turn
50
+ // every PA-creating test into a strict-mode violation.
51
+ this.createProcessApplicationButton = page
52
+ .getByRole('button', { name: 'Create process application' })
53
+ .first();
54
+ this.createProcessApplicationOption = page.locator('[data-test="create-process-application"]');
55
+ this.creationDialog = page.getByRole('dialog', {
56
+ name: 'Create a process application',
57
+ });
58
+ // Deliberately scoped to the dialog: ModelerCreatePage owns an unscoped
59
+ // getByLabel('Name', {exact: true}) for the properties panel, which would
60
+ // resolve to two elements while the creation modal is open.
61
+ this.nameInput = this.creationDialog.getByLabel('Name', { exact: true });
62
+ this.submitButton = this.creationDialog.getByRole('button', {
63
+ name: 'Create',
64
+ exact: true,
65
+ });
66
+ this.cancelButton = this.creationDialog.getByRole('button', {
67
+ name: 'Cancel',
68
+ exact: true,
69
+ });
70
+ this.breadcrumb = page.locator('[data-test="breadcrumb-process-application-menu"]');
71
+ this.folderExplorer = page.getByRole('region', { name: 'Folder explorer' });
72
+ // The process application page renders more than one diagram-dropdown
73
+ // (hub's own unit tests reach for it with getAllByTestId), so the dropdown
74
+ // has to be resolved inside the folder explorer rather than page-wide.
75
+ this.createNewDropdown = this.folderExplorer
76
+ .locator('[data-test="diagram-dropdown"]')
77
+ .first();
78
+ this.inlineNameInput = page.locator('[data-test="editable-input"]');
79
+ this.defineStagesDialog = page
80
+ .getByRole('dialog')
81
+ .filter({ hasText: 'Define stages' });
82
+ // Carbon Dropdown / design-system Select both keep this id.
83
+ this.developmentClusterSelect = this.defineStagesDialog.locator('#dropdown-development-cluster');
84
+ this.defineStagesSaveButton = this.defineStagesDialog.getByRole('button', {
85
+ name: 'Save',
86
+ exact: true,
87
+ });
88
+ }
89
+ // Either the folder explorer or the breadcrumb proves we are on the process
90
+ // application page; .first() because both are present once it has rendered.
91
+ pageReady() {
92
+ return this.folderExplorer.or(this.breadcrumb).first();
93
+ }
94
+ async waitForProcessApplication(timeout = 90000) {
95
+ await (0, test_1.expect)(this.pageReady()).toBeVisible({ timeout });
96
+ }
97
+ async clickCreateProcessApplicationButton() {
98
+ await (0, test_1.expect)(this.createProcessApplicationButton).toBeVisible({
99
+ timeout: 60000,
100
+ });
101
+ await this.createProcessApplicationButton.click({ timeout: 60000 });
102
+ }
103
+ async clickCreateProcessApplicationOption() {
104
+ await (0, test_1.expect)(this.createProcessApplicationOption).toBeVisible({
105
+ timeout: 60000,
106
+ });
107
+ await this.createProcessApplicationOption.click({ timeout: 60000 });
108
+ }
109
+ // Hub creates a process application through a modal today. It used an inline
110
+ // editable title before, and #27593 is still moving this surface, so the
111
+ // inline path is kept as a fallback — this is the one method that has to
112
+ // change if naming moves back inline.
113
+ async nameNewProcessApplication(name) {
114
+ const isModal = await this.creationDialog
115
+ .waitFor({ state: 'visible', timeout: 15000 })
116
+ .then(() => true)
117
+ .catch(() => false);
118
+ if (isModal) {
119
+ await this.nameInput.click({ timeout: 30000 });
120
+ await this.nameInput.fill(name);
121
+ await (0, test_1.expect)(this.nameInput).toHaveValue(name, { timeout: 10000 });
122
+ await (0, submitModalWithRetry_1.submitModalWithRetry)(this.submitButton, this.creationDialog);
123
+ await this.waitForProcessApplication();
124
+ return;
125
+ }
126
+ await (0, test_1.expect)(this.inlineNameInput).toBeVisible({ timeout: 30000 });
127
+ await this.inlineNameInput.click({ timeout: 60000 });
128
+ await this.inlineNameInput.fill(name);
129
+ await this.inlineNameInput.press('Enter');
130
+ await this.waitForProcessApplication();
131
+ }
132
+ // Assigns a cluster to this process application's development stage.
133
+ //
134
+ // Deploying from inside a process application goes through
135
+ // ProcessAppClusterSelection, which only lists clusters the application has
136
+ // assigned to a stage, and does not auto-select anything when that list is
137
+ // empty. A freshly created process application has no stages, so the deploy
138
+ // dialog shows "Clusters not configured for stages" and offers nothing to
139
+ // pick -- which is why the old per-deploy cluster toggle was nowhere to be
140
+ // found. Assign the stage once, at creation, and the deploy dialog then
141
+ // auto-selects it.
142
+ //
143
+ // clusterName is matched as a prefix because the dropdown renders each
144
+ // cluster as "<name> <generation>". Without it, the first real cluster is
145
+ // taken -- callers that care assert the name in the deploy dialog anyway.
146
+ async defineDevelopmentStage(clusterName) {
147
+ await (0, test_1.expect)(this.defineStagesDialog).toBeVisible({ timeout: 60000 });
148
+ await this.developmentClusterSelect.click({ timeout: 30000 });
149
+ // Escape before interpolating: a cluster name can carry regex
150
+ // metacharacters -- "Test Cluster (v2)" is the common case -- which would
151
+ // otherwise mis-match or throw. Same treatment as
152
+ // utils/modelerCluster.selectModelerCluster.
153
+ const escapedClusterName = clusterName?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
154
+ const option = clusterName
155
+ ? this.defineStagesDialog
156
+ .getByRole('option', { name: new RegExp(`^${escapedClusterName}`) })
157
+ .first()
158
+ : this.defineStagesDialog
159
+ .getByRole('option')
160
+ .filter({ hasNotText: 'Select a development cluster' })
161
+ .first();
162
+ await option.click({ timeout: 30000 });
163
+ await this.defineStagesSaveButton.click({ timeout: 30000 });
164
+ await (0, test_1.expect)(this.defineStagesDialog).toBeHidden({ timeout: 60000 });
165
+ }
166
+ rememberResourceContainer(url) {
167
+ resourceContainers.set(this.page, { url });
168
+ }
169
+ // Drops the recorded development-stage binding so the next ensureStageCluster
170
+ // call binds again. Called when the deploy dialog turns out not to offer the
171
+ // cluster we believe we bound: the dialog offers exactly what the
172
+ // application's stages point at, so if the cluster is missing the binding
173
+ // did not take, and reopening the dialog can never change that. Without
174
+ // this, a caller's retries all re-check a state nothing is changing.
175
+ forgetStageCluster() {
176
+ const container = resourceContainers.get(this.page);
177
+ if (container) {
178
+ container.developmentCluster = undefined;
179
+ }
180
+ }
181
+ // A process application deploys to the clusters bound to its stages, and
182
+ // nothing else: inside a container DeployModal renders
183
+ // ProcessAppClusterSelection, which lists only those and auto-selects the
184
+ // first. Which cluster a test wants is known only once a deploy flow names
185
+ // it, so the binding happens here, on demand -- leave the diagram, bind the
186
+ // cluster to the development stage, come back. Repeat calls for the same
187
+ // cluster cost nothing, and a test deploying to a second cluster rebinds.
188
+ // Returns whether it navigated: the caller may have been on a view that a
189
+ // reload does not restore -- Play is a tab click, not a URL -- and has to
190
+ // re-enter it.
191
+ async ensureStageCluster(clusterName) {
192
+ const container = resourceContainers.get(this.page);
193
+ if (!container || container.developmentCluster === clusterName) {
194
+ return false;
195
+ }
196
+ const returnTo = this.page.url();
197
+ const paUrl = container.url.replace(/[?#].*$/, '').replace(/\/$/, '');
198
+ // Retried as a whole, re-entering the page on every attempt. This binding
199
+ // is a one-shot precondition for every deploy the test goes on to make,
200
+ // and unlike the deploy itself it sits outside runProcessInstance's retry
201
+ // loop -- so a single transient miss (the session bounced to /login, the
202
+ // cluster list not yet arrived when the dropdown opened) failed the test
203
+ // outright instead of being absorbed the way every other modal in this
204
+ // suite is. Re-navigating is the recovery; waiting longer on a page that
205
+ // has already gone wrong is not, which is why the inner timeouts stay
206
+ // short. A genuinely unbindable cluster still fails, with the same error.
207
+ await (0, test_1.expect)(async () => {
208
+ await this.page.goto(`${paUrl}/connected-clusters`, {
209
+ waitUntil: 'domcontentloaded',
210
+ });
211
+ await this.openStageDefinition();
212
+ await this.defineDevelopmentStage(clusterName);
213
+ }).toPass({ timeout: 240000, intervals: [1000, 2000, 5000] });
214
+ container.developmentCluster = clusterName;
215
+ await this.page.goto(returnTo, { waitUntil: 'domcontentloaded' });
216
+ return true;
217
+ }
218
+ // The /connected-clusters deep link opens the Define stages dialog by itself
219
+ // while the application has no stage bound. Once one is bound -- a test that
220
+ // deploys to a second cluster -- it has to be reopened from the page, so try
221
+ // the affordances hub offers before failing with exactly what was looked for.
222
+ // Worth the noise: an unbound cluster otherwise surfaces as a deploy dialog
223
+ // that silently offers nothing, which says nothing about its own cause.
224
+ async openStageDefinition() {
225
+ const opened = await this.defineStagesDialog
226
+ .waitFor({ state: 'visible', timeout: 15000 })
227
+ .then(() => true)
228
+ .catch(() => false);
229
+ if (opened) {
230
+ return;
231
+ }
232
+ // Page-scoped .first(): hub renders one such control on this page, and a
233
+ // second placement must not turn every rebinding test into a strict-mode
234
+ // violation.
235
+ const reopen = this.page
236
+ .getByRole('button', { name: /define stages|edit stages|configure/i })
237
+ .first();
238
+ const canReopen = await reopen
239
+ .waitFor({ state: 'visible', timeout: 10000 })
240
+ .then(() => true)
241
+ .catch(() => false);
242
+ if (!canReopen) {
243
+ throw new Error('Could not open the "Define stages" dialog on /connected-clusters: it ' +
244
+ 'did not open by itself and no "Define stages" / "Edit stages" / ' +
245
+ '"Configure" control was found.');
246
+ }
247
+ await reopen.click({ timeout: 30000 });
248
+ }
249
+ async openByName(name) {
250
+ const processApplication = this.page
251
+ .getByRole('row')
252
+ .filter({ hasText: name })
253
+ .getByTitle(name)
254
+ .first();
255
+ await (0, test_1.expect)(processApplication).toBeVisible({ timeout: 90000 });
256
+ await processApplication.click({ timeout: 60000 });
257
+ await this.waitForProcessApplication();
258
+ }
259
+ }
260
+ exports.ProcessApplicationPage = ProcessApplicationPage;
@@ -449,6 +449,14 @@ async function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage, modeler
449
449
  timeout: 60000,
450
450
  });
451
451
  await connectorMarketplacePage.downloadConnectorToProject();
452
+ // Both lookups are container-relative: clickProjectBreadcrumb() returns to
453
+ // this test's process application, which is where the uploaded diagram
454
+ // lives. The downloaded element template is the open question -- hub
455
+ // publishes element templates to the workspace, but the marketplace download
456
+ // is initiated from inside the container, so it should land there. If a
457
+ // trace shows the template at workspace root instead, this call becomes
458
+ // clickWorkspaceBreadcrumb() followed by returnToResourceContainer() before
459
+ // the diagram is reopened.
452
460
  await modelerHomePage.clickProjectBreadcrumb();
453
461
  await modelerHomePage.clickProcessDiagram('REST Outbound Connector');
454
462
  await connectorTemplatePage.publishConnector();
@@ -1,6 +1,7 @@
1
1
  import { Page, Locator } from '@playwright/test';
2
2
  declare class FormJsPage {
3
3
  private page;
4
+ private processApplicationPage;
4
5
  readonly aiFormGeneratorButton: Locator;
5
6
  readonly formRequestInput: Locator;
6
7
  readonly generateFormButton: Locator;
@@ -34,6 +35,7 @@ declare class FormJsPage {
34
35
  selectCluster(clusterName: string): Promise<void>;
35
36
  clickDeployButton(): Promise<void>;
36
37
  clickDeploySubButton(): Promise<void>;
38
+ selectOnlyThisResource(): Promise<void>;
37
39
  deployForm(clusterName: string): Promise<void>;
38
40
  }
39
41
  export { FormJsPage };
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormJsPage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const sleep_1 = require("../../utils/sleep");
6
+ const ProcessApplicationPage_1 = require("./ProcessApplicationPage");
6
7
  class FormJsPage {
7
8
  page;
9
+ processApplicationPage;
8
10
  aiFormGeneratorButton;
9
11
  formRequestInput;
10
12
  generateFormButton;
@@ -25,6 +27,7 @@ class FormJsPage {
25
27
  deployErrorMessage;
26
28
  constructor(page) {
27
29
  this.page = page;
30
+ this.processApplicationPage = new ProcessApplicationPage_1.ProcessApplicationPage(page);
28
31
  this.aiFormGeneratorButton = page.getByRole('button', {
29
32
  name: 'AI Form Generator',
30
33
  });
@@ -47,9 +50,12 @@ class FormJsPage {
47
50
  this.deployButton = page
48
51
  .locator('[data-test="action-bar"]')
49
52
  .getByRole('button', { name: 'Deploy', exact: true });
53
+ // Inside a process application hub titles this modal for the application
54
+ // rather than for the form, so 'Deploy form' never matches and the dialog
55
+ // reads as absent. pages/SM-8.10 filters on 'Deploy' for the same reason.
50
56
  this.dialog = page
51
57
  .locator('.cds--modal-container[role="dialog"]')
52
- .filter({ hasText: 'Deploy form' });
58
+ .filter({ hasText: 'Deploy' });
53
59
  this.deploySubButton = this.dialog.getByRole('button', {
54
60
  name: 'Deploy',
55
61
  exact: true,
@@ -112,6 +118,46 @@ class FormJsPage {
112
118
  async selectCluster(clusterName) {
113
119
  await (0, test_1.expect)(this.dialog).toBeVisible({ timeout: 30000 });
114
120
  const healthCheckTimeout = 120000;
121
+ // Inside a process application the deploy dialog renders
122
+ // ProcessAppClusterSelection, not the per-deploy ClusterSelection toggle
123
+ // list: it shows only clusters assigned to one of the application's stages
124
+ // and auto-selects the first, so there is no label to click. Confirm the
125
+ // intended cluster is the one on offer instead.
126
+ //
127
+ // The unconfigured case is called out explicitly: without this the symptom
128
+ // is the cluster toggle never appearing, retried until the test times out,
129
+ // which says nothing about the actual cause.
130
+ const notConfigured = this.dialog.getByText('Clusters not configured for stages');
131
+ if (await notConfigured.isVisible().catch(() => false)) {
132
+ throw new Error(`Process application has no cluster assigned to any stage, so "${clusterName}" cannot be deployed to. ` +
133
+ 'ProcessApplicationPage.ensureStageCluster() should have bound it before the deploy dialog was opened.');
134
+ }
135
+ const legacyClusterToggle = this.dialog.locator('label').filter({
136
+ hasText: new RegExp(`^${clusterName}`),
137
+ });
138
+ const isLegacyDialog = await legacyClusterToggle
139
+ .first()
140
+ .isVisible()
141
+ .catch(() => false);
142
+ if (!isLegacyDialog) {
143
+ const offered = await this.dialog
144
+ .getByText(clusterName, { exact: false })
145
+ .first()
146
+ .waitFor({ state: 'visible', timeout: 30000 })
147
+ .then(() => true)
148
+ .catch(() => false);
149
+ if (!offered) {
150
+ // Forget the binding before failing. The dialog lists exactly the
151
+ // clusters this application's stages point at, so a missing cluster
152
+ // means the binding did not take -- and no amount of reopening the
153
+ // dialog will make it appear. Clearing the record lets the caller's
154
+ // next attempt rebind instead of re-checking an unchanged dialog.
155
+ this.processApplicationPage.forgetStageCluster();
156
+ throw new Error(`The deploy dialog does not offer "${clusterName}": its stage ` +
157
+ 'binding did not take. It will be rebound on the next attempt.');
158
+ }
159
+ return;
160
+ }
115
161
  const healthyRegex = new RegExp(`${clusterName}[\\s\\S]*?HealthydevManage`);
116
162
  const cluster = this.dialog.locator(`[title="${clusterName}"]`);
117
163
  await (0, test_1.expect)(cluster).toBeVisible({ timeout: 30000 });
@@ -130,7 +176,33 @@ class FormJsPage {
130
176
  async clickDeploySubButton() {
131
177
  await this.deploySubButton.click({ timeout: 60000 });
132
178
  }
179
+ // Since camunda/camunda-hub#25831 a form lives inside a process application,
180
+ // and Hub then scopes Deploy to the WHOLE application by default -- it calls
181
+ // deployProcessApplication, not deployFile, so the "Form deployed!" toast
182
+ // never fires (hub's own form-deploy-action.spec.sm.tsx asserts exactly that
183
+ // default). Narrowing the scope keeps this a form-deploy test instead of
184
+ // silently turning it into a process-application deploy. The combobox only
185
+ // exists inside a container, hence the boolean probe.
186
+ async selectOnlyThisResource() {
187
+ const scopeSelect = this.dialog.getByRole('combobox', {
188
+ name: 'Resources to deploy',
189
+ });
190
+ const hasScopeSelect = await scopeSelect
191
+ .waitFor({ state: 'visible', timeout: 10000 })
192
+ .then(() => true)
193
+ .catch(() => false);
194
+ if (!hasScopeSelect) {
195
+ return;
196
+ }
197
+ await scopeSelect.click();
198
+ await this.dialog
199
+ .getByRole('option', { name: 'Only this resource' })
200
+ .or(this.dialog.getByText('Only this resource', { exact: true }))
201
+ .first()
202
+ .click({ timeout: 30000 });
203
+ }
133
204
  async deployForm(clusterName) {
205
+ await this.processApplicationPage.ensureStageCluster(clusterName);
134
206
  // After a 8.7->8.8 upgrade, orchestration-cluster authorization commands
135
207
  // propagate across partitions for several minutes; deploy is rejected with
136
208
  // FORBIDDEN until the deployer's grant lands. In migration runs, reload and
@@ -143,6 +215,7 @@ class FormJsPage {
143
215
  timeout: 30000,
144
216
  });
145
217
  await this.selectCluster(clusterName);
218
+ await this.selectOnlyThisResource();
146
219
  await this.clickDeploySubButton();
147
220
  if (attempt === maxAttempts) {
148
221
  await (0, test_1.expect)(this.deploySuccessNotification).toBeVisible({