@camunda/e2e-test-suite 0.0.1294 → 0.0.1295

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.
Files changed (34) hide show
  1. package/dist/pages/8.10/AppsPage.d.ts +7 -3
  2. package/dist/pages/8.10/AppsPage.js +166 -49
  3. package/dist/pages/8.10/ClusterDetailsPage.d.ts +2 -0
  4. package/dist/pages/8.10/ClusterDetailsPage.js +49 -2
  5. package/dist/pages/8.10/ClusterSecretsPage.js +5 -1
  6. package/dist/pages/8.10/ConnectorMarketplacePage.d.ts +6 -0
  7. package/dist/pages/8.10/ConnectorMarketplacePage.js +107 -1
  8. package/dist/pages/8.10/ConsoleOrganizationPage.d.ts +3 -2
  9. package/dist/pages/8.10/ConsoleOrganizationPage.js +64 -27
  10. package/dist/pages/8.10/FormJsPage.js +36 -18
  11. package/dist/pages/8.10/IdpCreatePage.js +6 -2
  12. package/dist/pages/8.10/ModelerCreatePage.d.ts +8 -0
  13. package/dist/pages/8.10/ModelerCreatePage.js +316 -40
  14. package/dist/pages/8.10/ModelerHomePage.d.ts +10 -0
  15. package/dist/pages/8.10/ModelerHomePage.js +165 -55
  16. package/dist/pages/8.10/OCIdentityClusterVariablesPage.js +3 -1
  17. package/dist/pages/8.10/OCIdentityHomePage.js +7 -3
  18. package/dist/pages/8.10/OptimizeHomePage.d.ts +0 -1
  19. package/dist/pages/8.10/OptimizeHomePage.js +10 -46
  20. package/dist/pages/8.10/PlayPage.js +9 -3
  21. package/dist/pages/8.10/ProcessApplicationPage.d.ts +1 -0
  22. package/dist/pages/8.10/ProcessApplicationPage.js +128 -6
  23. package/dist/pages/8.10/UtilitiesPage.js +44 -17
  24. package/dist/pages/8.10/WorkspaceMembersPage.d.ts +21 -0
  25. package/dist/pages/8.10/WorkspaceMembersPage.js +264 -0
  26. package/dist/resources/agentic_ai/ai-agent-chat-with-tools_gemini_vertex.bpmn +1 -1
  27. package/dist/tests/8.10/access-user-role-management.spec.js +142 -26
  28. package/dist/tests/8.10/idp-user-flows.spec.js +2 -1
  29. package/dist/tests/8.10/rba-enabled-v2-user-flows.spec.js +13 -4
  30. package/dist/tests/8.10/smoke-tests.spec.js +9 -25
  31. package/dist/tests/8.10/test-setup.spec.js +57 -4
  32. package/dist/tests/8.10/web-modeler-user-flows.spec.js +2 -1
  33. package/package.json +1 -1
  34. package/resources/agentic_ai/ai-agent-chat-with-tools_gemini_vertex.bpmn +1 -1
@@ -6,6 +6,8 @@ const sleep_1 = require("../../utils/sleep");
6
6
  const clickLocatorWithRetry_1 = require("../../utils/assertionHelpers/clickLocatorWithRetry");
7
7
  const randomName_1 = require("../../utils/randomName");
8
8
  const ProcessApplicationPage_1 = require("./ProcessApplicationPage");
9
+ const sessionRecovery_1 = require("../../utils/sessionRecovery");
10
+ const modelerCluster_1 = require("../../utils/modelerCluster");
9
11
  class ModelerHomePage {
10
12
  defaultFolderName = 'Cross Component Test Project';
11
13
  // The default cluster test-setup.spec.ts's "Create Default Cluster" test
@@ -53,6 +55,9 @@ class ModelerHomePage {
53
55
  messageBanner;
54
56
  idpTemplateOption;
55
57
  idpEmptyStateButton;
58
+ idpProjectsTab;
59
+ createIdpProjectButton;
60
+ createActionDropdown;
56
61
  idpApplicationNameInput;
57
62
  createIdpApplicationButton;
58
63
  dialog;
@@ -61,6 +66,11 @@ class ModelerHomePage {
61
66
  blockingDialogDismiss;
62
67
  optionsButton;
63
68
  formNameBreadcrumb;
69
+ formBreadcrumbButton;
70
+ formActionsButton;
71
+ renameFormMenuItem;
72
+ renameInput;
73
+ renameSubmitButton;
64
74
  breadcrumbProjectMenu;
65
75
  renameProjectMenuItem;
66
76
  defaultNamedProjectRow;
@@ -118,7 +128,12 @@ class ModelerHomePage {
118
128
  });
119
129
  this.projectNameInput = page.locator('[data-test="editable-input"]');
120
130
  this.formNameInput = page.locator('[data-test="editable-input"]');
121
- this.idpApplicationNameInput = page.getByPlaceholder('New IDP Application');
131
+ // Hub's workspace projects page renamed IDP applications to "IDP projects"
132
+ // (camunda-hub CreateIdpApplicationModal.common.tsx).
133
+ this.idpApplicationNameInput = page
134
+ .getByPlaceholder('New IDP Application')
135
+ .or(page.getByPlaceholder('New IDP project'))
136
+ .first();
122
137
  this.createIdpApplicationButton = page.getByRole('button', {
123
138
  name: 'Create',
124
139
  exact: true,
@@ -132,7 +147,19 @@ class ModelerHomePage {
132
147
  this.idpEmptyStateButton = page.getByRole('button', {
133
148
  name: 'Create IDP application',
134
149
  });
150
+ // Hub's workspace projects page (camunda-hub WorkspaceProjects.tsx) has no
151
+ // create menu at the root: IDP projects live on their own tab, created
152
+ // through its "Create IDP project" split button (header or empty state).
153
+ this.idpProjectsTab = page.locator('[data-test="tab-idp-applications"]');
154
+ this.createIdpProjectButton = page
155
+ .getByRole('button', { name: 'Create IDP project', exact: true })
156
+ .first();
135
157
  this.diagramTypeDropdown = page.locator('[data-test="diagram-dropdown"]');
158
+ // Hub's design-system create menu (camunda-hub CreateActionDs.tsx), which
159
+ // an empty process application renders instead of the folder explorer's
160
+ // diagram-dropdown. Matched by test id: a "Create new" name also matches
161
+ // other buttons on the page.
162
+ this.createActionDropdown = page.locator('[data-test="create-action-dropdown"]');
136
163
  // Matched on the test id alone: hub's design-system variant of the create
137
164
  // menu renders "BPMN diagram" (lowercase d), so a text filter breaks the
138
165
  // day that variant ships.
@@ -200,9 +227,31 @@ class ModelerHomePage {
200
227
  .getByRole('button', { name: /^(Got it|Close|Dismiss)/i })
201
228
  .first();
202
229
  this.optionsButton = page.getByRole('button', { name: 'Options' });
203
- this.formNameBreadcrumb = (formName) => page.locator('button[data-test="breadcrumb-form"]', {
230
+ // The legacy breadcrumb shows the name directly; Hub's newer nav
231
+ // (isNavV2) embeds it in the current crumb's kebab ("<name> actions").
232
+ this.formNameBreadcrumb = (formName) => page
233
+ .locator('button[data-test="breadcrumb-form"]', {
204
234
  hasText: formName,
205
- });
235
+ })
236
+ .or(page.getByRole('button', { name: `${formName} actions` }))
237
+ .first();
238
+ this.formBreadcrumbButton = page.locator('button[data-test="breadcrumb-form"]');
239
+ // Nav-v2 moves Rename/Duplicate/Delete behind a kebab next to the current
240
+ // (last) crumb (camunda-hub use-file-page-actions.ts); same locator as
241
+ // camunda-hub's own e2e BasePage.breadcrumbActionsButton.
242
+ this.formActionsButton = page
243
+ .getByRole('navigation', { name: 'Context navigation' })
244
+ .or(page.getByRole('navigation', { name: 'Breadcrumb', exact: true }))
245
+ .getByRole('button', { name: / actions$/ })
246
+ .last();
247
+ this.renameFormMenuItem = page
248
+ .locator('[data-test="rename-form"]')
249
+ .or(page.getByRole('menuitem', { name: 'Rename', exact: true }))
250
+ .first();
251
+ // Nav-v2's Rename opens a modal dialog (camunda-hub RenameDialogDs.tsx)
252
+ // instead of the legacy inline breadcrumb editor.
253
+ this.renameInput = page.locator('[data-test="rename-input"]');
254
+ this.renameSubmitButton = page.locator('[data-test="rename-submit"]');
206
255
  this.breadcrumbProjectMenu = page.locator('[data-test="breadcrumb-project-menu"]');
207
256
  this.renameProjectMenuItem = page.locator('[data-test="rename-project"]');
208
257
  // EntityTable stamps `entity-<row id>` on the row, and on the projects list
@@ -363,7 +412,10 @@ class ModelerHomePage {
363
412
  // unchanged, which is why the existing spec call sites need no edit.
364
413
  async clickDiagramTypeDropdown() {
365
414
  await this.enterResourceContainer();
366
- const dropdown = this.processApplicationPage.createNewDropdown;
415
+ const dropdown = this.processApplicationPage.folderExplorer
416
+ .locator('[data-test="diagram-dropdown"]')
417
+ .or(this.createActionDropdown)
418
+ .first();
367
419
  // Navigation-class wait: the dropdown's render waits on the container's
368
420
  // resource list, so a slow load otherwise fails with
369
421
  // `element(s) not found`.
@@ -374,10 +426,13 @@ class ModelerHomePage {
374
426
  // applications and IDP applications can be created. Everything else has to
375
427
  // go through clickDiagramTypeDropdown().
376
428
  async clickWorkspaceDiagramTypeDropdown() {
377
- await (0, test_1.expect)(this.diagramTypeDropdown).toBeVisible({
429
+ const dropdown = this.diagramTypeDropdown
430
+ .or(this.createActionDropdown)
431
+ .first();
432
+ await (0, test_1.expect)(dropdown).toBeVisible({
378
433
  timeout: 60000,
379
434
  });
380
- await this.diagramTypeDropdown.click();
435
+ await dropdown.click();
381
436
  }
382
437
  // The click landing is not proof the diagram was created: hub creates the
383
438
  // resource and then navigates, so a create that fails server-side leaves the
@@ -410,37 +465,67 @@ class ModelerHomePage {
410
465
  async clickFormOption() {
411
466
  await this.formTemplateOption.click();
412
467
  }
468
+ // The legacy shell opens a fresh form with its breadcrumb name in inline-edit
469
+ // mode. Nav-v2 has no inline editing: the form stays "New form" until renamed
470
+ // through the crumb's "<name> actions" kebab and the shared rename dialog.
471
+ // Retried as a unit, and confirmed on the crumb, because a re-render
472
+ // (post-create refetch, form store load) can drop the editor mid-fill.
413
473
  async enterFormName(name) {
414
- await this.formNameInput.click({ timeout: 60000 });
415
- await this.formNameInput.fill(name);
416
- await this.formNameInput.press('Enter');
417
- }
418
- // Re-enters the name until the breadcrumb reflects it. Web Modeler mounts
419
- // the inline name field as soon as the form editor opens, before it is wired
420
- // to the rename mutation, so a fill that lands in that window is silently
421
- // discarded: the form keeps its default "New form" name and the breadcrumb
422
- // never shows the requested one. Nothing retried that, so a single lost
423
- // keystroke made the caller's `assertFormBreadcrumbVisible` wait out its
424
- // whole 120s on a form that was never going to be renamed
425
- // (`button[data-test="breadcrumb-form"] ... element(s) not found`). Verifying
426
- // with a short per-attempt budget turns that into one cheap retry. The
427
- // caller's assertion stays the authority: this returns after the last
428
- // attempt rather than throwing, so the failure is still reported by the
429
- // assertion and not by a helper.
430
- async enterFormNameWithRetry(name) {
431
- const maxRetries = 3;
432
- for (let attempt = 1; attempt <= maxRetries; attempt++) {
433
- await this.enterFormName(name);
434
- const renamed = await this.formNameBreadcrumb(name)
435
- .waitFor({ state: 'visible', timeout: 30000 })
436
- .then(() => true)
437
- .catch(() => false);
438
- if (renamed) {
474
+ const maxAttempts = 3;
475
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
476
+ try {
477
+ if (await this.formNameBreadcrumb(name).isVisible()) {
478
+ return;
479
+ }
480
+ const editorOpen = await this.becameVisible(this.formNameInput.or(this.renameInput).first(), 15000);
481
+ if (!editorOpen) {
482
+ await this.openFormRenameEditor();
483
+ }
484
+ if (await this.renameInput.isVisible().catch(() => false)) {
485
+ await this.renameInput.fill(name, { timeout: 30000 });
486
+ await (0, test_1.expect)(this.renameInput).toHaveValue(name, { timeout: 5000 });
487
+ await this.renameSubmitButton.click({ timeout: 10000 });
488
+ await (0, test_1.expect)(this.renameInput).toBeHidden({ timeout: 30000 });
489
+ }
490
+ else {
491
+ await this.formNameInput.click({ timeout: 30000 });
492
+ await this.formNameInput.fill(name);
493
+ await this.formNameInput.press('Enter');
494
+ }
495
+ await (0, test_1.expect)(this.formNameBreadcrumb(name)).toBeVisible({
496
+ timeout: 30000,
497
+ });
439
498
  return;
440
499
  }
441
- console.warn(`Form rename to "${name}" has not reached the breadcrumb ` +
442
- `(attempt ${attempt}/${maxRetries}). Re-entering the name.`);
500
+ catch (error) {
501
+ if (attempt === maxAttempts) {
502
+ throw error;
503
+ }
504
+ console.warn(`Form rename to "${name}" did not commit ` +
505
+ `(attempt ${attempt}/${maxAttempts}): ${error}`);
506
+ }
507
+ }
508
+ }
509
+ async openFormRenameEditor() {
510
+ await (0, test_1.expect)(this.formBreadcrumbButton.or(this.formActionsButton).first()).toBeVisible({ timeout: 60000 });
511
+ if (await this.formActionsButton.isVisible().catch(() => false)) {
512
+ // Until the new form has loaded, nav-v2 keeps showing the previous
513
+ // page's crumbs (camunda-hub NavProvider), so the last kebab can still
514
+ // belong to the parent container. A fresh form is named "New form";
515
+ // wait for its own crumb before renaming anything.
516
+ await (0, test_1.expect)(this.formActionsButton).toHaveAccessibleName('New form actions', { timeout: 60000 });
517
+ await this.formActionsButton.click({ timeout: 30000 });
518
+ }
519
+ else {
520
+ await this.formBreadcrumbButton.click({ timeout: 60000 });
443
521
  }
522
+ await this.renameFormMenuItem.click({ timeout: 30000 });
523
+ }
524
+ // Kept for the smoke spec's call site. enterFormName() now retries and
525
+ // confirms the rename on the breadcrumb itself, so a second retry layer here
526
+ // would only multiply its budget past the test timeout.
527
+ async enterFormNameWithRetry(name) {
528
+ await this.enterFormName(name);
444
529
  }
445
530
  // Kept under its original name because it is what the existing call sites
446
531
  // already mean: "go back to where my resources live". That is now the
@@ -579,29 +664,37 @@ class ModelerHomePage {
579
664
  await this.clickWorkspaceBreadcrumb();
580
665
  return;
581
666
  }
582
- await this.page.goto(this.processApplicationUrl, {
583
- waitUntil: 'domcontentloaded',
584
- });
585
- // Up to two reloads before spending the whole budget: processApplicationStore
586
- // .init() swallows a failed fetch (it only toasts "Yikes! Couldn't
587
- // retrieve your project" and clears its loading flag), so a transient 5xx
588
- // leaves a fully rendered page that simply has no process-application
589
- // breadcrumb -- waiting the full 90s on it can only ever time out, and
590
- // re-running the store init is the only thing that brings it back. A
591
- // single reload can itself land on a second transient failure (seen in
592
- // run 35340608406), so retry the reload once more before falling through
593
- // to the full-budget wait below.
594
- const maxReloadAttempts = 2;
595
- let backInside = false;
596
- for (let attempt = 0; attempt < maxReloadAttempts && !backInside; attempt++) {
597
- backInside = await this.becameVisible(this.processApplicationPage.breadcrumb, 45000);
598
- if (!backInside) {
599
- await this.page.reload({ waitUntil: 'domcontentloaded' });
667
+ // Every goto re-runs Hub's Auth0 hand-off, and CI runs show it stalling on
668
+ // /login-callback. Its code is single-use, so recover with a fresh goto,
669
+ // never a reload; any other failure still throws.
670
+ for (let attempt = 1;; attempt++) {
671
+ await this.page.goto(this.processApplicationUrl, {
672
+ waitUntil: 'domcontentloaded',
673
+ });
674
+ try {
675
+ await this.processApplicationPage.waitForProcessApplication(attempt === 1 ? 90000 : 150000);
676
+ break;
677
+ }
678
+ catch (error) {
679
+ const stalledInLogin = (await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page)) ||
680
+ this.isOnHubLoginRoute();
681
+ if (attempt === 2 || !stalledInLogin) {
682
+ throw error;
683
+ }
684
+ console.warn(`Hub's login hand-off stalled at ${this.page.url()}; ` +
685
+ 're-entering the process application.');
600
686
  }
601
687
  }
602
- await this.processApplicationPage.waitForProcessApplication();
603
688
  await this.dismissBlockingDialog();
604
689
  }
690
+ // Hub's own /login and /login-callback routes render only a spinner
691
+ // (camunda-hub App.tsx); the identity provider's pages are not these.
692
+ isOnHubLoginRoute() {
693
+ if ((0, sessionRecovery_1.isAtIdentityProvider)(this.page)) {
694
+ return false;
695
+ }
696
+ return /^\/login(-callback)?\/?$/.test(new URL(this.page.url()).pathname);
697
+ }
605
698
  // Single seam for "give me an empty BPMN diagram in this test's container".
606
699
  // A process application always ships an auto-created main process; this adds
607
700
  // a new diagram rather than adopting that one, so every existing modelling
@@ -1002,6 +1095,13 @@ class ModelerHomePage {
1002
1095
  async selectCluster(clusterName) {
1003
1096
  //Select the correct cluster if multiple exist
1004
1097
  const baseClusterName = clusterName.split('(')[0].trim();
1098
+ // With Hub's Environments feature on (camunda-hub#29210) the IDP create
1099
+ // dialog picks an Environment row instead of a cluster toggle.
1100
+ const hasEnvironmentRow = await this.becameVisible(this.dialog.locator('[data-test^="environment-row-"]').first(), 10000);
1101
+ if (hasEnvironmentRow) {
1102
+ await (0, modelerCluster_1.selectDeployEnvironment)(this.dialog, baseClusterName);
1103
+ return;
1104
+ }
1005
1105
  const cluster = this.dialog.getByText(new RegExp(`^${baseClusterName}`));
1006
1106
  await (0, test_1.expect)(cluster).toBeVisible({
1007
1107
  timeout: 30000,
@@ -1023,13 +1123,23 @@ class ModelerHomePage {
1023
1123
  // clickCreateProcessApplication has to straddle). A workspace whose very
1024
1124
  // first resource is the IDP application only ever offers the empty state's
1025
1125
  // "Create IDP application" button, so waiting for the create menu there
1026
- // times out on `[data-test="diagram-dropdown"]`. Race both entry points,
1027
- // then use whichever one rendered.
1126
+ // times out on `[data-test="diagram-dropdown"]`. Hub's workspace projects
1127
+ // page has neither: IDP projects are created from their own tab. Race all
1128
+ // entry points, then use whichever one rendered.
1028
1129
  async startIdpApplicationCreation() {
1029
- const rootLoaded = await this.becameVisible(this.idpEmptyStateButton.or(this.diagramTypeDropdown).first(), 60000);
1130
+ const rootLoaded = await this.becameVisible(this.idpEmptyStateButton
1131
+ .or(this.diagramTypeDropdown)
1132
+ .or(this.idpProjectsTab)
1133
+ .first(), 60000);
1030
1134
  if (!rootLoaded) {
1031
1135
  await this.page.reload();
1032
1136
  }
1137
+ if (await this.becameVisible(this.idpProjectsTab, 5000)) {
1138
+ await this.idpProjectsTab.click({ timeout: 30000 });
1139
+ await (0, test_1.expect)(this.createIdpProjectButton).toBeVisible({ timeout: 60000 });
1140
+ await this.createIdpProjectButton.click({ timeout: 30000 });
1141
+ return;
1142
+ }
1033
1143
  if (await this.becameVisible(this.idpEmptyStateButton, 5000)) {
1034
1144
  await this.idpEmptyStateButton.click({ timeout: 60000 });
1035
1145
  return;
@@ -104,7 +104,9 @@ class OCIdentityClusterVariablesPage {
104
104
  }
105
105
  }
106
106
  await this.saveVariableButton.click();
107
- await (0, test_1.expect)(this.successMessage).toBeVisible();
107
+ // The toast is only enqueued once the update mutation resolves, which on
108
+ // SaaS regularly takes longer than the default 5s expect timeout.
109
+ await (0, test_1.expect)(this.successMessage).toBeVisible({ timeout: 30000 });
108
110
  await (0, test_1.expect)(this.editVariableModal).toBeHidden();
109
111
  }
110
112
  async assertVariableExists(variableName) {
@@ -20,9 +20,13 @@ class OCIdentityHomePage {
20
20
  // the header off the old Carbon shell: its logo link now carries the static
21
21
  // aria-label "Camunda Admin" (AppHeaderV2 in camunda/camunda's
22
22
  // identity/client), replacing the old "Camunda logo Admin" accessible name.
23
- this.adminBanner = page.getByRole('link', {
24
- name: 'Camunda Admin',
25
- });
23
+ // AppHeader still falls back to LegacyAppHeader while
24
+ // isNewDesignSystemEnabled is off, so accept both, as
25
+ // pages/SM-8.10/OCIdentityHomePage.ts does.
26
+ this.adminBanner = page
27
+ .getByRole('link', { name: 'Camunda Admin', exact: true })
28
+ .or(page.getByRole('link', { name: 'Camunda logo Admin', exact: true }))
29
+ .first();
26
30
  // The same redesign that renamed the logo link moved the nav out of the
27
31
  // header: AppHeaderV2 renders an AppSidebar, a <nav aria-label="Main
28
32
  // navigation">, so nothing is left under the old
@@ -9,7 +9,6 @@ declare class OptimizeHomePage {
9
9
  readonly filterTableInput: Locator;
10
10
  constructor(page: Page);
11
11
  private waitForOptimizeToRender;
12
- private filterTableToProcess;
13
12
  closeModalIfVisible(): Promise<void>;
14
13
  assertProcessImportedWithRetry(processName: string, timeout: number, maxRetries?: number): Promise<void>;
15
14
  clickCollectionsLink(): Promise<void>;
@@ -31,12 +31,8 @@ class OptimizeHomePage {
31
31
  filterTableInput;
32
32
  constructor(page) {
33
33
  this.page = page;
34
- // Optimize's Design System EntityList replaced the Carbon table toolbar
35
- // search (placeholder "Filter table") with a plain input whose placeholder
36
- // is the `home.search.name` translation, "Search for name...". Matching on
37
- // the old placeholder resolved to nothing, so `filterTableToProcess` below
38
- // silently fell through and every polling round asserted against the
39
- // unfiltered — and now paginated — definition table.
34
+ // Optimize's Design System EntityList search; its placeholder is the
35
+ // `home.search.name` translation, "Search for name...".
40
36
  this.filterTableInput = page.getByPlaceholder(/Search for name/i);
41
37
  // The same navigation rollout moved Dashboards/Collections out of the top
42
38
  // banner into a left sidebar (`<nav aria-label="Main navigation">`), and
@@ -56,30 +52,10 @@ class OptimizeHomePage {
56
52
  .or(page.getByRole('link', { name: 'Camunda Optimize' }));
57
53
  this.noPermissionsMessage = page.getByText('default backend - 404');
58
54
  }
59
- // The Optimize process overview renders a bounded slice of the definition
60
- // table, so on an org that already holds the definitions every sibling spec
61
- // deployed that night a freshly imported one can sit outside the rendered
62
- // rows entirely: `getByRole('link', {name})` then never becomes visible no
63
- // matter how long the loop below waits, which is exactly what reported
64
- // "Assertion of process <name> in Optimize failed after 1200000ms of
65
- // polling" from the app root — a full 20 minutes of reload-polling for a
66
- // definition that had long since been imported. Narrowing the table to the
67
- // name being waited for is what `OptimizeDashboardPage.processLinkAssertion`
68
- // already does before this identical link assertion.
69
- // Best effort by design: when the input is not rendered (the app is still
70
- // coming up, or a round landed on a page without the table) the round falls
71
- // through and asserts against the unfiltered table exactly as before.
72
- // Every probe a polling round makes runs immediately after that round's
73
- // `reload()` + `waitForLoadState('domcontentloaded')`, which returns while
74
- // the Optimize SPA is still mounting and the document is effectively empty.
75
- // `isVisible()` answers instantly, so both probes below — the onboarding
76
- // modal and the table filter — answered "not there" on essentially every
77
- // round: the modal was never dismissed and the table was never narrowed, and
78
- // the round then spent its whole slice asserting against a list that had not
79
- // rendered. Waiting for the app shell first is what makes the rest of the
80
- // round mean anything. It costs nothing once Optimize is up (the wait
81
- // resolves in milliseconds) and is bounded, so a round that lands on a page
82
- // which never renders Optimize still falls through and reloads as before.
55
+ // Every round's reload returns while the Optimize SPA is still mounting,
56
+ // so probes that answer at once (the onboarding modal) only mean something
57
+ // after the app shell has rendered. Bounded, so a page that never renders
58
+ // Optimize still falls through and reloads.
83
59
  async waitForOptimizeToRender(timeout) {
84
60
  await this.filterTableInput
85
61
  .or(this.optimizeBanner)
@@ -87,21 +63,6 @@ class OptimizeHomePage {
87
63
  .waitFor({ state: 'visible', timeout })
88
64
  .catch(() => { });
89
65
  }
90
- async filterTableToProcess(processName) {
91
- const hasFilter = await this.filterTableInput
92
- .isVisible()
93
- .catch(() => false);
94
- if (!hasFilter) {
95
- return;
96
- }
97
- try {
98
- await this.filterTableInput.fill(processName, { timeout: 15000 });
99
- await this.filterTableInput.press('Enter');
100
- }
101
- catch (error) {
102
- console.warn(`Could not filter the Optimize process table: ${error}`);
103
- }
104
- }
105
66
  async closeModalIfVisible() {
106
67
  if (await this.modalCloseButton.isVisible()) {
107
68
  await this.modalCloseButton.click({ timeout: 60000 });
@@ -135,7 +96,10 @@ class OptimizeHomePage {
135
96
  try {
136
97
  await this.waitForOptimizeToRender(Math.min(checkSlice, remaining));
137
98
  await this.closeModalIfVisible();
138
- await this.filterTableToProcess(processName);
99
+ // No "Search for name" filtering here: on this page it narrows the
100
+ // entity list and the process link never renders once it is applied.
101
+ // The one round that passed was one where the input had not rendered
102
+ // yet, and 8.9's passing smoke asserts on the unfiltered page.
139
103
  await (0, test_1.expect)(processLink).toBeVisible({
140
104
  timeout: Math.min(checkSlice, remaining),
141
105
  });
@@ -12,9 +12,15 @@ class PlayPage {
12
12
  startInstanceOverlayButton;
13
13
  constructor(page) {
14
14
  this.page = page;
15
- this.completeJobButton = page
16
- .getByTestId('diagram')
17
- .getByLabel('Complete job');
15
+ // Hub's Test Studio renders this control as a button with a
16
+ // "<elementId>-Complete job" test id and no aria-label, so getByLabel()
17
+ // cannot see it; keep getByLabel for the older overlay.
18
+ const diagram = page.getByTestId('diagram');
19
+ this.completeJobButton = diagram
20
+ .getByLabel('Complete job')
21
+ .or(diagram.getByRole('button', { name: 'Complete job' }))
22
+ .or(diagram.getByTestId(/-Complete job$/))
23
+ .first();
18
24
  // Newer Modeler Play UI: the "Configure Scenario" floating card hosts a
19
25
  // primary "Start" Carbon button (variants: "Start", "Start with
20
26
  // variables", "Start with a form"). Source:
@@ -24,6 +24,7 @@ declare class ProcessApplicationPage {
24
24
  rememberResourceContainer(url: string): void;
25
25
  forgetStageCluster(): void;
26
26
  ensureStageCluster(clusterName: string): Promise<boolean>;
27
+ private ensureWorkspaceEnvironment;
27
28
  private openStageDefinition;
28
29
  openByNameIfPresent(name: string, timeout?: number): Promise<boolean>;
29
30
  openByName(name: string): Promise<void>;
@@ -95,13 +95,23 @@ class ProcessApplicationPage {
95
95
  name: 'Cancel',
96
96
  exact: true,
97
97
  });
98
- this.breadcrumb = page.locator('[data-test="breadcrumb-process-application-menu"]');
98
+ // The Hub project detail renders a title-bar hook instead of the
99
+ // process-application breadcrumb menu; either proves we are inside.
100
+ this.breadcrumb = page
101
+ .locator('[data-test="breadcrumb-process-application-menu"]')
102
+ .or(page.locator('[data-test="process-application-title-bar"]'))
103
+ .first();
99
104
  this.folderExplorer = page.getByRole('region', { name: 'Folder explorer' });
100
105
  // The process application page renders more than one diagram-dropdown
101
106
  // (hub's own unit tests reach for it with getAllByTestId), so the dropdown
102
107
  // has to be resolved inside the folder explorer rather than page-wide.
108
+ // A freshly-created, empty process application collapses the folder
109
+ // explorer and offers only a centred "Create new" empty-state button
110
+ // instead, so accept that as a fallback (the folder-explorer dropdown wins
111
+ // once the project has content).
103
112
  this.createNewDropdown = this.folderExplorer
104
113
  .locator('[data-test="diagram-dropdown"]')
114
+ .or(page.locator('[data-test="create-action-dropdown"]'))
105
115
  .first();
106
116
  this.inlineNameInput = page.locator('[data-test="editable-input"]');
107
117
  this.defineStagesDialog = page
@@ -124,7 +134,11 @@ class ProcessApplicationPage {
124
134
  // container's `[data-test="diagram-dropdown"]` create menu does not exist --
125
135
  // surfacing 60s later as `element(s) not found` on an unrelated step.
126
136
  pageReady() {
127
- return this.breadcrumb;
137
+ // Accept the Folder explorer region as well as the breadcrumb: under the
138
+ // current Hub Web Modeler the process-application breadcrumb menu no longer
139
+ // renders, but the Folder explorer does, so requiring the breadcrumb alone
140
+ // times out on every process-application flow. Mirrors 8.8/8.9.
141
+ return this.folderExplorer.or(this.breadcrumb).first();
128
142
  }
129
143
  async waitForProcessApplication(timeout = 90000) {
130
144
  await (0, test_1.expect)(this.pageReady()).toBeVisible({ timeout });
@@ -267,16 +281,124 @@ class ProcessApplicationPage {
267
281
  if (!container || container.developmentCluster === clusterName) {
268
282
  return false;
269
283
  }
284
+ // A caller that just reloaded can still be on Hub's /login-callback. Its
285
+ // code is single use, so returning to that URL afterwards would land on
286
+ // the Auth0 login page. Let Hub finish the exchange first.
287
+ if (this.page.url().includes('/login-callback')) {
288
+ await this.page.waitForURL((url) => !url.pathname.startsWith('/login-callback'), { timeout: 120000 });
289
+ }
270
290
  const returnTo = this.page.url();
271
291
  const paUrl = container.url.replace(/[?#].*$/, '').replace(/\/$/, '');
272
- const deepLink = `${paUrl}/connected-clusters`;
273
- await this.page.goto(deepLink, { waitUntil: 'domcontentloaded' });
274
- await this.openStageDefinition(deepLink);
275
- await this.defineDevelopmentStage(clusterName);
292
+ // Under Hub workspaces (/workspaces/<ws>/projects/<id>) there is no
293
+ // /connected-clusters route -- it renders "No match for the current
294
+ // location". With Hub's Environments feature on (camunda-hub#29210) the
295
+ // deploy dialog offers the environments assigned to the parent workspace,
296
+ // so the binding is made there. Ported from pages/8.9.
297
+ const workspaceId = paUrl.match(/\/workspaces\/([^/]+)\/projects\//)?.[1];
298
+ if (workspaceId) {
299
+ await (0, test_1.expect)(async () => {
300
+ await this.ensureWorkspaceEnvironment(paUrl, workspaceId, clusterName);
301
+ }).toPass({ timeout: 240000, intervals: [1000, 2000, 5000] });
302
+ }
303
+ else {
304
+ const deepLink = `${paUrl}/connected-clusters`;
305
+ await this.page.goto(deepLink, { waitUntil: 'domcontentloaded' });
306
+ await this.openStageDefinition(deepLink);
307
+ await this.defineDevelopmentStage(clusterName);
308
+ }
276
309
  container.developmentCluster = clusterName;
277
310
  await this.page.goto(returnTo, { waitUntil: 'domcontentloaded' });
311
+ // A full navigation on Hub bounces through /login and /login-callback
312
+ // before it lands back on returnTo, and goto() resolves on the first
313
+ // document.
314
+ await this.page.waitForURL((url) => !/^\/login(-callback)?\/?$/.test(url.pathname), { timeout: 120000 });
278
315
  return true;
279
316
  }
317
+ // Assigns the Environment backed by clusterName to the workspace, from
318
+ // workspace management's Environments tab (camunda-hub
319
+ // WorkspaceEnvironmentsTab). Without the Environments feature the project
320
+ // page still carries the Connected clusters card, whose "Configure" button
321
+ // opens the Define stages dialog -- that path is taken instead.
322
+ //
323
+ // Save replaces the workspace's whole assignment with the picker's
324
+ // selection, and parallel workers share this workspace, so only this
325
+ // cluster's toggle is touched and the result re-read afterwards.
326
+ async ensureWorkspaceEnvironment(paUrl, workspaceId, clusterName) {
327
+ await this.page.goto(paUrl, { waitUntil: 'domcontentloaded' });
328
+ await this.waitForProcessApplication();
329
+ const configure = this.page.getByRole('button', {
330
+ name: 'Configure',
331
+ exact: true,
332
+ });
333
+ const configureAppeared = await configure
334
+ .waitFor({ state: 'visible', timeout: 10000 })
335
+ .then(() => true)
336
+ .catch(() => false);
337
+ if (configureAppeared) {
338
+ await configure.click({ timeout: 30000 });
339
+ await this.defineDevelopmentStage(clusterName);
340
+ return;
341
+ }
342
+ const manageUrl = `${new URL(paUrl).origin}/workspaces/${workspaceId}/manage?tab=environments`;
343
+ await this.page.goto(manageUrl, { waitUntil: 'domcontentloaded' });
344
+ const heading = this.page.locator('[data-test="manage-environments-heading"]');
345
+ // Hub only offers the Environments tab to users with an elevated or
346
+ // DevOps org role (camunda-hub WorkspaceManageBody, #28955) and rewrites
347
+ // `?tab=environments` to `?tab=members` for everyone else. Such a user
348
+ // cannot assign anything here; the spec's elevated user has to have done
349
+ // it already, and the deploy dialog's selectDeployEnvironment reports a
350
+ // precise "not assigned" error otherwise.
351
+ const onMembersTab = () => new URL(this.page.url()).searchParams.get('tab') === 'members';
352
+ await (0, test_1.expect)(async () => {
353
+ if (!onMembersTab()) {
354
+ await (0, test_1.expect)(heading).toBeVisible({ timeout: 2000 });
355
+ }
356
+ }).toPass({ timeout: 60000 });
357
+ if (onMembersTab()) {
358
+ console.log(`The workspace Environments tab is not available to this user; ` +
359
+ `relying on "${clusterName}" having been assigned by an elevated user`);
360
+ return;
361
+ }
362
+ const editButton = this.page.locator('[data-test="edit-environments-button"]');
363
+ await (0, test_1.expect)(editButton).toBeEnabled({ timeout: 60000 });
364
+ await editButton.click({ timeout: 30000 });
365
+ const editor = this.page.getByRole('group', {
366
+ name: 'Edit assigned environments',
367
+ });
368
+ await (0, test_1.expect)(editor).toBeVisible({ timeout: 30000 });
369
+ const search = editor.locator('[data-test="picker-search"]');
370
+ if (await search.isVisible().catch(() => false)) {
371
+ await search.fill(clusterName);
372
+ }
373
+ // Picker card toggles are named "Select <environment> (<cluster>)" and
374
+ // flip to "Selected ..." with aria-pressed once picked.
375
+ const escapedClusterName = clusterName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
376
+ const toggle = editor
377
+ .locator('[data-test="picker-environment"]')
378
+ .getByRole('button', {
379
+ name: new RegExp(`^Select(ed)? .*\\(${escapedClusterName}\\)$`),
380
+ })
381
+ .first();
382
+ await (0, test_1.expect)(toggle).toBeVisible({ timeout: 60000 });
383
+ if ((await toggle.getAttribute('aria-pressed')) === 'true') {
384
+ await this.page
385
+ .getByRole('button', { name: 'Cancel', exact: true })
386
+ .click({ timeout: 30000 });
387
+ await (0, test_1.expect)(editor).toBeHidden({ timeout: 30000 });
388
+ return;
389
+ }
390
+ await toggle.click({ timeout: 30000 });
391
+ await (0, test_1.expect)(toggle).toHaveAttribute('aria-pressed', 'true');
392
+ await this.page
393
+ .getByRole('button', { name: 'Save', exact: true })
394
+ .click({ timeout: 30000 });
395
+ await (0, test_1.expect)(editor).toBeHidden({ timeout: 60000 });
396
+ await (0, test_1.expect)(this.page
397
+ .getByRole('list', { name: 'Assigned environments' })
398
+ .getByRole('listitem')
399
+ .filter({ hasText: clusterName })
400
+ .first()).toBeVisible({ timeout: 60000 });
401
+ }
280
402
  // The /connected-clusters deep link opens the Define stages dialog by itself
281
403
  // while the application has no stage bound. Once one is bound -- a test that
282
404
  // deploys to a second cluster -- it has to be reopened from the page, so try