@camunda/e2e-test-suite 0.0.1329 → 0.0.1330
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/.github/c8_versions.json +1 -0
- package/README.md +1 -0
- package/dist/fixtures/8.11.d.ts +83 -0
- package/dist/fixtures/8.11.js +203 -0
- package/dist/pages/8.11/AppsPage.d.ts +60 -0
- package/dist/pages/8.11/AppsPage.js +1060 -0
- package/dist/pages/8.11/AuditLogPage.d.ts +14 -0
- package/dist/pages/8.11/AuditLogPage.js +69 -0
- package/dist/pages/8.11/Authorization.d.ts +44 -0
- package/dist/pages/8.11/Authorization.js +409 -0
- package/dist/pages/8.11/ClientCredentialsDetailsPage.d.ts +12 -0
- package/dist/pages/8.11/ClientCredentialsDetailsPage.js +36 -0
- package/dist/pages/8.11/ClusterDetailsPage.d.ts +107 -0
- package/dist/pages/8.11/ClusterDetailsPage.js +892 -0
- package/dist/pages/8.11/ClusterPage.d.ts +96 -0
- package/dist/pages/8.11/ClusterPage.js +657 -0
- package/dist/pages/8.11/ClusterSecretsPage.d.ts +48 -0
- package/dist/pages/8.11/ClusterSecretsPage.js +406 -0
- package/dist/pages/8.11/ConnectorMarketplacePage.d.ts +29 -0
- package/dist/pages/8.11/ConnectorMarketplacePage.js +156 -0
- package/dist/pages/8.11/ConnectorSettingsPage.d.ts +39 -0
- package/dist/pages/8.11/ConnectorSettingsPage.js +150 -0
- package/dist/pages/8.11/ConnectorTemplatePage.d.ts +11 -0
- package/dist/pages/8.11/ConnectorTemplatePage.js +34 -0
- package/dist/pages/8.11/ConsoleOrganizationPage.d.ts +77 -0
- package/dist/pages/8.11/ConsoleOrganizationPage.js +457 -0
- package/dist/pages/8.11/DataFiltersPage.d.ts +30 -0
- package/dist/pages/8.11/DataFiltersPage.js +135 -0
- package/dist/pages/8.11/FormJsPage.d.ts +38 -0
- package/dist/pages/8.11/FormJsPage.js +283 -0
- package/dist/pages/8.11/HomePage.d.ts +29 -0
- package/dist/pages/8.11/HomePage.js +176 -0
- package/dist/pages/8.11/IdpCreatePage.d.ts +118 -0
- package/dist/pages/8.11/IdpCreatePage.js +514 -0
- package/dist/pages/8.11/LoginPage.d.ts +45 -0
- package/dist/pages/8.11/LoginPage.js +214 -0
- package/dist/pages/8.11/ModelerCreatePage.d.ts +256 -0
- package/dist/pages/8.11/ModelerCreatePage.js +2272 -0
- package/dist/pages/8.11/ModelerHomePage.d.ts +100 -0
- package/dist/pages/8.11/ModelerHomePage.js +1168 -0
- package/dist/pages/8.11/ModelerUserInvitePage.d.ts +29 -0
- package/dist/pages/8.11/ModelerUserInvitePage.js +136 -0
- package/dist/pages/8.11/OCIdentityAuthorizationsPage.d.ts +11 -0
- package/dist/pages/8.11/OCIdentityAuthorizationsPage.js +25 -0
- package/dist/pages/8.11/OCIdentityClusterVariablesPage.d.ts +21 -0
- package/dist/pages/8.11/OCIdentityClusterVariablesPage.js +128 -0
- package/dist/pages/8.11/OCIdentityGroupsPage.d.ts +38 -0
- package/dist/pages/8.11/OCIdentityGroupsPage.js +176 -0
- package/dist/pages/8.11/OCIdentityHomePage.d.ts +21 -0
- package/dist/pages/8.11/OCIdentityHomePage.js +111 -0
- package/dist/pages/8.11/OCIdentityMappingRulesPage.d.ts +23 -0
- package/dist/pages/8.11/OCIdentityMappingRulesPage.js +124 -0
- package/dist/pages/8.11/OCIdentityRolesPage.d.ts +43 -0
- package/dist/pages/8.11/OCIdentityRolesPage.js +236 -0
- package/dist/pages/8.11/OperateHomePage.d.ts +28 -0
- package/dist/pages/8.11/OperateHomePage.js +150 -0
- package/dist/pages/8.11/OperateProcessInstancePage.d.ts +43 -0
- package/dist/pages/8.11/OperateProcessInstancePage.js +893 -0
- package/dist/pages/8.11/OperateProcessesPage.d.ts +28 -0
- package/dist/pages/8.11/OperateProcessesPage.js +153 -0
- package/dist/pages/8.11/OptimizeCollectionsPage.d.ts +30 -0
- package/dist/pages/8.11/OptimizeCollectionsPage.js +175 -0
- package/dist/pages/8.11/OptimizeDashboardPage.d.ts +11 -0
- package/dist/pages/8.11/OptimizeDashboardPage.js +71 -0
- package/dist/pages/8.11/OptimizeHomePage.d.ts +17 -0
- package/dist/pages/8.11/OptimizeHomePage.js +171 -0
- package/dist/pages/8.11/OptimizeReportPage.d.ts +49 -0
- package/dist/pages/8.11/OptimizeReportPage.js +184 -0
- package/dist/pages/8.11/OptimizeSharePage.d.ts +16 -0
- package/dist/pages/8.11/OptimizeSharePage.js +100 -0
- package/dist/pages/8.11/PlayPage.d.ts +17 -0
- package/dist/pages/8.11/PlayPage.js +157 -0
- package/dist/pages/8.11/ProcessApplicationPage.d.ts +32 -0
- package/dist/pages/8.11/ProcessApplicationPage.js +496 -0
- package/dist/pages/8.11/SettingsPage.d.ts +10 -0
- package/dist/pages/8.11/SettingsPage.js +53 -0
- package/dist/pages/8.11/SignUpPage.d.ts +42 -0
- package/dist/pages/8.11/SignUpPage.js +134 -0
- package/dist/pages/8.11/TaskDetailsPage.d.ts +77 -0
- package/dist/pages/8.11/TaskDetailsPage.js +324 -0
- package/dist/pages/8.11/TaskPanelPage.d.ts +26 -0
- package/dist/pages/8.11/TaskPanelPage.js +245 -0
- package/dist/pages/8.11/TaskProcessesPage.d.ts +18 -0
- package/dist/pages/8.11/TaskProcessesPage.js +134 -0
- package/dist/pages/8.11/UtilitiesPage.d.ts +56 -0
- package/dist/pages/8.11/UtilitiesPage.js +1024 -0
- package/dist/pages/8.11/WorkspaceMembersPage.d.ts +21 -0
- package/dist/pages/8.11/WorkspaceMembersPage.js +268 -0
- package/dist/tests/8.11/access-user-role-management.spec.d.ts +1 -0
- package/dist/tests/8.11/access-user-role-management.spec.js +487 -0
- package/dist/tests/8.11/agentic-ai-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/agentic-ai-user-flows.spec.js +209 -0
- package/dist/tests/8.11/aws-cluster-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/aws-cluster-user-flows.spec.js +188 -0
- package/dist/tests/8.11/aws-connectors-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/aws-connectors-user-flows.spec.js +167 -0
- package/dist/tests/8.11/cluster-variables.spec.d.ts +1 -0
- package/dist/tests/8.11/cluster-variables.spec.js +202 -0
- package/dist/tests/8.11/connectors-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/connectors-user-flows.spec.js +537 -0
- package/dist/tests/8.11/console-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/console-user-flows.spec.js +199 -0
- package/dist/tests/8.11/hto-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/hto-user-flows.spec.js +358 -0
- package/dist/tests/8.11/idp-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/idp-user-flows.spec.js +316 -0
- package/dist/tests/8.11/login-negative-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/login-negative-tests.spec.js +29 -0
- package/dist/tests/8.11/login.spec.d.ts +1 -0
- package/dist/tests/8.11/login.spec.js +29 -0
- package/dist/tests/8.11/navigation.spec.d.ts +1 -0
- package/dist/tests/8.11/navigation.spec.js +59 -0
- package/dist/tests/8.11/operate-access-flow.spec.d.ts +1 -0
- package/dist/tests/8.11/operate-access-flow.spec.js +136 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-api.spec.js +96 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-agentic-control-panel-ui.spec.js +69 -0
- package/dist/tests/8.11/optimize-api-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-api-tests.spec.js +1194 -0
- package/dist/tests/8.11/optimize-collections-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-collections-api.spec.js +184 -0
- package/dist/tests/8.11/optimize-collections-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-collections-ui.spec.js +46 -0
- package/dist/tests/8.11/optimize-data-filters-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-data-filters-api.spec.js +195 -0
- package/dist/tests/8.11/optimize-data-filters-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-data-filters-ui.spec.js +306 -0
- package/dist/tests/8.11/optimize-exporter-filters-importer-e2e.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-exporter-filters-importer-e2e.spec.js +316 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-api.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-api.spec.js +337 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-ui.spec.d.ts +1 -0
- package/dist/tests/8.11/optimize-sharing-alerts-export-ui.spec.js +198 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-audit-log.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-audit-log.spec.js +146 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-call-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-call-tools.spec.js +208 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-e2e-flow.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-e2e-flow.spec.js +151 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-list-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/api/mcp-processes-list-tools.spec.js +242 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-cluster-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-cluster-tools.spec.js +75 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-incident-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-incident-tools.spec.js +123 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-user-task-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-user-task-tools.spec.js +151 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-variable-tools.spec.d.ts +1 -0
- package/dist/tests/8.11/orchestration-cluster-mcp-server/mcp-variable-tools.spec.js +123 -0
- package/dist/tests/8.11/play.spec.d.ts +1 -0
- package/dist/tests/8.11/play.spec.js +93 -0
- package/dist/tests/8.11/rba-enabled-v2-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/rba-enabled-v2-user-flows.spec.js +495 -0
- package/dist/tests/8.11/saas-migration-path-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/saas-migration-path-user-flows.spec.js +133 -0
- package/dist/tests/8.11/smoke-tests.spec.d.ts +1 -0
- package/dist/tests/8.11/smoke-tests.spec.js +339 -0
- package/dist/tests/8.11/test-setup.spec.d.ts +1 -0
- package/dist/tests/8.11/test-setup.spec.js +256 -0
- package/dist/tests/8.11/web-modeler-user-flows.spec.d.ts +1 -0
- package/dist/tests/8.11/web-modeler-user-flows.spec.js +523 -0
- package/dist/utils/clusterVersions.d.ts +2 -1
- package/dist/utils/clusterVersions.js +1 -0
- package/dist/utils/consoleApiHelpers.js +1 -0
- package/package.json +1 -1
- package/playwright.config.ts +10 -0
|
@@ -0,0 +1,1024 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitForLoadingToFinish = exports.assertTestUsesCorrectOrganizationFromModeler = exports.expectCountToBeOneOf = exports.ensureDefaultClusterApiCredentials = exports.createAPIClient = exports.modelAndRunConnectorsTimerEventDiagram = exports.modelAndRunConnectorsDocHandlingDiagram = exports.deleteCluster = exports.deleteAllUserGroups = exports.assertTestUsesCorrectOrganization = exports.assertLatestAlertEmail = exports.clickInvitationLinkInEmail = exports.enableAuthorizations = exports.disableRBA = exports.goBackWithRetry = exports.consoleSessionRecovery = exports.runMultipleProcesses = exports.runProcess = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.openAppTabWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.modelDiagramFromFile = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const ModelerHomePage_1 = require("./ModelerHomePage");
|
|
6
|
+
const HomePage_1 = require("./HomePage");
|
|
7
|
+
const sleep_1 = require("../../utils/sleep");
|
|
8
|
+
const randomSleep_1 = require("../../utils/randomSleep");
|
|
9
|
+
const authErrorClassification_1 = require("../../utils/authErrorClassification");
|
|
10
|
+
const LoginPage_1 = require("./LoginPage");
|
|
11
|
+
const fileUpload_1 = require("../../utils/fileUpload");
|
|
12
|
+
const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
|
|
13
|
+
const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
|
|
14
|
+
async function clearWebStorage(page) {
|
|
15
|
+
await page
|
|
16
|
+
.evaluate(() => {
|
|
17
|
+
try {
|
|
18
|
+
localStorage.clear();
|
|
19
|
+
}
|
|
20
|
+
catch (_) {
|
|
21
|
+
// ignore — storage may be unavailable in some contexts
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
sessionStorage.clear();
|
|
25
|
+
}
|
|
26
|
+
catch (_) {
|
|
27
|
+
// ignore — storage may be unavailable in some contexts
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.catch(() => { });
|
|
31
|
+
}
|
|
32
|
+
// Waits for the auth0 login form, re-asking Console for the auth redirect
|
|
33
|
+
// between checks instead of idling on whatever page the browser landed on.
|
|
34
|
+
//
|
|
35
|
+
// A single passive `expect.poll` cannot recover the two ways this hand-off
|
|
36
|
+
// fails: Console swallowing the redirect (the tab stays on a page that will
|
|
37
|
+
// never render a login form), or a session that outlived the cookie wipe (the
|
|
38
|
+
// authenticated shell renders instead). In both cases nothing changes on its
|
|
39
|
+
// own, so the poll burns its whole budget and the login attempt is lost --
|
|
40
|
+
// three of those in a row is exactly the reported "Login failed after 3
|
|
41
|
+
// attempts: ... Timeout 60000ms exceeded while waiting on the predicate".
|
|
42
|
+
// Re-navigating to '/' re-triggers the redirect, and dropping cookies +
|
|
43
|
+
// storage first evicts a surviving session, so the hand-off self-heals inside
|
|
44
|
+
// the attempt rather than costing one.
|
|
45
|
+
async function waitForLoginForm(page, loginPage, totalTimeout = 90000, roundTimeout = 20000) {
|
|
46
|
+
const deadline = Date.now() + totalTimeout;
|
|
47
|
+
const homePage = new HomePage_1.HomePage(page);
|
|
48
|
+
let lastState = 'no login form';
|
|
49
|
+
while (Date.now() < deadline) {
|
|
50
|
+
const round = Math.min(roundTimeout, deadline - Date.now());
|
|
51
|
+
// The identity provider occasionally returns a generic error / rate
|
|
52
|
+
// limit page that has none of the usual auth controls. Checked once per
|
|
53
|
+
// iteration, outside expect.poll: a throw inside a poll predicate is
|
|
54
|
+
// swallowed and retried by design, which would burn this function's
|
|
55
|
+
// whole budget waiting for a login form that will never appear. Bailing
|
|
56
|
+
// out immediately with a typed marker lets loginWithRetry's caller back
|
|
57
|
+
// off long enough to actually outlast the rate-limit window instead.
|
|
58
|
+
await (0, authErrorClassification_1.throwIfAuthErrorPage)(page);
|
|
59
|
+
try {
|
|
60
|
+
// Confirm we reached the login page before filling credentials.
|
|
61
|
+
// Without this check the locator for 'Email address' can match a hidden
|
|
62
|
+
// invite-user input on the Console page when the logout redirect has not
|
|
63
|
+
// yet completed, causing a 200 s wait before failing.
|
|
64
|
+
await test_1.expect
|
|
65
|
+
.poll(async () => {
|
|
66
|
+
const [loginMessageVisible, passwordHeadingVisible, usernameVisible, passwordVisible,] = await Promise.all([
|
|
67
|
+
loginPage.loginMessage.isVisible().catch(() => false),
|
|
68
|
+
loginPage.passwordHeading.isVisible().catch(() => false),
|
|
69
|
+
loginPage.usernameInput.locator.isVisible().catch(() => false),
|
|
70
|
+
loginPage.passwordInput.isVisible().catch(() => false),
|
|
71
|
+
]);
|
|
72
|
+
return (loginMessageVisible ||
|
|
73
|
+
passwordHeadingVisible ||
|
|
74
|
+
usernameVisible ||
|
|
75
|
+
passwordVisible);
|
|
76
|
+
}, { timeout: round })
|
|
77
|
+
.toBe(true);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// No login form this round — establish why, then re-ask for the redirect.
|
|
82
|
+
lastState = `no login form on ${page.url()}`;
|
|
83
|
+
}
|
|
84
|
+
const authenticated = await homePage.camundaComponentsButton
|
|
85
|
+
.isVisible()
|
|
86
|
+
.catch(() => false);
|
|
87
|
+
if (authenticated) {
|
|
88
|
+
lastState = 'an authenticated Console shell — no auth0 hand-off happened';
|
|
89
|
+
// The session survived the cookie wipe done before this wait; drop it
|
|
90
|
+
// again so the navigation below has to go through auth0.
|
|
91
|
+
await page.context().clearCookies();
|
|
92
|
+
await clearWebStorage(page);
|
|
93
|
+
}
|
|
94
|
+
if (Date.now() >= deadline) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
98
|
+
}
|
|
99
|
+
throw new Error(`Auth0 login form did not render within ${totalTimeout}ms: ${lastState}`);
|
|
100
|
+
}
|
|
101
|
+
// Tracks which worker-derived `timeout` values have already paid the
|
|
102
|
+
// stagger sleep below, so a worker only pays it once per process lifetime
|
|
103
|
+
// rather than on every call -- see the comment at the call site.
|
|
104
|
+
const staggeredWorkerTimeouts = new Set();
|
|
105
|
+
const onboardingTourSuppressed = new WeakSet();
|
|
106
|
+
// Mirrors camunda-hub@452978f: pre-seed the onboarding tour's "seen" localStorage flag
|
|
107
|
+
// (SEEN_KEY_PREFIX in .../tour-dialog/use-onboarding-seen.ts) so it never auto-opens. The
|
|
108
|
+
// "Welcome to Camunda Hub" tour mounts app-wide -- Console included, not just Modeler -- and
|
|
109
|
+
// hides the post-login shell from the accessibility tree until dismissed, which times out
|
|
110
|
+
// assertTestUsesCorrectOrganization's banner check. addInitScript runs before any page
|
|
111
|
+
// script on every navigation/reload, so there's no login-response race to lose; the flag is
|
|
112
|
+
// matched by prefix since the user id isn't known ahead of login.
|
|
113
|
+
async function suppressOnboardingTour(page) {
|
|
114
|
+
if (onboardingTourSuppressed.has(page)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
onboardingTourSuppressed.add(page);
|
|
118
|
+
await page.addInitScript((prefixPattern) => {
|
|
119
|
+
const pattern = new RegExp(prefixPattern);
|
|
120
|
+
const originalGetItem = Storage.prototype.getItem;
|
|
121
|
+
Storage.prototype.getItem = function (key) {
|
|
122
|
+
return pattern.test(key) ? 'true' : originalGetItem.call(this, key);
|
|
123
|
+
};
|
|
124
|
+
}, '^hub\\.onboarding\\..*\\.seen\\.');
|
|
125
|
+
}
|
|
126
|
+
async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 5) {
|
|
127
|
+
// A blank credential is not something retrying can fix, and from inside the
|
|
128
|
+
// browser it does not look like a credential problem at all: the form takes
|
|
129
|
+
// the empty password, auth0 keeps the tab on its own page, and the failure
|
|
130
|
+
// surfaces a minute later as the Console banner "element(s) not found" --
|
|
131
|
+
// five times over, plus the test-level retry.
|
|
132
|
+
//
|
|
133
|
+
// Run 35320545635 spent 22 minutes that way on one empty password, and since
|
|
134
|
+
// the caller is test-setup.spec.ts the 239 tests depending on that setup
|
|
135
|
+
// project never ran. The password was empty because GitHub refused to set
|
|
136
|
+
// the job output carrying it ("Skip output 'c8_org_1_admin_9_password' since
|
|
137
|
+
// it may contain secret" in the create-organization job): a job output whose
|
|
138
|
+
// value contains a masked secret is dropped, and a freshly generated Console
|
|
139
|
+
// password can contain one by chance -- this repo already has a masked value
|
|
140
|
+
// two characters long, see the counting trap in
|
|
141
|
+
// docs/saas-login-investigation.md. Which password it hits is luck, so the
|
|
142
|
+
// job cannot be trusted to have delivered them all. Say so here, in one
|
|
143
|
+
// second, instead of spending the suite's budget proving it through the UI.
|
|
144
|
+
if (!testUser?.username || !testUser?.password) {
|
|
145
|
+
const missing = [
|
|
146
|
+
testUser?.username ? null : 'username',
|
|
147
|
+
testUser?.password ? null : 'password',
|
|
148
|
+
]
|
|
149
|
+
.filter(Boolean)
|
|
150
|
+
.join(' and ');
|
|
151
|
+
throw new Error(`Cannot log in: this test user has no ${missing}. The credential never ` +
|
|
152
|
+
'reached the runner -- check the create-organization job for a ' +
|
|
153
|
+
'"Skip output ... since it may contain secret" warning on the ' +
|
|
154
|
+
'matching C8_*_PASSWORD output.');
|
|
155
|
+
}
|
|
156
|
+
await suppressOnboardingTour(page);
|
|
157
|
+
let lastError;
|
|
158
|
+
// `timeout` is a stable per-worker identifier (derived from workerIndex),
|
|
159
|
+
// and a worker is a long-lived process across every test/repeat it runs, so
|
|
160
|
+
// the stagger below only needs to happen for that worker's first call in
|
|
161
|
+
// the whole job. A --repeat-each validation pass otherwise pays it on
|
|
162
|
+
// every repeat instead of just the first (team-test-automation#78).
|
|
163
|
+
const isWorkersFirstCall = !staggeredWorkerTimeouts.has(timeout);
|
|
164
|
+
staggeredWorkerTimeouts.add(timeout);
|
|
165
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
166
|
+
try {
|
|
167
|
+
await page.context().clearCookies();
|
|
168
|
+
// The Hub bearer-token cache in consoleApiHelpers.ts is keyed by Page
|
|
169
|
+
// for the tab's whole lifetime; without clearing it here alongside
|
|
170
|
+
// cookies/storage, a flow that logs a different user into the same
|
|
171
|
+
// page could have getUserToken() return the PREVIOUS user's token.
|
|
172
|
+
// Listen from before Hub loads: an API helper called later on an idle
|
|
173
|
+
// Hub page would otherwise find no request carrying the token.
|
|
174
|
+
(0, consoleApiHelpers_1.observeBearerTokens)(page);
|
|
175
|
+
await page.goto('about:blank');
|
|
176
|
+
// After about:blank: until then the previous user's Hub page can still
|
|
177
|
+
// send a request, and its token must not count for the new session.
|
|
178
|
+
(0, consoleApiHelpers_1.resetHubBearerToken)(page);
|
|
179
|
+
await page
|
|
180
|
+
.evaluate(() => {
|
|
181
|
+
try {
|
|
182
|
+
localStorage.clear();
|
|
183
|
+
}
|
|
184
|
+
catch (_) {
|
|
185
|
+
// storage may be unavailable in some contexts
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
sessionStorage.clear();
|
|
189
|
+
}
|
|
190
|
+
catch (_) {
|
|
191
|
+
// storage may be unavailable in some contexts
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
.catch(() => { });
|
|
195
|
+
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
196
|
+
// The evaluate above ran on about:blank, not on the Console domain, so it
|
|
197
|
+
// did not clear Console's own localStorage. Clear it now while on the
|
|
198
|
+
// Console domain, then reload to force a fresh auth check with no cached
|
|
199
|
+
// tokens — without this, Console can keep a session alive via localStorage
|
|
200
|
+
// even after cookies are cleared, preventing the auth0 redirect.
|
|
201
|
+
await page
|
|
202
|
+
.evaluate(() => {
|
|
203
|
+
try {
|
|
204
|
+
localStorage.clear();
|
|
205
|
+
}
|
|
206
|
+
catch (_) {
|
|
207
|
+
// ignore — storage may be unavailable in some contexts
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
sessionStorage.clear();
|
|
211
|
+
}
|
|
212
|
+
catch (_) {
|
|
213
|
+
// ignore — storage may be unavailable in some contexts
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
.catch(() => { });
|
|
217
|
+
await page
|
|
218
|
+
.reload({ waitUntil: 'domcontentloaded', timeout: 60000 })
|
|
219
|
+
.catch(() => { });
|
|
220
|
+
await page
|
|
221
|
+
.waitForLoadState('networkidle', { timeout: 30000 })
|
|
222
|
+
.catch(() => { });
|
|
223
|
+
if (isWorkersFirstCall) {
|
|
224
|
+
await (0, sleep_1.sleep)(timeout);
|
|
225
|
+
}
|
|
226
|
+
await waitForLoginForm(page, loginPage);
|
|
227
|
+
await loginPage.loginWithTestUser(testUser);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
lastError = error;
|
|
232
|
+
// A rejected password or a blocked account is a credential/
|
|
233
|
+
// provisioning-level failure, not a transient one: every attempt
|
|
234
|
+
// resubmits the same env-supplied credentials, so retrying just
|
|
235
|
+
// reproduces the same rejection up to maxRetries times (observed:
|
|
236
|
+
// ~6 minutes burned across 5 identical "Wrong email or password"
|
|
237
|
+
// cycles for one seeded user). Fail on the first rejection instead.
|
|
238
|
+
if (String(error).includes(authErrorClassification_1.AUTH0_INVALID_CREDENTIALS) ||
|
|
239
|
+
String(error).includes(authErrorClassification_1.AUTH0_ACCOUNT_BLOCKED)) {
|
|
240
|
+
console.error(lastError);
|
|
241
|
+
throw lastError;
|
|
242
|
+
}
|
|
243
|
+
if (attempt < maxRetries - 1) {
|
|
244
|
+
const rateLimited = String(error).includes(authErrorClassification_1.AUTH0_RATE_LIMIT);
|
|
245
|
+
console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying with clean session...`, error);
|
|
246
|
+
if (rateLimited) {
|
|
247
|
+
// Auth0 rate-limit windows commonly last 30-90s. Back off long
|
|
248
|
+
// enough to outlast the window before the next attempt, rather
|
|
249
|
+
// than retrying inside it and burning another attempt for free.
|
|
250
|
+
await (0, randomSleep_1.randomSleep)(60000, 90000);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
await (0, randomSleep_1.randomSleep)(10000, 20000);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
console.error(lastError);
|
|
258
|
+
throw new Error(`Login failed after ${maxRetries} attempts: ${String(lastError)}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.loginWithRetry = loginWithRetry;
|
|
264
|
+
// True once the tab has been thrown out of the app and back to the IdP: the
|
|
265
|
+
// Modeler hand-off can commit `/login-callback?code=...` and then bounce
|
|
266
|
+
// straight back to `modeler.<host>/login` and on to `weblogin.<host>`, leaving
|
|
267
|
+
// an Auth0 form where the app used to be. Distinct from
|
|
268
|
+
// `AppsPage.isModelerAuthTransit`, which covers a hand-off still in flight.
|
|
269
|
+
function isSignedOut(page) {
|
|
270
|
+
try {
|
|
271
|
+
const { hostname, pathname } = new URL(page.url());
|
|
272
|
+
return (hostname.startsWith('weblogin.') ||
|
|
273
|
+
(hostname.startsWith('modeler.') && /^\/login\/?$/.test(pathname)));
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
// Not a parsable URL yet (e.g. a tab still on about:blank).
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
exports.isSignedOut = isSignedOut;
|
|
281
|
+
// Runs `action`, and if it fails because the session was dropped mid-flow,
|
|
282
|
+
// signs back in, returns to the Modeler projects list and runs it again.
|
|
283
|
+
//
|
|
284
|
+
// Without this the caller's own locator retries keep hunting for app controls
|
|
285
|
+
// on the Auth0 form and expire against a page that is not the app at all —
|
|
286
|
+
// reported as a misleading "Failed to click locator ... New project" rather
|
|
287
|
+
// than as the sign-out it actually was. Only a confirmed sign-out is retried;
|
|
288
|
+
// any other failure propagates untouched, so a genuinely broken control still
|
|
289
|
+
// fails the test.
|
|
290
|
+
//
|
|
291
|
+
// Recovers up to `maxRecoveries` times rather than once: under a concurrent
|
|
292
|
+
// login burst the SaaS `/api/internal/login` hand-off can 500 and bounce the
|
|
293
|
+
// tab back to Auth0 (see AppsPage.openModelerWithRetry) more than once in a
|
|
294
|
+
// row, so the lowest-staggered workers get dropped, recovered, then dropped
|
|
295
|
+
// again — spending the single recovery before landing a stable session. A
|
|
296
|
+
// bounded re-login loop (the same shape as loginWithRetry's own retries) lets
|
|
297
|
+
// those tail sessions settle; a session that never stabilises still exhausts
|
|
298
|
+
// the loop and fails, so a genuinely broken login is not masked.
|
|
299
|
+
async function withSessionRecovery(page, loginPage, appsPage, modelerBanner, testUser, loginStagger, action, maxRecoveries = 2) {
|
|
300
|
+
for (let recovery = 0; recovery <= maxRecoveries; recovery++) {
|
|
301
|
+
try {
|
|
302
|
+
await action();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
// A mid-flow sign-out redirects to the IdP asynchronously: at the instant
|
|
307
|
+
// action() throws, the tab can still report the Modeler URL for a beat
|
|
308
|
+
// before it commits to weblogin.*, so a single synchronous isSignedOut()
|
|
309
|
+
// check reads "still signed in" and the recovery below never fires -- the
|
|
310
|
+
// error then propagates while the tab drifts on to the login page, which
|
|
311
|
+
// is exactly how a create-button-never-visible timeout presented on the
|
|
312
|
+
// isolated provisioning burst. Give the redirect a bounded window to land
|
|
313
|
+
// before deciding whether this was a dropped session.
|
|
314
|
+
if (!isSignedOut(page)) {
|
|
315
|
+
try {
|
|
316
|
+
await page.waitForURL((url) => url.hostname.startsWith('weblogin.') ||
|
|
317
|
+
(url.hostname.startsWith('modeler.') &&
|
|
318
|
+
/^\/login\/?$/.test(url.pathname)), { timeout: 15000 });
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
// Redirect never landed within the window: this was not a dropped
|
|
322
|
+
// session, so fall through and let the original error propagate.
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (!isSignedOut(page) || recovery === maxRecoveries) {
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
console.warn(`Session was dropped mid-flow (tab landed on ${page.url()}); ` +
|
|
329
|
+
`signing back in and retrying (recovery ${recovery + 1} of ` +
|
|
330
|
+
`${maxRecoveries}).`);
|
|
331
|
+
}
|
|
332
|
+
await loginWithRetry(page, loginPage, testUser, loginStagger);
|
|
333
|
+
await appsPage.openModelerWithRetry(modelerBanner);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
exports.withSessionRecovery = withSessionRecovery;
|
|
337
|
+
async function modelDiagramFromFile(page, modelerHomePage, modelerCreatePage, processName, fileName = '', nrOfRenamedUserTasks = 0, taskName = '') {
|
|
338
|
+
await modelerHomePage.clickDiagramTypeDropdown();
|
|
339
|
+
await modelerHomePage.clickUploadFilesButton();
|
|
340
|
+
await (0, fileUpload_1.uploadFile)(page, fileName + '.bpmn');
|
|
341
|
+
await modelerHomePage.clickProcessDiagram(fileName);
|
|
342
|
+
await modelerCreatePage.clickDiagramBreadcrumb();
|
|
343
|
+
await modelerCreatePage.clickEditDiagramNameButton();
|
|
344
|
+
await modelerCreatePage.enterDiagramName(processName);
|
|
345
|
+
await (0, sleep_1.sleep)(1000);
|
|
346
|
+
await modelerCreatePage.clickGeneralPropertiesPanel();
|
|
347
|
+
await modelerCreatePage.clickNameInput();
|
|
348
|
+
await modelerCreatePage.fillNamedInput(processName);
|
|
349
|
+
await modelerCreatePage.clickIdInput();
|
|
350
|
+
await modelerCreatePage.fillIdInput(processName);
|
|
351
|
+
if (nrOfRenamedUserTasks > 0) {
|
|
352
|
+
for (let i = 1; i <= nrOfRenamedUserTasks; i++) {
|
|
353
|
+
await modelerCreatePage.clickUserTask('process' + i);
|
|
354
|
+
await modelerCreatePage.clickNameInput();
|
|
355
|
+
await modelerCreatePage.fillNamedInput(taskName + i);
|
|
356
|
+
await modelerCreatePage.clickIdInput();
|
|
357
|
+
await modelerCreatePage.fillIdInput(taskName + i);
|
|
358
|
+
await modelerCreatePage.clickCanvas();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
await (0, sleep_1.sleep)(10000);
|
|
362
|
+
}
|
|
363
|
+
exports.modelDiagramFromFile = modelDiagramFromFile;
|
|
364
|
+
async function modelRestConnector(modelerCreatePage, connectorSettingsPage, processName, url, auth, resultExpression, resultVariable = '', basicAuthCredentials = {
|
|
365
|
+
username: '',
|
|
366
|
+
password: '',
|
|
367
|
+
}) {
|
|
368
|
+
// Same gate as `modelJobWorkerDiagram` (120s) and
|
|
369
|
+
// `modelCamundaUserTaskDiagram` (180s): the properties panel renders once the
|
|
370
|
+
// new BPMN template has finished opening. 15s was the outlier here, and a
|
|
371
|
+
// slow template load failed with
|
|
372
|
+
// `locator('[data-group-id="group-general"]') ... element(s) not found`
|
|
373
|
+
// before any modelling had started.
|
|
374
|
+
await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
|
|
375
|
+
timeout: 120000,
|
|
376
|
+
});
|
|
377
|
+
await modelerCreatePage.enterDiagramName(processName);
|
|
378
|
+
await (0, sleep_1.sleep)(10000);
|
|
379
|
+
await modelerCreatePage.clickCanvas();
|
|
380
|
+
await modelerCreatePage.clickGeneralPropertiesPanel();
|
|
381
|
+
await modelerCreatePage.clickNameInput();
|
|
382
|
+
await modelerCreatePage.fillNamedInput(processName);
|
|
383
|
+
await modelerCreatePage.clickIdInput();
|
|
384
|
+
await modelerCreatePage.fillIdInput(processName);
|
|
385
|
+
await modelerCreatePage.clickStartEventElement();
|
|
386
|
+
await modelerCreatePage.clickAppendElementButton();
|
|
387
|
+
await modelerCreatePage.clickAppendTaskButton();
|
|
388
|
+
await modelerCreatePage.clickChangeTypeButton();
|
|
389
|
+
await modelerCreatePage.clickRestConnectorOption();
|
|
390
|
+
await connectorSettingsPage.clickAuthenticationTab();
|
|
391
|
+
await connectorSettingsPage.clickHTTPEndpointTab();
|
|
392
|
+
if (auth == 'bearer') {
|
|
393
|
+
await connectorSettingsPage.selectAuthenticationType('bearer');
|
|
394
|
+
await (0, test_1.expect)(connectorSettingsPage.bearerTokenInput).toBeVisible({
|
|
395
|
+
timeout: 10000,
|
|
396
|
+
});
|
|
397
|
+
await connectorSettingsPage.clickBearerTokenInput();
|
|
398
|
+
await connectorSettingsPage.fillBearerTokenInput('thisisabearertoken');
|
|
399
|
+
await (0, test_1.expect)(connectorSettingsPage.methodTypeDropdown).toBeVisible({
|
|
400
|
+
timeout: 10000,
|
|
401
|
+
});
|
|
402
|
+
await connectorSettingsPage.selectMethodType('POST');
|
|
403
|
+
}
|
|
404
|
+
else if (auth == 'basic') {
|
|
405
|
+
await connectorSettingsPage.selectAuthenticationType('basic');
|
|
406
|
+
await (0, test_1.expect)(connectorSettingsPage.usernameInput).toBeVisible({
|
|
407
|
+
timeout: 60000,
|
|
408
|
+
});
|
|
409
|
+
await connectorSettingsPage.clickUsernameInput();
|
|
410
|
+
(0, test_1.expect)(basicAuthCredentials['username'].length).toBeGreaterThan(0);
|
|
411
|
+
(0, test_1.expect)(basicAuthCredentials['password'].length).toBeGreaterThan(0);
|
|
412
|
+
await connectorSettingsPage.fillUsernameInput(basicAuthCredentials['username']);
|
|
413
|
+
await connectorSettingsPage.clickPasswordInput();
|
|
414
|
+
await connectorSettingsPage.fillPasswordInput(basicAuthCredentials['password']);
|
|
415
|
+
await connectorSettingsPage.selectMethodType('POST');
|
|
416
|
+
}
|
|
417
|
+
await connectorSettingsPage.clickUrlInput();
|
|
418
|
+
await connectorSettingsPage.fillUrlInput(url);
|
|
419
|
+
await connectorSettingsPage.clickOutputMappingTab();
|
|
420
|
+
if (resultVariable.length > 0) {
|
|
421
|
+
await connectorSettingsPage.clickResultVariableInput();
|
|
422
|
+
await connectorSettingsPage.fillResultVariableInput('result');
|
|
423
|
+
await (0, sleep_1.sleep)(3000);
|
|
424
|
+
}
|
|
425
|
+
await connectorSettingsPage.clickResultExpressionInput();
|
|
426
|
+
await connectorSettingsPage.fillResultExpressionInput(resultExpression);
|
|
427
|
+
await (0, sleep_1.sleep)(3000);
|
|
428
|
+
await modelerCreatePage.clickAppendElementButton();
|
|
429
|
+
await modelerCreatePage.clickAppendEndEventButton();
|
|
430
|
+
await (0, sleep_1.sleep)(10000);
|
|
431
|
+
}
|
|
432
|
+
exports.modelRestConnector = modelRestConnector;
|
|
433
|
+
async function assertLocatorVisibleWithRetry(page, locator, text, timeout = 60000, notVisible, maxRetries = 6, clickLocator) {
|
|
434
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
435
|
+
try {
|
|
436
|
+
if (clickLocator) {
|
|
437
|
+
await (0, test_1.expect)(clickLocator).toBeVisible({
|
|
438
|
+
timeout: 30000,
|
|
439
|
+
});
|
|
440
|
+
await clickLocator.click();
|
|
441
|
+
}
|
|
442
|
+
if (notVisible == true) {
|
|
443
|
+
await (0, sleep_1.sleep)(10000);
|
|
444
|
+
await (0, test_1.expect)(locator.first()).not.toBeVisible({
|
|
445
|
+
timeout: timeout,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
await (0, test_1.expect)(locator).toBeVisible({
|
|
450
|
+
timeout: timeout,
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
if (attempt < maxRetries - 1) {
|
|
457
|
+
console.warn(`Attempt ${attempt + 1} failed for asserting ${text}. Retrying...`);
|
|
458
|
+
// The reload is only the recovery step: when it races an in-flight
|
|
459
|
+
// navigation (`net::ERR_ABORTED; maybe frame was detached?`) or hits a
|
|
460
|
+
// DNS blip (`net::ERR_NAME_NOT_RESOLVED`) it used to escape this catch
|
|
461
|
+
// and fail the test instead of letting the next attempt re-assert.
|
|
462
|
+
try {
|
|
463
|
+
await page.reload();
|
|
464
|
+
}
|
|
465
|
+
catch (reloadError) {
|
|
466
|
+
console.warn(`Could not reload while asserting ${text}: ${reloadError}`);
|
|
467
|
+
}
|
|
468
|
+
await (0, sleep_1.sleep)(10000);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
throw new Error(`Assertion of ${text} failed after ${maxRetries} attempts`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
exports.assertLocatorVisibleWithRetry = assertLocatorVisibleWithRetry;
|
|
477
|
+
// Clicks a link/button that opens another Camunda app in a new tab and returns
|
|
478
|
+
// that tab, retrying the click when no tab appears.
|
|
479
|
+
//
|
|
480
|
+
// The wait is registered BEFORE each click because Playwright only reports
|
|
481
|
+
// events raised after it is called and the tab opens while the click is still
|
|
482
|
+
// resolving. That alone is not enough though: the "View process instance"
|
|
483
|
+
// control lives in Modeler's post-deployment notification, and a click that
|
|
484
|
+
// lands while that notification is being torn down resolves without ever
|
|
485
|
+
// running its handler — no tab is opened, and the wait then sits out its full
|
|
486
|
+
// budget on a click that silently did nothing ("page.waitForEvent: Timeout
|
|
487
|
+
// 60000ms exceeded while waiting for event \"popup\""). Re-clicking recovers
|
|
488
|
+
// that, so long as the control is still on screen; when it is gone the loop
|
|
489
|
+
// stops immediately rather than burning another click timeout on it.
|
|
490
|
+
async function openAppTabWithRetry(page, link, timeout = 60000, maxRetries = 3, clickTimeout = 180000) {
|
|
491
|
+
const context = page.context();
|
|
492
|
+
const knownPages = new Set(context.pages());
|
|
493
|
+
let lastError;
|
|
494
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
495
|
+
if (attempt > 1 && !(await link.isVisible().catch(() => false))) {
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
const appTabPromise = page.waitForEvent('popup', { timeout });
|
|
499
|
+
let clickError;
|
|
500
|
+
try {
|
|
501
|
+
await link.click({ timeout: clickTimeout });
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
clickError = error;
|
|
505
|
+
}
|
|
506
|
+
try {
|
|
507
|
+
// Always awaited, even when the click threw, so the wait can never
|
|
508
|
+
// reject unobserved.
|
|
509
|
+
return await appTabPromise;
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
lastError = clickError ?? error;
|
|
513
|
+
// The click may still have opened the tab without the wait observing it.
|
|
514
|
+
const opened = context.pages().find((tab) => !knownPages.has(tab));
|
|
515
|
+
if (opened !== undefined) {
|
|
516
|
+
return opened;
|
|
517
|
+
}
|
|
518
|
+
console.warn(`Attempt ${attempt} to open the app tab failed: ${error}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
throw new Error(`Failed to open the app tab after ${maxRetries} attempts: ${lastError}`);
|
|
522
|
+
}
|
|
523
|
+
exports.openAppTabWithRetry = openAppTabWithRetry;
|
|
524
|
+
async function assertPageTextWithRetry(page, text, notVisible = false, timeout = 60000, maxRetries = 10) {
|
|
525
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
526
|
+
try {
|
|
527
|
+
if (notVisible) {
|
|
528
|
+
await (0, sleep_1.sleep)(10000);
|
|
529
|
+
await (0, test_1.expect)(page.getByText(text, { exact: true }).first()).not.toBeVisible({
|
|
530
|
+
timeout: timeout,
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
await (0, test_1.expect)(page.getByText(text, { exact: true }).first()).toBeVisible({
|
|
535
|
+
timeout: timeout,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
catch (error) {
|
|
541
|
+
if (attempt < maxRetries - 1) {
|
|
542
|
+
console.warn(`Attempt ${attempt + 1} failed for asserting ${text}. Retrying...`);
|
|
543
|
+
await page.reload();
|
|
544
|
+
await (0, sleep_1.sleep)(5000);
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
throw new Error(`Assertion of ${text} failed after ${maxRetries} attempts`);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
exports.assertPageTextWithRetry = assertPageTextWithRetry;
|
|
553
|
+
// `totalTimeout` bounds the whole "complete this task" hop, including the wait
|
|
554
|
+
// for Tasklist to import the task. It is shared across the attempts below
|
|
555
|
+
// rather than granted to each of them: `openTask` polls for minutes on its
|
|
556
|
+
// own, so a per-attempt budget multiplied out to a worst case longer than the
|
|
557
|
+
// test timeout and the harness killed the test mid-wait, with no assertion
|
|
558
|
+
// error to diagnose. One deadline keeps the retries (which recover a lost
|
|
559
|
+
// click or a stale assign button) without inflating the ceiling.
|
|
560
|
+
async function completeTaskWithRetry(taskPanelPage, taskDetailsPage, taskName, taskPriority, maxRetries = 3, totalTimeout = 1200000) {
|
|
561
|
+
const deadline = Date.now() + totalTimeout;
|
|
562
|
+
const openTask = taskPanelPage.availableTasks
|
|
563
|
+
.getByText(taskName, { exact: true })
|
|
564
|
+
.first();
|
|
565
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
566
|
+
let completionRequested = false;
|
|
567
|
+
try {
|
|
568
|
+
await taskPanelPage.openTask(taskName, Math.max(30000, deadline - Date.now()));
|
|
569
|
+
await (0, test_1.expect)(taskDetailsPage.detailsInfo.getByText(taskName, { exact: true })).toBeVisible();
|
|
570
|
+
if (!(await taskDetailsPage.assignedToMeText.isVisible())) {
|
|
571
|
+
await taskDetailsPage.clickAssignToMeButton();
|
|
572
|
+
}
|
|
573
|
+
await (0, test_1.expect)(taskDetailsPage.detailsPanel.getByText(taskPriority)).toBeVisible();
|
|
574
|
+
completionRequested = true;
|
|
575
|
+
await taskDetailsPage.clickCompleteTaskButton();
|
|
576
|
+
await (0, test_1.expect)(openTask).not.toBeVisible({ timeout: 30000 });
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
// Once the Complete Task click has gone out, the task may well have been
|
|
581
|
+
// completed even though its confirmation was missed. Retrying blindly
|
|
582
|
+
// re-enters openTask, which waits 120s per attempt for a task that no
|
|
583
|
+
// longer exists and exhausts the 12 min test timeout, so first check the
|
|
584
|
+
// durable signal: the task leaving the open task list.
|
|
585
|
+
if (completionRequested) {
|
|
586
|
+
const taskGone = await openTask
|
|
587
|
+
.waitFor({ state: 'hidden', timeout: 30000 })
|
|
588
|
+
.then(() => true)
|
|
589
|
+
.catch(() => false);
|
|
590
|
+
if (taskGone) {
|
|
591
|
+
console.warn(`Confirmation for completing task ${taskName} was missed, but the task left the open task list - treating it as completed.`);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (attempt < maxRetries - 1) {
|
|
596
|
+
console.warn(`Attempt ${attempt + 1} failed for completing task ${taskName}. Retrying...`);
|
|
597
|
+
await (0, sleep_1.sleep)(2000);
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
throw new Error(`Failed to complete task ${taskName} after ${maxRetries} attempts: ${error}`);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
exports.completeTaskWithRetry = completeTaskWithRetry;
|
|
606
|
+
async function runProcess(clusterName, page, modelerHomePage, modelerCreatePage, processName, processId = '', uploadFromFile = '') {
|
|
607
|
+
if (uploadFromFile.length > 0) {
|
|
608
|
+
await modelDiagramFromFile(page, modelerHomePage, modelerCreatePage, processName, uploadFromFile);
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
await modelerHomePage.clickDiagramTypeDropdown();
|
|
612
|
+
await modelerHomePage.clickBpmnTemplateOption();
|
|
613
|
+
await modelerCreatePage.modelCamundaUserTaskDiagram(processName, processId);
|
|
614
|
+
}
|
|
615
|
+
await modelerCreatePage.runProcessInstance(clusterName);
|
|
616
|
+
await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
|
|
617
|
+
timeout: 60000,
|
|
618
|
+
});
|
|
619
|
+
// camunda-hub 6813a7e (2026-09-25) made the "Instance started!" toast
|
|
620
|
+
// persistent (shouldPersist) whenever it carries the Operate action, so it
|
|
621
|
+
// no longer times out on its own. Close it via its "Dismiss" button, as
|
|
622
|
+
// pages/8.9 does.
|
|
623
|
+
const instanceStartedToast = page
|
|
624
|
+
.locator('[data-sonner-toast]')
|
|
625
|
+
.filter({ has: modelerCreatePage.viewProcessInstanceLink });
|
|
626
|
+
const dismissButton = instanceStartedToast.getByRole('button', {
|
|
627
|
+
name: 'Dismiss',
|
|
628
|
+
});
|
|
629
|
+
if (await dismissButton.isVisible().catch(() => false)) {
|
|
630
|
+
await dismissButton.click({ timeout: 10000 });
|
|
631
|
+
}
|
|
632
|
+
await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeHidden({
|
|
633
|
+
timeout: 60000,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
exports.runProcess = runProcess;
|
|
637
|
+
async function runMultipleProcesses(clusterName, page, modelerHomePage, modelerCreatePage, options) {
|
|
638
|
+
const { processName = 'Camunda_User_Task', numberOfProcesses = 2, uploadFromFile = '', } = options || {};
|
|
639
|
+
for (let i = 1; i <= numberOfProcesses; i++) {
|
|
640
|
+
await runProcess(clusterName, page, modelerHomePage, modelerCreatePage, processName + i, processName + i, uploadFromFile);
|
|
641
|
+
await modelerHomePage.clickProjectBreadcrumb();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
exports.runMultipleProcesses = runMultipleProcesses;
|
|
645
|
+
// The Console SPA drops its own session when auth0-spa-js fails a silent
|
|
646
|
+
// token renewal: it calls `/v2/logout` and the tab is bounced to the identity
|
|
647
|
+
// provider's login form. That happens mid-flight during the minutes-long
|
|
648
|
+
// component-health poll below, after which reloading only ever re-renders the
|
|
649
|
+
// login form. Re-authenticate as the console user and return to the page that
|
|
650
|
+
// was being polled, so the health assertion carries on unchanged.
|
|
651
|
+
function consoleSessionRecovery(page, clusterUrl) {
|
|
652
|
+
return async () => {
|
|
653
|
+
console.warn(`Console session lost while polling component health on ${clusterUrl}; re-authenticating.`);
|
|
654
|
+
await loginWithRetry(page, new LoginPage_1.LoginPage(page), {
|
|
655
|
+
username: process.env.C8_USERNAME,
|
|
656
|
+
password: process.env.C8_PASSWORD,
|
|
657
|
+
}, 0, 3);
|
|
658
|
+
await page.goto(clusterUrl, {
|
|
659
|
+
waitUntil: 'domcontentloaded',
|
|
660
|
+
timeout: 60000,
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
exports.consoleSessionRecovery = consoleSessionRecovery;
|
|
665
|
+
// `page.goBack()` rejects with `net::ERR_ABORTED` when the page it returns to
|
|
666
|
+
// immediately issues a navigation of its own (Console re-runs its auth
|
|
667
|
+
// redirect on entry): the history entry is superseded, not failed, and the
|
|
668
|
+
// browser still ends up on a usable shell -- sometimes after briefly leaving
|
|
669
|
+
// the tab blank. Judge the outcome by what actually rendered rather than by
|
|
670
|
+
// the rejection, and re-request Console directly if no app shell came back.
|
|
671
|
+
async function goBackWithRetry(page, maxRetries = 3) {
|
|
672
|
+
const homePage = new HomePage_1.HomePage(page);
|
|
673
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
674
|
+
try {
|
|
675
|
+
await page.goBack({ waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
676
|
+
}
|
|
677
|
+
catch (error) {
|
|
678
|
+
console.warn(`goBack attempt ${attempt} failed: ${error}`);
|
|
679
|
+
}
|
|
680
|
+
await page
|
|
681
|
+
.waitForLoadState('domcontentloaded', { timeout: 60000 })
|
|
682
|
+
.catch(() => { });
|
|
683
|
+
if (await homePage.camundaComponentsButton
|
|
684
|
+
.first()
|
|
685
|
+
.isVisible({ timeout: 15000 })
|
|
686
|
+
.catch(() => false)) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
await (0, sleep_1.sleep)(2000);
|
|
690
|
+
}
|
|
691
|
+
await page
|
|
692
|
+
.goto('/', { waitUntil: 'domcontentloaded', timeout: 60000 })
|
|
693
|
+
.catch(() => { });
|
|
694
|
+
await (0, test_1.expect)(homePage.camundaComponentsButton.first()).toBeVisible({
|
|
695
|
+
timeout: 60000,
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
exports.goBackWithRetry = goBackWithRetry;
|
|
699
|
+
async function disableRBA(clusterName, homePage, clusterPage, clusterDetailsPage, appsPage) {
|
|
700
|
+
await appsPage.clickCamundaApps();
|
|
701
|
+
await appsPage.clickConsoleLink();
|
|
702
|
+
await (0, test_1.expect)(homePage.clusterTab).toBeVisible({ timeout: 120000 });
|
|
703
|
+
await homePage.clickClusters();
|
|
704
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
705
|
+
await (0, test_1.expect)(clusterDetailsPage.settingsTab).toBeVisible({
|
|
706
|
+
timeout: 90000,
|
|
707
|
+
});
|
|
708
|
+
await clusterDetailsPage.clickSettingsTab();
|
|
709
|
+
await clusterDetailsPage.disableAuthorizations();
|
|
710
|
+
await homePage.clickClusters();
|
|
711
|
+
await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, 120000, 600000);
|
|
712
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
713
|
+
await (0, test_1.expect)(clusterDetailsPage.rbaEnabledMessage.first()).not.toBeVisible({
|
|
714
|
+
timeout: 30000,
|
|
715
|
+
});
|
|
716
|
+
const detailsPage = clusterDetailsPage.settingsTab.page();
|
|
717
|
+
await clusterDetailsPage.assertComponentsHealth(undefined, consoleSessionRecovery(detailsPage, detailsPage.url()));
|
|
718
|
+
}
|
|
719
|
+
exports.disableRBA = disableRBA;
|
|
720
|
+
async function enableAuthorizations(clusterName, homePage, clusterPage, clusterDetailsPage, appsPage) {
|
|
721
|
+
await appsPage.clickCamundaApps();
|
|
722
|
+
await appsPage.clickConsoleLink();
|
|
723
|
+
await (0, test_1.expect)(homePage.clusterTab).toBeVisible({ timeout: 120000 });
|
|
724
|
+
await homePage.clickClusters();
|
|
725
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
726
|
+
// After navigating to the cluster-details page, the Console
|
|
727
|
+
// occasionally lands on the hard-crash banner
|
|
728
|
+
// ("An error has occurred / We're sorry / Please open a Bug Report
|
|
729
|
+
// at Github") instead of rendering the tab list. The 90s Settings-
|
|
730
|
+
// tab visibility wait below then burns the full 90s and fails.
|
|
731
|
+
// Probe for the crash banner once and reload before falling through.
|
|
732
|
+
// We derive the Page from a locator on clusterDetailsPage (which is
|
|
733
|
+
// public) since the ClusterPage.page field is private.
|
|
734
|
+
const cdPage = clusterDetailsPage.settingsTab.page();
|
|
735
|
+
const crashBanner = cdPage.getByText('An error has occurred');
|
|
736
|
+
if (await crashBanner.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
737
|
+
console.warn('enableAuthorizations: Console crash banner detected after clickClusterLink; reloading.');
|
|
738
|
+
await cdPage.reload({ waitUntil: 'domcontentloaded' }).catch(() => { });
|
|
739
|
+
}
|
|
740
|
+
await (0, test_1.expect)(clusterDetailsPage.settingsTab).toBeVisible({
|
|
741
|
+
timeout: 90000,
|
|
742
|
+
});
|
|
743
|
+
await clusterDetailsPage.clickSettingsTab();
|
|
744
|
+
await clusterDetailsPage.enableAuthorizations();
|
|
745
|
+
await homePage.clickClusters();
|
|
746
|
+
await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, 120000, 600000);
|
|
747
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
748
|
+
await clusterDetailsPage.assertComponentsHealth(undefined, consoleSessionRecovery(cdPage, cdPage.url()));
|
|
749
|
+
}
|
|
750
|
+
exports.enableAuthorizations = enableAuthorizations;
|
|
751
|
+
async function clickInvitationLinkInEmail(page, id) {
|
|
752
|
+
const email = await mailSlurpClient_1.mailSlurp.waitForLatestEmail(id, 120000);
|
|
753
|
+
if (email && email.body) {
|
|
754
|
+
const confirmationLinkMatch = email.body.match(/href="([^"]*)/);
|
|
755
|
+
if (confirmationLinkMatch) {
|
|
756
|
+
await page.goto(confirmationLinkMatch[1]);
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
throw new Error('Confirmation link not found in email body.');
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
throw new Error('Email or email body is null or undefined.');
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
exports.clickInvitationLinkInEmail = clickInvitationLinkInEmail;
|
|
767
|
+
async function assertLatestAlertEmail(id, mailSlurp, processName, alertText) {
|
|
768
|
+
// waitForLatestEmail returns the newest email at once when the inbox is not
|
|
769
|
+
// empty, so a second call on the same inbox re-reads the first alert email.
|
|
770
|
+
// Search the inbox for an email that carries the expected text instead.
|
|
771
|
+
// alert-distributor sends one email per batch, 60-70s after the batch's
|
|
772
|
+
// oldest incident, and retries a failed send every ~10s; delivery comes on
|
|
773
|
+
// top. Incidents more than ~60s apart split into separate emails, which the
|
|
774
|
+
// error lists as several "New Incidents: 1".
|
|
775
|
+
let body;
|
|
776
|
+
await (0, test_1.expect)(async () => {
|
|
777
|
+
const previews = await mailSlurp.getEmails(id, {
|
|
778
|
+
minCount: 1,
|
|
779
|
+
retryTimeout: 60000,
|
|
780
|
+
});
|
|
781
|
+
const seen = [];
|
|
782
|
+
for (const preview of previews) {
|
|
783
|
+
const email = await mailSlurp.getEmail(preview.id);
|
|
784
|
+
const text = email?.body ?? '';
|
|
785
|
+
if (text.includes(processName) && text.includes(alertText)) {
|
|
786
|
+
body = text;
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
seen.push(text.match(/New Incidents: \d+/)?.[0] ?? 'no incident count');
|
|
790
|
+
}
|
|
791
|
+
throw new Error(`No alert email for "${processName}" containing "${alertText}" in ` +
|
|
792
|
+
`inbox ${id} yet; emails present: [${seen.join(', ')}]`);
|
|
793
|
+
}).toPass({ timeout: 360000, intervals: [5000, 10000, 20000] });
|
|
794
|
+
return body;
|
|
795
|
+
}
|
|
796
|
+
exports.assertLatestAlertEmail = assertLatestAlertEmail;
|
|
797
|
+
async function assertTestUsesCorrectOrganization(page) {
|
|
798
|
+
const homePage = new HomePage_1.HomePage(page);
|
|
799
|
+
if (page.url().includes('?code=') || page.url().includes('&state=')) {
|
|
800
|
+
console.log('OAuth callback detected, waiting for redirect...');
|
|
801
|
+
// Camunda Hub (which replaced Console on SaaS) only exchanges the code
|
|
802
|
+
// once its SPA has booted, and on CI runners that boot alone was measured
|
|
803
|
+
// at ~45s past /login-callback -- a 30s wait aborted the exchange on every
|
|
804
|
+
// attempt.
|
|
805
|
+
await page.waitForURL((url) => !url.toString().includes('?code='), {
|
|
806
|
+
timeout: 120000,
|
|
807
|
+
});
|
|
808
|
+
await (0, sleep_1.sleep)(5000);
|
|
809
|
+
}
|
|
810
|
+
if (page.url().includes('modeler')) {
|
|
811
|
+
const modelerHomePage = new ModelerHomePage_1.ModelerHomePage(page);
|
|
812
|
+
await modelerHomePage.clickMessageBanner();
|
|
813
|
+
await (0, test_1.expect)(homePage.modelerBanner).toBeVisible({ timeout: 30000 });
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
await (0, test_1.expect)(homePage.consoleBanner.or(homePage.hubHeader)).toBeVisible({
|
|
817
|
+
timeout: 60000,
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
// Camunda Hub replaces Console on SaaS (8.10 release notes), and the Hub
|
|
821
|
+
// shell has neither the "Camunda logo Console" link nor the "Open
|
|
822
|
+
// Organizations" switcher, and lands on /workspaces without the org id in
|
|
823
|
+
// the URL. Its sidebar scopes the Clusters/Organization links to the active
|
|
824
|
+
// org, so assert the expected org id there instead.
|
|
825
|
+
if (await homePage.hubHeader.isVisible()) {
|
|
826
|
+
await (0, test_1.expect)(homePage.hubSidebar
|
|
827
|
+
.locator(`a[href*="/org/${process.env.ORG_ID}/"]`)
|
|
828
|
+
.first()).toBeVisible({ timeout: 180000 });
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
|
|
832
|
+
try {
|
|
833
|
+
await (0, test_1.expect)(page.url()).toContain(process.env.ORG_ID);
|
|
834
|
+
}
|
|
835
|
+
catch (error) {
|
|
836
|
+
// If the first check fails, check by org name
|
|
837
|
+
try {
|
|
838
|
+
await homePage.clickOpenOrganizationButton();
|
|
839
|
+
await page
|
|
840
|
+
.getByRole('treeitem', { name: process.env.ORG_NAME, exact: true })
|
|
841
|
+
.click({ timeout: 30000 });
|
|
842
|
+
}
|
|
843
|
+
catch (reloadError) {
|
|
844
|
+
await page
|
|
845
|
+
.getByRole('button', { name: process.env.ORG_NAME })
|
|
846
|
+
.click({ timeout: 30000 });
|
|
847
|
+
}
|
|
848
|
+
await (0, test_1.expect)(page
|
|
849
|
+
.locator('[class="cds--header__global"]')
|
|
850
|
+
.getByTitle(process.env.ORG_NAME, { exact: true })
|
|
851
|
+
.first()).toBeVisible({
|
|
852
|
+
timeout: 30000,
|
|
853
|
+
});
|
|
854
|
+
await (0, test_1.expect)(page.url()).toContain(process.env.ORG_ID);
|
|
855
|
+
await (0, sleep_1.sleep)(5000);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
exports.assertTestUsesCorrectOrganization = assertTestUsesCorrectOrganization;
|
|
859
|
+
async function deleteAllUserGroups(homePage, organizationPage, appsPage) {
|
|
860
|
+
await appsPage.clickCamundaApps();
|
|
861
|
+
await appsPage.clickConsoleLink();
|
|
862
|
+
await (0, test_1.expect)(homePage.organizationTab).toBeVisible({ timeout: 120000 });
|
|
863
|
+
await homePage.clickOrganization();
|
|
864
|
+
await organizationPage.clickGroupsTab();
|
|
865
|
+
await organizationPage.deleteAllGroups();
|
|
866
|
+
}
|
|
867
|
+
exports.deleteAllUserGroups = deleteAllUserGroups;
|
|
868
|
+
async function deleteCluster(clusterName, homePage, clusterPage, appsPage) {
|
|
869
|
+
await appsPage.clickCamundaApps();
|
|
870
|
+
await appsPage.clickConsoleLink();
|
|
871
|
+
await homePage.clickClusters();
|
|
872
|
+
await clusterPage.deleteCluster(clusterName);
|
|
873
|
+
}
|
|
874
|
+
exports.deleteCluster = deleteCluster;
|
|
875
|
+
async function modelAndRunConnectorsDocHandlingDiagram(modelerCreatePage, modelerHomePage, processName, page, clusterName, zeebeUrl, zeebeClientId, zeebeClientSecret) {
|
|
876
|
+
await modelerHomePage.clickCrossComponentProjectFolder();
|
|
877
|
+
await modelerHomePage.clickDiagramTypeDropdown();
|
|
878
|
+
await modelerHomePage.clickUploadFilesButton();
|
|
879
|
+
await (0, fileUpload_1.uploadFile)(page, 'Connectors Document Handling.bpmn');
|
|
880
|
+
await modelerHomePage.clickProcessDiagram('Connectors Document Handling');
|
|
881
|
+
await modelerCreatePage.clickDiagramBreadcrumb();
|
|
882
|
+
await modelerCreatePage.clickEditDiagramNameButton();
|
|
883
|
+
await modelerCreatePage.enterDiagramName(processName);
|
|
884
|
+
await modelerCreatePage.clickGeneralPropertiesPanel();
|
|
885
|
+
await modelerCreatePage.clickNameInput();
|
|
886
|
+
await modelerCreatePage.fillNamedInput(processName);
|
|
887
|
+
await modelerCreatePage.clickIdInput();
|
|
888
|
+
await modelerCreatePage.fillIdInput(processName);
|
|
889
|
+
await (0, sleep_1.sleep)(10000);
|
|
890
|
+
// The uploaded fixture embeds the REST connector template id, version,
|
|
891
|
+
// task definition, mappings, and headers on every service task. It deploys
|
|
892
|
+
// without adding the template to the project; opening Marketplace here was
|
|
893
|
+
// redundant setup and previously continued even when that import timed out.
|
|
894
|
+
await (0, sleep_1.sleep)(5000);
|
|
895
|
+
await page.reload();
|
|
896
|
+
await (0, sleep_1.sleep)(5000);
|
|
897
|
+
await modelerCreatePage.fillStartEventVariablesForDocHandling(zeebeUrl, zeebeClientId, zeebeClientSecret);
|
|
898
|
+
await modelerCreatePage.runProcessInstance(clusterName);
|
|
899
|
+
}
|
|
900
|
+
exports.modelAndRunConnectorsDocHandlingDiagram = modelAndRunConnectorsDocHandlingDiagram;
|
|
901
|
+
async function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage, modelerHomePage, processName, page, connectorMarketplacePage, clusterName, connectorTemplatePage) {
|
|
902
|
+
await modelerHomePage.clickCrossComponentProjectFolder();
|
|
903
|
+
await modelerHomePage.clickDiagramTypeDropdown();
|
|
904
|
+
await modelerHomePage.clickUploadFilesButton();
|
|
905
|
+
await (0, fileUpload_1.uploadFile)(page, 'Rest Connector Timer Event.bpmn');
|
|
906
|
+
await modelerHomePage.clickProcessDiagram('Rest Connector Timer Event');
|
|
907
|
+
await modelerCreatePage.clickDiagramBreadcrumb();
|
|
908
|
+
await modelerCreatePage.clickEditDiagramNameButton();
|
|
909
|
+
await modelerCreatePage.enterDiagramName(processName);
|
|
910
|
+
await modelerCreatePage.clickEighthPlacedElement();
|
|
911
|
+
await modelerCreatePage.clickChangeTypeButton();
|
|
912
|
+
await (0, test_1.expect)(modelerCreatePage.marketPlaceButton).toBeVisible({
|
|
913
|
+
timeout: 120000,
|
|
914
|
+
});
|
|
915
|
+
await modelerCreatePage.clickMarketPlaceButton();
|
|
916
|
+
await connectorMarketplacePage.searchAndDownloadConnector('REST Connector');
|
|
917
|
+
// Both lookups are container-relative: clickProjectBreadcrumb() returns to
|
|
918
|
+
// this test's process application, which is where the uploaded diagram
|
|
919
|
+
// lives. The downloaded element template is the open question -- hub
|
|
920
|
+
// publishes element templates to the workspace, but the marketplace download
|
|
921
|
+
// is initiated from inside the container, so it should land there. If a
|
|
922
|
+
// trace shows the template at workspace root instead, the first of these two
|
|
923
|
+
// calls becomes clickWorkspaceBreadcrumb() followed by
|
|
924
|
+
// returnToResourceContainer() before the diagram is reopened.
|
|
925
|
+
await modelerHomePage.clickProjectBreadcrumb();
|
|
926
|
+
await modelerHomePage.clickProcessDiagram('REST Outbound Connector');
|
|
927
|
+
await connectorTemplatePage.publishConnector();
|
|
928
|
+
await modelerHomePage.clickProjectBreadcrumb();
|
|
929
|
+
await modelerHomePage.clickProcessDiagram(processName);
|
|
930
|
+
await (0, sleep_1.sleep)(5000);
|
|
931
|
+
await page.reload();
|
|
932
|
+
await (0, sleep_1.sleep)(5000);
|
|
933
|
+
await modelerCreatePage.runProcessInstance(clusterName);
|
|
934
|
+
}
|
|
935
|
+
exports.modelAndRunConnectorsTimerEventDiagram = modelAndRunConnectorsTimerEventDiagram;
|
|
936
|
+
async function createAPIClient(apiClientName, homePage, clusterDetailsPage, clusterName, clusterPage) {
|
|
937
|
+
await homePage.closeInformationDialog();
|
|
938
|
+
await homePage.clickClusters();
|
|
939
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
940
|
+
await clusterDetailsPage.clickAPITab();
|
|
941
|
+
await clusterDetailsPage.createAPIClientAndReturnVariables(apiClientName);
|
|
942
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
943
|
+
}
|
|
944
|
+
exports.createAPIClient = createAPIClient;
|
|
945
|
+
// The default-cluster ZEEBE_API_* env vars are set by the setup project's
|
|
946
|
+
// "Create Default Cluster" test and reach a spec only through Playwright's
|
|
947
|
+
// dependency env propagation, i.e. within one `playwright test` invocation.
|
|
948
|
+
// Runs that execute a spec without its setup project in that same invocation
|
|
949
|
+
// (the flakiness validate loop and the nightly fix agent's verification loop
|
|
950
|
+
// both pass --no-deps) leave them unset, and every Zeebe API call in the spec
|
|
951
|
+
// then fails before it is made. Provision a client of our own in that case,
|
|
952
|
+
// the same way operate-access-flow.spec.ts does, so a spec that talks to the
|
|
953
|
+
// Zeebe REST API does not depend on how it was launched.
|
|
954
|
+
//
|
|
955
|
+
// Requires `page` to already be logged in to Console as an org admin.
|
|
956
|
+
async function ensureDefaultClusterApiCredentials(apiClientName, homePage, clusterDetailsPage, clusterName, clusterPage) {
|
|
957
|
+
const required = [
|
|
958
|
+
'ZEEBE_API_CLIENT_ID',
|
|
959
|
+
'ZEEBE_API_CLIENT_SECRET',
|
|
960
|
+
'ZEEBE_API_AUTH_URL',
|
|
961
|
+
'ZEEBE_API_URL',
|
|
962
|
+
'ZEEBE_API_TOKEN_AUDIENCE',
|
|
963
|
+
];
|
|
964
|
+
if (required.every((key) => process.env[key])) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
console.log('Default-cluster API credentials are not in the environment ' +
|
|
968
|
+
`(missing: ${required
|
|
969
|
+
.filter((key) => !process.env[key])
|
|
970
|
+
.join(', ')}); creating an API client on "${clusterName}".`);
|
|
971
|
+
await createAPIClient(apiClientName, homePage, clusterDetailsPage, clusterName, clusterPage);
|
|
972
|
+
}
|
|
973
|
+
exports.ensureDefaultClusterApiCredentials = ensureDefaultClusterApiCredentials;
|
|
974
|
+
async function expectCountToBeOneOf(locator, count1, count2) {
|
|
975
|
+
try {
|
|
976
|
+
await Promise.race([
|
|
977
|
+
(0, test_1.expect)(locator).toHaveCount(count1),
|
|
978
|
+
(0, test_1.expect)(locator).toHaveCount(count2),
|
|
979
|
+
]);
|
|
980
|
+
}
|
|
981
|
+
catch {
|
|
982
|
+
const actual = await locator.count();
|
|
983
|
+
throw new Error(`Expected count to be either ${count1} or ${count2}, but was ${actual}`);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
exports.expectCountToBeOneOf = expectCountToBeOneOf;
|
|
987
|
+
async function assertTestUsesCorrectOrganizationFromModeler(page) {
|
|
988
|
+
const homePage = new HomePage_1.HomePage(page);
|
|
989
|
+
await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
|
|
990
|
+
if (page.url().includes('modeler')) {
|
|
991
|
+
await (0, test_1.expect)(homePage.modelerBanner).toBeVisible({ timeout: 60000 });
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
await homePage.closeInformationDialog();
|
|
995
|
+
await (0, test_1.expect)(homePage.consoleBanner).toBeVisible({ timeout: 60000 });
|
|
996
|
+
}
|
|
997
|
+
try {
|
|
998
|
+
await (0, sleep_1.sleep)(20000);
|
|
999
|
+
await (0, test_1.expect)(page.getByTitle(process.env.ORG_NAME)).toBeVisible({
|
|
1000
|
+
timeout: 30000,
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
catch (error) {
|
|
1004
|
+
// If the first check fails, check by org name
|
|
1005
|
+
try {
|
|
1006
|
+
await homePage.clickOpenOrganizationButton();
|
|
1007
|
+
await page
|
|
1008
|
+
.getByRole('treeitem', { name: process.env.ORG_NAME, exact: true })
|
|
1009
|
+
.click({ timeout: 30000 });
|
|
1010
|
+
}
|
|
1011
|
+
catch (reloadError) {
|
|
1012
|
+
await page
|
|
1013
|
+
.getByRole('button', { name: process.env.ORG_NAME })
|
|
1014
|
+
.click({ timeout: 30000 });
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
exports.assertTestUsesCorrectOrganizationFromModeler = assertTestUsesCorrectOrganizationFromModeler;
|
|
1019
|
+
async function waitForLoadingToFinish(page, timeout = 20000) {
|
|
1020
|
+
await page.waitForLoadState('load', { timeout }).catch((error) => {
|
|
1021
|
+
console.log(error);
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
exports.waitForLoadingToFinish = waitForLoadingToFinish;
|