@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.
- package/dist/pages/SM-8.10/EntraUtils.d.ts +5 -0
- package/dist/pages/SM-8.10/EntraUtils.js +36 -0
- package/dist/pages/SM-8.10/LoginPage.d.ts +7 -0
- package/dist/pages/SM-8.10/LoginPage.js +28 -2
- package/dist/pages/SM-8.10/NavigationPage.d.ts +1 -0
- package/dist/pages/SM-8.10/NavigationPage.js +46 -0
- package/dist/pages/SM-8.10/OCIdentityRolesPage.d.ts +1 -0
- package/dist/pages/SM-8.10/OCIdentityRolesPage.js +2 -0
- package/dist/pages/SM-8.11/EntraUtils.d.ts +5 -0
- package/dist/pages/SM-8.11/EntraUtils.js +36 -0
- package/dist/pages/SM-8.11/LoginPage.d.ts +7 -0
- package/dist/pages/SM-8.11/LoginPage.js +28 -2
- package/dist/pages/SM-8.11/NavigationPage.d.ts +1 -0
- package/dist/pages/SM-8.11/NavigationPage.js +46 -0
- package/dist/pages/SM-8.11/OCIdentityRolesPage.d.ts +1 -0
- package/dist/pages/SM-8.11/OCIdentityRolesPage.js +2 -0
- package/dist/tests/SM-8.10/entra-login.spec.d.ts +1 -0
- package/dist/tests/SM-8.10/entra-login.spec.js +41 -0
- package/dist/tests/SM-8.10/identity-user-flows.spec.js +52 -6
- package/dist/tests/SM-8.10/smoke-tests.spec.js +27 -1
- package/dist/tests/SM-8.11/entra-login.spec.d.ts +1 -0
- package/dist/tests/SM-8.11/entra-login.spec.js +41 -0
- package/dist/tests/SM-8.11/identity-user-flows.spec.js +52 -6
- package/dist/tests/SM-8.11/smoke-tests.spec.js +28 -1
- package/dist/utils/apiHelpers.js +70 -14
- package/dist/utils/entraLogin.d.ts +48 -0
- package/dist/utils/entraLogin.js +122 -0
- package/dist/utils/totp.d.ts +2 -0
- package/dist/utils/totp.js +43 -0
- package/dist/utils/users.d.ts +7 -0
- package/dist/utils/users.js +34 -1
- package/package.json +1 -1
- package/playwright.config.ts +20 -6
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigationPage } from '../SM-8.10/NavigationPage';
|
|
2
|
+
import { OCIdentityHomePage } from './OCIdentityHomePage';
|
|
3
|
+
import { OCIdentityRolesPage } from './OCIdentityRolesPage';
|
|
4
|
+
import { EntraPoolUser } from '../../utils/users';
|
|
5
|
+
export declare const setupEntraPoolUser: (navigationPage: NavigationPage, ocIdentityHomePage: OCIdentityHomePage, ocIdentityRolesPage: OCIdentityRolesPage, slot: number) => Promise<EntraPoolUser>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupEntraPoolUser = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const users_1 = require("../../utils/users");
|
|
6
|
+
const findLocatorWithPagination_1 = require("../../utils/assertionHelpers/findLocatorWithPagination");
|
|
7
|
+
// An OIDC cluster has no Keycloak and no local user store, so the Keycloak
|
|
8
|
+
// path's create-user-per-test is impossible here: setupKeycloakUser's first
|
|
9
|
+
// two steps (mint the Keycloak account, tick its Management Identity role
|
|
10
|
+
// checkboxes) have no equivalent. Component access comes from the chart's
|
|
11
|
+
// mapping rule on the tenant claim instead, which covers every account in the
|
|
12
|
+
// QA tenant, so all that is left to do per test is the third step -- putting
|
|
13
|
+
// the identity in the Orchestration Cluster admin role.
|
|
14
|
+
//
|
|
15
|
+
// The slot is fixed per test rather than leased, matching how the SaaS specs
|
|
16
|
+
// claim a numbered credential slot.
|
|
17
|
+
const setupEntraPoolUser = async (navigationPage, ocIdentityHomePage, ocIdentityRolesPage, slot) => {
|
|
18
|
+
const user = (0, users_1.requireEntraPoolUser)(slot);
|
|
19
|
+
await navigationPage.goToOCAdmin();
|
|
20
|
+
await ocIdentityHomePage.clickRolesTab();
|
|
21
|
+
await ocIdentityRolesPage.clickAdminRole();
|
|
22
|
+
// Pool accounts outlive the run, so by the second test -- and by the second
|
|
23
|
+
// night -- the identity is already in the role and assigning it again fails.
|
|
24
|
+
const userRow = ocIdentityRolesPage.userRow(user.oid).first();
|
|
25
|
+
const alreadyAssigned = await (0, findLocatorWithPagination_1.findLocatorWithPagination)(userRow.page(), userRow, { timeout: 60000 });
|
|
26
|
+
if (!alreadyAssigned) {
|
|
27
|
+
await ocIdentityRolesPage.assignUserToRole(user.oid);
|
|
28
|
+
// assignUserToRole returns on submit; the caller resets the session next,
|
|
29
|
+
// which can abort a grant that has not landed yet.
|
|
30
|
+
await (0, test_1.expect)(ocIdentityRolesPage.userRow(user.oid).first()).toBeVisible({
|
|
31
|
+
timeout: 60000,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return user;
|
|
35
|
+
};
|
|
36
|
+
exports.setupEntraPoolUser = setupEntraPoolUser;
|
|
@@ -8,10 +8,17 @@ declare class LoginPage {
|
|
|
8
8
|
readonly corePasswordInput: Locator;
|
|
9
9
|
readonly coreLoginButton: Locator;
|
|
10
10
|
readonly keycloakBanner: Locator;
|
|
11
|
+
readonly entraEmailInput: Locator;
|
|
12
|
+
readonly entraPasswordInput: Locator;
|
|
13
|
+
readonly entraCodeInput: Locator;
|
|
14
|
+
readonly entraSubmitButton: Locator;
|
|
15
|
+
readonly entraStaySignedInDecline: Locator;
|
|
11
16
|
private useCore;
|
|
12
17
|
private useKeycloak;
|
|
18
|
+
private useEntra;
|
|
13
19
|
constructor(page: Page);
|
|
14
20
|
detectLoginForm(): Promise<void>;
|
|
21
|
+
private loginWithEntra;
|
|
15
22
|
fillUsername(username: string): Promise<void>;
|
|
16
23
|
clickUsername(): Promise<void>;
|
|
17
24
|
fillPassword(password: string): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoginPage = void 0;
|
|
4
|
+
const entraLogin_1 = require("../../utils/entraLogin");
|
|
4
5
|
class LoginPage {
|
|
5
6
|
page;
|
|
6
7
|
usernameInput;
|
|
@@ -10,8 +11,14 @@ class LoginPage {
|
|
|
10
11
|
corePasswordInput;
|
|
11
12
|
coreLoginButton;
|
|
12
13
|
keycloakBanner;
|
|
14
|
+
entraEmailInput;
|
|
15
|
+
entraPasswordInput;
|
|
16
|
+
entraCodeInput;
|
|
17
|
+
entraSubmitButton;
|
|
18
|
+
entraStaySignedInDecline;
|
|
13
19
|
useCore = false;
|
|
14
20
|
useKeycloak = false;
|
|
21
|
+
useEntra = false;
|
|
15
22
|
constructor(page) {
|
|
16
23
|
this.page = page;
|
|
17
24
|
this.usernameInput = page.getByLabel('Username or email');
|
|
@@ -21,6 +28,11 @@ class LoginPage {
|
|
|
21
28
|
this.corePasswordInput = page.getByPlaceholder('Password');
|
|
22
29
|
this.coreLoginButton = page.getByRole('button', { name: 'Login' });
|
|
23
30
|
this.keycloakBanner = page.locator('body#keycloak-bg[data-page-id="login-login"]');
|
|
31
|
+
this.entraEmailInput = page.locator('input[name="loginfmt"]');
|
|
32
|
+
this.entraPasswordInput = page.locator('input[name="passwd"]');
|
|
33
|
+
this.entraCodeInput = page.locator('input[name="otc"]');
|
|
34
|
+
this.entraSubmitButton = page.locator('#idSIButton9');
|
|
35
|
+
this.entraStaySignedInDecline = page.locator('#idBtn_Back');
|
|
24
36
|
}
|
|
25
37
|
async detectLoginForm() {
|
|
26
38
|
// If we're on an app page that's about to redirect to KC, wait for
|
|
@@ -28,7 +40,8 @@ class LoginPage {
|
|
|
28
40
|
const url = this.page.url();
|
|
29
41
|
if (!url.includes('/auth/') && !url.includes('/login-callback')) {
|
|
30
42
|
await this.page
|
|
31
|
-
.waitForURL((u) => u.pathname.includes('/auth/')
|
|
43
|
+
.waitForURL((u) => u.pathname.includes('/auth/') ||
|
|
44
|
+
u.hostname.endsWith('login.microsoftonline.com'), {
|
|
32
45
|
timeout: 30000,
|
|
33
46
|
waitUntil: 'domcontentloaded',
|
|
34
47
|
})
|
|
@@ -38,15 +51,24 @@ class LoginPage {
|
|
|
38
51
|
const anyForm = kcUsername
|
|
39
52
|
.or(this.coreLoginButton)
|
|
40
53
|
.or(this.keycloakBanner)
|
|
54
|
+
.or(this.entraEmailInput)
|
|
41
55
|
.first();
|
|
42
56
|
await anyForm.waitFor({ state: 'visible', timeout: 30000 });
|
|
43
|
-
if (await this.
|
|
57
|
+
if (await this.entraEmailInput.isVisible()) {
|
|
58
|
+
this.useEntra = true;
|
|
59
|
+
}
|
|
60
|
+
else if (await this.coreLoginButton.isVisible()) {
|
|
44
61
|
this.useCore = true;
|
|
45
62
|
}
|
|
46
63
|
else if (await this.keycloakBanner.isVisible()) {
|
|
47
64
|
this.useKeycloak = true;
|
|
48
65
|
}
|
|
49
66
|
}
|
|
67
|
+
// Delegates to the shared helper so the Entra sequence -- and the per-slot
|
|
68
|
+
// authenticator seed it resolves from the address -- stays in one place.
|
|
69
|
+
async loginWithEntra(username, password) {
|
|
70
|
+
await (0, entraLogin_1.signInWithEntra)(this.page, username, password);
|
|
71
|
+
}
|
|
50
72
|
async fillUsername(username) {
|
|
51
73
|
if (await this.page.locator('#username').isVisible()) {
|
|
52
74
|
await this.page.fill('#username', username);
|
|
@@ -102,6 +124,10 @@ class LoginPage {
|
|
|
102
124
|
catch (error) {
|
|
103
125
|
return false;
|
|
104
126
|
}
|
|
127
|
+
if (this.useEntra) {
|
|
128
|
+
await this.loginWithEntra(username, password);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
105
131
|
await this.clickUsername();
|
|
106
132
|
await this.fillUsername(username);
|
|
107
133
|
await this.fillPassword(password);
|
|
@@ -183,11 +183,21 @@ class NavigationPage {
|
|
|
183
183
|
});
|
|
184
184
|
gatewayReloads++;
|
|
185
185
|
}
|
|
186
|
+
// A gateway page is not a login page. Falling through into the Entra
|
|
187
|
+
// sequence spends the email, password, MFA-probe and banner budgets --
|
|
188
|
+
// around three minutes -- driving an error page, so the 720s test
|
|
189
|
+
// budget buys four attempts instead of the eight the loop is sized
|
|
190
|
+
// for, and a component that is merely slow to boot reads as a failed
|
|
191
|
+
// navigation. Fail the attempt now and let the backoff retry.
|
|
192
|
+
if (await this.isGatewayErrorPage()) {
|
|
193
|
+
throw new Error(`Navigation to ${url} served a gateway error page; the component is not serving yet.`);
|
|
194
|
+
}
|
|
186
195
|
const loginPage = new LoginPage_1.LoginPage(this.page);
|
|
187
196
|
const loginEntryPoint = banner
|
|
188
197
|
.or(loginPage.usernameInput)
|
|
189
198
|
.or(loginPage.coreUsernameInput)
|
|
190
199
|
.or(loginPage.keycloakBanner)
|
|
200
|
+
.or(loginPage.entraEmailInput)
|
|
191
201
|
.first();
|
|
192
202
|
await (0, test_1.expect)(loginEntryPoint).toBeVisible({ timeout: 60000 });
|
|
193
203
|
const isBannerVisible = await banner.isVisible().catch(() => false);
|
|
@@ -206,6 +216,7 @@ class NavigationPage {
|
|
|
206
216
|
const loginVisible = await this.page
|
|
207
217
|
.locator('#username')
|
|
208
218
|
.or(loginPage.usernameInput)
|
|
219
|
+
.or(loginPage.entraEmailInput)
|
|
209
220
|
.first()
|
|
210
221
|
.isVisible()
|
|
211
222
|
.catch(() => false);
|
|
@@ -223,6 +234,11 @@ class NavigationPage {
|
|
|
223
234
|
catch (error) {
|
|
224
235
|
const now = new Date();
|
|
225
236
|
const elapsed = Date.now() - startTime;
|
|
237
|
+
const blocker = await this.terminalEntraBlocker();
|
|
238
|
+
if (blocker) {
|
|
239
|
+
console.error(`[${now.toISOString()}] (+${elapsed}ms) [NavigationPage] Login (${url}) aborted on attempt ${attempt + 1}: ${blocker}`);
|
|
240
|
+
throw new Error(`Login (${url}) aborted: ${blocker}`);
|
|
241
|
+
}
|
|
226
242
|
if (attempt < maxRetries - 1) {
|
|
227
243
|
// Progressive backoff: a transient Keycloak 5xx during the OAuth
|
|
228
244
|
// login (the "We are sorry... internal server error" /
|
|
@@ -263,6 +279,36 @@ class NavigationPage {
|
|
|
263
279
|
}
|
|
264
280
|
}
|
|
265
281
|
}
|
|
282
|
+
// Entra rejects some sign-ins with a terminal error that no retry can
|
|
283
|
+
// clear: AADSTS50011, when this deployment's redirect URI is absent from
|
|
284
|
+
// the shared app registration, and the Authenticator registration
|
|
285
|
+
// campaign ("Let's keep your account secure"), which offers only Next and
|
|
286
|
+
// so cannot be dismissed by an automated run. Retrying either burns
|
|
287
|
+
// maxRetries x the goto budget -- enough to exhaust the test timeout,
|
|
288
|
+
// which then surfaces as a bare "beforeEach hook timeout" and loses the
|
|
289
|
+
// cause entirely.
|
|
290
|
+
async terminalEntraBlocker() {
|
|
291
|
+
if (this.page.isClosed()) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
if (!this.page.url().includes('login.microsoftonline.com')) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const body = await this.page
|
|
298
|
+
.locator('body')
|
|
299
|
+
.innerText({ timeout: 5000 })
|
|
300
|
+
.catch(() => '');
|
|
301
|
+
const detail = body.match(/AADSTS\d+:[^\n]{0,200}/)?.[0];
|
|
302
|
+
if (detail) {
|
|
303
|
+
return `Entra rejected the sign-in: ${detail}`;
|
|
304
|
+
}
|
|
305
|
+
if (body.includes("Let's keep your account secure")) {
|
|
306
|
+
return ('Entra is showing the Authenticator registration campaign for this ' +
|
|
307
|
+
'account. It has no Skip option, so the account must complete ' +
|
|
308
|
+
'registration interactively before automated sign-in can work.');
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
266
312
|
async goToModeler(sleepTimeout, credentials) {
|
|
267
313
|
await this.suppressOnboardingTour();
|
|
268
314
|
await this.goTo(MODELER_CONTEXT_PATH, this.modelerPageBanner, sleepTimeout, credentials, 8);
|
|
@@ -12,6 +12,7 @@ declare class OCIdentityRolesPage {
|
|
|
12
12
|
readonly rolesList: Locator;
|
|
13
13
|
readonly roleCell: (name: string) => Locator;
|
|
14
14
|
readonly mappingRuleRow: (name: string) => Locator;
|
|
15
|
+
readonly userRow: (name: string) => Locator;
|
|
15
16
|
readonly createRoleButton: Locator;
|
|
16
17
|
readonly createRoleModal: Locator;
|
|
17
18
|
readonly createNameField: Locator;
|
|
@@ -20,6 +20,7 @@ class OCIdentityRolesPage {
|
|
|
20
20
|
rolesList;
|
|
21
21
|
roleCell;
|
|
22
22
|
mappingRuleRow;
|
|
23
|
+
userRow;
|
|
23
24
|
createRoleButton;
|
|
24
25
|
createRoleModal;
|
|
25
26
|
createNameField;
|
|
@@ -106,6 +107,7 @@ class OCIdentityRolesPage {
|
|
|
106
107
|
});
|
|
107
108
|
this.roleCell = (roleID) => this.rolesList.getByRole('cell', { name: roleID, exact: true });
|
|
108
109
|
this.mappingRuleRow = (name) => page.getByRole('row').filter({ hasText: name });
|
|
110
|
+
this.userRow = (name) => page.getByRole('row').filter({ hasText: name });
|
|
109
111
|
this.createRoleModal = page.getByRole('dialog', {
|
|
110
112
|
name: 'Create role',
|
|
111
113
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigationPage } from '../SM-8.11/NavigationPage';
|
|
2
|
+
import { OCIdentityHomePage } from './OCIdentityHomePage';
|
|
3
|
+
import { OCIdentityRolesPage } from './OCIdentityRolesPage';
|
|
4
|
+
import { EntraPoolUser } from '../../utils/users';
|
|
5
|
+
export declare const setupEntraPoolUser: (navigationPage: NavigationPage, ocIdentityHomePage: OCIdentityHomePage, ocIdentityRolesPage: OCIdentityRolesPage, slot: number) => Promise<EntraPoolUser>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupEntraPoolUser = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const users_1 = require("../../utils/users");
|
|
6
|
+
const findLocatorWithPagination_1 = require("../../utils/assertionHelpers/findLocatorWithPagination");
|
|
7
|
+
// An OIDC cluster has no Keycloak and no local user store, so the Keycloak
|
|
8
|
+
// path's create-user-per-test is impossible here: setupKeycloakUser's first
|
|
9
|
+
// two steps (mint the Keycloak account, tick its Management Identity role
|
|
10
|
+
// checkboxes) have no equivalent. Component access comes from the chart's
|
|
11
|
+
// mapping rule on the tenant claim instead, which covers every account in the
|
|
12
|
+
// QA tenant, so all that is left to do per test is the third step -- putting
|
|
13
|
+
// the identity in the Orchestration Cluster admin role.
|
|
14
|
+
//
|
|
15
|
+
// The slot is fixed per test rather than leased, matching how the SaaS specs
|
|
16
|
+
// claim a numbered credential slot.
|
|
17
|
+
const setupEntraPoolUser = async (navigationPage, ocIdentityHomePage, ocIdentityRolesPage, slot) => {
|
|
18
|
+
const user = (0, users_1.requireEntraPoolUser)(slot);
|
|
19
|
+
await navigationPage.goToOCAdmin();
|
|
20
|
+
await ocIdentityHomePage.clickRolesTab();
|
|
21
|
+
await ocIdentityRolesPage.clickAdminRole();
|
|
22
|
+
// Pool accounts outlive the run, so by the second test -- and by the second
|
|
23
|
+
// night -- the identity is already in the role and assigning it again fails.
|
|
24
|
+
const userRow = ocIdentityRolesPage.userRow(user.oid).first();
|
|
25
|
+
const alreadyAssigned = await (0, findLocatorWithPagination_1.findLocatorWithPagination)(userRow.page(), userRow, { timeout: 60000 });
|
|
26
|
+
if (!alreadyAssigned) {
|
|
27
|
+
await ocIdentityRolesPage.assignUserToRole(user.oid);
|
|
28
|
+
// assignUserToRole returns on submit; the caller resets the session next,
|
|
29
|
+
// which can abort a grant that has not landed yet.
|
|
30
|
+
await (0, test_1.expect)(ocIdentityRolesPage.userRow(user.oid).first()).toBeVisible({
|
|
31
|
+
timeout: 60000,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return user;
|
|
35
|
+
};
|
|
36
|
+
exports.setupEntraPoolUser = setupEntraPoolUser;
|
|
@@ -8,10 +8,17 @@ declare class LoginPage {
|
|
|
8
8
|
readonly corePasswordInput: Locator;
|
|
9
9
|
readonly coreLoginButton: Locator;
|
|
10
10
|
readonly keycloakBanner: Locator;
|
|
11
|
+
readonly entraEmailInput: Locator;
|
|
12
|
+
readonly entraPasswordInput: Locator;
|
|
13
|
+
readonly entraCodeInput: Locator;
|
|
14
|
+
readonly entraSubmitButton: Locator;
|
|
15
|
+
readonly entraStaySignedInDecline: Locator;
|
|
11
16
|
private useCore;
|
|
12
17
|
private useKeycloak;
|
|
18
|
+
private useEntra;
|
|
13
19
|
constructor(page: Page);
|
|
14
20
|
detectLoginForm(): Promise<void>;
|
|
21
|
+
private loginWithEntra;
|
|
15
22
|
fillUsername(username: string): Promise<void>;
|
|
16
23
|
clickUsername(): Promise<void>;
|
|
17
24
|
fillPassword(password: string): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoginPage = void 0;
|
|
4
|
+
const entraLogin_1 = require("../../utils/entraLogin");
|
|
4
5
|
class LoginPage {
|
|
5
6
|
page;
|
|
6
7
|
usernameInput;
|
|
@@ -10,8 +11,14 @@ class LoginPage {
|
|
|
10
11
|
corePasswordInput;
|
|
11
12
|
coreLoginButton;
|
|
12
13
|
keycloakBanner;
|
|
14
|
+
entraEmailInput;
|
|
15
|
+
entraPasswordInput;
|
|
16
|
+
entraCodeInput;
|
|
17
|
+
entraSubmitButton;
|
|
18
|
+
entraStaySignedInDecline;
|
|
13
19
|
useCore = false;
|
|
14
20
|
useKeycloak = false;
|
|
21
|
+
useEntra = false;
|
|
15
22
|
constructor(page) {
|
|
16
23
|
this.page = page;
|
|
17
24
|
this.usernameInput = page.getByLabel('Username or email');
|
|
@@ -21,6 +28,11 @@ class LoginPage {
|
|
|
21
28
|
this.corePasswordInput = page.getByPlaceholder('Password');
|
|
22
29
|
this.coreLoginButton = page.getByRole('button', { name: 'Login' });
|
|
23
30
|
this.keycloakBanner = page.locator('body#keycloak-bg[data-page-id="login-login"]');
|
|
31
|
+
this.entraEmailInput = page.locator('input[name="loginfmt"]');
|
|
32
|
+
this.entraPasswordInput = page.locator('input[name="passwd"]');
|
|
33
|
+
this.entraCodeInput = page.locator('input[name="otc"]');
|
|
34
|
+
this.entraSubmitButton = page.locator('#idSIButton9');
|
|
35
|
+
this.entraStaySignedInDecline = page.locator('#idBtn_Back');
|
|
24
36
|
}
|
|
25
37
|
async detectLoginForm() {
|
|
26
38
|
// If we're on an app page that's about to redirect to KC, wait for
|
|
@@ -28,7 +40,8 @@ class LoginPage {
|
|
|
28
40
|
const url = this.page.url();
|
|
29
41
|
if (!url.includes('/auth/') && !url.includes('/login-callback')) {
|
|
30
42
|
await this.page
|
|
31
|
-
.waitForURL((u) => u.pathname.includes('/auth/')
|
|
43
|
+
.waitForURL((u) => u.pathname.includes('/auth/') ||
|
|
44
|
+
u.hostname.endsWith('login.microsoftonline.com'), {
|
|
32
45
|
timeout: 30000,
|
|
33
46
|
waitUntil: 'domcontentloaded',
|
|
34
47
|
})
|
|
@@ -38,15 +51,24 @@ class LoginPage {
|
|
|
38
51
|
const anyForm = kcUsername
|
|
39
52
|
.or(this.coreLoginButton)
|
|
40
53
|
.or(this.keycloakBanner)
|
|
54
|
+
.or(this.entraEmailInput)
|
|
41
55
|
.first();
|
|
42
56
|
await anyForm.waitFor({ state: 'visible', timeout: 30000 });
|
|
43
|
-
if (await this.
|
|
57
|
+
if (await this.entraEmailInput.isVisible()) {
|
|
58
|
+
this.useEntra = true;
|
|
59
|
+
}
|
|
60
|
+
else if (await this.coreLoginButton.isVisible()) {
|
|
44
61
|
this.useCore = true;
|
|
45
62
|
}
|
|
46
63
|
else if (await this.keycloakBanner.isVisible()) {
|
|
47
64
|
this.useKeycloak = true;
|
|
48
65
|
}
|
|
49
66
|
}
|
|
67
|
+
// Delegates to the shared helper so the Entra sequence -- and the per-slot
|
|
68
|
+
// authenticator seed it resolves from the address -- stays in one place.
|
|
69
|
+
async loginWithEntra(username, password) {
|
|
70
|
+
await (0, entraLogin_1.signInWithEntra)(this.page, username, password);
|
|
71
|
+
}
|
|
50
72
|
async fillUsername(username) {
|
|
51
73
|
if (await this.page.locator('#username').isVisible()) {
|
|
52
74
|
await this.page.fill('#username', username);
|
|
@@ -102,6 +124,10 @@ class LoginPage {
|
|
|
102
124
|
catch (error) {
|
|
103
125
|
return false;
|
|
104
126
|
}
|
|
127
|
+
if (this.useEntra) {
|
|
128
|
+
await this.loginWithEntra(username, password);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
105
131
|
await this.clickUsername();
|
|
106
132
|
await this.fillUsername(username);
|
|
107
133
|
await this.fillPassword(password);
|
|
@@ -183,11 +183,21 @@ class NavigationPage {
|
|
|
183
183
|
});
|
|
184
184
|
gatewayReloads++;
|
|
185
185
|
}
|
|
186
|
+
// A gateway page is not a login page. Falling through into the Entra
|
|
187
|
+
// sequence spends the email, password, MFA-probe and banner budgets --
|
|
188
|
+
// around three minutes -- driving an error page, so the 720s test
|
|
189
|
+
// budget buys four attempts instead of the eight the loop is sized
|
|
190
|
+
// for, and a component that is merely slow to boot reads as a failed
|
|
191
|
+
// navigation. Fail the attempt now and let the backoff retry.
|
|
192
|
+
if (await this.isGatewayErrorPage()) {
|
|
193
|
+
throw new Error(`Navigation to ${url} served a gateway error page; the component is not serving yet.`);
|
|
194
|
+
}
|
|
186
195
|
const loginPage = new LoginPage_1.LoginPage(this.page);
|
|
187
196
|
const loginEntryPoint = banner
|
|
188
197
|
.or(loginPage.usernameInput)
|
|
189
198
|
.or(loginPage.coreUsernameInput)
|
|
190
199
|
.or(loginPage.keycloakBanner)
|
|
200
|
+
.or(loginPage.entraEmailInput)
|
|
191
201
|
.first();
|
|
192
202
|
await (0, test_1.expect)(loginEntryPoint).toBeVisible({ timeout: 60000 });
|
|
193
203
|
const isBannerVisible = await banner.isVisible().catch(() => false);
|
|
@@ -206,6 +216,7 @@ class NavigationPage {
|
|
|
206
216
|
const loginVisible = await this.page
|
|
207
217
|
.locator('#username')
|
|
208
218
|
.or(loginPage.usernameInput)
|
|
219
|
+
.or(loginPage.entraEmailInput)
|
|
209
220
|
.first()
|
|
210
221
|
.isVisible()
|
|
211
222
|
.catch(() => false);
|
|
@@ -223,6 +234,11 @@ class NavigationPage {
|
|
|
223
234
|
catch (error) {
|
|
224
235
|
const now = new Date();
|
|
225
236
|
const elapsed = Date.now() - startTime;
|
|
237
|
+
const blocker = await this.terminalEntraBlocker();
|
|
238
|
+
if (blocker) {
|
|
239
|
+
console.error(`[${now.toISOString()}] (+${elapsed}ms) [NavigationPage] Login (${url}) aborted on attempt ${attempt + 1}: ${blocker}`);
|
|
240
|
+
throw new Error(`Login (${url}) aborted: ${blocker}`);
|
|
241
|
+
}
|
|
226
242
|
if (attempt < maxRetries - 1) {
|
|
227
243
|
// Progressive backoff: a transient Keycloak 5xx during the OAuth
|
|
228
244
|
// login (the "We are sorry... internal server error" /
|
|
@@ -263,6 +279,36 @@ class NavigationPage {
|
|
|
263
279
|
}
|
|
264
280
|
}
|
|
265
281
|
}
|
|
282
|
+
// Entra rejects some sign-ins with a terminal error that no retry can
|
|
283
|
+
// clear: AADSTS50011, when this deployment's redirect URI is absent from
|
|
284
|
+
// the shared app registration, and the Authenticator registration
|
|
285
|
+
// campaign ("Let's keep your account secure"), which offers only Next and
|
|
286
|
+
// so cannot be dismissed by an automated run. Retrying either burns
|
|
287
|
+
// maxRetries x the goto budget -- enough to exhaust the test timeout,
|
|
288
|
+
// which then surfaces as a bare "beforeEach hook timeout" and loses the
|
|
289
|
+
// cause entirely.
|
|
290
|
+
async terminalEntraBlocker() {
|
|
291
|
+
if (this.page.isClosed()) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
if (!this.page.url().includes('login.microsoftonline.com')) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const body = await this.page
|
|
298
|
+
.locator('body')
|
|
299
|
+
.innerText({ timeout: 5000 })
|
|
300
|
+
.catch(() => '');
|
|
301
|
+
const detail = body.match(/AADSTS\d+:[^\n]{0,200}/)?.[0];
|
|
302
|
+
if (detail) {
|
|
303
|
+
return `Entra rejected the sign-in: ${detail}`;
|
|
304
|
+
}
|
|
305
|
+
if (body.includes("Let's keep your account secure")) {
|
|
306
|
+
return ('Entra is showing the Authenticator registration campaign for this ' +
|
|
307
|
+
'account. It has no Skip option, so the account must complete ' +
|
|
308
|
+
'registration interactively before automated sign-in can work.');
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
266
312
|
async goToModeler(sleepTimeout, credentials) {
|
|
267
313
|
await this.suppressOnboardingTour();
|
|
268
314
|
await this.goTo(MODELER_CONTEXT_PATH, this.modelerPageBanner, sleepTimeout, credentials, 8);
|
|
@@ -12,6 +12,7 @@ declare class OCIdentityRolesPage {
|
|
|
12
12
|
readonly rolesList: Locator;
|
|
13
13
|
readonly roleCell: (name: string) => Locator;
|
|
14
14
|
readonly mappingRuleRow: (name: string) => Locator;
|
|
15
|
+
readonly userRow: (name: string) => Locator;
|
|
15
16
|
readonly createRoleButton: Locator;
|
|
16
17
|
readonly createRoleModal: Locator;
|
|
17
18
|
readonly createNameField: Locator;
|
|
@@ -20,6 +20,7 @@ class OCIdentityRolesPage {
|
|
|
20
20
|
rolesList;
|
|
21
21
|
roleCell;
|
|
22
22
|
mappingRuleRow;
|
|
23
|
+
userRow;
|
|
23
24
|
createRoleButton;
|
|
24
25
|
createRoleModal;
|
|
25
26
|
createNameField;
|
|
@@ -106,6 +107,7 @@ class OCIdentityRolesPage {
|
|
|
106
107
|
});
|
|
107
108
|
this.roleCell = (roleID) => this.rolesList.getByRole('cell', { name: roleID, exact: true });
|
|
108
109
|
this.mappingRuleRow = (name) => page.getByRole('row').filter({ hasText: name });
|
|
110
|
+
this.userRow = (name) => page.getByRole('row').filter({ hasText: name });
|
|
109
111
|
this.createRoleModal = page.getByRole('dialog', {
|
|
110
112
|
name: 'Create role',
|
|
111
113
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const SM_8_10_1 = require("../../fixtures/SM-8.10");
|
|
5
|
+
const _setup_1 = require("../../test-setup.js");
|
|
6
|
+
const loggingUtils_1 = require("../../utils/loggingUtils");
|
|
7
|
+
SM_8_10_1.test.describe('Entra ID Sign-In', () => {
|
|
8
|
+
SM_8_10_1.test.beforeEach(async ({ page }, testInfo) => {
|
|
9
|
+
(0, loggingUtils_1.setupTestLogging)(testInfo);
|
|
10
|
+
await page.context().clearCookies();
|
|
11
|
+
});
|
|
12
|
+
SM_8_10_1.test.afterEach(async ({ page }, testInfo) => {
|
|
13
|
+
await (0, _setup_1.captureScreenshot)(page, testInfo);
|
|
14
|
+
await (0, _setup_1.captureFailureVideo)(page, testInfo);
|
|
15
|
+
(0, loggingUtils_1.cleanupTestLogging)();
|
|
16
|
+
});
|
|
17
|
+
(0, SM_8_10_1.test)('signs in to Web Modeler through Entra ID', async ({ page, loginPage, }) => {
|
|
18
|
+
await SM_8_10_1.test.step('Open Web Modeler and follow the IdP redirect', async () => {
|
|
19
|
+
// C8_USERNAME/C8_PASSWORD are the SaaS slots and are never exported by
|
|
20
|
+
// the SM flow: it passes sm_username/sm_password -- the Entra address and
|
|
21
|
+
// password on an oidc run -- which run-tests-reusable maps to these two.
|
|
22
|
+
// Reading the SaaS names filled both Entra fields with the empty string,
|
|
23
|
+
// so the IdP answered "Enter a valid email address" and the test failed
|
|
24
|
+
// 120s later on waitForURL rather than on the missing credential.
|
|
25
|
+
const username = process.env.DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_USERNAME;
|
|
26
|
+
const password = process.env.DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_PASSWORD;
|
|
27
|
+
(0, test_1.expect)(username, 'DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_USERNAME is unset').toBeTruthy();
|
|
28
|
+
(0, test_1.expect)(password, 'DISTRO_QA_E2E_TESTS_IDENTITY_FIRSTUSER_PASSWORD is unset').toBeTruthy();
|
|
29
|
+
await page.goto('/modeler');
|
|
30
|
+
await page.waitForURL((url) => url.hostname.endsWith('login.microsoftonline.com'), { timeout: 60000 });
|
|
31
|
+
const submitted = await loginPage.login(username, password);
|
|
32
|
+
(0, test_1.expect)(submitted).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
await SM_8_10_1.test.step('Land back on Web Modeler as a signed-in user', async () => {
|
|
35
|
+
await page.waitForURL((url) => url.pathname.startsWith('/modeler'), {
|
|
36
|
+
timeout: 120000,
|
|
37
|
+
});
|
|
38
|
+
await (0, test_1.expect)(page.getByRole('link', { name: /workspaces/i }).first()).toBeVisible({ timeout: 60000 });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|