@camunda/e2e-test-suite 0.0.10 → 0.0.12

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.
@@ -20,6 +20,7 @@ declare class IdentityTenantPage {
20
20
  readonly rows: Locator;
21
21
  readonly confirmDeleteInput: Locator;
22
22
  readonly dangerDeleteButton: Locator;
23
+ readonly cancelButton: Locator;
23
24
  constructor(page: Page);
24
25
  clickCreateTenantMainButton(): Promise<void>;
25
26
  clickCreateTenantSubButton(): Promise<void>;
@@ -24,6 +24,7 @@ class IdentityTenantPage {
24
24
  rows;
25
25
  confirmDeleteInput;
26
26
  dangerDeleteButton;
27
+ cancelButton;
27
28
  constructor(page) {
28
29
  this.page = page;
29
30
  this.createTenantMainButton = page.getByRole('button', {
@@ -60,6 +61,7 @@ class IdentityTenantPage {
60
61
  name: 'Type the word DELETE to confirm',
61
62
  });
62
63
  this.dangerDeleteButton = page.getByRole('button', { name: 'danger Delete' });
64
+ this.cancelButton = page.getByRole('button', { name: 'Cancel' });
63
65
  }
64
66
  async clickCreateTenantMainButton() {
65
67
  await this.createTenantMainButton.click({ timeout: 60000 });
@@ -102,6 +104,7 @@ class IdentityTenantPage {
102
104
  }
103
105
  async createTenant(tenantName) {
104
106
  await this.page.waitForLoadState('networkidle');
107
+ await (0, sleep_1.sleep)(1000);
105
108
  const tenant = this.rows.filter({ hasText: tenantName }).first();
106
109
  // Check if the tenant already exists. If so, we're done.
107
110
  if (await tenant.isVisible({ timeout: 5000 })) {
@@ -117,10 +120,27 @@ class IdentityTenantPage {
117
120
  // After attempting to create, we expect either a success message,
118
121
  // or for the tenant to now be in the list (in case of a race condition
119
122
  // where another process created it).
120
- const successMessage = this.page.getByText('Tenant created');
121
- await (0, test_1.expect)(successMessage.or(tenant)).toBeVisible({
122
- timeout: 10000,
123
- });
123
+ const toast = this.page.getByText('Tenant created');
124
+ const errorToast = this.page.getByText('An error occurred');
125
+ const row = this.page.getByRole('row', { name: tenantName });
126
+ const result = await Promise.race([
127
+ toast.waitFor({ state: 'visible', timeout: 10000 }).then(() => 'Tenant Created'),
128
+ row.waitFor({ state: 'visible', timeout: 10000 }).then(() => 'Tenant Created'),
129
+ errorToast.waitFor({ state: 'visible', timeout: 10000 }).then(() => 'Tenant Creation Failed'),
130
+ ]);
131
+ if (result === 'Tenant Created') {
132
+ console.log(`Tenant ${tenantName} created.`);
133
+ return;
134
+ }
135
+ else if (result === 'Tenant Creation Failed') {
136
+ console.log(`Tenant ${tenantName} already exists.`);
137
+ await this.cancelButton.click();
138
+ await this.page.reload;
139
+ return;
140
+ }
141
+ else {
142
+ throw new Error(`Unknown error creating tenant ${tenantName}`);
143
+ }
124
144
  }
125
145
  async deleteTenant(tenantName, tenant) {
126
146
  console.log(`Tenant ${tenantName} already exists, deleting.`);
@@ -139,6 +159,7 @@ class IdentityTenantPage {
139
159
  }
140
160
  }
141
161
  async assignUserToTenant(tenantName, user, userEmail) {
162
+ await this.page.reload();
142
163
  const tenant = this.rows.filter({ hasText: tenantName }).first();
143
164
  await (0, test_1.expect)(tenant).toBeVisible();
144
165
  await tenant.click();
@@ -454,11 +454,11 @@ class ModelerCreatePage {
454
454
  if (attempt > 1) {
455
455
  await this.page.reload();
456
456
  }
457
- if (await this.startInstanceMainButton.isVisible({ timeout: 30000 })) {
458
- await this.startInstanceMainButton.click({ timeout: 30000 });
457
+ if (await this.startInstanceMainButton.isVisible({ timeout: 3000 })) {
458
+ await this.startInstanceMainButton.click({ timeout: 3000 });
459
459
  }
460
460
  else {
461
- await this.deployAndRunMainButton.click({ timeout: 30000 }); //will be available from alpha7
461
+ await this.deployAndRunMainButton.click({ timeout: 3000 }); //will be available from alpha7
462
462
  }
463
463
  return;
464
464
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NavigationPage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const LoginPage_1 = require("./LoginPage");
6
- const randomSleep_1 = require("../../utils/randomSleep");
7
6
  const sleep_1 = require("../../utils/sleep");
8
7
  const constants_1 = require("../../utils/constants");
9
8
  class NavigationPage {
@@ -60,37 +59,38 @@ class NavigationPage {
60
59
  if (sleepTimeout) {
61
60
  await (0, sleep_1.sleep)(sleepTimeout);
62
61
  }
63
- await this.page.goto(url, { timeout: constants_1._1_SECOND_IN_MS * 10 });
62
+ await this.page.goto(url, { timeout: 10000 });
64
63
  const loginPage = new LoginPage_1.LoginPage(this.page);
65
- const isLogin = await Promise.race([
66
- loginPage.isLoginPage(),
67
- (0, sleep_1.sleep)(timeout) // the sleep here is a delay to allow the login page to load so that the race is a fair race
68
- .then(async () => {
69
- try {
70
- await (0, test_1.expect)(banner).toBeVisible({
71
- timeout: constants_1._1_SECOND_IN_MS * 2,
72
- });
73
- return false;
74
- }
75
- catch {
76
- return true;
77
- }
78
- }),
79
- ]);
80
- if (isLogin) {
81
- if (!this.activeUser) {
82
- console.error('Fatal error, shutting down.');
83
- process.exit(1);
64
+ const loginSelector = loginPage.usernameInput; // Or another unique, stable selector
65
+ // 1. Wait for either the banner or the login page to appear first.
66
+ await (0, test_1.expect)(banner.or(loginSelector)).toBeVisible({ timeout: 15000 });
67
+ // 2. Now, check which one it was.
68
+ const isBannerVisible = await banner.isVisible();
69
+ if (isBannerVisible) {
70
+ // The banner is visible. This MIGHT be the page that redirects.
71
+ // We'll wait a few seconds to see if it "corrects itself" to the login page.
72
+ try {
73
+ // Wait specifically for the login page selector to appear.
74
+ await (0, test_1.expect)(loginSelector).toBeVisible({ timeout: 5000 });
75
+ // If we get here, a redirect occurred. Now we log in.
76
+ await loginPage.login(this.activeUser, this.activePassword);
84
77
  }
78
+ catch (error) {
79
+ // The login selector did NOT appear. The banner is real. We are on the correct page.
80
+ // The navigation was successful, so we can just return.
81
+ }
82
+ }
83
+ else {
84
+ // The login page was visible from the start.
85
85
  await loginPage.login(this.activeUser, this.activePassword);
86
86
  }
87
- return;
87
+ return; // End of successful navigation/login
88
88
  }
89
89
  catch (error) {
90
90
  const now = new Date();
91
91
  const elapsed = Date.now() - startTime;
92
92
  if (attempt < maxRetries - 1) {
93
- await (0, randomSleep_1.randomSleep)(15000, 30000);
93
+ await (0, sleep_1.sleep)(5000);
94
94
  if (!this.page.isClosed()) {
95
95
  try {
96
96
  await this.page.waitForLoadState('load', { timeout: timeout });
@@ -10,17 +10,20 @@ const optimizeReportUtils_1 = require("./optimizeReportUtils");
10
10
  const loggingUtils_1 = require("../../utils/loggingUtils");
11
11
  SM_8_7_1.test.describe.parallel('Smoke Tests', () => {
12
12
  SM_8_7_1.test.beforeEach(async ({ navigationPage, identityPage, identityTenantPage, keycloakLoginPage, keycloakAdminPage, }, testInfo) => {
13
+ console.log('TIMEOUT: ' + testInfo.timeout);
13
14
  (0, loggingUtils_1.setupTestLogging)(testInfo);
14
15
  await (0, keycloak_1.setupKeycloakUser)(navigationPage, identityPage, keycloakLoginPage, keycloakAdminPage, identityTenantPage);
15
16
  if (process.env.IS_MT === 'true') {
16
17
  const mt_connectors_tenant = [
18
+ 'default',
17
19
  'Tenant_Main_Connectors',
18
20
  'Tenant_Second_Connectors',
19
21
  'Tenant_1_Connectors',
20
22
  'Tenant_2_Connectors',
21
23
  ];
24
+ await navigationPage.goToIdentity();
22
25
  for (const tenant of mt_connectors_tenant) {
23
- await navigationPage.goToIdentity();
26
+ await identityPage.clickTenantTab();
24
27
  await identityTenantPage.createTenant(tenant);
25
28
  await identityTenantPage.assignUserToTenant(tenant, navigationPage.activeUser, navigationPage.activeUser + '@camunda.com');
26
29
  await identityTenantPage.assignClientToTenant('Zeebe');
@@ -28,6 +31,7 @@ SM_8_7_1.test.describe.parallel('Smoke Tests', () => {
28
31
  }
29
32
  });
30
33
  SM_8_7_1.test.afterEach(async ({ page }, testInfo) => {
34
+ console.log('TIMEOUT: ' + testInfo.timeout);
31
35
  await (0, _setup_1.captureScreenshot)(page, testInfo);
32
36
  await (0, _setup_1.captureFailureVideo)(page, testInfo);
33
37
  (0, loggingUtils_1.cleanupTestLogging)();
@@ -35,7 +39,7 @@ SM_8_7_1.test.describe.parallel('Smoke Tests', () => {
35
39
  (0, SM_8_7_1.test)('Basic Login', async ({ context, identityPage, navigationPage }) => {
36
40
  await context.clearCookies();
37
41
  await navigationPage.goToIdentity(1000);
38
- await (0, test_1.expect)(identityPage.identityBanner).toBeVisible({ timeout: 120000 });
42
+ await (0, test_1.expect)(identityPage.identityBanner).toBeVisible({ timeout: 10000 });
39
43
  });
40
44
  (0, SM_8_7_1.test)('Basic Navigation', async ({ context, navigationPage }) => {
41
45
  await SM_8_7_1.test.step('Assert Web Modeler Navigation', async () => {
@@ -63,8 +63,4 @@ const createIdentityUser = async (navigationPage, identityPage, identityTenantPa
63
63
  await identityPage.clickIdentityCheckbox();
64
64
  await identityPage.clickModelerAdminCheckbox();
65
65
  await identityPage.clickAddButton();
66
- if (process.env.IS_MT === 'true') {
67
- await identityPage.clickTenantTab();
68
- await identityTenantPage.assignUserToTenant('default', username, username + '@camunda.com');
69
- }
70
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",