@camunda/e2e-test-suite 0.0.1296 → 0.0.1298

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.
@@ -83,7 +83,8 @@ declare class ClusterPage {
83
83
  */
84
84
  private pruneDuplicateClusters;
85
85
  createClusterIfNotExists(clusterName: string, region?: string): Promise<void>;
86
- assertClusterHealthyStatusWithRetry(name: string, visibilityTimeout?: number, totalTimeout?: number): Promise<void>;
86
+ private isSessionLost;
87
+ assertClusterHealthyStatusWithRetry(name: string, visibilityTimeout?: number, totalTimeout?: number, recoverSession?: () => Promise<void>): Promise<void>;
87
88
  clickAlphaTab(): Promise<void>;
88
89
  clickDevTab(): Promise<void>;
89
90
  clickStableTab(): Promise<void>;
@@ -496,7 +496,15 @@ class ClusterPage {
496
496
  console.log(`${clusterName} exists but is not Healthy yet; waiting for it to come up.`);
497
497
  await this.assertClusterHealthyStatusWithRetry(clusterName, 120000, 600000);
498
498
  }
499
- async assertClusterHealthyStatusWithRetry(name, visibilityTimeout = 100000, totalTimeout = 500000) {
499
+ isSessionLost() {
500
+ try {
501
+ return /^(weblogin|login|auth)\./.test(new URL(this.page.url()).host);
502
+ }
503
+ catch {
504
+ return false;
505
+ }
506
+ }
507
+ async assertClusterHealthyStatusWithRetry(name, visibilityTimeout = 100000, totalTimeout = 500000, recoverSession) {
500
508
  const unhealthy = this.clusterRow(name).getByText('Unhealthy', {
501
509
  exact: true,
502
510
  });
@@ -540,7 +548,14 @@ class ClusterPage {
540
548
  while (Date.now() - start < totalTimeout) {
541
549
  attempt++;
542
550
  try {
543
- await this.page.reload();
551
+ // Once the Console session drops the tab sits on the identity
552
+ // provider's login form, and reloading only re-renders it.
553
+ if (recoverSession && this.isSessionLost()) {
554
+ await recoverSession();
555
+ }
556
+ else {
557
+ await this.page.reload();
558
+ }
544
559
  await (0, test_1.expect)(this.clusterRow(name)).toBeVisible({ timeout: 10000 });
545
560
  // Only treat Unhealthy as terminal once it has persisted for
546
561
  // `unhealthyConfirmMs`. A cluster mid-provisioning can flash through
@@ -38,6 +38,7 @@ export declare function runMultipleProcesses(clusterName: string, page: Page, mo
38
38
  processName?: string;
39
39
  uploadFromFile?: string;
40
40
  }): Promise<void>;
41
+ export declare function consoleSessionRecovery(page: Page, clusterUrl: string): () => Promise<void>;
41
42
  export declare function goBackWithRetry(page: Page, maxRetries?: number): Promise<void>;
42
43
  export declare function disableRBA(clusterName: string, homePage: HomePage, clusterPage: ClusterPage, clusterDetailsPage: ClusterDetailsPage, appsPage: AppsPage): Promise<void>;
43
44
  export declare function enableAuthorizations(clusterName: string, homePage: HomePage, clusterPage: ClusterPage, clusterDetailsPage: ClusterDetailsPage, appsPage: AppsPage): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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.runMultipleProcesses = exports.runProcess = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.openAppTabWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.modelDiagramFromFile = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
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
4
  const test_1 = require("@playwright/test");
5
5
  const ModelerHomePage_1 = require("./ModelerHomePage");
6
6
  const HomePage_1 = require("./HomePage");
@@ -661,6 +661,7 @@ function consoleSessionRecovery(page, clusterUrl) {
661
661
  });
662
662
  };
663
663
  }
664
+ exports.consoleSessionRecovery = consoleSessionRecovery;
664
665
  // `page.goBack()` rejects with `net::ERR_ABORTED` when the page it returns to
665
666
  // immediately issues a navigation of its own (Console re-runs its auth
666
667
  // redirect on entry): the history entry is superseded, not failed, and the
@@ -779,11 +779,21 @@ class ModelerHomePage {
779
779
  // non-elevated users (their list is membership-scoped anyway), so a missing
780
780
  // control is a no-op. Ported from pages/8.10/ModelerHomePage.ts (#3710).
781
781
  async showAllWorkspaces(probeTimeout) {
782
+ const switchButton = this.page.getByRole('button', {
783
+ name: 'Switch to All workspaces',
784
+ });
782
785
  const scopeFilter = this.page.getByRole('combobox', {
783
786
  name: 'Filter workspaces',
784
787
  });
785
- if (!(await this.becameVisible(scopeFilter, probeTimeout)))
788
+ if (!(await this.becameVisible(switchButton.or(scopeFilter).first(), probeTimeout)))
789
+ return;
790
+ // The empty state's own button avoids the Radix dropdown, whose option can
791
+ // stay "not stable" for the whole click timeout.
792
+ if (await switchButton.isVisible().catch(() => false)) {
793
+ await switchButton.click({ timeout: 10000 });
794
+ await (0, test_1.expect)(switchButton).toBeHidden({ timeout: 10000 });
786
795
  return;
796
+ }
787
797
  if ((await scopeFilter.innerText()).includes('All workspaces'))
788
798
  return;
789
799
  await scopeFilter.click({ timeout: 10000 });
@@ -46,7 +46,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
46
46
  await homePage.clickClusters();
47
47
  }
48
48
  await clusterPage.clickClusterLink(clusterName);
49
- await clusterDetailsPage.assertComponentsHealth();
49
+ await clusterDetailsPage.assertComponentsHealth(undefined, (0, UtilitiesPage_1.consoleSessionRecovery)(page, page.url()));
50
50
  // API-client creation is needed whenever this run will also exercise the
51
51
  // full-suite pass: many of those specs call the Zeebe REST API directly
52
52
  // and need CAMUNDA_OPTIMIZE_BASE_URL for Optimize session login, even
@@ -99,7 +99,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
99
99
  await (0, consoleApiHelpers_1.waitForClusterHealthyViaApi)(page, clusterUuid, 1500000);
100
100
  await homePage.clickClusters();
101
101
  await clusterPage.clickClusterLink(clusterName);
102
- await clusterDetailsPage.assertComponentsHealth();
102
+ await clusterDetailsPage.assertComponentsHealth(undefined, (0, UtilitiesPage_1.consoleSessionRecovery)(page, page.url()));
103
103
  // Must happen before the MCP toggle: the restart that toggle triggers is
104
104
  // what makes the new audit-log configuration live on the cluster.
105
105
  await (0, consoleApiHelpers_1.ensureClientAuditLoggingViaApi)(page, clusterUuid);
@@ -111,7 +111,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
111
111
  // abort on the transient Unhealthy state during the restart.
112
112
  await (0, consoleApiHelpers_1.waitForClusterRestartHealthyViaApi)(page, clusterUuid, 1500000);
113
113
  await homePage.clickClusters();
114
- await clusterPage.assertClusterHealthyStatusWithRetry(clusterName);
114
+ await clusterPage.assertClusterHealthyStatusWithRetry(clusterName, undefined, undefined, (0, UtilitiesPage_1.consoleSessionRecovery)(page, page.url()));
115
115
  await clusterPage.clickClusterLink(clusterName);
116
116
  await clusterDetailsPage.clickAPITab();
117
117
  const agenticCredentials = await clusterDetailsPage.createAPIClientAndReturnVariables(apiClientName, true, 'agentic_cluster');
@@ -142,7 +142,7 @@ _8_10_1.test.describe('Cluster Setup Tests', () => {
142
142
  await homePage.clickClusters();
143
143
  }
144
144
  await clusterPage.clickClusterLink(clusterName);
145
- await clusterDetailsPage.assertComponentsHealth();
145
+ await clusterDetailsPage.assertComponentsHealth(undefined, (0, UtilitiesPage_1.consoleSessionRecovery)(page, page.url()));
146
146
  if (process.env.IS_AG !== 'true') {
147
147
  await clusterPage.clickConnectorSecretsTab(clusterName);
148
148
  await clusterSecretsPage.createSetOfSecrets(clusterName, connectorSecrets_1.connectorSecretsValues);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Playwright projects for the Orchestration Cluster REST v2 API suite.
3
+ *
4
+ * `playwright.api.config.ts` uses these, and so do the Helm chart configs in
5
+ * camunda/camunda-platform-helm, which run the suite from the published
6
+ * `@camunda/e2e-test-suite` package on AlwaysGreen. Both read one definition,
7
+ * so the clock ordering below cannot drift between them.
8
+ *
9
+ * `testDir` is this file's own directory: `tests/api` in a checkout and
10
+ * `dist/tests/api` in the package, so either consumer finds the specs.
11
+ */
12
+ import type { Project } from '@playwright/test';
13
+ export declare const apiProjects: Project[];
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /**
3
+ * Playwright projects for the Orchestration Cluster REST v2 API suite.
4
+ *
5
+ * `playwright.api.config.ts` uses these, and so do the Helm chart configs in
6
+ * camunda/camunda-platform-helm, which run the suite from the published
7
+ * `@camunda/e2e-test-suite` package on AlwaysGreen. Both read one definition,
8
+ * so the clock ordering below cannot drift between them.
9
+ *
10
+ * `testDir` is this file's own directory: `tests/api` in a checkout and
11
+ * `dist/tests/api` in the package, so either consumer finds the specs.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.apiProjects = void 0;
15
+ exports.apiProjects = [
16
+ {
17
+ name: 'api',
18
+ testDir: __dirname,
19
+ testIgnore: /clock-api-tests\.spec\.[jt]s$/,
20
+ // Safe for every spec except the clock, which the `clock` project below
21
+ // keeps out of this window: identity resources, processes and decisions are
22
+ // randomised per test, so nothing else one file creates is visible to
23
+ // another as anything but an extra row in a filtered search.
24
+ fullyParallel: true,
25
+ // Generous: some assertions wait on exporter lag, and the ingress retry can
26
+ // legitimately spend 90s riding out a pod restart during an upgrade run.
27
+ timeout: 5 * 60 * 1000,
28
+ expect: { timeout: 30000 },
29
+ },
30
+ {
31
+ /**
32
+ * The clock tests pin the cluster clock, and the engine's notion of time
33
+ * is process-wide: while one of them holds 2029, a job in another file
34
+ * activates against a timeout that has already passed and a published
35
+ * message is born expired.
36
+ *
37
+ * `test.describe.configure({mode: 'serial'})` cannot prevent that. It
38
+ * orders tests inside one file, and `fullyParallel` runs the other files at
39
+ * the same time on other workers — the same intra-file-only limitation
40
+ * `docs/serial-specs.md` records for the 8.10 browser specs. A project that
41
+ * depends on `api` is the only ordering Playwright offers that takes them
42
+ * out of the parallel window entirely.
43
+ *
44
+ * The cost, stated because it is a real one: Playwright skips a project
45
+ * whose dependency failed, so any `api` failure skips these three tests.
46
+ * That is accepted here and is not the defect `5d6ac21` fixed — there a
47
+ * *different* suite's failure left a green cluster with no API signal at
48
+ * all, whereas a red `api` project means this suite is already red and
49
+ * being read, and what is skipped is three status-code assertions.
50
+ */
51
+ name: 'clock',
52
+ testDir: __dirname,
53
+ testMatch: /clock-api-tests\.spec\.[jt]s$/,
54
+ dependencies: ['api'],
55
+ fullyParallel: false,
56
+ timeout: 5 * 60 * 1000,
57
+ expect: { timeout: 30000 },
58
+ },
59
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1296",
3
+ "version": "0.0.1298",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "dist",
16
16
  "resources",
17
17
  "playwright.config.ts",
18
- ".github/c8_versions.json"
18
+ ".github/c8_versions.json",
19
+ "scripts/wait-for-orchestration-admin-role.sh"
19
20
  ],
20
21
  "type": "commonjs",
21
22
  "publishConfig": {
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env bash
2
+ # Blocks until CLIENT_ID holds an effective ROLE_ID (default: admin) membership on
3
+ # the orchestration cluster, so the API v2 suite is not started with a client that
4
+ # has no permissions.
5
+ #
6
+ # Membership changes (roles, groups, tenants, component authorizations) are
7
+ # resolved when a session is established and are only re-resolved on the next
8
+ # authentication refresh interval (default PT30S), so a cluster that has just
9
+ # been installed or upgraded can still answer 403 to a client that is configured
10
+ # as an admin:
11
+ # https://docs.camunda.io/docs/self-managed/components/orchestration-cluster/core-settings/configuration/webserver/#propagation-of-membership-changes-to-active-sessions
12
+ #
13
+ # Assigning a client to a role itself requires UPDATE on ROLE, so for a
14
+ # self-assignment the response is the readiness signal:
15
+ # 409 ALREADY_EXISTS -> the caller is an admin and the membership is effective
16
+ # 2xx -> the caller is an admin and the membership was just added
17
+ # 403 FORBIDDEN -> the membership is not effective (yet)
18
+
19
+ set -euo pipefail
20
+
21
+ : "${BASE_URL:?BASE_URL is required, e.g. https://<host>/orchestration}"
22
+ : "${TOKEN_URL:?TOKEN_URL is required}"
23
+ : "${CLIENT_ID:?CLIENT_ID is required}"
24
+ : "${CLIENT_SECRET:?CLIENT_SECRET is required}"
25
+
26
+ ROLE_ID="${ROLE_ID:-admin}"
27
+ MAX_ATTEMPTS="${MAX_ATTEMPTS:-10}"
28
+ REQUEST_TIMEOUT="${REQUEST_TIMEOUT:-30}"
29
+ MAX_BACKOFF="${MAX_BACKOFF:-30}"
30
+
31
+ body_file="$(mktemp)"
32
+ trap 'rm -f "$body_file"' EXIT
33
+
34
+ fetch_token() {
35
+ curl -sS --max-time "$REQUEST_TIMEOUT" -X POST "$TOKEN_URL" \
36
+ -H 'Content-Type: application/x-www-form-urlencoded' \
37
+ --data-urlencode 'grant_type=client_credentials' \
38
+ --data-urlencode "client_id=${CLIENT_ID}" \
39
+ --data-urlencode "client_secret=${CLIENT_SECRET}" |
40
+ jq -r '.access_token // empty'
41
+ }
42
+
43
+ attempt=1
44
+ backoff=5
45
+
46
+ while [ "$attempt" -le "$MAX_ATTEMPTS" ]; do
47
+ # Re-mint the token on every attempt: memberships are attached to the session
48
+ # the token opens, so reusing one token keeps reporting the stale membership.
49
+ token="$(fetch_token || true)"
50
+
51
+ if [ -z "$token" ]; then
52
+ echo "Attempt ${attempt}/${MAX_ATTEMPTS}: no access token returned by ${TOKEN_URL}"
53
+ else
54
+ status="$(
55
+ curl -sS --max-time "$REQUEST_TIMEOUT" -o "$body_file" -w '%{http_code}' \
56
+ -X PUT "${BASE_URL}/v2/roles/${ROLE_ID}/clients/${CLIENT_ID}" \
57
+ -H "Authorization: Bearer ${token}" || echo 000
58
+ )"
59
+
60
+ case "$status" in
61
+ 2*)
62
+ echo "Assigned client '${CLIENT_ID}' to role '${ROLE_ID}' (HTTP ${status})."
63
+ echo "Waiting ${MAX_BACKOFF}s for the new membership to propagate."
64
+ sleep "$MAX_BACKOFF"
65
+ exit 0
66
+ ;;
67
+ 409)
68
+ echo "Client '${CLIENT_ID}' holds role '${ROLE_ID}' and the membership is effective."
69
+ exit 0
70
+ ;;
71
+ 403)
72
+ echo "Attempt ${attempt}/${MAX_ATTEMPTS}: role '${ROLE_ID}' is not effective yet for client '${CLIENT_ID}' (HTTP 403)."
73
+ cat "$body_file"
74
+ echo
75
+ ;;
76
+ *)
77
+ echo "Attempt ${attempt}/${MAX_ATTEMPTS}: unexpected response while assigning role '${ROLE_ID}' (HTTP ${status})."
78
+ cat "$body_file"
79
+ echo
80
+ ;;
81
+ esac
82
+ fi
83
+
84
+ if [ "$attempt" -lt "$MAX_ATTEMPTS" ]; then
85
+ sleep "$backoff"
86
+ backoff=$((backoff * 2))
87
+ if [ "$backoff" -gt "$MAX_BACKOFF" ]; then
88
+ backoff="$MAX_BACKOFF"
89
+ fi
90
+ fi
91
+
92
+ attempt=$((attempt + 1))
93
+ done
94
+
95
+ echo "ERROR: client '${CLIENT_ID}' never obtained an effective '${ROLE_ID}' role on ${BASE_URL}." >&2
96
+ echo "Refusing to start the API v2 suite: without admin permissions every write is rejected with 403" >&2
97
+ echo "and every search is filtered to an empty result, which hides the real failure." >&2
98
+ exit 1