@camunda/e2e-test-suite 0.0.17 → 0.0.18
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.
|
@@ -3,11 +3,15 @@ declare class LoginPage {
|
|
|
3
3
|
private page;
|
|
4
4
|
readonly usernameInput: Locator;
|
|
5
5
|
readonly passwordInput: Locator;
|
|
6
|
+
readonly keycloakLogin: Locator;
|
|
7
|
+
readonly keycloakPassword: Locator;
|
|
8
|
+
readonly keycloakLoginButton: Locator;
|
|
6
9
|
readonly loginButton: Locator;
|
|
7
10
|
readonly coreUsernameInput: Locator;
|
|
8
11
|
readonly corePasswordInput: Locator;
|
|
9
12
|
readonly coreLoginButton: Locator;
|
|
10
13
|
private useCore;
|
|
14
|
+
private useKeycloak;
|
|
11
15
|
constructor(page: Page);
|
|
12
16
|
detectLoginForm(): Promise<void>;
|
|
13
17
|
fillUsername(username: string): Promise<void>;
|
|
@@ -6,15 +6,22 @@ class LoginPage {
|
|
|
6
6
|
page;
|
|
7
7
|
usernameInput;
|
|
8
8
|
passwordInput;
|
|
9
|
+
keycloakLogin;
|
|
10
|
+
keycloakPassword;
|
|
11
|
+
keycloakLoginButton;
|
|
9
12
|
loginButton;
|
|
10
13
|
coreUsernameInput;
|
|
11
14
|
corePasswordInput;
|
|
12
15
|
coreLoginButton;
|
|
13
16
|
useCore = false;
|
|
17
|
+
useKeycloak = false;
|
|
14
18
|
constructor(page) {
|
|
15
19
|
this.page = page;
|
|
16
20
|
this.usernameInput = page.getByLabel('Username or email');
|
|
17
21
|
this.passwordInput = page.getByLabel('Password');
|
|
22
|
+
this.keycloakLogin = page.locator('#username');
|
|
23
|
+
this.keycloakPassword = page.locator('#password');
|
|
24
|
+
this.keycloakLoginButton = page.locator('button[type="submit"]');
|
|
18
25
|
this.loginButton = page.getByRole('button', { name: 'Log in' });
|
|
19
26
|
this.coreUsernameInput = page.getByPlaceholder('Username');
|
|
20
27
|
this.corePasswordInput = page.getByPlaceholder('Password');
|
|
@@ -23,38 +30,66 @@ class LoginPage {
|
|
|
23
30
|
// Race logic: call before interacting
|
|
24
31
|
async detectLoginForm() {
|
|
25
32
|
const winner = await Promise.race([
|
|
33
|
+
this.keycloakLogin.waitFor({ state: 'visible' }).then(() => 'keycloak'),
|
|
26
34
|
this.usernameInput.waitFor({ state: 'visible' }).then(() => 'default'),
|
|
27
35
|
this.coreUsernameInput.waitFor({ state: 'visible' }).then(() => 'core'),
|
|
28
36
|
]);
|
|
29
37
|
this.useCore = winner === 'core';
|
|
38
|
+
this.useKeycloak = winner === 'keycloak';
|
|
30
39
|
}
|
|
31
40
|
async fillUsername(username) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
if (this.useKeycloak) {
|
|
42
|
+
await this.keycloakLogin.fill(username);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await (this.useCore
|
|
46
|
+
? this.coreUsernameInput.fill(username)
|
|
47
|
+
: this.usernameInput.fill(username));
|
|
48
|
+
}
|
|
35
49
|
}
|
|
36
50
|
async clickUsername() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
if (this.useKeycloak) {
|
|
52
|
+
await this.keycloakLogin.click({ timeout: 60000 });
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await (this.useCore
|
|
56
|
+
? this.coreUsernameInput.click({ timeout: 60000 })
|
|
57
|
+
: this.usernameInput.click({ timeout: 60000 }));
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
60
|
async fillPassword(password) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
if (this.useKeycloak) {
|
|
62
|
+
await this.keycloakPassword.click();
|
|
63
|
+
await this.keycloakPassword.fill(process.env.DISTRO_QA_E2E_TESTS_KEYCLOAK_PASSWORD);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
await (this.useCore
|
|
67
|
+
? this.corePasswordInput.fill(password)
|
|
68
|
+
: this.passwordInput.fill(password));
|
|
69
|
+
}
|
|
45
70
|
}
|
|
46
71
|
async clickLoginButton() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
if (this.useKeycloak) {
|
|
73
|
+
await this.keycloakLoginButton.click({ timeout: 60000 });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
await (this.useCore
|
|
77
|
+
? this.coreLoginButton.click({ timeout: 60000 })
|
|
78
|
+
: this.loginButton.click({ timeout: 60000 }));
|
|
79
|
+
}
|
|
50
80
|
}
|
|
51
81
|
async login(username, password) {
|
|
52
82
|
try {
|
|
53
83
|
await this.detectLoginForm();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
if (this.useKeycloak) {
|
|
85
|
+
await (0, test_1.expect)(this.keycloakLogin).toBeVisible({ timeout: 15000 });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const activeLoginButton = this.useCore
|
|
89
|
+
? this.coreLoginButton
|
|
90
|
+
: this.loginButton;
|
|
91
|
+
await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
|
|
92
|
+
}
|
|
58
93
|
}
|
|
59
94
|
catch (error) {
|
|
60
95
|
return;
|