@camunda/e2e-test-suite 0.0.1647 → 0.0.1648
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pages/SM-8.11/ManagementIdentityPage.d.ts +1 -0
- package/dist/pages/SM-8.11/ManagementIdentityPage.js +46 -0
- package/dist/pages/SM-8.8/OCTenantPage.d.ts +1 -0
- package/dist/pages/SM-8.8/OCTenantPage.js +12 -1
- package/dist/tests/SM-8.11/identity-user-flows.spec.js +11 -7
- package/dist/tests/SM-8.8/mt-enabled-user-flows.spec.js +10 -2
- package/dist/utils/api/auth.js +49 -17
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ declare class ManagementIdentityPage {
|
|
|
29
29
|
clickDemoUser(): Promise<void>;
|
|
30
30
|
clickDeleteAccessButton(accessToDelete: string | string[]): Promise<void>;
|
|
31
31
|
clickConfirmDeleteButton(): Promise<void>;
|
|
32
|
+
removeAssignedRole(accessToDelete: string | string[], reopenUserRoles: () => Promise<void>): Promise<void>;
|
|
32
33
|
clickAssignRolesButton(): Promise<void>;
|
|
33
34
|
clickAddButton(): Promise<void>;
|
|
34
35
|
clickOptimizeCheckbox(): Promise<void>;
|
|
@@ -139,6 +139,52 @@ class ManagementIdentityPage {
|
|
|
139
139
|
await (0, test_1.expect)(this.confirmDeleteButton, 'The delete-role confirmation dialog did not appear.').toBeVisible({ timeout: 60000 });
|
|
140
140
|
await this.confirmDeleteButton.click();
|
|
141
141
|
}
|
|
142
|
+
// A user removing roles from their own account changes the claims behind
|
|
143
|
+
// their IDENTITY_JWT session. Nightly run 42734128630 deleted Optimize (204)
|
|
144
|
+
// and, 400 ms later, sent the Hub delete without the IDENTITY_JWT cookie, got
|
|
145
|
+
// a 401, and the UI dropped it silently — Hub stayed assigned, so the later
|
|
146
|
+
// "assign Hub" step found no Hub checkbox (assigned roles are not offered).
|
|
147
|
+
// Confirm each removal actually landed in the assigned-roles table, and
|
|
148
|
+
// re-open the user's roles (re-authenticating via `reopenUserRoles`) to retry
|
|
149
|
+
// when it did not.
|
|
150
|
+
async removeAssignedRole(accessToDelete, reopenUserRoles) {
|
|
151
|
+
const candidates = typeof accessToDelete === 'string' ? [accessToDelete] : accessToDelete;
|
|
152
|
+
const rowSelector = candidates.map((c) => `:text("${c}")`).join(', ');
|
|
153
|
+
const rolesTable = this.page.getByRole('table', {
|
|
154
|
+
name: 'Roles assigned to user',
|
|
155
|
+
});
|
|
156
|
+
const roleRow = rolesTable.locator(rowSelector).first();
|
|
157
|
+
const maxAttempts = 3;
|
|
158
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
159
|
+
if (attempt > 1) {
|
|
160
|
+
await reopenUserRoles();
|
|
161
|
+
// The user keeps ManagementIdentity throughout, so its row proves the
|
|
162
|
+
// table has rendered before we read the target role's absence.
|
|
163
|
+
await (0, test_1.expect)(rolesTable.getByText('Provides full access to Management Identity')).toBeVisible({ timeout: 60000 });
|
|
164
|
+
const stillAssigned = await roleRow
|
|
165
|
+
.waitFor({ state: 'visible', timeout: 10000 })
|
|
166
|
+
.then(() => true)
|
|
167
|
+
.catch(() => false);
|
|
168
|
+
if (!stillAssigned) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
await this.clickDeleteAccessButton(candidates);
|
|
173
|
+
await this.clickConfirmDeleteButton();
|
|
174
|
+
const removed = await roleRow
|
|
175
|
+
.waitFor({ state: 'hidden', timeout: 30000 })
|
|
176
|
+
.then(() => true)
|
|
177
|
+
.catch(() => false);
|
|
178
|
+
if (removed) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
console.log(`Attempt ${attempt} to remove role ${candidates.join(' / ')} did ` +
|
|
182
|
+
'not take effect; re-opening the user roles and retrying...');
|
|
183
|
+
}
|
|
184
|
+
await (0, test_1.expect)(roleRow, `Role matching ${candidates
|
|
185
|
+
.map((c) => `"${c}"`)
|
|
186
|
+
.join(' or ')} is still assigned after ${maxAttempts} removal attempts.`).toBeHidden({ timeout: 30000 });
|
|
187
|
+
}
|
|
142
188
|
async clickAssignRolesButton() {
|
|
143
189
|
await this.assignRolesButton.click();
|
|
144
190
|
}
|
|
@@ -62,6 +62,7 @@ declare class OCTenantPage {
|
|
|
62
62
|
clickRoleIdSearchBox(): Promise<void>;
|
|
63
63
|
fillRoleIdSearchBox(roleId: string, roleIdentifier: string): Promise<void>;
|
|
64
64
|
clickAssignRoleSubButton(): Promise<void>;
|
|
65
|
+
private isRoleAssigned;
|
|
65
66
|
assignRoleToTenant(roleId: string, roleIdentifier: string): Promise<void>;
|
|
66
67
|
}
|
|
67
68
|
export { OCTenantPage };
|
|
@@ -268,10 +268,21 @@ class OCTenantPage {
|
|
|
268
268
|
async clickAssignRoleSubButton() {
|
|
269
269
|
await this.assignRoleSubButton.click();
|
|
270
270
|
}
|
|
271
|
+
async isRoleAssigned(roleId) {
|
|
272
|
+
return this.row(roleId)
|
|
273
|
+
.waitFor({ state: 'visible', timeout: 15000 })
|
|
274
|
+
.then(() => true)
|
|
275
|
+
.catch(() => false);
|
|
276
|
+
}
|
|
271
277
|
async assignRoleToTenant(roleId, roleIdentifier) {
|
|
272
278
|
await this.clickRolesTab();
|
|
273
279
|
await this.page.waitForLoadState('networkidle');
|
|
274
|
-
|
|
280
|
+
// The roles table renders from its own fetch, which `networkidle` can
|
|
281
|
+
// resolve ahead of, so an immediate `isVisible()` reads the table as empty
|
|
282
|
+
// and reopens the modal for a role that is already assigned. The assign
|
|
283
|
+
// dropdown never offers an already-assigned role, so "Assign role" stays
|
|
284
|
+
// disabled and that attempt can never converge.
|
|
285
|
+
if (await this.isRoleAssigned(roleId)) {
|
|
275
286
|
console.log(`Role ${roleId} is already assigned to tenant`);
|
|
276
287
|
return;
|
|
277
288
|
}
|
|
@@ -46,20 +46,24 @@ SM_8_11_1.test.describe('Identity User Flow Tests', () => {
|
|
|
46
46
|
await managementIdentityPage.clickUser(testUser);
|
|
47
47
|
await managementIdentityPage.clickAssignedRolesTab();
|
|
48
48
|
});
|
|
49
|
+
// The test user removes roles from its own account, which can drop its
|
|
50
|
+
// Management Identity session mid-flow; this re-opens the roles tab with a
|
|
51
|
+
// fresh login so `removeAssignedRole` can confirm/retry each removal.
|
|
52
|
+
const reopenUserRoles = async () => {
|
|
53
|
+
await navigationPage.goToManagementIdentity(undefined, credentials);
|
|
54
|
+
await managementIdentityPage.clickUsersLink();
|
|
55
|
+
await managementIdentityPage.clickUser(testUser);
|
|
56
|
+
await managementIdentityPage.clickAssignedRolesTab();
|
|
57
|
+
};
|
|
49
58
|
if (node_process_1.default.env.IS_OPTIMIZE !== 'false') {
|
|
50
59
|
await SM_8_11_1.test.step('Remove Access from Optimize', async () => {
|
|
51
|
-
await managementIdentityPage.
|
|
52
|
-
await managementIdentityPage.clickConfirmDeleteButton();
|
|
60
|
+
await managementIdentityPage.removeAssignedRole('Grants full access to Optimize', reopenUserRoles);
|
|
53
61
|
});
|
|
54
62
|
}
|
|
55
63
|
await SM_8_11_1.test.step('Remove Access from Hub', async () => {
|
|
56
64
|
// Either wording, for the same Web Modeler → Hub rename straddle the
|
|
57
65
|
// `modelerCheckbox` locator documents.
|
|
58
|
-
await managementIdentityPage.
|
|
59
|
-
'Grants full access to Hub',
|
|
60
|
-
'Grants full access to Web Modeler',
|
|
61
|
-
]);
|
|
62
|
-
await managementIdentityPage.clickConfirmDeleteButton();
|
|
66
|
+
await managementIdentityPage.removeAssignedRole(['Grants full access to Hub', 'Grants full access to Web Modeler'], reopenUserRoles);
|
|
63
67
|
});
|
|
64
68
|
await SM_8_11_1.test.step('Reset Session', async () => {
|
|
65
69
|
await (0, resetSession_1.resetSession)(browser, page);
|
|
@@ -313,8 +313,16 @@ if (process.env.IS_MT === 'true') {
|
|
|
313
313
|
await operateHomePage.clickProcessesTab();
|
|
314
314
|
await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
|
|
315
315
|
await operateProcessInstancePage.completedIconAssertion();
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
// Operate can show the instance as completed before its variables are
|
|
317
|
+
// imported ("The Flow Node has no Variables"), and it does not poll
|
|
318
|
+
// variables of a finished instance, so reload until they arrive.
|
|
319
|
+
await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(page, page.getByTestId('variables-list'), {
|
|
320
|
+
totalTimeout: 120000,
|
|
321
|
+
visibilityTimeout: 30000,
|
|
322
|
+
maxRetries: 4,
|
|
323
|
+
postAction: async () => {
|
|
324
|
+
await page.reload();
|
|
325
|
+
},
|
|
318
326
|
});
|
|
319
327
|
await (0, test_1.expect)(page.getByText('"Awesome!"')).toBeVisible({
|
|
320
328
|
timeout: 60000,
|
package/dist/utils/api/auth.js
CHANGED
|
@@ -26,26 +26,58 @@ function cacheKey(clientId, subject = '') {
|
|
|
26
26
|
function basicHeader(username, password) {
|
|
27
27
|
return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Attempts per token request. The identity provider is shared by the whole
|
|
31
|
+
* cluster and, on a freshly upgraded Helm cluster, answers the odd request
|
|
32
|
+
* with a 5xx for a few seconds at a time (Keycloak's `unknown_error`). A
|
|
33
|
+
* single attempt turns that blip into a hard failure for whichever test
|
|
34
|
+
* happens to need a fresh token — typically the first test of a new worker,
|
|
35
|
+
* such as the `clock` project, whose token cache starts empty.
|
|
36
|
+
*/
|
|
37
|
+
const TOKEN_FETCH_ATTEMPTS = 5;
|
|
38
|
+
/** Backoff before attempt n+1 is `TOKEN_RETRY_BASE_MS * 2^(n-1)`: 1, 2, 4, 8s. */
|
|
39
|
+
const TOKEN_RETRY_BASE_MS = 1000;
|
|
40
|
+
/** Per-attempt timeout, so a hung endpoint cannot eat the test's budget. */
|
|
41
|
+
const TOKEN_REQUEST_TIMEOUT_MS = 15000;
|
|
42
|
+
/**
|
|
43
|
+
* Only server-side and throttling failures are worth retrying. A 4xx means the
|
|
44
|
+
* credentials or request are wrong — retrying cannot help, and the
|
|
45
|
+
* authorization tests rely on an invalid client failing promptly.
|
|
46
|
+
*/
|
|
47
|
+
function isRetryableStatus(status) {
|
|
48
|
+
return status >= 500 || status === 429;
|
|
49
|
+
}
|
|
50
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
29
51
|
async function fetchToken(request, tokenUrl, form) {
|
|
30
52
|
let response;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
for (let attempt = 1;; attempt++) {
|
|
54
|
+
const isLastAttempt = attempt >= TOKEN_FETCH_ATTEMPTS;
|
|
55
|
+
try {
|
|
56
|
+
response = await request.post(tokenUrl, {
|
|
57
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
58
|
+
form,
|
|
59
|
+
timeout: TOKEN_REQUEST_TIMEOUT_MS,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// An unreachable token endpoint is the single most likely reason a whole
|
|
64
|
+
// run fails: on a Helm cluster the identity provider may not be serving
|
|
65
|
+
// yet. Reported raw, it surfaces as a Playwright stack inside auth.ts on
|
|
66
|
+
// every one of the suite's tests, which says nothing about the cause.
|
|
67
|
+
console.error(`Token endpoint ${tokenUrl} is unreachable (attempt ${attempt}/${TOKEN_FETCH_ATTEMPTS}): ${error instanceof Error ? error.message : String(error)}`);
|
|
68
|
+
if (isLastAttempt)
|
|
69
|
+
return undefined;
|
|
70
|
+
await sleep(TOKEN_RETRY_BASE_MS * 2 ** (attempt - 1));
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (response.ok())
|
|
74
|
+
break;
|
|
46
75
|
const body = await response.text().catch(() => '<no-body>');
|
|
47
|
-
console.error(`Token request to ${tokenUrl} failed with ${response.status()}: ${body}`);
|
|
48
|
-
|
|
76
|
+
console.error(`Token request to ${tokenUrl} failed with ${response.status()} (attempt ${attempt}/${TOKEN_FETCH_ATTEMPTS}): ${body}`);
|
|
77
|
+
if (isLastAttempt || !isRetryableStatus(response.status())) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
await sleep(TOKEN_RETRY_BASE_MS * 2 ** (attempt - 1));
|
|
49
81
|
}
|
|
50
82
|
const json = (await response.json());
|
|
51
83
|
if (!json.access_token) {
|