@camunda/e2e-test-suite 0.0.1535 → 0.0.1537

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;
@@ -75,6 +82,7 @@ declare class ClusterDetailsPage {
75
82
  searchAndClickClientCredentialsLink(name: string): Promise<ClientCredentialsDetailsPage>;
76
83
  deleteAPIClientsIfExist(name?: string): Promise<void>;
77
84
  clickAlertsTab(): Promise<void>;
85
+ reopenAlertsTab(): Promise<void>;
78
86
  clickExpandButton(): Promise<void>;
79
87
  clickCreateFirstAlertButton(): Promise<void>;
80
88
  clickCreateNewAlertButton(): Promise<void>;
@@ -82,6 +90,7 @@ declare class ClusterDetailsPage {
82
90
  selectEmailRadioButton(): Promise<void>;
83
91
  clickCreateAlertButton(): Promise<void>;
84
92
  deleteAlerts(): Promise<void>;
93
+ expandAlerts(): Promise<void>;
85
94
  private doDelete;
86
95
  assertComponentsHealth(components?: string[], recoverSession?: () => Promise<void>): Promise<void>;
87
96
  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
  });
@@ -514,6 +554,46 @@ class ClusterDetailsPage {
514
554
  async clickAlertsTab() {
515
555
  await (0, test_1.expect)(this.alertsTab).toBeVisible({ timeout: 40000 });
516
556
  await this.alertsTab.click();
557
+ // The tab bar remounts while the cluster payload is still arriving, which
558
+ // discards the click and leaves Overview selected -- and the tab is a
559
+ // button, not a route, so nothing later re-selects it. Callers would then
560
+ // find no Alerts panel for alertsList to read. Confirm the panel mounted,
561
+ // re-selecting the tab after a reload between attempts.
562
+ await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.alertsPanel, {
563
+ visibilityTimeout: 60000,
564
+ totalTimeout: 240000,
565
+ maxRetries: 4,
566
+ postAction: async () => {
567
+ await this.page.reload({ waitUntil: 'domcontentloaded' });
568
+ await this.alertsTab.waitFor({ state: 'visible', timeout: 60000 });
569
+ await this.alertsTab.click({ timeout: 60000 });
570
+ },
571
+ });
572
+ }
573
+ // Re-enters the cluster page and re-opens the Alerts tab, for callers that
574
+ // poll the alerts table for a server-side change. Hub keeps the selected
575
+ // tab out of the URL (ClusterDetails.saas.tsx drops c4's tabChange), so any
576
+ // full load comes back on Overview and the tab has to be clicked again.
577
+ // A goto to the remembered cluster page rather than a reload: a full load
578
+ // re-runs Hub's Auth0 hand-off, and a reload issued while the page is still
579
+ // parked on /login-callback?code=... replays that single-use code.
580
+ async reopenAlertsTab() {
581
+ if ((0, sessionRecovery_1.isAtIdentityProvider)(this.page)) {
582
+ await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
583
+ }
584
+ const current = new URL(this.page.url());
585
+ if (!(0, sessionRecovery_1.isAtIdentityProvider)(this.page) &&
586
+ !HUB_LOGIN_ROUTE.test(current.pathname)) {
587
+ this.clusterDetailsUrl = current.href;
588
+ }
589
+ const target = this.clusterDetailsUrl ?? current.href;
590
+ const host = new URL(target).host;
591
+ await this.page.goto(target, { waitUntil: 'domcontentloaded' });
592
+ // goto() resolves on the first document; the hand-off then bounces
593
+ // through /login and /login-callback (~45s on CI) before it lands back.
594
+ await this.page.waitForURL((url) => url.host === host && !HUB_LOGIN_ROUTE.test(url.pathname), { timeout: 120000 });
595
+ await this.alertsTab.click({ timeout: 60000 });
596
+ await (0, test_1.expect)(this.alertsPanel.first()).toBeVisible({ timeout: 60000 });
517
597
  }
518
598
  async clickExpandButton() {
519
599
  await this.expandButton.click({ timeout: 60000 });
@@ -552,7 +632,47 @@ class ClusterDetailsPage {
552
632
  });
553
633
  }
554
634
  async deleteAlerts() {
555
- await this.doDelete(this.dialog, 'Alerts');
635
+ const hasRowActions = await this.alertRowActionsButtons
636
+ .first()
637
+ .waitFor({ state: 'visible', timeout: 10000 })
638
+ .then(() => true)
639
+ .catch(() => false);
640
+ if (!hasRowActions) {
641
+ await this.doDelete(this.dialog, 'Alerts');
642
+ return;
643
+ }
644
+ let remaining = await this.alertRowActionsButtons.count();
645
+ while (remaining > 0) {
646
+ // A re-render can detach the menu between opening it and the click, so
647
+ // open-menu-and-choose-Delete is retried as one unit.
648
+ await (0, test_1.expect)(async () => {
649
+ await this.alertRowActionsButtons.first().click({ timeout: 10000 });
650
+ await this.deleteAlertMenuItem.click({ timeout: 10000 });
651
+ await (0, test_1.expect)(this.deleteAlertConfirmButton).toBeVisible({
652
+ timeout: 10000,
653
+ });
654
+ }).toPass({ timeout: 60000 });
655
+ await this.deleteAlertConfirmButton.click({ timeout: 30000 });
656
+ await (0, test_1.expect)(this.alertRowActionsButtons).toHaveCount(remaining - 1, {
657
+ timeout: 60000,
658
+ });
659
+ remaining = await this.alertRowActionsButtons.count();
660
+ }
661
+ }
662
+ // Reveals each alert's detail row. A no-op on the legacy table, whose
663
+ // detail rows are always rendered.
664
+ async expandAlerts() {
665
+ for (let i = 0; i < 10; i++) {
666
+ const toggle = this.alertExpandRowButtons.first();
667
+ if (!(await toggle.isVisible().catch(() => false))) {
668
+ return;
669
+ }
670
+ const before = await this.alertExpandRowButtons.count();
671
+ await toggle.click({ timeout: 10000 });
672
+ await (0, test_1.expect)(this.alertExpandRowButtons).toHaveCount(before - 1, {
673
+ timeout: 10000,
674
+ });
675
+ }
556
676
  }
557
677
  async doDelete(dialog, text) {
558
678
  try {
@@ -808,14 +928,15 @@ class ClusterDetailsPage {
808
928
  async assertAlertText(text, timeout = 60000, maxRetries = 10) {
809
929
  for (let attempt = 0; attempt < maxRetries; attempt++) {
810
930
  try {
931
+ await (0, test_1.expect)(this.alertsList.first()).toBeVisible({ timeout });
932
+ await this.expandAlerts();
811
933
  await (0, test_1.expect)(this.alertsList.nth(1)).toContainText(text, { timeout });
812
934
  return;
813
935
  }
814
936
  catch (error) {
815
937
  if (attempt < maxRetries - 1) {
816
938
  console.warn(`Attempt ${attempt + 1} failed for asserting ${text}. Retrying...`);
817
- await this.page.reload();
818
- await (0, sleep_1.sleep)(20000);
939
+ await this.reopenAlertsTab();
819
940
  }
820
941
  else {
821
942
  throw new Error(`Assertion failed after ${maxRetries} attempts`);
@@ -9,16 +9,21 @@ const UtilitiesPage_1 = require("../../pages/8.10/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_10_1.test.describe.configure({ mode: 'parallel' });
14
15
  _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
15
16
  const clusterName = 'Test Cluster';
17
+ let inbox = '';
16
18
  _8_10_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_10_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_10_1.test)('Console Most Common Flow', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, }) => {
24
29
  const clientName = await (0, _setup_1.generateRandomStringAsync)(6);
@@ -85,14 +90,14 @@ _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
85
90
  await clusterPage.deleteCluster(newClusterName);
86
91
  });
87
92
  });
88
- //Waiting infra team to provide DNS configuration for email testing, skipping for now
89
- _8_10_1.test.skip('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
93
+ (0, _8_10_1.test)('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
90
94
  _8_10_1.test.slow();
91
95
  const processName = 'Email_Alert_Process' + (await (0, _setup_1.generateRandomStringAsync)(3));
92
96
  const invalidURl = 'https://invalid';
93
97
  let lastTriggerTime = 0;
94
- const alertFlowClusterName = 'Alert Flow Cluster';
95
98
  const { id } = await (0, mailSlurpClient_1.createInbox)(testUser.username);
99
+ inbox = id;
100
+ const alertFlowClusterName = 'Alert Flow Cluster';
96
101
  await _8_10_1.test.step('Create Cluster', async () => {
97
102
  await homePage.clickClusters();
98
103
  await clusterPage.createClusterIfNotExists(alertFlowClusterName);
@@ -102,15 +107,20 @@ _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
102
107
  await clusterPage.clickClusterLink(alertFlowClusterName);
103
108
  await clusterDetailsPage.clickAlertsTab();
104
109
  await clusterDetailsPage.deleteAlerts();
105
- (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBe(0);
110
+ await (0, test_1.expect)(clusterDetailsPage.alertsList).toHaveCount(0, {
111
+ timeout: 15000,
112
+ });
106
113
  });
107
114
  await _8_10_1.test.step('Create First Email Alert', async () => {
108
115
  await clusterDetailsPage.createAlert(true);
109
- (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
110
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
111
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText(testUser.username);
112
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText((0, formatDate_1.formatDate)());
113
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered0');
116
+ await (0, test_1.expect)(async () => {
117
+ await clusterDetailsPage.expandAlerts();
118
+ (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
119
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
120
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText(testUser.username);
121
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText((0, formatDate_1.formatDate)());
122
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered0');
123
+ }).toPass(constants_1.defaultAssertionOptions);
114
124
  });
115
125
  await _8_10_1.test.step('Navigate to Web Modeler', async () => {
116
126
  await appsPage.clickCamundaApps();
@@ -152,14 +162,15 @@ _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
152
162
  await _8_10_1.test.step('Verify Alert Count Increases to 1 After Trigger', async () => {
153
163
  await clusterDetailsPage.clickAlertsTab();
154
164
  await (0, test_1.expect)(async () => {
155
- await page.reload();
165
+ await clusterDetailsPage.reopenAlertsTab();
156
166
  await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
157
167
  timeout: 20000,
158
168
  });
169
+ await clusterDetailsPage.expandAlerts();
159
170
  (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
160
- }).toPass({ timeout: 60000 });
161
- await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
162
- await clusterDetailsPage.assertAlertText('Amount triggered1');
171
+ await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
172
+ await clusterDetailsPage.assertAlertText('Amount triggered1');
173
+ }).toPass({ timeout: 240000 });
163
174
  });
164
175
  await _8_10_1.test.step('Verify Alerts Received via Email for Incident', async () => {
165
176
  await (0, sleep_1.sleep)(60000);
@@ -178,7 +189,26 @@ _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
178
189
  await modelerHomePage.clickCrossComponentProjectFolder();
179
190
  await modelerHomePage.clickProcessDiagram(processName);
180
191
  await modelerCreatePage.runProcessInstance(alertFlowClusterName);
181
- await (0, sleep_1.sleep)(10000);
192
+ // Straight into the next run, no wait. The email assertion below expects
193
+ // ONE mail reporting "New Incidents: 2", which only happens when both
194
+ // incidents fall inside the same alert evaluation cycle; the 10s sleep
195
+ // that used to be here pushed them into separate cycles and Console sent
196
+ // a "New Incidents: 1" mail for each (nightly: "3 email(s) present",
197
+ // none matching). Ported from 8.8 (647375e5d).
198
+ //
199
+ // Close the first run's toast before clicking again: camunda-hub 6813a7e
200
+ // made the "Instance started!" toast persistent whenever it carries the
201
+ // Operate action, so its action button covers "Deploy & run" and would
202
+ // swallow the second click.
203
+ const instanceStartedToast = page
204
+ .locator('[data-sonner-toast]')
205
+ .filter({ has: modelerCreatePage.viewProcessInstanceLink });
206
+ await instanceStartedToast
207
+ .locator('[data-close-button="true"]')
208
+ .click({ timeout: 30000 });
209
+ await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeHidden({
210
+ timeout: 30000,
211
+ });
182
212
  await modelerCreatePage.runProcessInstance(alertFlowClusterName);
183
213
  });
184
214
  await _8_10_1.test.step('Navigate to Cluster Details', async () => {
@@ -191,12 +221,13 @@ _8_10_1.test.describe('Console User Flow Tests @tasklistV2', () => {
191
221
  await _8_10_1.test.step('Verify Alert Count Increases to 3 After Trigger', async () => {
192
222
  await clusterDetailsPage.clickAlertsTab();
193
223
  await (0, test_1.expect)(async () => {
194
- await page.reload();
224
+ await clusterDetailsPage.reopenAlertsTab();
195
225
  await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
196
226
  timeout: 20000,
197
227
  });
228
+ await clusterDetailsPage.expandAlerts();
198
229
  (0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
199
- }).toPass({ timeout: 60000 });
230
+ }).toPass({ timeout: 240000 });
200
231
  await clusterDetailsPage.assertAlertText('Amount triggered3');
201
232
  });
202
233
  await _8_10_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.1535",
3
+ "version": "0.0.1537",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",