@camunda/e2e-test-suite 0.0.1543 → 0.0.1545

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,6 +4,7 @@ import { ClientCredentialsDetailsPage } from './ClientCredentialsDetailsPage';
4
4
  declare class ClusterDetailsPage {
5
5
  private page;
6
6
  private pendingClientScopeCheck;
7
+ private clusterDetailsUrl;
7
8
  readonly apiTab: Locator;
8
9
  readonly createFirstClientButton: Locator;
9
10
  readonly clientNameTextbox: Locator;
@@ -24,7 +25,13 @@ declare class ClusterDetailsPage {
24
25
  readonly clientCredentialsDialog: Locator;
25
26
  readonly clustersLink: Locator;
26
27
  readonly alertsTab: Locator;
28
+ readonly alertsTabPanel: Locator;
27
29
  readonly alertsList: Locator;
30
+ readonly alertExpandRowButtons: Locator;
31
+ readonly alertRowActionsButtons: Locator;
32
+ readonly deleteAlertMenuItem: Locator;
33
+ readonly deleteAlertConfirmButton: Locator;
34
+ readonly alertsPanel: Locator;
28
35
  readonly createFirstAlertButton: Locator;
29
36
  readonly createNewAlertButton: Locator;
30
37
  readonly emailRadioButton: Locator;
@@ -74,6 +81,7 @@ declare class ClusterDetailsPage {
74
81
  searchAndClickClientCredentialsLink(name: string): Promise<ClientCredentialsDetailsPage>;
75
82
  deleteAPIClientsIfExist(name?: string): Promise<void>;
76
83
  clickAlertsTab(): Promise<void>;
84
+ reopenAlertsTab(): Promise<void>;
77
85
  clickExpandButton(): Promise<void>;
78
86
  clickCreateFirstAlertButton(): Promise<void>;
79
87
  clickCreateNewAlertButton(): Promise<void>;
@@ -81,6 +89,7 @@ declare class ClusterDetailsPage {
81
89
  selectEmailRadioButton(): Promise<void>;
82
90
  clickCreateAlertButton(): Promise<void>;
83
91
  deleteAlerts(): Promise<void>;
92
+ expandAlerts(): Promise<void>;
84
93
  private doDelete;
85
94
  assertComponentsHealth(components?: string[], recoverSession?: () => Promise<void>): Promise<void>;
86
95
  private isSessionLost;
@@ -6,11 +6,17 @@ const sleep_1 = require("../../utils/sleep");
6
6
  const clickLocatorWithRetry_1 = require("../../utils/assertionHelpers/clickLocatorWithRetry");
7
7
  const expectLocatorWithRetry_1 = require("../../utils/assertionHelpers/expectLocatorWithRetry");
8
8
  const ClientCredentialsDetailsPage_1 = require("./ClientCredentialsDetailsPage");
9
+ const sessionRecovery_1 = require("../../utils/sessionRecovery");
10
+ // Hub's own /login and /login-callback routes, which render only a spinner
11
+ // while the Auth0 hand-off of a full page load is in flight.
12
+ const HUB_LOGIN_ROUTE = /^\/login(-callback)?\/?$/;
9
13
  class ClusterDetailsPage {
10
14
  page;
11
15
  // Name of a client whose scopes still have to be checked against the
12
16
  // clients list — see createAPIClient() / clickCloseModalButton().
13
17
  pendingClientScopeCheck = null;
18
+ // The cluster page reopenAlertsTab() goes back to -- see there.
19
+ clusterDetailsUrl;
14
20
  apiTab;
15
21
  createFirstClientButton;
16
22
  clientNameTextbox;
@@ -31,7 +37,13 @@ class ClusterDetailsPage {
31
37
  clientCredentialsDialog;
32
38
  clustersLink;
33
39
  alertsTab;
40
+ alertsTabPanel;
34
41
  alertsList;
42
+ alertExpandRowButtons;
43
+ alertRowActionsButtons;
44
+ deleteAlertMenuItem;
45
+ deleteAlertConfirmButton;
46
+ alertsPanel;
35
47
  createFirstAlertButton;
36
48
  createNewAlertButton;
37
49
  emailRadioButton;
@@ -115,15 +127,43 @@ class ClusterDetailsPage {
115
127
  .getByRole('banner')
116
128
  .getByRole('link', { name: 'Clusters' });
117
129
  this.alertsTab = page.getByRole('tab', { name: 'Alerts' });
118
- this.alertsList = page
130
+ // Only the selected tab's panel is exposed (the design-system tabs unmount
131
+ // the others, Carbon marks them hidden), and it is named after its tab.
132
+ // Page-wide, getByRole('row') read the Overview "Cluster Details" rows
133
+ // whenever Overview was showing -- the nightly's `Received string:
134
+ // "NameAlert Flow Cluster"` where the Email alert row was expected.
135
+ this.alertsTabPanel = page.getByRole('tabpanel', { name: 'Alerts' });
136
+ this.alertsList = this.alertsTabPanel
119
137
  .getByRole('row')
120
138
  .filter({ hasNotText: 'Delivery method' }); //Filter out header row
139
+ // Hub's Alerts tab is a design-system data table: one summary row per
140
+ // alert (Delivery method / Created at / Created by), with the detail
141
+ // fields in a sibling expansion row that only exists once the row's
142
+ // "Expand row" toggle is clicked, and Delete behind the row's "Row
143
+ // actions" kebab -> "Delete" -> "Delete alert" dialog (camunda-hub e2e
144
+ // ConsoleClusterDetailsPage). Scoped to the visible tab panel.
145
+ this.alertExpandRowButtons = page
146
+ .getByRole('tabpanel')
147
+ .getByRole('button', { name: 'Expand row', exact: true });
148
+ this.alertRowActionsButtons = page
149
+ .getByRole('tabpanel')
150
+ .getByRole('button', { name: 'Row actions', exact: true });
151
+ this.deleteAlertMenuItem = page.getByRole('menuitem', {
152
+ name: 'Delete',
153
+ exact: true,
154
+ });
155
+ this.deleteAlertConfirmButton = page
156
+ .getByRole('dialog', { name: 'Delete alert' })
157
+ .getByRole('button', { name: 'Delete', exact: true });
121
158
  this.createFirstAlertButton = page.getByRole('button', {
122
159
  name: 'Create an alert',
123
160
  });
124
161
  this.createNewAlertButton = page.getByRole('button', {
125
162
  name: 'Create new alert',
126
163
  });
164
+ // The Alerts panel offers "Create an alert" while empty and "Create new
165
+ // alert" once it holds one, so either proves the panel itself mounted.
166
+ this.alertsPanel = this.createFirstAlertButton.or(this.createNewAlertButton);
127
167
  this.emailRadioButton = page.getByRole('radio', {
128
168
  name: 'Email',
129
169
  });
@@ -488,6 +528,45 @@ class ClusterDetailsPage {
488
528
  async clickAlertsTab() {
489
529
  await (0, test_1.expect)(this.alertsTab).toBeVisible({ timeout: 40000 });
490
530
  await this.alertsTab.click();
531
+ // The tab bar remounts while the cluster payload is still arriving, which
532
+ // discards the click and leaves Overview selected -- and the tab is a
533
+ // button, not a route, so nothing later re-selects it. Callers would then
534
+ // find no Alerts panel for alertsList to read. Confirm the panel mounted,
535
+ // re-selecting the tab after a reload between attempts.
536
+ await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.alertsPanel, {
537
+ visibilityTimeout: 60000,
538
+ totalTimeout: 240000,
539
+ maxRetries: 4,
540
+ postAction: async () => {
541
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
542
+ await this.alertsTab.waitFor({ state: 'visible', timeout: 60000 });
543
+ await this.alertsTab.click({ timeout: 60000 });
544
+ },
545
+ });
546
+ }
547
+ // Re-enters the cluster page and re-opens the Alerts tab, for callers that
548
+ // poll the alerts table for a server-side change. Hub keeps the selected
549
+ // tab out of the URL (ClusterDetails.saas.tsx drops c4's tabChange), so any
550
+ // full load comes back on Overview and the tab has to be clicked again.
551
+ // A goto to the remembered cluster page rather than a reload: a full load
552
+ // re-runs Hub's Auth0 hand-off, and a reload issued while the page is still
553
+ // parked on /login-callback?code=... replays that single-use code.
554
+ async reopenAlertsTab() {
555
+ if ((0, sessionRecovery_1.isAtIdentityProvider)(this.page)) {
556
+ await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
557
+ }
558
+ const current = new URL(this.page.url());
559
+ if (!(0, sessionRecovery_1.isAtIdentityProvider)(this.page) &&
560
+ !HUB_LOGIN_ROUTE.test(current.pathname)) {
561
+ this.clusterDetailsUrl = current.href;
562
+ }
563
+ const target = this.clusterDetailsUrl ?? current.href;
564
+ const host = new URL(target).host;
565
+ await this.page.goto(target, { waitUntil: 'domcontentloaded' });
566
+ // goto() resolves on the first document; the hand-off then bounces
567
+ // through /login and /login-callback (~45s on CI) before it lands back.
568
+ await this.page.waitForURL((url) => url.host === host && !HUB_LOGIN_ROUTE.test(url.pathname), { timeout: 120000 });
569
+ await this.clickAlertsTab();
491
570
  }
492
571
  async clickExpandButton() {
493
572
  await this.expandButton.click({ timeout: 60000 });
@@ -526,7 +605,47 @@ class ClusterDetailsPage {
526
605
  });
527
606
  }
528
607
  async deleteAlerts() {
529
- await this.doDelete(this.dialog, 'Alerts');
608
+ const hasRowActions = await this.alertRowActionsButtons
609
+ .first()
610
+ .waitFor({ state: 'visible', timeout: 10000 })
611
+ .then(() => true)
612
+ .catch(() => false);
613
+ if (!hasRowActions) {
614
+ await this.doDelete(this.dialog, 'Alerts');
615
+ return;
616
+ }
617
+ let remaining = await this.alertRowActionsButtons.count();
618
+ while (remaining > 0) {
619
+ // A re-render can detach the menu between opening it and the click, so
620
+ // open-menu-and-choose-Delete is retried as one unit.
621
+ await (0, test_1.expect)(async () => {
622
+ await this.alertRowActionsButtons.first().click({ timeout: 10000 });
623
+ await this.deleteAlertMenuItem.click({ timeout: 10000 });
624
+ await (0, test_1.expect)(this.deleteAlertConfirmButton).toBeVisible({
625
+ timeout: 10000,
626
+ });
627
+ }).toPass({ timeout: 60000 });
628
+ await this.deleteAlertConfirmButton.click({ timeout: 30000 });
629
+ await (0, test_1.expect)(this.alertRowActionsButtons).toHaveCount(remaining - 1, {
630
+ timeout: 60000,
631
+ });
632
+ remaining = await this.alertRowActionsButtons.count();
633
+ }
634
+ }
635
+ // Reveals each alert's detail row. A no-op on the legacy table, whose
636
+ // detail rows are always rendered.
637
+ async expandAlerts() {
638
+ for (let i = 0; i < 10; i++) {
639
+ const toggle = this.alertExpandRowButtons.first();
640
+ if (!(await toggle.isVisible().catch(() => false))) {
641
+ return;
642
+ }
643
+ const before = await this.alertExpandRowButtons.count();
644
+ await toggle.click({ timeout: 10000 });
645
+ await (0, test_1.expect)(this.alertExpandRowButtons).toHaveCount(before - 1, {
646
+ timeout: 10000,
647
+ });
648
+ }
530
649
  }
531
650
  async doDelete(dialog, text) {
532
651
  try {
@@ -782,14 +901,15 @@ class ClusterDetailsPage {
782
901
  async assertAlertText(text, timeout = 60000, maxRetries = 10) {
783
902
  for (let attempt = 0; attempt < maxRetries; attempt++) {
784
903
  try {
904
+ await (0, test_1.expect)(this.alertsList.first()).toBeVisible({ timeout });
905
+ await this.expandAlerts();
785
906
  await (0, test_1.expect)(this.alertsList.nth(1)).toContainText(text, { timeout });
786
907
  return;
787
908
  }
788
909
  catch (error) {
789
910
  if (attempt < maxRetries - 1) {
790
911
  console.warn(`Attempt ${attempt + 1} failed for asserting ${text}. Retrying...`);
791
- await this.page.reload();
792
- await (0, sleep_1.sleep)(20000);
912
+ await this.reopenAlertsTab();
793
913
  }
794
914
  else {
795
915
  throw new Error(`Assertion failed after ${maxRetries} attempts`);
@@ -9,16 +9,21 @@ const UtilitiesPage_1 = require("../../pages/8.11/UtilitiesPage");
9
9
  const sleep_1 = require("../../utils/sleep");
10
10
  const users_1 = require("../../utils/users");
11
11
  const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
12
+ const constants_1 = require("../../utils/constants");
12
13
  const testUser = (0, users_1.getTestUser)('eighteenthUser');
13
14
  _8_11_1.test.describe.configure({ mode: 'parallel' });
14
15
  _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
15
16
  const clusterName = 'Test Cluster';
17
+ let inbox = '';
16
18
  _8_11_1.test.beforeEach(async ({ page, loginPage }, testInfo) => {
17
19
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
18
20
  });
19
21
  _8_11_1.test.afterEach(async ({ page }, testInfo) => {
20
22
  await (0, _setup_1.captureScreenshot)(page, testInfo);
21
23
  await (0, _setup_1.captureFailureVideo)(page, testInfo);
24
+ if (inbox.length > 0) {
25
+ await (0, mailSlurpClient_1.deleteInbox)(inbox);
26
+ }
22
27
  });
23
28
  (0, _8_11_1.test)('Console Most Common Flow', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, }) => {
24
29
  const clientName = await (0, _setup_1.generateRandomStringAsync)(6);
@@ -77,14 +82,14 @@ _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
77
82
  await clusterPage.assertClusterHealthyStatusWithRetry(newClusterName, 300000, 1500000);
78
83
  });
79
84
  });
80
- //Waiting infra team to provide DNS configuration for email testing, skipping for now
81
- _8_11_1.test.skip('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
85
+ (0, _8_11_1.test)('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
82
86
  _8_11_1.test.slow();
83
87
  const processName = 'Email_Alert_Process' + (await (0, _setup_1.generateRandomStringAsync)(3));
84
88
  const invalidURl = 'https://invalid';
85
89
  let lastTriggerTime = 0;
86
- const alertFlowClusterName = 'Alert Flow Cluster';
87
90
  const { id } = await (0, mailSlurpClient_1.createInbox)(testUser.username);
91
+ inbox = id;
92
+ const alertFlowClusterName = 'Alert Flow Cluster';
88
93
  await _8_11_1.test.step('Create Cluster', async () => {
89
94
  await homePage.clickClusters();
90
95
  await clusterPage.createClusterIfNotExists(alertFlowClusterName);
@@ -94,15 +99,20 @@ _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
94
99
  await clusterPage.clickClusterLink(alertFlowClusterName);
95
100
  await clusterDetailsPage.clickAlertsTab();
96
101
  await clusterDetailsPage.deleteAlerts();
97
- (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBe(0);
102
+ await (0, test_1.expect)(clusterDetailsPage.alertsList).toHaveCount(0, {
103
+ timeout: 15000,
104
+ });
98
105
  });
99
106
  await _8_11_1.test.step('Create First Email Alert', async () => {
100
107
  await clusterDetailsPage.createAlert(true);
101
- (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
102
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
103
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText(testUser.username);
104
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText((0, formatDate_1.formatDate)());
105
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered0');
108
+ await (0, test_1.expect)(async () => {
109
+ await clusterDetailsPage.expandAlerts();
110
+ (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
111
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
112
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText(testUser.username);
113
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText((0, formatDate_1.formatDate)());
114
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered0');
115
+ }).toPass(constants_1.defaultAssertionOptions);
106
116
  });
107
117
  await _8_11_1.test.step('Navigate to Web Modeler', async () => {
108
118
  await appsPage.clickCamundaApps();
@@ -144,14 +154,15 @@ _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
144
154
  await _8_11_1.test.step('Verify Alert Count Increases to 1 After Trigger', async () => {
145
155
  await clusterDetailsPage.clickAlertsTab();
146
156
  await (0, test_1.expect)(async () => {
147
- await page.reload();
157
+ await clusterDetailsPage.reopenAlertsTab();
148
158
  await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
149
159
  timeout: 20000,
150
160
  });
161
+ await clusterDetailsPage.expandAlerts();
151
162
  (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
152
- }).toPass({ timeout: 60000 });
153
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
154
- await clusterDetailsPage.assertAlertText('Amount triggered1');
163
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
164
+ await clusterDetailsPage.assertAlertText('Amount triggered1');
165
+ }).toPass({ timeout: 240000 });
155
166
  });
156
167
  await _8_11_1.test.step('Verify Alerts Received via Email for Incident', async () => {
157
168
  await (0, sleep_1.sleep)(60000);
@@ -170,7 +181,26 @@ _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
170
181
  await modelerHomePage.clickCrossComponentProjectFolder();
171
182
  await modelerHomePage.clickProcessDiagram(processName);
172
183
  await modelerCreatePage.runProcessInstance(alertFlowClusterName);
173
- await (0, sleep_1.sleep)(10000);
184
+ // Straight into the next run, no wait. The email assertion below expects
185
+ // ONE mail reporting "New Incidents: 2", which only happens when both
186
+ // incidents fall inside the same alert evaluation cycle; the 10s sleep
187
+ // that used to be here pushed them into separate cycles and Console sent
188
+ // a "New Incidents: 1" mail for each (nightly: "3 email(s) present",
189
+ // none matching). Ported from 8.8 (647375e5d).
190
+ //
191
+ // Close the first run's toast before clicking again: camunda-hub 6813a7e
192
+ // made the "Instance started!" toast persistent whenever it carries the
193
+ // Operate action, so its action button covers "Deploy & run" and would
194
+ // swallow the second click.
195
+ const instanceStartedToast = page
196
+ .locator('[data-sonner-toast]')
197
+ .filter({ has: modelerCreatePage.viewProcessInstanceLink });
198
+ await instanceStartedToast
199
+ .locator('[data-close-button="true"]')
200
+ .click({ timeout: 30000 });
201
+ await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeHidden({
202
+ timeout: 30000,
203
+ });
174
204
  await modelerCreatePage.runProcessInstance(alertFlowClusterName);
175
205
  });
176
206
  await _8_11_1.test.step('Navigate to Cluster Details', async () => {
@@ -183,12 +213,13 @@ _8_11_1.test.describe('Console User Flow Tests @tasklistV2', () => {
183
213
  await _8_11_1.test.step('Verify Alert Count Increases to 3 After Trigger', async () => {
184
214
  await clusterDetailsPage.clickAlertsTab();
185
215
  await (0, test_1.expect)(async () => {
186
- await page.reload();
216
+ await clusterDetailsPage.reopenAlertsTab();
187
217
  await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
188
218
  timeout: 20000,
189
219
  });
220
+ await clusterDetailsPage.expandAlerts();
190
221
  (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
191
- }).toPass({ timeout: 60000 });
222
+ }).toPass({ timeout: 240000 });
192
223
  await clusterDetailsPage.assertAlertText('Amount triggered3');
193
224
  });
194
225
  await _8_11_1.test.step('Verify Alerts Received via Email for Incident', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1543",
3
+ "version": "0.0.1545",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",