@camunda/e2e-test-suite 0.0.928 → 0.0.930
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.
|
@@ -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();
|
|
@@ -32,6 +32,10 @@ declare class NavigationPage {
|
|
|
32
32
|
username: string;
|
|
33
33
|
password: string;
|
|
34
34
|
}): Promise<void>;
|
|
35
|
+
goToOptimizeWithoutAccess({ username, password, }?: {
|
|
36
|
+
username?: string;
|
|
37
|
+
password?: string;
|
|
38
|
+
}): Promise<void>;
|
|
35
39
|
goToKeycloak(): Promise<void>;
|
|
36
40
|
goToOCIdentity(sleepTimeout?: number, credentials?: {
|
|
37
41
|
username: string;
|
|
@@ -45,6 +49,10 @@ declare class NavigationPage {
|
|
|
45
49
|
username: string;
|
|
46
50
|
password: string;
|
|
47
51
|
}): Promise<void>;
|
|
52
|
+
goToConsoleWithoutAccess({ username, password, }?: {
|
|
53
|
+
username?: string;
|
|
54
|
+
password?: string;
|
|
55
|
+
}): Promise<void>;
|
|
48
56
|
goToManagementIdentity(sleepTimeout?: number, credentials?: {
|
|
49
57
|
username: string;
|
|
50
58
|
password: string;
|
|
@@ -177,6 +177,15 @@ class NavigationPage {
|
|
|
177
177
|
async goToOptimize(sleepTimeout, credentials) {
|
|
178
178
|
await this.goTo(OPTIMIZE_CONTEXT_PATH, this.optimizePageBanner, sleepTimeout, credentials);
|
|
179
179
|
}
|
|
180
|
+
// `goTo` ends by asserting the app banner, so it cannot be used to reach
|
|
181
|
+
// Optimize as a user without the Optimize role: that request ends on a
|
|
182
|
+
// `text/plain` 403 page carrying neither the banner nor a login form, and
|
|
183
|
+
// every retry burns a full 60s timeout. Navigate and log in only; the
|
|
184
|
+
// caller asserts what the denied page shows.
|
|
185
|
+
async goToOptimizeWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
|
|
186
|
+
await this.gotoWithNetworkRetry(OPTIMIZE_CONTEXT_PATH, Date.now() + NETWORK_OUTAGE_BUDGET);
|
|
187
|
+
await new LoginPage_1.LoginPage(this.page).login(username, password);
|
|
188
|
+
}
|
|
180
189
|
async goToKeycloak() {
|
|
181
190
|
const keycloakUrl = process.env.KEYCLOAK_URL
|
|
182
191
|
? `${process.env.KEYCLOAK_URL}/auth`
|
|
@@ -193,6 +202,15 @@ class NavigationPage {
|
|
|
193
202
|
async goToConsole(sleepTimeout, credentials) {
|
|
194
203
|
await this.goTo(CONSOLE_CONTEXT_PATH, this.consolePageBanner, sleepTimeout, credentials);
|
|
195
204
|
}
|
|
205
|
+
// `goTo` ends by asserting the app banner, so it cannot be used to reach
|
|
206
|
+
// Console as a user without the Console role: that request renders
|
|
207
|
+
// Console's own "Something went wrong" error page, which has neither the
|
|
208
|
+
// banner nor a login form, and every retry burns a full 60s timeout.
|
|
209
|
+
// Navigate and log in only; the caller asserts what the denied page shows.
|
|
210
|
+
async goToConsoleWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
|
|
211
|
+
await this.gotoWithNetworkRetry(CONSOLE_CONTEXT_PATH, Date.now() + NETWORK_OUTAGE_BUDGET);
|
|
212
|
+
await new LoginPage_1.LoginPage(this.page).login(username, password);
|
|
213
|
+
}
|
|
196
214
|
async goToManagementIdentity(sleepTimeout, credentials) {
|
|
197
215
|
await this.goTo(MANAGEMENT_IDENTITY_CONTEXT_PATH, this.managementIdentityPageBanner, sleepTimeout, credentials);
|
|
198
216
|
}
|
|
@@ -17,8 +17,7 @@ SM_8_9_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_9_1.test.skip('User Roles User Flow on Management Identity @tasklistV2', async ({ page, navigationPage, optimizeHomePage, managementIdentityPage, keycloakLoginPage, keycloakAdminPage, modelerHomePage, consoleHomePage, settingsPage, browser, }) => {
|
|
20
|
+
(0, SM_8_9_1.test)('User Roles User Flow on Management Identity @tasklistV2', async ({ page, navigationPage, optimizeHomePage, managementIdentityPage, keycloakLoginPage, keycloakAdminPage, modelerHomePage, consoleHomePage, 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') {
|
|
@@ -66,7 +65,7 @@ SM_8_9_1.test.describe('Identity User Flow Tests', () => {
|
|
|
66
65
|
await (0, sleep_1.sleep)(40000);
|
|
67
66
|
});
|
|
68
67
|
await SM_8_9_1.test.step('Ensure Console is not Accessible', async () => {
|
|
69
|
-
await navigationPage.
|
|
68
|
+
await navigationPage.goToConsoleWithoutAccess(credentials);
|
|
70
69
|
await (0, test_1.expect)(page.getByText('Something went wrong')).toBeVisible({
|
|
71
70
|
timeout: 60000,
|
|
72
71
|
});
|
|
@@ -82,11 +81,11 @@ SM_8_9_1.test.describe('Identity User Flow Tests', () => {
|
|
|
82
81
|
});
|
|
83
82
|
if (node_process_1.default.env.IS_OPTIMIZE !== 'false') {
|
|
84
83
|
await SM_8_9_1.test.step('Ensure Optimize is not Accessible', async () => {
|
|
85
|
-
await navigationPage.
|
|
86
|
-
await (0, test_1.expect)(
|
|
84
|
+
await navigationPage.goToOptimizeWithoutAccess(credentials);
|
|
85
|
+
await (0, test_1.expect)(page.getByText('User has no authorization to access Optimize. Please check your Identity configuration')).toBeVisible({
|
|
87
86
|
timeout: 60000,
|
|
88
87
|
});
|
|
89
|
-
await (0, test_1.expect)(
|
|
88
|
+
await (0, test_1.expect)(optimizeHomePage.optimizeBanner).not.toBeVisible({
|
|
90
89
|
timeout: 60000,
|
|
91
90
|
});
|
|
92
91
|
});
|