@camunda/e2e-test-suite 0.0.1536 → 0.0.1538
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.
- package/dist/pages/8.7/ClusterDetailsPage.d.ts +9 -0
- package/dist/pages/8.7/ClusterDetailsPage.js +122 -2
- package/dist/pages/8.7/UtilitiesPage.d.ts +2 -0
- package/dist/pages/8.7/UtilitiesPage.js +25 -1
- package/dist/tests/8.7/console-user-flows.spec.js +57 -26
- package/package.json +1 -1
- package/dist/utils/googleapi.d.ts +0 -5
- package/dist/utils/googleapi.js +0 -102
|
@@ -2,6 +2,7 @@ import { Page, Locator } from '@playwright/test';
|
|
|
2
2
|
import { ClientCredentialsDetailsPage } from '../8.7/ClientCredentialsDetailsPage';
|
|
3
3
|
declare class ClusterDetailsPage {
|
|
4
4
|
private page;
|
|
5
|
+
private clusterDetailsUrl;
|
|
5
6
|
readonly apiTab: Locator;
|
|
6
7
|
readonly createFirstClientButton: Locator;
|
|
7
8
|
readonly clientNameTextbox: Locator;
|
|
@@ -27,7 +28,13 @@ declare class ClusterDetailsPage {
|
|
|
27
28
|
readonly disableRBADialog: Locator;
|
|
28
29
|
readonly rbaEnabledMessage: Locator;
|
|
29
30
|
readonly alertsTab: Locator;
|
|
31
|
+
readonly alertsTabPanel: Locator;
|
|
30
32
|
readonly alertsList: Locator;
|
|
33
|
+
readonly alertExpandRowButtons: Locator;
|
|
34
|
+
readonly alertRowActionsButtons: Locator;
|
|
35
|
+
readonly deleteAlertMenuItem: Locator;
|
|
36
|
+
readonly deleteAlertConfirmButton: Locator;
|
|
37
|
+
readonly alertsPanel: Locator;
|
|
31
38
|
readonly createFirstAlertButton: Locator;
|
|
32
39
|
readonly createNewAlertButton: Locator;
|
|
33
40
|
readonly emailRadioButton: Locator;
|
|
@@ -69,12 +76,14 @@ declare class ClusterDetailsPage {
|
|
|
69
76
|
searchAndClickClientCredentialsLink(name: string): Promise<ClientCredentialsDetailsPage>;
|
|
70
77
|
deleteAPIClientsIfExist(name?: string): Promise<void>;
|
|
71
78
|
clickAlertsTab(): Promise<void>;
|
|
79
|
+
reopenAlertsTab(): Promise<void>;
|
|
72
80
|
clickCreateFirstAlertButton(): Promise<void>;
|
|
73
81
|
clickCreateNewAlertButton(): Promise<void>;
|
|
74
82
|
createAlert(isFirstAlert?: boolean): Promise<void>;
|
|
75
83
|
selectEmailRadioButton(): Promise<void>;
|
|
76
84
|
clickCreateAlertButton(): Promise<void>;
|
|
77
85
|
deleteAlerts(): Promise<void>;
|
|
86
|
+
expandAlerts(): Promise<void>;
|
|
78
87
|
private doDelete;
|
|
79
88
|
assertComponentsHealth(components?: string[]): Promise<void>;
|
|
80
89
|
userTaskEnabledAssertion(): Promise<void>;
|
|
@@ -6,8 +6,14 @@ const sleep_1 = require("../../utils/sleep");
|
|
|
6
6
|
const clickLocatorWithRetry_1 = require("../../utils/assertionHelpers/clickLocatorWithRetry");
|
|
7
7
|
const ClientCredentialsDetailsPage_1 = require("../8.7/ClientCredentialsDetailsPage");
|
|
8
8
|
const expectLocatorWithRetry_1 = require("../../utils/assertionHelpers/expectLocatorWithRetry");
|
|
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;
|
|
15
|
+
// The cluster page reopenAlertsTab() goes back to -- see there.
|
|
16
|
+
clusterDetailsUrl;
|
|
11
17
|
apiTab;
|
|
12
18
|
createFirstClientButton;
|
|
13
19
|
clientNameTextbox;
|
|
@@ -33,7 +39,13 @@ class ClusterDetailsPage {
|
|
|
33
39
|
disableRBADialog;
|
|
34
40
|
rbaEnabledMessage;
|
|
35
41
|
alertsTab;
|
|
42
|
+
alertsTabPanel;
|
|
36
43
|
alertsList;
|
|
44
|
+
alertExpandRowButtons;
|
|
45
|
+
alertRowActionsButtons;
|
|
46
|
+
deleteAlertMenuItem;
|
|
47
|
+
deleteAlertConfirmButton;
|
|
48
|
+
alertsPanel;
|
|
37
49
|
createFirstAlertButton;
|
|
38
50
|
createNewAlertButton;
|
|
39
51
|
emailRadioButton;
|
|
@@ -124,15 +136,43 @@ class ClusterDetailsPage {
|
|
|
124
136
|
this.userTaskRestriction = page.locator('button[aria-label="Switch Enforce user task restrictions"]');
|
|
125
137
|
this.rbaEnabledMessage = page.getByText('Resource-based authorizations enabled');
|
|
126
138
|
this.alertsTab = page.getByRole('tab', { name: 'Alerts' });
|
|
127
|
-
|
|
139
|
+
// Only the selected tab's panel is exposed (the design-system tabs unmount
|
|
140
|
+
// the others, Carbon marks them hidden), and it is named after its tab.
|
|
141
|
+
// Page-wide, getByRole('row') read the Overview "Cluster Details" rows
|
|
142
|
+
// whenever Overview was showing -- the nightly's `Received string:
|
|
143
|
+
// "NameAlert Flow Cluster"` where the Email alert row was expected.
|
|
144
|
+
this.alertsTabPanel = page.getByRole('tabpanel', { name: 'Alerts' });
|
|
145
|
+
this.alertsList = this.alertsTabPanel
|
|
128
146
|
.getByRole('row')
|
|
129
147
|
.filter({ hasNotText: 'Delivery method' }); //Filter out header row
|
|
148
|
+
// Hub's Alerts tab is a design-system data table: one summary row per
|
|
149
|
+
// alert (Delivery method / Created at / Created by), with the detail
|
|
150
|
+
// fields in a sibling expansion row that only exists once the row's
|
|
151
|
+
// "Expand row" toggle is clicked, and Delete behind the row's "Row
|
|
152
|
+
// actions" kebab -> "Delete" -> "Delete alert" dialog (camunda-hub e2e
|
|
153
|
+
// ConsoleClusterDetailsPage). Scoped to the visible tab panel.
|
|
154
|
+
this.alertExpandRowButtons = page
|
|
155
|
+
.getByRole('tabpanel')
|
|
156
|
+
.getByRole('button', { name: 'Expand row', exact: true });
|
|
157
|
+
this.alertRowActionsButtons = page
|
|
158
|
+
.getByRole('tabpanel')
|
|
159
|
+
.getByRole('button', { name: 'Row actions', exact: true });
|
|
160
|
+
this.deleteAlertMenuItem = page.getByRole('menuitem', {
|
|
161
|
+
name: 'Delete',
|
|
162
|
+
exact: true,
|
|
163
|
+
});
|
|
164
|
+
this.deleteAlertConfirmButton = page
|
|
165
|
+
.getByRole('dialog', { name: 'Delete alert' })
|
|
166
|
+
.getByRole('button', { name: 'Delete', exact: true });
|
|
130
167
|
this.createFirstAlertButton = page.getByRole('button', {
|
|
131
168
|
name: 'Create an alert',
|
|
132
169
|
});
|
|
133
170
|
this.createNewAlertButton = page.getByRole('button', {
|
|
134
171
|
name: 'Create new alert',
|
|
135
172
|
});
|
|
173
|
+
// The Alerts panel offers "Create an alert" while empty and "Create new
|
|
174
|
+
// alert" once it holds one, so either proves the panel itself mounted.
|
|
175
|
+
this.alertsPanel = this.createFirstAlertButton.or(this.createNewAlertButton);
|
|
136
176
|
this.emailRadioButton = page.getByRole('radio', {
|
|
137
177
|
name: 'Email',
|
|
138
178
|
});
|
|
@@ -348,6 +388,46 @@ class ClusterDetailsPage {
|
|
|
348
388
|
async clickAlertsTab() {
|
|
349
389
|
await (0, test_1.expect)(this.alertsTab).toBeVisible({ timeout: 40000 });
|
|
350
390
|
await this.alertsTab.click();
|
|
391
|
+
// The tab bar remounts while the cluster payload is still arriving, which
|
|
392
|
+
// discards the click and leaves Overview selected -- and the tab is a
|
|
393
|
+
// button, not a route, so nothing later re-selects it. Callers would then
|
|
394
|
+
// find no Alerts panel for alertsList to read. Confirm the panel mounted,
|
|
395
|
+
// re-selecting the tab after a reload between attempts.
|
|
396
|
+
await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(this.page, this.alertsPanel, {
|
|
397
|
+
visibilityTimeout: 60000,
|
|
398
|
+
totalTimeout: 240000,
|
|
399
|
+
maxRetries: 4,
|
|
400
|
+
postAction: async () => {
|
|
401
|
+
await this.page.reload({ waitUntil: 'domcontentloaded' });
|
|
402
|
+
await this.alertsTab.waitFor({ state: 'visible', timeout: 60000 });
|
|
403
|
+
await this.alertsTab.click({ timeout: 60000 });
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
// Re-enters the cluster page and re-opens the Alerts tab, for callers that
|
|
408
|
+
// poll the alerts table for a server-side change. Hub keeps the selected
|
|
409
|
+
// tab out of the URL (ClusterDetails.saas.tsx drops c4's tabChange), so any
|
|
410
|
+
// full load comes back on Overview and the tab has to be clicked again.
|
|
411
|
+
// A goto to the remembered cluster page rather than a reload: a full load
|
|
412
|
+
// re-runs Hub's Auth0 hand-off, and a reload issued while the page is still
|
|
413
|
+
// parked on /login-callback?code=... replays that single-use code.
|
|
414
|
+
async reopenAlertsTab() {
|
|
415
|
+
if ((0, sessionRecovery_1.isAtIdentityProvider)(this.page)) {
|
|
416
|
+
await (0, sessionRecovery_1.restoreSessionIfLoggedOut)(this.page);
|
|
417
|
+
}
|
|
418
|
+
const current = new URL(this.page.url());
|
|
419
|
+
if (!(0, sessionRecovery_1.isAtIdentityProvider)(this.page) &&
|
|
420
|
+
!HUB_LOGIN_ROUTE.test(current.pathname)) {
|
|
421
|
+
this.clusterDetailsUrl = current.href;
|
|
422
|
+
}
|
|
423
|
+
const target = this.clusterDetailsUrl ?? current.href;
|
|
424
|
+
const host = new URL(target).host;
|
|
425
|
+
await this.page.goto(target, { waitUntil: 'domcontentloaded' });
|
|
426
|
+
// goto() resolves on the first document; the hand-off then bounces
|
|
427
|
+
// through /login and /login-callback (~45s on CI) before it lands back.
|
|
428
|
+
await this.page.waitForURL((url) => url.host === host && !HUB_LOGIN_ROUTE.test(url.pathname), { timeout: 120000 });
|
|
429
|
+
await this.alertsTab.click({ timeout: 60000 });
|
|
430
|
+
await (0, test_1.expect)(this.alertsPanel.first()).toBeVisible({ timeout: 60000 });
|
|
351
431
|
}
|
|
352
432
|
async clickCreateFirstAlertButton() {
|
|
353
433
|
await (0, test_1.expect)(this.createFirstAlertButton).toBeVisible({ timeout: 40000 });
|
|
@@ -383,7 +463,47 @@ class ClusterDetailsPage {
|
|
|
383
463
|
});
|
|
384
464
|
}
|
|
385
465
|
async deleteAlerts() {
|
|
386
|
-
await this.
|
|
466
|
+
const hasRowActions = await this.alertRowActionsButtons
|
|
467
|
+
.first()
|
|
468
|
+
.waitFor({ state: 'visible', timeout: 10000 })
|
|
469
|
+
.then(() => true)
|
|
470
|
+
.catch(() => false);
|
|
471
|
+
if (!hasRowActions) {
|
|
472
|
+
await this.doDelete(this.dialog, 'Alerts');
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
let remaining = await this.alertRowActionsButtons.count();
|
|
476
|
+
while (remaining > 0) {
|
|
477
|
+
// A re-render can detach the menu between opening it and the click, so
|
|
478
|
+
// open-menu-and-choose-Delete is retried as one unit.
|
|
479
|
+
await (0, test_1.expect)(async () => {
|
|
480
|
+
await this.alertRowActionsButtons.first().click({ timeout: 10000 });
|
|
481
|
+
await this.deleteAlertMenuItem.click({ timeout: 10000 });
|
|
482
|
+
await (0, test_1.expect)(this.deleteAlertConfirmButton).toBeVisible({
|
|
483
|
+
timeout: 10000,
|
|
484
|
+
});
|
|
485
|
+
}).toPass({ timeout: 60000 });
|
|
486
|
+
await this.deleteAlertConfirmButton.click({ timeout: 30000 });
|
|
487
|
+
await (0, test_1.expect)(this.alertRowActionsButtons).toHaveCount(remaining - 1, {
|
|
488
|
+
timeout: 60000,
|
|
489
|
+
});
|
|
490
|
+
remaining = await this.alertRowActionsButtons.count();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
// Reveals each alert's detail row. A no-op on the legacy table, whose
|
|
494
|
+
// detail rows are always rendered.
|
|
495
|
+
async expandAlerts() {
|
|
496
|
+
for (let i = 0; i < 10; i++) {
|
|
497
|
+
const toggle = this.alertExpandRowButtons.first();
|
|
498
|
+
if (!(await toggle.isVisible().catch(() => false))) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const before = await this.alertExpandRowButtons.count();
|
|
502
|
+
await toggle.click({ timeout: 10000 });
|
|
503
|
+
await (0, test_1.expect)(this.alertExpandRowButtons).toHaveCount(before - 1, {
|
|
504
|
+
timeout: 10000,
|
|
505
|
+
});
|
|
506
|
+
}
|
|
387
507
|
}
|
|
388
508
|
async doDelete(dialog, text) {
|
|
389
509
|
try {
|
|
@@ -14,6 +14,7 @@ import { LoginPage } from './LoginPage';
|
|
|
14
14
|
import { ConnectorSettingsPage } from './ConnectorSettingsPage';
|
|
15
15
|
import { ConnectorMarketplacePage } from './ConnectorMarketplacePage';
|
|
16
16
|
import { ConnectorTemplatePage } from './ConnectorTemplatePage';
|
|
17
|
+
import { MailSlurp } from 'mailslurp-client';
|
|
17
18
|
export declare function loginWithRetry(page: Page, loginPage: LoginPage, testUser: {
|
|
18
19
|
username: string;
|
|
19
20
|
password: string;
|
|
@@ -46,3 +47,4 @@ export declare function deleteAllUserGroups(homePage: HomePage, organizationPage
|
|
|
46
47
|
export declare function deleteCluster(clusterName: string, homePage: HomePage, clusterPage: ClusterPage, appsPage: AppsPage): Promise<void>;
|
|
47
48
|
export declare function modelAndRunConnectorsDocHandlingDiagram(modelerCreatePage: ModelerCreatePage, modelerHomePage: ModelerHomePage, processName: string, page: Page, connectorMarketplacePage: ConnectorMarketplacePage, clusterName: string, zeebeUrl: string, zeebeClientId: string, zeebeClientSecret: string): Promise<void>;
|
|
48
49
|
export declare function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage: ModelerCreatePage, modelerHomePage: ModelerHomePage, processName: string, page: Page, connectorMarketplacePage: ConnectorMarketplacePage, clusterName: string, connectorTemplatePage: ConnectorTemplatePage): Promise<void>;
|
|
50
|
+
export declare function assertLatestAlertEmail(id: string, mailSlurp: MailSlurp, processName: string, alertText: string): Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelAndRunConnectorsTimerEventDiagram = exports.modelAndRunConnectorsDocHandlingDiagram = exports.deleteCluster = exports.deleteAllUserGroups = exports.assertTestUsesCorrectOrganization = exports.clickInvitationLinkInEmail = exports.enableRBA = exports.disableRBA = exports.modelDiagramFromFile = exports.runProcess = exports.runMultipleProcesses = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
|
|
3
|
+
exports.assertLatestAlertEmail = exports.modelAndRunConnectorsTimerEventDiagram = exports.modelAndRunConnectorsDocHandlingDiagram = exports.deleteCluster = exports.deleteAllUserGroups = exports.assertTestUsesCorrectOrganization = exports.clickInvitationLinkInEmail = exports.enableRBA = exports.disableRBA = exports.modelDiagramFromFile = exports.runProcess = exports.runMultipleProcesses = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
|
|
4
4
|
const test_1 = require("@playwright/test");
|
|
5
5
|
const ModelerHomePage_1 = require("./ModelerHomePage");
|
|
6
6
|
const HomePage_1 = require("./HomePage");
|
|
@@ -653,3 +653,27 @@ async function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage, modeler
|
|
|
653
653
|
await modelerCreatePage.runProcessInstance(clusterName);
|
|
654
654
|
}
|
|
655
655
|
exports.modelAndRunConnectorsTimerEventDiagram = modelAndRunConnectorsTimerEventDiagram;
|
|
656
|
+
async function assertLatestAlertEmail(id, mailSlurp, processName, alertText) {
|
|
657
|
+
// waitForLatestEmail returns the newest email at once when the inbox is not
|
|
658
|
+
// empty, so a second call on the same inbox re-reads the first alert email.
|
|
659
|
+
// Search the inbox for an email that carries the expected text instead.
|
|
660
|
+
let body;
|
|
661
|
+
await (0, test_1.expect)(async () => {
|
|
662
|
+
const previews = await mailSlurp.getEmails(id, {
|
|
663
|
+
minCount: 1,
|
|
664
|
+
retryTimeout: 60000,
|
|
665
|
+
});
|
|
666
|
+
for (const preview of previews) {
|
|
667
|
+
const email = await mailSlurp.getEmail(preview.id);
|
|
668
|
+
if (email?.body?.includes(processName) &&
|
|
669
|
+
email.body.includes(alertText)) {
|
|
670
|
+
body = email.body;
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
throw new Error(`No alert email for "${processName}" containing "${alertText}" in ` +
|
|
675
|
+
`inbox ${id} yet (${previews.length} email(s) present)`);
|
|
676
|
+
}).toPass({ timeout: 360000, intervals: [5000, 10000, 20000] });
|
|
677
|
+
return body;
|
|
678
|
+
}
|
|
679
|
+
exports.assertLatestAlertEmail = assertLatestAlertEmail;
|
|
@@ -7,20 +7,22 @@ const OperateProcessInstancePage_1 = require("../../pages/8.7/OperateProcessInst
|
|
|
7
7
|
const sleep_1 = require("../../utils/sleep");
|
|
8
8
|
const UtilitiesPage_1 = require("../../pages/8.7/UtilitiesPage");
|
|
9
9
|
const formatDate_1 = require("../../utils/formatDate");
|
|
10
|
-
const googleapi_1 = require("../../utils/googleapi");
|
|
11
10
|
const users_1 = require("../../utils/users");
|
|
12
|
-
const
|
|
11
|
+
const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
|
|
13
12
|
const testUser = (0, users_1.getTestUser)('eighteenthUser');
|
|
14
13
|
_8_7_1.test.describe.configure({ mode: 'parallel' });
|
|
15
14
|
_8_7_1.test.describe('Console User Flow Tests', () => {
|
|
16
15
|
const clusterName = 'Test Cluster';
|
|
17
|
-
|
|
16
|
+
let inbox = '';
|
|
18
17
|
_8_7_1.test.beforeEach(async ({ page, loginPage }, testInfo) => {
|
|
19
18
|
await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
|
|
20
19
|
});
|
|
21
20
|
_8_7_1.test.afterEach(async ({ page }, testInfo) => {
|
|
22
21
|
await (0, _setup_1.captureScreenshot)(page, testInfo);
|
|
23
22
|
await (0, _setup_1.captureFailureVideo)(page, testInfo);
|
|
23
|
+
if (inbox.length > 0) {
|
|
24
|
+
await (0, mailSlurpClient_1.deleteInbox)(inbox);
|
|
25
|
+
}
|
|
24
26
|
});
|
|
25
27
|
(0, _8_7_1.test)('Create Cluster', async ({ homePage, clusterPage }, testInfo) => {
|
|
26
28
|
_8_7_1.test.slow();
|
|
@@ -49,28 +51,38 @@ _8_7_1.test.describe('Console User Flow Tests', () => {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
});
|
|
52
|
-
|
|
53
|
-
_8_7_1.test.skip('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, }) => {
|
|
54
|
+
(0, _8_7_1.test)('Alert Trigger Flow - Email Notification', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, connectorSettingsPage, }) => {
|
|
54
55
|
_8_7_1.test.slow();
|
|
55
56
|
const processName = 'Email_Alert_Process' + (await (0, _setup_1.generateRandomStringAsync)(3));
|
|
56
57
|
const invalidURl = 'https://invalid';
|
|
57
|
-
const senderEmail = 'no-reply@camunda.io';
|
|
58
58
|
let lastTriggerTime = 0;
|
|
59
|
-
|
|
59
|
+
const alertFlowClusterName = 'Alert Flow Cluster';
|
|
60
|
+
const { id } = await (0, mailSlurpClient_1.createInbox)(testUser.username);
|
|
61
|
+
inbox = id;
|
|
62
|
+
await _8_7_1.test.step('Create Cluster', async () => {
|
|
60
63
|
await (0, test_1.expect)(homePage.clusterTab).toBeVisible({ timeout: 30000 });
|
|
64
|
+
await homePage.clickClusters();
|
|
65
|
+
await clusterPage.createClusterIfNotExists(alertFlowClusterName);
|
|
66
|
+
});
|
|
67
|
+
await _8_7_1.test.step('Delete Alert Settings If Exist', async () => {
|
|
61
68
|
await homePage.clickClusters();
|
|
62
69
|
await clusterPage.clickClusterLink(alertFlowClusterName);
|
|
63
70
|
await clusterDetailsPage.clickAlertsTab();
|
|
64
71
|
await clusterDetailsPage.deleteAlerts();
|
|
65
|
-
(0, test_1.expect)(
|
|
72
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList).toHaveCount(0, {
|
|
73
|
+
timeout: 15000,
|
|
74
|
+
});
|
|
66
75
|
});
|
|
67
76
|
await _8_7_1.test.step('Create First Email Alert', async () => {
|
|
68
77
|
await clusterDetailsPage.createAlert(true);
|
|
69
|
-
(0, test_1.expect)(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
await (0, test_1.expect)(async () => {
|
|
79
|
+
await clusterDetailsPage.expandAlerts();
|
|
80
|
+
(0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
|
|
81
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
|
|
82
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText(testUser.username);
|
|
83
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText((0, formatDate_1.formatDate)());
|
|
84
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered0');
|
|
85
|
+
}).toPass({ timeout: 60000 });
|
|
74
86
|
});
|
|
75
87
|
await _8_7_1.test.step('Navigate to Web Modeler', async () => {
|
|
76
88
|
await appsPage.clickCamundaApps();
|
|
@@ -112,18 +124,19 @@ _8_7_1.test.describe('Console User Flow Tests', () => {
|
|
|
112
124
|
await _8_7_1.test.step('Verify Alert Count Increases to 1 After Trigger', async () => {
|
|
113
125
|
await clusterDetailsPage.clickAlertsTab();
|
|
114
126
|
await (0, test_1.expect)(async () => {
|
|
127
|
+
await clusterDetailsPage.reopenAlertsTab();
|
|
128
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
|
|
129
|
+
timeout: 20000,
|
|
130
|
+
});
|
|
131
|
+
await clusterDetailsPage.expandAlerts();
|
|
115
132
|
(0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
|
|
116
133
|
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(0)).toContainText(`Email`);
|
|
117
134
|
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered1');
|
|
118
|
-
}).toPass(
|
|
135
|
+
}).toPass({ timeout: 240000 });
|
|
119
136
|
});
|
|
120
137
|
await _8_7_1.test.step('Verify Alerts Received via Email for Incident', async () => {
|
|
121
138
|
await (0, sleep_1.sleep)(60000);
|
|
122
|
-
|
|
123
|
-
const messages = await (0, googleapi_1.getGmailMessagesWithRetry)(token, senderEmail, processName);
|
|
124
|
-
(0, test_1.expect)(messages.length).toBe(1);
|
|
125
|
-
const emailDetails = await (0, googleapi_1.getLatestEmailDetails)(token, await messages[0]['id']);
|
|
126
|
-
(0, test_1.expect)(emailDetails).toContain('New Incidents: 1');
|
|
139
|
+
await (0, UtilitiesPage_1.assertLatestAlertEmail)(id, mailSlurpClient_1.mailSlurp, processName, 'New Incidents: 1');
|
|
127
140
|
lastTriggerTime = Math.floor(Date.now() / 1000); // Current time in seconds (Unix timestamp)
|
|
128
141
|
console.log('Captured Target Time:', lastTriggerTime);
|
|
129
142
|
});
|
|
@@ -138,9 +151,25 @@ _8_7_1.test.describe('Console User Flow Tests', () => {
|
|
|
138
151
|
await modelerHomePage.clickCrossComponentProjectFolder();
|
|
139
152
|
await modelerHomePage.clickProcessDiagram(processName);
|
|
140
153
|
await modelerCreatePage.runProcessInstance(alertFlowClusterName);
|
|
141
|
-
|
|
154
|
+
// Straight into the next run, no wait. The email assertion below expects
|
|
155
|
+
// ONE mail reporting "New Incidents: 2", which only happens when both
|
|
156
|
+
// incidents fall inside the same alert evaluation cycle; a sleep here
|
|
157
|
+
// splits them across cycles and Console sends one mail per incident.
|
|
158
|
+
//
|
|
159
|
+
// Close the first run's toast before clicking again: camunda-hub 6813a7e
|
|
160
|
+
// made the "Instance started!" toast persistent whenever it carries the
|
|
161
|
+
// Operate action, so its action button covers "Deploy & run" and would
|
|
162
|
+
// swallow the second click.
|
|
163
|
+
const instanceStartedToast = page
|
|
164
|
+
.locator('[data-sonner-toast]')
|
|
165
|
+
.filter({ has: modelerCreatePage.viewProcessInstanceLink });
|
|
166
|
+
await instanceStartedToast
|
|
167
|
+
.locator('[data-close-button="true"]')
|
|
168
|
+
.click({ timeout: 30000 });
|
|
169
|
+
await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeHidden({
|
|
170
|
+
timeout: 30000,
|
|
171
|
+
});
|
|
142
172
|
await modelerCreatePage.runProcessInstance(alertFlowClusterName);
|
|
143
|
-
await (0, sleep_1.sleep)(10000);
|
|
144
173
|
});
|
|
145
174
|
await _8_7_1.test.step('Navigate to Cluster Details', async () => {
|
|
146
175
|
await appsPage.clickCamundaApps();
|
|
@@ -152,16 +181,18 @@ _8_7_1.test.describe('Console User Flow Tests', () => {
|
|
|
152
181
|
await _8_7_1.test.step('Verify Alert Count Increases to 3 After Trigger', async () => {
|
|
153
182
|
await clusterDetailsPage.clickAlertsTab();
|
|
154
183
|
await (0, test_1.expect)(async () => {
|
|
184
|
+
await clusterDetailsPage.reopenAlertsTab();
|
|
185
|
+
await (0, test_1.expect)(clusterDetailsPage.alertsList.first()).toBeVisible({
|
|
186
|
+
timeout: 20000,
|
|
187
|
+
});
|
|
188
|
+
await clusterDetailsPage.expandAlerts();
|
|
155
189
|
(0, test_1.expect)(await clusterDetailsPage.alertsList.count()).toBeGreaterThan(1);
|
|
156
190
|
await (0, test_1.expect)(clusterDetailsPage.alertsList.nth(1)).toContainText('Amount triggered3');
|
|
157
|
-
}).toPass(
|
|
191
|
+
}).toPass({ timeout: 240000 });
|
|
158
192
|
});
|
|
159
193
|
await _8_7_1.test.step('Verify Alerts Received via Email for Incident', async () => {
|
|
160
194
|
await (0, sleep_1.sleep)(60000);
|
|
161
|
-
|
|
162
|
-
const messages = await (0, googleapi_1.getGmailMessagesWithRetry)(token, senderEmail, processName, lastTriggerTime);
|
|
163
|
-
const emailDetails = await (0, googleapi_1.getLatestEmailDetails)(token, await messages[0]['id']);
|
|
164
|
-
(0, test_1.expect)(emailDetails).toContain('New Incidents: 2'); //# of alerts triggered since the last one
|
|
195
|
+
await (0, UtilitiesPage_1.assertLatestAlertEmail)(id, mailSlurpClient_1.mailSlurp, processName, 'New Incidents: 2');
|
|
165
196
|
});
|
|
166
197
|
});
|
|
167
198
|
(0, _8_7_1.test)('Console Most Common Flow', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, }) => {
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Serializable } from 'playwright-core/types/structs';
|
|
2
|
-
export declare function getGoogleAccessToken(): Promise<any>;
|
|
3
|
-
export declare function getGmailMessagesWithRetry(token: string, sender: string, diagramName: string, laterThan?: number, maxRetries?: number): Promise<Serializable>;
|
|
4
|
-
export declare function getGmailMessages(token: string, sender: string, diagramName: string, laterThan?: number): Promise<Serializable>;
|
|
5
|
-
export declare function getLatestEmailDetails(token: string, emailId: string): Promise<string>;
|
package/dist/utils/googleapi.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getLatestEmailDetails = exports.getGmailMessages = exports.getGmailMessagesWithRetry = exports.getGoogleAccessToken = void 0;
|
|
27
|
-
const test_1 = require("@playwright/test");
|
|
28
|
-
const console = __importStar(require("node:console"));
|
|
29
|
-
const sleep_1 = require("./sleep");
|
|
30
|
-
async function getGoogleAccessToken() {
|
|
31
|
-
const tokenUrl = 'https://oauth2.googleapis.com/token';
|
|
32
|
-
const context = await test_1.request.newContext();
|
|
33
|
-
const response = await context.post(tokenUrl, {
|
|
34
|
-
form: {
|
|
35
|
-
client_id: process.env.GOOGLE_OATH_CLIENT_ID,
|
|
36
|
-
grant_type: 'refresh_token',
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
const responseBody = await response.json();
|
|
40
|
-
(0, test_1.expect)(responseBody).toHaveProperty('access_token');
|
|
41
|
-
(0, test_1.expect)(responseBody.access_token).not.toBeFalsy();
|
|
42
|
-
return responseBody.access_token;
|
|
43
|
-
}
|
|
44
|
-
exports.getGoogleAccessToken = getGoogleAccessToken;
|
|
45
|
-
async function getGmailMessagesWithRetry(token, sender, diagramName, laterThan, maxRetries = 5) {
|
|
46
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
47
|
-
try {
|
|
48
|
-
const messages = await getGmailMessages(token, sender, diagramName, laterThan);
|
|
49
|
-
(0, test_1.expect)(messages.length).toBe(1);
|
|
50
|
-
return messages;
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
if (attempt < maxRetries - 1) {
|
|
54
|
-
console.warn(`Attempt ${attempt + 1} failed for finding alert email ${diagramName}. Retrying...`);
|
|
55
|
-
await (0, sleep_1.sleep)(60000);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
throw new Error(`Failed to find email for ${diagramName} failed after ${maxRetries} attempts`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.getGmailMessagesWithRetry = getGmailMessagesWithRetry;
|
|
64
|
-
async function getGmailMessages(token, sender, diagramName, laterThan) {
|
|
65
|
-
const context = await test_1.request.newContext({
|
|
66
|
-
extraHTTPHeaders: {
|
|
67
|
-
Authorization: `Bearer ${token}`,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
let url = `https://www.googleapis.com/gmail/v1/users/me/messages?q=from:${sender} "${diagramName}"`;
|
|
71
|
-
if (laterThan) {
|
|
72
|
-
url = ` ${url} after:${laterThan}`;
|
|
73
|
-
}
|
|
74
|
-
console.log(url);
|
|
75
|
-
const response = await context.get(url);
|
|
76
|
-
const responseBody = await response.json();
|
|
77
|
-
(0, test_1.expect)(responseBody).toHaveProperty('messages');
|
|
78
|
-
(0, test_1.expect)(responseBody.messages).not.toBeFalsy();
|
|
79
|
-
return responseBody.messages;
|
|
80
|
-
}
|
|
81
|
-
exports.getGmailMessages = getGmailMessages;
|
|
82
|
-
async function getLatestEmailDetails(token, emailId) {
|
|
83
|
-
const context = await test_1.request.newContext({
|
|
84
|
-
extraHTTPHeaders: {
|
|
85
|
-
Authorization: `Bearer ${token}`,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
const response = await context.get(`https://www.googleapis.com/gmail/v1/users/me/messages/${emailId}`);
|
|
89
|
-
const data = await response.json();
|
|
90
|
-
let body = 'No body available';
|
|
91
|
-
if (data.payload.parts) {
|
|
92
|
-
const part = data.payload.parts.find((p) => p.mimeType === 'text/plain');
|
|
93
|
-
if (part && part.body.data) {
|
|
94
|
-
body = Buffer.from(part.body.data, 'base64').toString('utf-8');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else if (data.payload.body.data) {
|
|
98
|
-
body = Buffer.from(data.payload.body.data, 'base64').toString('utf-8');
|
|
99
|
-
}
|
|
100
|
-
return body;
|
|
101
|
-
}
|
|
102
|
-
exports.getLatestEmailDetails = getLatestEmailDetails;
|