@camunda/e2e-test-suite 0.0.32 → 0.0.34

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.
@@ -4,7 +4,14 @@ declare class LoginPage {
4
4
  readonly usernameInput: Locator;
5
5
  readonly passwordInput: Locator;
6
6
  readonly loginButton: Locator;
7
+ readonly coreUsernameInput: Locator;
8
+ readonly corePasswordInput: Locator;
9
+ readonly coreLoginButton: Locator;
10
+ readonly keycloakBanner: Locator;
11
+ private useCore;
12
+ private useKeycloak;
7
13
  constructor(page: Page);
14
+ detectLoginForm(): Promise<void>;
8
15
  fillUsername(username: string): Promise<void>;
9
16
  clickUsername(): Promise<void>;
10
17
  fillPassword(password: string): Promise<void>;
@@ -7,35 +7,109 @@ class LoginPage {
7
7
  usernameInput;
8
8
  passwordInput;
9
9
  loginButton;
10
+ coreUsernameInput;
11
+ corePasswordInput;
12
+ coreLoginButton;
13
+ keycloakBanner;
14
+ useCore = false;
15
+ useKeycloak = false;
10
16
  constructor(page) {
11
17
  this.page = page;
12
18
  this.usernameInput = page.getByLabel('Username or email');
13
19
  this.passwordInput = page.getByLabel('Password');
14
20
  this.loginButton = page.getByRole('button', { name: 'Log in' });
21
+ this.coreUsernameInput = page.getByPlaceholder('Username');
22
+ this.corePasswordInput = page.getByPlaceholder('Password');
23
+ this.coreLoginButton = page.getByRole('button', { name: 'Login' });
24
+ this.keycloakBanner = page.locator('body#keycloak-bg[data-page-id="login-login"]');
25
+ }
26
+ // Race logic: call before interacting
27
+ async detectLoginForm() {
28
+ const winner = await Promise.race([
29
+ this.usernameInput.waitFor({ state: 'visible' }).then(() => 'default'),
30
+ this.coreUsernameInput.waitFor({ state: 'visible' }).then(() => 'core'),
31
+ this.keycloakBanner.waitFor({ state: 'visible' }).then(() => 'keycloak'),
32
+ ]);
33
+ this.useCore = winner === 'core';
34
+ this.useKeycloak = winner === 'keycloak';
15
35
  }
16
36
  async fillUsername(username) {
17
- await this.usernameInput.fill(username);
37
+ if (await this.page.locator('#username').isVisible()) {
38
+ await this.page.fill('#username', username);
39
+ }
40
+ else {
41
+ await (this.useCore
42
+ ? this.coreUsernameInput.fill(username)
43
+ : this.usernameInput.fill(username));
44
+ }
18
45
  }
19
46
  async clickUsername() {
20
- await this.usernameInput.click({ timeout: 60000 });
47
+ if (await this.page.locator('#username').isVisible()) {
48
+ await this.page.click('#username');
49
+ }
50
+ else {
51
+ await (this.useCore
52
+ ? this.coreUsernameInput.click({ timeout: 60000 })
53
+ : this.usernameInput.click({ timeout: 60000 }));
54
+ }
21
55
  }
22
56
  async fillPassword(password) {
23
- await this.passwordInput.fill(password);
57
+ if (await this.page.locator('#password').isVisible()) {
58
+ await this.page.fill('#password', password);
59
+ }
60
+ else {
61
+ await (this.useCore
62
+ ? this.corePasswordInput.fill(password)
63
+ : this.passwordInput.fill(password));
64
+ }
24
65
  }
25
66
  async clickLoginButton() {
26
- await this.loginButton.click({ timeout: 60000 });
67
+ if (await this.page.locator('button[type="submit"]').isVisible()) {
68
+ await this.page.click('button[type="submit"]');
69
+ }
70
+ else {
71
+ await (this.useCore
72
+ ? this.coreLoginButton.click({ timeout: 60000 })
73
+ : this.loginButton.click({ timeout: 60000 }));
74
+ }
27
75
  }
28
76
  async login(username, password) {
29
- await (0, test_1.expect)(this.usernameInput).toBeVisible({ timeout: 180000 });
77
+ try {
78
+ await this.detectLoginForm();
79
+ if (await this.page
80
+ .locator('body#keycloak-bg[data-page-id="login-login"]')
81
+ .isVisible()) {
82
+ await (0, test_1.expect)(this.keycloakBanner).toBeVisible({ timeout: 15000 });
83
+ }
84
+ else {
85
+ const activeLoginButton = this.useCore
86
+ ? this.coreLoginButton
87
+ : this.loginButton;
88
+ await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
89
+ }
90
+ }
91
+ catch (error) {
92
+ return;
93
+ }
30
94
  await this.clickUsername();
31
95
  await this.fillUsername(username);
32
96
  await this.fillPassword(password);
33
- await (0, test_1.expect)(this.loginButton).toBeVisible({ timeout: 120000 });
34
97
  await this.clickLoginButton();
35
98
  }
36
99
  async loginAfterPermissionsReadded(username, password) {
37
100
  try {
38
- await (0, test_1.expect)(this.usernameInput).toBeVisible({ timeout: 15000 });
101
+ await this.detectLoginForm();
102
+ if (await this.page
103
+ .locator('body#keycloak-bg[data-page-id="login-login"]')
104
+ .isVisible()) {
105
+ await (0, test_1.expect)(this.keycloakBanner).toBeVisible({ timeout: 15000 });
106
+ }
107
+ else {
108
+ const activeLoginButton = this.useCore
109
+ ? this.coreLoginButton
110
+ : this.loginButton;
111
+ await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
112
+ }
39
113
  }
40
114
  catch (error) {
41
115
  return;
@@ -43,7 +117,6 @@ class LoginPage {
43
117
  await this.clickUsername();
44
118
  await this.fillUsername(username);
45
119
  await this.fillPassword(password);
46
- await (0, test_1.expect)(this.loginButton).toBeVisible({ timeout: 10000 });
47
120
  await this.clickLoginButton();
48
121
  }
49
122
  }
@@ -47,9 +47,7 @@ class ModelerHomePage {
47
47
  this.projectBreadcrumb = page.locator('[data-test="breadcrumb-project"]');
48
48
  this.openOrganizationsButton = page.getByLabel('Open Organizations');
49
49
  this.manageButton = page.getByRole('button', { name: 'Manage' });
50
- this.crossComponentProjectFolder = page.getByTitle(this.defaultFolderName, {
51
- exact: true,
52
- });
50
+ this.crossComponentProjectFolder = page.getByTitle(this.defaultFolderName);
53
51
  this.homeBreadcrumb = page.locator('[data-test="breadcrumb-home"]');
54
52
  this.formNameInput = page.locator('[data-test="editable-input"]');
55
53
  this.rows = page.getByRole('row');
@@ -29,20 +29,20 @@ class OptimizeHomePage {
29
29
  }
30
30
  async clickCollectionsLink() {
31
31
  try {
32
- await this.modalCloseButton.click({ timeout: 60000 });
33
- await this.collectionsLink.click({ timeout: 60000 });
32
+ await this.modalCloseButton.click();
33
+ await this.collectionsLink.click();
34
34
  }
35
35
  catch (error) {
36
- await this.collectionsLink.click({ timeout: 60000 });
36
+ await this.collectionsLink.click();
37
37
  }
38
38
  }
39
39
  async clickDashboardLink() {
40
40
  try {
41
- await this.modalCloseButton.click({ timeout: 60000 });
42
- await this.dashboardLink.click({ timeout: 60000 });
41
+ await this.modalCloseButton.click();
42
+ await this.dashboardLink.click();
43
43
  }
44
44
  catch (error) {
45
- await this.dashboardLink.click({ timeout: 60000 });
45
+ await this.dashboardLink.click();
46
46
  }
47
47
  }
48
48
  async assertProcessHasBeenImported(processId) {
@@ -16,7 +16,17 @@ class KeycloakAdminPage {
16
16
  async switchToCamundaPlatform() {
17
17
  const realmSelector = this.page.getByTestId('nav-item-realms');
18
18
  await realmSelector.click();
19
- await this.page.getByRole('link', { name: 'camunda-platform' }).click();
19
+ const searchField = this.page.getByTestId('selectRealminput');
20
+ await searchField.click();
21
+ await this.page
22
+ .getByPlaceholder('Search')
23
+ .fill(process.env.KEYCLOAK_REALM || 'camunda-platform');
24
+ await this.page
25
+ .locator('[data-ouia-component-id="OUIA-Generated-Button-control-1"]')
26
+ .click();
27
+ await this.page
28
+ .getByText(process.env.KEYCLOAK_REALM || 'camunda-platform')
29
+ .click();
20
30
  const mainLocator = this.page.locator('#kc-main-content-page-container');
21
31
  await (0, test_1.expect)(mainLocator).toBeVisible();
22
32
  }
@@ -1,9 +1,17 @@
1
1
  import { Page, Locator } from '@playwright/test';
2
2
  declare class LoginPage {
3
+ private page;
3
4
  readonly usernameInput: Locator;
4
5
  readonly passwordInput: Locator;
5
6
  readonly loginButton: Locator;
7
+ readonly coreUsernameInput: Locator;
8
+ readonly corePasswordInput: Locator;
9
+ readonly coreLoginButton: Locator;
10
+ readonly keycloakBanner: Locator;
11
+ private useCore;
12
+ private useKeycloak;
6
13
  constructor(page: Page);
14
+ detectLoginForm(): Promise<void>;
7
15
  fillUsername(username: string): Promise<void>;
8
16
  clickUsername(): Promise<void>;
9
17
  fillPassword(password: string): Promise<void>;
@@ -1,31 +1,100 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoginPage = void 0;
4
+ const test_1 = require("@playwright/test");
4
5
  class LoginPage {
6
+ page;
5
7
  usernameInput;
6
8
  passwordInput;
7
9
  loginButton;
10
+ coreUsernameInput;
11
+ corePasswordInput;
12
+ coreLoginButton;
13
+ keycloakBanner;
14
+ useCore = false;
15
+ useKeycloak = false;
8
16
  constructor(page) {
9
- this.usernameInput = page.locator('input[name="username"]');
10
- this.passwordInput = page.locator('input[name="password"]');
17
+ this.page = page;
18
+ this.usernameInput = page.getByLabel('Username or email');
19
+ this.passwordInput = page.getByLabel('Password');
11
20
  this.loginButton = page.getByRole('button', { name: 'Log in' });
21
+ this.coreUsernameInput = page.getByPlaceholder('Username');
22
+ this.corePasswordInput = page.getByPlaceholder('Password');
23
+ this.coreLoginButton = page.getByRole('button', { name: 'Login' });
24
+ this.keycloakBanner = page.locator('body#keycloak-bg[data-page-id="login-login"]');
25
+ }
26
+ // Race logic: call before interacting
27
+ async detectLoginForm() {
28
+ const winner = await Promise.race([
29
+ this.usernameInput.waitFor({ state: 'visible' }).then(() => 'default'),
30
+ this.coreUsernameInput.waitFor({ state: 'visible' }).then(() => 'core'),
31
+ this.keycloakBanner.waitFor({ state: 'visible' }).then(() => 'keycloak'),
32
+ ]);
33
+ this.useCore = winner === 'core';
34
+ this.useKeycloak = winner === 'keycloak';
12
35
  }
13
36
  async fillUsername(username) {
14
- await this.usernameInput.fill(username);
37
+ if (await this.page.locator('#username').isVisible()) {
38
+ await this.page.fill('#username', username);
39
+ }
40
+ else {
41
+ await (this.useCore
42
+ ? this.coreUsernameInput.fill(username)
43
+ : this.usernameInput.fill(username));
44
+ }
15
45
  }
16
46
  async clickUsername() {
17
- await this.usernameInput.click({ timeout: 60000 });
47
+ if (await this.page.locator('#username').isVisible()) {
48
+ await this.page.click('#username');
49
+ }
50
+ else {
51
+ await (this.useCore
52
+ ? this.coreUsernameInput.click({ timeout: 60000 })
53
+ : this.usernameInput.click({ timeout: 60000 }));
54
+ }
18
55
  }
19
56
  async fillPassword(password) {
20
- await this.passwordInput.fill(password);
57
+ if (await this.page.locator('#password').isVisible()) {
58
+ await this.page.fill('#password', password);
59
+ }
60
+ else {
61
+ await (this.useCore
62
+ ? this.corePasswordInput.fill(password)
63
+ : this.passwordInput.fill(password));
64
+ }
21
65
  }
22
66
  async clickLoginButton() {
23
- await this.loginButton.click({ timeout: 60000 });
67
+ if (await this.page.locator('button[type="submit"]').isVisible()) {
68
+ await this.page.click('button[type="submit"]');
69
+ }
70
+ else {
71
+ await (this.useCore
72
+ ? this.coreLoginButton.click({ timeout: 60000 })
73
+ : this.loginButton.click({ timeout: 60000 }));
74
+ }
24
75
  }
25
76
  async login(username, password) {
26
- await this.usernameInput.fill(username);
27
- await this.passwordInput.fill(password);
28
- await this.loginButton.click();
77
+ try {
78
+ await this.detectLoginForm();
79
+ if (await this.page
80
+ .locator('body#keycloak-bg[data-page-id="login-login"]')
81
+ .isVisible()) {
82
+ await (0, test_1.expect)(this.keycloakBanner).toBeVisible({ timeout: 15000 });
83
+ }
84
+ else {
85
+ const activeLoginButton = this.useCore
86
+ ? this.coreLoginButton
87
+ : this.loginButton;
88
+ await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
89
+ }
90
+ }
91
+ catch (error) {
92
+ return;
93
+ }
94
+ await this.clickUsername();
95
+ await this.fillUsername(username);
96
+ await this.fillPassword(password);
97
+ await this.clickLoginButton();
29
98
  }
30
99
  async isLoginPage() {
31
100
  try {
@@ -111,21 +111,21 @@ class ModelerHomePage {
111
111
  await this.formTemplateOption.click();
112
112
  }
113
113
  async enterFormName(name) {
114
- await this.formNameInput.click({ timeout: 5000 });
114
+ await this.formNameInput.click();
115
115
  await this.formNameInput.fill(name);
116
116
  await this.formNameInput.press('Enter');
117
117
  }
118
118
  async clickProjectBreadcrumb() {
119
- await this.projectBreadcrumb.click({ timeout: 5000 });
119
+ await this.projectBreadcrumb.click();
120
120
  }
121
121
  async clickOpenOrganizationsButton() {
122
- await this.openOrganizationsButton.click({ timeout: 5000 });
122
+ await this.openOrganizationsButton.click();
123
123
  }
124
124
  async clickManageButton() {
125
125
  await this.manageButton.click({ timeout: 5000 });
126
126
  }
127
127
  async clickUploadFilesButton() {
128
- await this.uploadFilesButton.click({ timeout: 5000 });
128
+ await this.uploadFilesButton.click();
129
129
  }
130
130
  getDefaultFolderName() {
131
131
  return this.defaultFolderName;
@@ -124,7 +124,10 @@ class NavigationPage {
124
124
  await this.goTo('/optimize', this.optimizePageBanner, sleepTimeout);
125
125
  }
126
126
  async goToKeycloak() {
127
- await this.page.goto('/auth');
127
+ const keycloakUrl = process.env.KEYCLOAK_URL
128
+ ? `${process.env.KEYCLOAK_URL}/auth`
129
+ : '/auth';
130
+ await this.page.goto(keycloakUrl);
128
131
  await (0, test_1.expect)(this.keyboardPageBanner).toBeVisible();
129
132
  }
130
133
  async goToIdentity(sleepTimeout) {
@@ -16,7 +16,17 @@ class KeycloakAdminPage {
16
16
  async switchToCamundaPlatform() {
17
17
  const realmSelector = this.page.getByTestId('nav-item-realms');
18
18
  await realmSelector.click();
19
- await this.page.getByText('camunda-platform').click();
19
+ const searchField = this.page.getByTestId('selectRealminput');
20
+ await searchField.click();
21
+ await this.page
22
+ .getByPlaceholder('Search')
23
+ .fill(process.env.KEYCLOAK_REALM || 'camunda-platform');
24
+ await this.page
25
+ .locator('[data-ouia-component-id="OUIA-Generated-Button-control-1"]')
26
+ .click();
27
+ await this.page
28
+ .getByText(process.env.KEYCLOAK_REALM || 'camunda-platform')
29
+ .click();
20
30
  const mainLocator = this.page.locator('#kc-main-content-page-container');
21
31
  await (0, test_1.expect)(mainLocator).toBeVisible();
22
32
  }
@@ -7,7 +7,9 @@ declare class LoginPage {
7
7
  readonly coreUsernameInput: Locator;
8
8
  readonly corePasswordInput: Locator;
9
9
  readonly coreLoginButton: Locator;
10
+ readonly keycloakBanner: Locator;
10
11
  private useCore;
12
+ private useKeycloak;
11
13
  constructor(page: Page);
12
14
  detectLoginForm(): Promise<void>;
13
15
  fillUsername(username: string): Promise<void>;
@@ -10,7 +10,9 @@ class LoginPage {
10
10
  coreUsernameInput;
11
11
  corePasswordInput;
12
12
  coreLoginButton;
13
+ keycloakBanner;
13
14
  useCore = false;
15
+ useKeycloak = false;
14
16
  constructor(page) {
15
17
  this.page = page;
16
18
  this.usernameInput = page.getByLabel('Username or email');
@@ -19,42 +21,72 @@ class LoginPage {
19
21
  this.coreUsernameInput = page.getByPlaceholder('Username');
20
22
  this.corePasswordInput = page.getByPlaceholder('Password');
21
23
  this.coreLoginButton = page.getByRole('button', { name: 'Login' });
24
+ this.keycloakBanner = page.locator('body#keycloak-bg[data-page-id="login-login"]');
22
25
  }
23
26
  // Race logic: call before interacting
24
27
  async detectLoginForm() {
25
28
  const winner = await Promise.race([
26
29
  this.usernameInput.waitFor({ state: 'visible' }).then(() => 'default'),
27
30
  this.coreUsernameInput.waitFor({ state: 'visible' }).then(() => 'core'),
31
+ this.keycloakBanner.waitFor({ state: 'visible' }).then(() => 'keycloak'),
28
32
  ]);
29
33
  this.useCore = winner === 'core';
34
+ this.useKeycloak = winner === 'keycloak';
30
35
  }
31
36
  async fillUsername(username) {
32
- await (this.useCore
33
- ? this.coreUsernameInput.fill(username)
34
- : this.usernameInput.fill(username));
37
+ if (await this.page.locator('#username').isVisible()) {
38
+ await this.page.fill('#username', username);
39
+ }
40
+ else {
41
+ await (this.useCore
42
+ ? this.coreUsernameInput.fill(username)
43
+ : this.usernameInput.fill(username));
44
+ }
35
45
  }
36
46
  async clickUsername() {
37
- await (this.useCore
38
- ? this.coreUsernameInput.click({ timeout: 60000 })
39
- : this.usernameInput.click({ timeout: 60000 }));
47
+ if (await this.page.locator('#username').isVisible()) {
48
+ await this.page.click('#username');
49
+ }
50
+ else {
51
+ await (this.useCore
52
+ ? this.coreUsernameInput.click({ timeout: 60000 })
53
+ : this.usernameInput.click({ timeout: 60000 }));
54
+ }
40
55
  }
41
56
  async fillPassword(password) {
42
- await (this.useCore
43
- ? this.corePasswordInput.fill(password)
44
- : this.passwordInput.fill(password));
57
+ if (await this.page.locator('#password').isVisible()) {
58
+ await this.page.fill('#password', password);
59
+ }
60
+ else {
61
+ await (this.useCore
62
+ ? this.corePasswordInput.fill(password)
63
+ : this.passwordInput.fill(password));
64
+ }
45
65
  }
46
66
  async clickLoginButton() {
47
- await (this.useCore
48
- ? this.coreLoginButton.click({ timeout: 60000 })
49
- : this.loginButton.click({ timeout: 60000 }));
67
+ if (await this.page.locator('button[type="submit"]').isVisible()) {
68
+ await this.page.click('button[type="submit"]');
69
+ }
70
+ else {
71
+ await (this.useCore
72
+ ? this.coreLoginButton.click({ timeout: 60000 })
73
+ : this.loginButton.click({ timeout: 60000 }));
74
+ }
50
75
  }
51
76
  async login(username, password) {
52
77
  try {
53
78
  await this.detectLoginForm();
54
- const activeLoginButton = this.useCore
55
- ? this.coreLoginButton
56
- : this.loginButton;
57
- await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
79
+ if (await this.page
80
+ .locator('body#keycloak-bg[data-page-id="login-login"]')
81
+ .isVisible()) {
82
+ await (0, test_1.expect)(this.keycloakBanner).toBeVisible({ timeout: 15000 });
83
+ }
84
+ else {
85
+ const activeLoginButton = this.useCore
86
+ ? this.coreLoginButton
87
+ : this.loginButton;
88
+ await (0, test_1.expect)(activeLoginButton).toBeVisible({ timeout: 15000 });
89
+ }
58
90
  }
59
91
  catch (error) {
60
92
  return;
@@ -108,7 +108,10 @@ class NavigationPage {
108
108
  await this.goTo('/optimize', this.optimizePageBanner, sleepTimeout, credentials);
109
109
  }
110
110
  async goToKeycloak() {
111
- await this.page.goto('/auth');
111
+ const keycloakUrl = process.env.KEYCLOAK_URL
112
+ ? `${process.env.KEYCLOAK_URL}/auth`
113
+ : '/auth';
114
+ await this.page.goto(keycloakUrl);
112
115
  await (0, test_1.expect)(this.keyboardPageBanner).toBeVisible();
113
116
  }
114
117
  async goToOCIdentity(sleepTimeout, credentials) {
@@ -31,20 +31,20 @@ class OptimizeHomePage {
31
31
  }
32
32
  async clickCollectionsLink() {
33
33
  try {
34
- await this.modalCloseButton.click({ timeout: 60000 });
35
- await this.collectionsLink.click({ timeout: 60000 });
34
+ await this.modalCloseButton.click();
35
+ await this.collectionsLink.click();
36
36
  }
37
37
  catch (error) {
38
- await this.collectionsLink.click({ timeout: 60000 });
38
+ await this.collectionsLink.click();
39
39
  }
40
40
  }
41
41
  async clickDashboardLink() {
42
42
  try {
43
- await this.modalCloseButton.click({ timeout: 60000 });
44
- await this.dashboardLink.click({ timeout: 60000 });
43
+ await this.modalCloseButton.click();
44
+ await this.dashboardLink.click();
45
45
  }
46
46
  catch (error) {
47
- await this.dashboardLink.click({ timeout: 60000 });
47
+ await this.dashboardLink.click();
48
48
  }
49
49
  }
50
50
  async assertProcessHasBeenImported(processId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",