@camunda/e2e-test-suite 0.0.1757 → 0.0.1758

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.
Files changed (33) hide show
  1. package/dist/pages/SM-8.10/EntraUtils.d.ts +5 -0
  2. package/dist/pages/SM-8.10/EntraUtils.js +36 -0
  3. package/dist/pages/SM-8.10/LoginPage.d.ts +7 -0
  4. package/dist/pages/SM-8.10/LoginPage.js +28 -2
  5. package/dist/pages/SM-8.10/NavigationPage.d.ts +1 -0
  6. package/dist/pages/SM-8.10/NavigationPage.js +46 -0
  7. package/dist/pages/SM-8.10/OCIdentityRolesPage.d.ts +1 -0
  8. package/dist/pages/SM-8.10/OCIdentityRolesPage.js +2 -0
  9. package/dist/pages/SM-8.11/EntraUtils.d.ts +5 -0
  10. package/dist/pages/SM-8.11/EntraUtils.js +36 -0
  11. package/dist/pages/SM-8.11/LoginPage.d.ts +7 -0
  12. package/dist/pages/SM-8.11/LoginPage.js +28 -2
  13. package/dist/pages/SM-8.11/NavigationPage.d.ts +1 -0
  14. package/dist/pages/SM-8.11/NavigationPage.js +46 -0
  15. package/dist/pages/SM-8.11/OCIdentityRolesPage.d.ts +1 -0
  16. package/dist/pages/SM-8.11/OCIdentityRolesPage.js +2 -0
  17. package/dist/tests/SM-8.10/entra-login.spec.d.ts +1 -0
  18. package/dist/tests/SM-8.10/entra-login.spec.js +41 -0
  19. package/dist/tests/SM-8.10/identity-user-flows.spec.js +52 -6
  20. package/dist/tests/SM-8.10/smoke-tests.spec.js +27 -1
  21. package/dist/tests/SM-8.11/entra-login.spec.d.ts +1 -0
  22. package/dist/tests/SM-8.11/entra-login.spec.js +41 -0
  23. package/dist/tests/SM-8.11/identity-user-flows.spec.js +52 -6
  24. package/dist/tests/SM-8.11/smoke-tests.spec.js +28 -1
  25. package/dist/utils/apiHelpers.js +70 -14
  26. package/dist/utils/entraLogin.d.ts +48 -0
  27. package/dist/utils/entraLogin.js +122 -0
  28. package/dist/utils/totp.d.ts +2 -0
  29. package/dist/utils/totp.js +43 -0
  30. package/dist/utils/users.d.ts +7 -0
  31. package/dist/utils/users.js +34 -1
  32. package/package.json +1 -1
  33. package/playwright.config.ts +20 -6
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateTotp = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
6
+ const TOTP_STEP_SECONDS = 30;
7
+ const TOTP_DIGITS = 6;
8
+ function base32Decode(secret) {
9
+ const clean = secret.replace(/[\s=]/g, '').toUpperCase();
10
+ const bytes = [];
11
+ let value = 0;
12
+ let bits = 0;
13
+ for (const char of clean) {
14
+ const index = BASE32_ALPHABET.indexOf(char);
15
+ if (index === -1) {
16
+ throw new Error(`TOTP secret is not valid base32: found '${char}'.`);
17
+ }
18
+ value = (value << 5) | index;
19
+ bits += 5;
20
+ if (bits >= 8) {
21
+ bits -= 8;
22
+ bytes.push((value >>> bits) & 0xff);
23
+ }
24
+ }
25
+ if (bytes.length === 0) {
26
+ throw new Error('TOTP secret decoded to zero bytes.');
27
+ }
28
+ return Buffer.from(bytes);
29
+ }
30
+ // RFC 6238 TOTP over RFC 4226 HOTP: HMAC-SHA1 of the 30-second counter,
31
+ // dynamically truncated to six digits. Verifiers accept the adjacent step,
32
+ // so a code generated at the end of a window is still valid.
33
+ function generateTotp(secret, atMs = Date.now()) {
34
+ const key = base32Decode(secret);
35
+ const counter = Math.floor(atMs / 1000 / TOTP_STEP_SECONDS);
36
+ const counterBuffer = Buffer.alloc(8);
37
+ counterBuffer.writeBigUInt64BE(BigInt(counter));
38
+ const digest = (0, crypto_1.createHmac)('sha1', key).update(counterBuffer).digest();
39
+ const offset = digest[digest.length - 1] & 0x0f;
40
+ const binary = digest.readUInt32BE(offset) & 0x7fffffff;
41
+ return (binary % 10 ** TOTP_DIGITS).toString().padStart(TOTP_DIGITS, '0');
42
+ }
43
+ exports.generateTotp = generateTotp;
@@ -104,3 +104,10 @@ export declare function requireTestUser(usernameVar: string): {
104
104
  username: string;
105
105
  password: string;
106
106
  };
107
+ export type EntraPoolUser = {
108
+ username: string;
109
+ password: string;
110
+ oid: string;
111
+ totpSecret: string;
112
+ };
113
+ export declare function requireEntraPoolUser(slot: number): EntraPoolUser;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireTestUser = exports.getTestUsers = exports.getTestUser = exports.smokeTestUsers = exports.testUsers = void 0;
3
+ exports.requireEntraPoolUser = exports.requireTestUser = exports.getTestUsers = exports.getTestUser = exports.smokeTestUsers = exports.testUsers = void 0;
4
4
  exports.testUsers = {
5
5
  mainUser: {
6
6
  username: process.env.C8_USERNAME,
@@ -149,3 +149,36 @@ function requireTestUser(usernameVar) {
149
149
  return { username: username, password: password };
150
150
  }
151
151
  exports.requireTestUser = requireTestUser;
152
+ // An OIDC cluster has no local user store and no Keycloak admin console, so
153
+ // the specs that used to mint a user per test cannot create one: the identity
154
+ // has to exist in Entra already. The pool is pre-provisioned and its
155
+ // credentials live in Vault, mirroring how the SaaS specs claim a numbered
156
+ // slot with requireTestUser above.
157
+ //
158
+ // Slots are assigned statically per spec, as on SaaS, rather than leased at
159
+ // runtime -- 1..5 belong to SM-8.10 and 6..10 to SM-8.11, so the two Entra
160
+ // nightlies can overlap (which they do by design) without contending.
161
+ //
162
+ // The OID matters because oidc-qa.yaml sets orchestration's usernameClaim to
163
+ // `oid`: on these clusters a Camunda username IS the Entra object id, so role
164
+ // and membership assignment needs the id, not the address.
165
+ function requireEntraPoolUser(slot) {
166
+ const vars = {
167
+ username: `ENTRA_USER_EMAIL_${slot}`,
168
+ password: `ENTRA_USER_PASSWORD_${slot}`,
169
+ oid: `ENTRA_USER_OID_${slot}`,
170
+ totpSecret: `ENTRA_USER_TOTP_SECRET_${slot}`,
171
+ };
172
+ const resolved = Object.fromEntries(Object.entries(vars).map(([field, name]) => [field, process.env[name]]));
173
+ const missing = Object.entries(vars)
174
+ .filter(([field]) => !resolved[field])
175
+ .map(([, name]) => name);
176
+ if (missing.length > 0) {
177
+ throw new Error(`Entra pool slot ${slot} is not fully configured: ${missing.join(', ')} ` +
178
+ 'is unset. The pool lives in Vault under ' +
179
+ 'secret/products/qa/ci/cross-component-e2e-test-suite; the reusable ' +
180
+ 'SM flow exports it only when auth is oidc.');
181
+ }
182
+ return resolved;
183
+ }
184
+ exports.requireEntraPoolUser = requireEntraPoolUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1757",
3
+ "version": "0.0.1758",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",
@@ -125,7 +125,10 @@ const useReportersWithSlack: any[] = [
125
125
  : '';
126
126
  suffix += tasklistSuffix;
127
127
 
128
- return `Test Results for Self-Managed with Helm with Latest 8.11-SNAPSHOT Versions (${searchEngine})${suffix} - ${projectName}`;
128
+ const entraSuffix = process.env.ENTRA_TOTP_SECRET
129
+ ? ', Entra ID'
130
+ : '';
131
+ return `Test Results for Self-Managed with Helm with Latest 8.11-SNAPSHOT Versions (${searchEngine}${entraSuffix})${suffix} - ${projectName}`;
129
132
  }
130
133
  case 'SM-8.10': {
131
134
  const searchEngine =
@@ -148,7 +151,10 @@ const useReportersWithSlack: any[] = [
148
151
  : '';
149
152
  suffix += tasklistSuffix;
150
153
 
151
- return `Test Results for Self-Managed with Helm with Latest 8.10-SNAPSHOT Versions (${searchEngine})${suffix} - ${projectName}`;
154
+ const entraSuffix = process.env.ENTRA_TOTP_SECRET
155
+ ? ', Entra ID'
156
+ : '';
157
+ return `Test Results for Self-Managed with Helm with Latest 8.10-SNAPSHOT Versions (${searchEngine}${entraSuffix})${suffix} - ${projectName}`;
152
158
  }
153
159
  case 'SM-8.9': {
154
160
  const searchEngine =
@@ -381,10 +387,18 @@ const dependencies = (project: string) => {
381
387
  return [`${project}-setup`];
382
388
  };
383
389
 
384
- const regularTestIgnore =
385
- process.env.C8RUN_PHYSICAL_TENANTS === 'unsupported'
386
- ? /(?:test-setup|prod-cluster-cleanup|hub-web-modeler-smoke|topology-orchestration-smoke|physical-tenants)\.spec\.[jt]s$/
387
- : /(?:test-setup|prod-cluster-cleanup|hub-web-modeler-smoke|topology-orchestration-smoke)\.spec\.[jt]s$/;
390
+ const regularTestIgnore = new RegExp(
391
+ `(?:${[
392
+ 'test-setup',
393
+ 'prod-cluster-cleanup',
394
+ 'hub-web-modeler-smoke',
395
+ 'topology-orchestration-smoke',
396
+ ...(process.env.C8RUN_PHYSICAL_TENANTS === 'unsupported'
397
+ ? ['physical-tenants']
398
+ : []),
399
+ ...(process.env.ENTRA_TOTP_SECRET ? [] : ['entra-login']),
400
+ ].join('|')})\\.spec\\.[jt]s$`,
401
+ );
388
402
 
389
403
  export default defineConfig({
390
404
  testDir: process.env.MINOR_VERSION