@camunda/e2e-test-suite 0.0.933 → 0.0.935
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.10/KeycloakUtils.js +29 -6
- package/dist/pages/SM-8.10/NavigationPage.d.ts +4 -0
- package/dist/pages/SM-8.10/NavigationPage.js +21 -0
- package/dist/pages/SM-8.7/IdentityPage.js +6 -1
- package/dist/pages/SM-8.7/ModelerCreatePage.d.ts +1 -0
- package/dist/pages/SM-8.7/ModelerCreatePage.js +10 -6
- package/dist/tests/SM-8.10/identity-user-flows.spec.js +4 -5
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createKeycloakUser = exports.createUser = exports.setupKeycloakUser = exports.keycloakAdminCredentials = void 0;
|
|
4
4
|
const test_1 = require("@playwright/test");
|
|
5
|
+
const sleep_1 = require("../../utils/sleep");
|
|
5
6
|
const keycloakAdminCredentials = () => {
|
|
6
7
|
return {
|
|
7
8
|
username: process.env.DISTRO_QA_E2E_TESTS_KEYCLOAK_USERNAME || 'admin',
|
|
@@ -33,13 +34,35 @@ async function createUser(navigationPage, identityPage, keycloakLoginPage, keycl
|
|
|
33
34
|
await createIdentityUser(navigationPage, identityPage, username);
|
|
34
35
|
}
|
|
35
36
|
exports.createUser = createUser;
|
|
37
|
+
// Keycloak occasionally serves "We are sorry... Unexpected error when
|
|
38
|
+
// handling authentication request to identity provider" instead of
|
|
39
|
+
// completing the admin login (the same transient 5xx NavigationPage.goTo's
|
|
40
|
+
// progressive backoff already guards against for app logins). This flow logs
|
|
41
|
+
// into the Keycloak admin console directly rather than through goTo, so it
|
|
42
|
+
// needs the same retry of the whole login sequence instead of failing the
|
|
43
|
+
// test outright on the first hit.
|
|
44
|
+
async function loginToKeycloakAdmin(navigationPage, keycloakLoginPage, keycloakAdminPage, maxRetries = 5) {
|
|
45
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
46
|
+
try {
|
|
47
|
+
await navigationPage.goToKeycloak();
|
|
48
|
+
await keycloakLoginPage.toBeVisible();
|
|
49
|
+
await keycloakLoginPage.fillUsername((0, exports.keycloakAdminCredentials)().username);
|
|
50
|
+
await keycloakLoginPage.fillPassword((0, exports.keycloakAdminCredentials)().password);
|
|
51
|
+
await keycloakLoginPage.clickLogin();
|
|
52
|
+
await keycloakAdminPage.toBeVisible();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (attempt >= maxRetries - 1) {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
console.warn(`[KeycloakUtils] Keycloak admin login attempt ${attempt + 1} failed, retrying: ${error instanceof Error ? error.message : error}`);
|
|
60
|
+
await (0, sleep_1.sleep)(2000 * (attempt + 1));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
36
64
|
async function createKeycloakUser(navigationPage, keycloakLoginPage, keycloakAdminPage, username, password) {
|
|
37
|
-
await navigationPage
|
|
38
|
-
await keycloakLoginPage.toBeVisible();
|
|
39
|
-
await keycloakLoginPage.fillUsername((0, exports.keycloakAdminCredentials)().username);
|
|
40
|
-
await keycloakLoginPage.fillPassword((0, exports.keycloakAdminCredentials)().password);
|
|
41
|
-
await keycloakLoginPage.clickLogin();
|
|
42
|
-
await keycloakAdminPage.toBeVisible();
|
|
65
|
+
await loginToKeycloakAdmin(navigationPage, keycloakLoginPage, keycloakAdminPage);
|
|
43
66
|
await keycloakAdminPage.switchToCamundaPlatform();
|
|
44
67
|
await keycloakAdminPage.clickUsersTab();
|
|
45
68
|
await keycloakAdminPage.clickAddUser();
|
|
@@ -30,6 +30,10 @@ declare class NavigationPage {
|
|
|
30
30
|
username: string;
|
|
31
31
|
password: string;
|
|
32
32
|
}): Promise<void>;
|
|
33
|
+
goToOptimizeWithoutAccess({ username, password, }?: {
|
|
34
|
+
username?: string;
|
|
35
|
+
password?: string;
|
|
36
|
+
}): Promise<void>;
|
|
33
37
|
goToKeycloak(maxRetries?: number): Promise<void>;
|
|
34
38
|
goToOCAdmin(sleepTimeout?: number, credentials?: {
|
|
35
39
|
username: string;
|
|
@@ -160,6 +160,27 @@ class NavigationPage {
|
|
|
160
160
|
async goToOptimize(sleepTimeout, credentials) {
|
|
161
161
|
await this.goTo(OPTIMIZE_CONTEXT_PATH, this.optimizePageBanner, sleepTimeout, credentials);
|
|
162
162
|
}
|
|
163
|
+
// `goTo` ends by asserting the app banner, so it cannot be used to reach
|
|
164
|
+
// Optimize as a user without the Optimize role: that request ends on a
|
|
165
|
+
// `text/plain` 403 page carrying neither the banner nor a login form, and
|
|
166
|
+
// every retry burns a full 60s timeout. Navigate and log in only; the
|
|
167
|
+
// caller asserts what the denied page shows.
|
|
168
|
+
async goToOptimizeWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
|
|
169
|
+
await this.page.goto(OPTIMIZE_CONTEXT_PATH, {
|
|
170
|
+
timeout: 60000,
|
|
171
|
+
waitUntil: 'domcontentloaded',
|
|
172
|
+
});
|
|
173
|
+
let gatewayReloads = 0;
|
|
174
|
+
while (gatewayReloads < 8 && (await this.isGatewayErrorPage())) {
|
|
175
|
+
await (0, sleep_1.sleep)(constants_1._1_SECOND_IN_MS * 5);
|
|
176
|
+
await this.page.goto(OPTIMIZE_CONTEXT_PATH, {
|
|
177
|
+
timeout: 60000,
|
|
178
|
+
waitUntil: 'domcontentloaded',
|
|
179
|
+
});
|
|
180
|
+
gatewayReloads++;
|
|
181
|
+
}
|
|
182
|
+
await new LoginPage_1.LoginPage(this.page).login(username, password);
|
|
183
|
+
}
|
|
163
184
|
async goToKeycloak(maxRetries = 5) {
|
|
164
185
|
const keycloakUrl = process.env.KEYCLOAK_URL
|
|
165
186
|
? `${process.env.KEYCLOAK_URL}/auth`
|
|
@@ -249,7 +249,12 @@ class IdentityPage {
|
|
|
249
249
|
await button.click();
|
|
250
250
|
}
|
|
251
251
|
async fillGroupNameInput(name) {
|
|
252
|
-
await this.
|
|
252
|
+
await (0, test_1.expect)(this.createGroupDialoge).toBeVisible({ timeout: 60000 });
|
|
253
|
+
await this.groupNameInput.waitFor({ state: 'visible', timeout: 60000 });
|
|
254
|
+
await (0, test_1.expect)(async () => {
|
|
255
|
+
await this.groupNameInput.fill(name);
|
|
256
|
+
await (0, test_1.expect)(this.groupNameInput).toHaveValue(name, { timeout: 5000 });
|
|
257
|
+
}).toPass({ timeout: 60000, intervals: [1000, 2000, 5000] });
|
|
253
258
|
}
|
|
254
259
|
async clickUserGroup(name) {
|
|
255
260
|
await this.page.getByRole('cell', { name: name }).click();
|
|
@@ -99,6 +99,7 @@ declare class ModelerCreatePage {
|
|
|
99
99
|
clickSecondPlacedElement(): Promise<void>;
|
|
100
100
|
clickFirstPlacedGateway(): Promise<void>;
|
|
101
101
|
clickSecondPlacedGateway(): Promise<void>;
|
|
102
|
+
private reloadAndWaitForCanvas;
|
|
102
103
|
/**
|
|
103
104
|
* Detects if the page has been redirected to the Keycloak login page
|
|
104
105
|
* (session expiry) or is in the middle of an OIDC redirect, and performs
|
|
@@ -460,24 +460,28 @@ class ModelerCreatePage {
|
|
|
460
460
|
}
|
|
461
461
|
async clickFirstPlacedGateway() {
|
|
462
462
|
try {
|
|
463
|
-
await this.firstPlacedGateway.click({ timeout:
|
|
463
|
+
await this.firstPlacedGateway.click({ timeout: 15000 });
|
|
464
464
|
await this.appendElementButton.isVisible({ timeout: 3000 });
|
|
465
465
|
}
|
|
466
466
|
catch (error) {
|
|
467
|
-
await this.
|
|
468
|
-
await this.firstPlacedGateway.click({ timeout:
|
|
467
|
+
await this.reloadAndWaitForCanvas(this.firstPlacedGateway);
|
|
468
|
+
await this.firstPlacedGateway.click({ timeout: 30000 });
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
async clickSecondPlacedGateway() {
|
|
472
472
|
try {
|
|
473
|
-
await this.secondPlacedGateway.click({ timeout:
|
|
473
|
+
await this.secondPlacedGateway.click({ timeout: 15000 });
|
|
474
474
|
await this.appendElementButton.isVisible({ timeout: 3000 });
|
|
475
475
|
}
|
|
476
476
|
catch (error) {
|
|
477
|
-
await this.
|
|
478
|
-
await this.secondPlacedGateway.click({ timeout:
|
|
477
|
+
await this.reloadAndWaitForCanvas(this.secondPlacedGateway);
|
|
478
|
+
await this.secondPlacedGateway.click({ timeout: 30000 });
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
+
async reloadAndWaitForCanvas(element) {
|
|
482
|
+
await this.page.reload({ waitUntil: 'domcontentloaded' });
|
|
483
|
+
await element.waitFor({ state: 'visible', timeout: 120000 });
|
|
484
|
+
}
|
|
481
485
|
/**
|
|
482
486
|
* Detects if the page has been redirected to the Keycloak login page
|
|
483
487
|
* (session expiry) or is in the middle of an OIDC redirect, and performs
|
|
@@ -17,8 +17,7 @@ SM_8_10_1.test.describe('Identity User Flow Tests', () => {
|
|
|
17
17
|
await (0, _setup_1.captureScreenshot)(page, testInfo);
|
|
18
18
|
await (0, _setup_1.captureFailureVideo)(page, testInfo);
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
SM_8_10_1.test.skip('User Roles User Flow on Management Identity @tasklistV2', async ({ page, navigationPage, optimizeHomePage, managementIdentityPage, keycloakLoginPage, keycloakAdminPage, modelerHomePage, settingsPage, browser, }) => {
|
|
20
|
+
(0, SM_8_10_1.test)('User Roles User Flow on Management Identity @tasklistV2', async ({ page, navigationPage, optimizeHomePage, managementIdentityPage, keycloakLoginPage, keycloakAdminPage, modelerHomePage, settingsPage, browser, }) => {
|
|
22
21
|
if (node_process_1.default.env.IS_RBA === 'true' ||
|
|
23
22
|
node_process_1.default.env.IS_MT === 'true' ||
|
|
24
23
|
node_process_1.default.env.IS_LICENSE_KEY === 'true') {
|
|
@@ -69,11 +68,11 @@ SM_8_10_1.test.describe('Identity User Flow Tests', () => {
|
|
|
69
68
|
});
|
|
70
69
|
if (node_process_1.default.env.IS_OPTIMIZE !== 'false') {
|
|
71
70
|
await SM_8_10_1.test.step('Ensure Optimize is not Accessible', async () => {
|
|
72
|
-
await navigationPage.
|
|
73
|
-
await (0, test_1.expect)(
|
|
71
|
+
await navigationPage.goToOptimizeWithoutAccess(credentials);
|
|
72
|
+
await (0, test_1.expect)(page.getByText('User has no authorization to access Optimize. Please check your Identity configuration')).toBeVisible({
|
|
74
73
|
timeout: 60000,
|
|
75
74
|
});
|
|
76
|
-
await (0, test_1.expect)(
|
|
75
|
+
await (0, test_1.expect)(optimizeHomePage.optimizeBanner).not.toBeVisible({
|
|
77
76
|
timeout: 60000,
|
|
78
77
|
});
|
|
79
78
|
});
|