@camunda/e2e-test-suite 0.0.571 → 0.0.572

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.
@@ -109,21 +109,28 @@ class IdentityTenantPage {
109
109
  await this.searchUsersInput.fill(user);
110
110
  }
111
111
  async clickAssignUserFinalButton() {
112
- try {
113
- await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
114
- await this.assignUserFinalButton.click();
115
- await (0, test_1.expect)(this.page.getByText('Users assigned', { exact: true })).toBeVisible();
112
+ await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
113
+ await this.assignUserFinalButton.click();
114
+ const successToast = this.page.getByText('Users assigned', { exact: true });
115
+ const errorToast = this.page.getByText('An error occurred');
116
+ const alreadyExists = this.page.getByText('ALREADY_EXISTS');
117
+ await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
118
+ timeout: 30000,
119
+ });
120
+ if (await alreadyExists.isVisible()) {
121
+ console.log('User already assigned to tenant');
122
+ await this.cancelButton.click();
123
+ await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
124
+ return;
116
125
  }
117
- catch (e) {
118
- if (await this.page.getByText('ALREADY_EXISTS').first().isVisible()) {
119
- console.log('Tenant is already assigned to tenant');
120
- await this.cancelButton.click();
121
- await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
122
- }
123
- else {
124
- throw new Error('Assigning user to tenant failed' + e);
125
- }
126
+ if (await errorToast.isVisible()) {
127
+ await this.cancelButton.click().catch(() => { });
128
+ await (0, test_1.expect)(this.dialog)
129
+ .not.toBeVisible({ timeout: 15000 })
130
+ .catch(() => { });
131
+ throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
126
132
  }
133
+ // success: "Users assigned" toast visible
127
134
  }
128
135
  async clickRemoveUserButton() {
129
136
  await this.removeUserButton.click();
@@ -176,18 +183,34 @@ class IdentityTenantPage {
176
183
  return false;
177
184
  }
178
185
  async assignUserToTenant(tenantName, user, userEmail) {
179
- await (0, sleep_1.sleep)(1000);
180
- await this.clickTenant(tenantName);
181
- await this.clickAssignedUsersTab();
182
- if (await this.isRowVisible(userEmail)) {
183
- return;
186
+ const MAX_ATTEMPTS = 3;
187
+ for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
188
+ await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
189
+ await this.clickTenant(tenantName);
190
+ await this.clickAssignedUsersTab();
191
+ if (await this.isRowVisible(userEmail)) {
192
+ return;
193
+ }
194
+ try {
195
+ await this.clickAssignUsersButton();
196
+ await this.clickSearchUsersInput();
197
+ await this.fillSearchUsersInput(user);
198
+ await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
199
+ timeout: 30000,
200
+ });
201
+ await this.page.getByText(userEmail).click({ timeout: 30000 });
202
+ await this.clickAssignUserFinalButton();
203
+ return;
204
+ }
205
+ catch (e) {
206
+ console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
207
+ if (attempt >= MAX_ATTEMPTS) {
208
+ throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
209
+ }
210
+ await this.page.reload({ timeout: 30000 }).catch(() => { });
211
+ await (0, sleep_1.sleep)(5000);
212
+ }
184
213
  }
185
- await this.clickAssignUsersButton();
186
- await this.clickSearchUsersInput();
187
- await this.fillSearchUsersInput(user);
188
- await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
189
- await this.page.getByText(userEmail).click({ timeout: 30000 });
190
- await this.clickAssignUserFinalButton();
191
214
  }
192
215
  async removeUserFromTenant(tenantName) {
193
216
  await this.page.getByText(tenantName).first().click();
@@ -109,21 +109,28 @@ class IdentityTenantPage {
109
109
  await this.searchUsersInput.fill(user);
110
110
  }
111
111
  async clickAssignUserFinalButton() {
112
- try {
113
- await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
114
- await this.assignUserFinalButton.click();
115
- await (0, test_1.expect)(this.page.getByText('Users assigned', { exact: true })).toBeVisible();
112
+ await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
113
+ await this.assignUserFinalButton.click();
114
+ const successToast = this.page.getByText('Users assigned', { exact: true });
115
+ const errorToast = this.page.getByText('An error occurred');
116
+ const alreadyExists = this.page.getByText('ALREADY_EXISTS');
117
+ await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
118
+ timeout: 30000,
119
+ });
120
+ if (await alreadyExists.isVisible()) {
121
+ console.log('User already assigned to tenant');
122
+ await this.cancelButton.click();
123
+ await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
124
+ return;
116
125
  }
117
- catch (e) {
118
- if (await this.page.getByText('ALREADY_EXISTS').first().isVisible()) {
119
- console.log('Tenant is already assigned to tenant');
120
- await this.cancelButton.click();
121
- await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
122
- }
123
- else {
124
- throw new Error('Assigning user to tenant failed' + e);
125
- }
126
+ if (await errorToast.isVisible()) {
127
+ await this.cancelButton.click().catch(() => { });
128
+ await (0, test_1.expect)(this.dialog)
129
+ .not.toBeVisible({ timeout: 15000 })
130
+ .catch(() => { });
131
+ throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
126
132
  }
133
+ // success: "Users assigned" toast visible
127
134
  }
128
135
  async clickRemoveUserButton() {
129
136
  await this.removeUserButton.click();
@@ -176,18 +183,34 @@ class IdentityTenantPage {
176
183
  return false;
177
184
  }
178
185
  async assignUserToTenant(tenantName, user, userEmail) {
179
- await (0, sleep_1.sleep)(1000);
180
- await this.clickTenant(tenantName);
181
- await this.clickAssignedUsersTab();
182
- if (await this.isRowVisible(userEmail)) {
183
- return;
186
+ const MAX_ATTEMPTS = 3;
187
+ for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
188
+ await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
189
+ await this.clickTenant(tenantName);
190
+ await this.clickAssignedUsersTab();
191
+ if (await this.isRowVisible(userEmail)) {
192
+ return;
193
+ }
194
+ try {
195
+ await this.clickAssignUsersButton();
196
+ await this.clickSearchUsersInput();
197
+ await this.fillSearchUsersInput(user);
198
+ await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
199
+ timeout: 30000,
200
+ });
201
+ await this.page.getByText(userEmail).click({ timeout: 30000 });
202
+ await this.clickAssignUserFinalButton();
203
+ return;
204
+ }
205
+ catch (e) {
206
+ console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
207
+ if (attempt >= MAX_ATTEMPTS) {
208
+ throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
209
+ }
210
+ await this.page.reload({ timeout: 30000 }).catch(() => { });
211
+ await (0, sleep_1.sleep)(5000);
212
+ }
184
213
  }
185
- await this.clickAssignUsersButton();
186
- await this.clickSearchUsersInput();
187
- await this.fillSearchUsersInput(user);
188
- await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
189
- await this.page.getByText(userEmail).click({ timeout: 30000 });
190
- await this.clickAssignUserFinalButton();
191
214
  }
192
215
  async removeUserFromTenant(tenantName) {
193
216
  await this.page.getByText(tenantName).first().click();
@@ -179,8 +179,12 @@ class OperateProcessesPage {
179
179
  catch (err) {
180
180
  lastError = err instanceof Error ? err.message : err;
181
181
  console.log(`Attempt ${attempt} failed for "${processName}". URL: ${this.page.url()}. Error: ${String(lastError)}. Reloading...`);
182
- await this.page.reload();
183
- await this.page.waitForLoadState('networkidle');
182
+ await this.page
183
+ .reload({ timeout: 30000 })
184
+ .catch(() => console.log('Page reload timed out or refused, continuing...'));
185
+ await this.page
186
+ .waitForLoadState('networkidle', { timeout: 30000 })
187
+ .catch(() => console.log('waitForLoadState networkidle timed out, continuing...'));
184
188
  }
185
189
  }
186
190
  throw new Error(`Failed to open instance "${processName}" after ${MAX_ATTEMPTS} attempts. Last error: ${String(lastError)}`);
@@ -223,7 +227,9 @@ class OperateProcessesPage {
223
227
  catch (error) {
224
228
  retryCount++;
225
229
  console.log(`Attempt ${retryCount} failed. Retrying...`);
226
- await this.page.reload();
230
+ await this.page
231
+ .reload({ timeout: 30000 })
232
+ .catch(() => console.log('Page reload timed out or refused, continuing...'));
227
233
  await this.page.waitForTimeout(10000);
228
234
  }
229
235
  }
@@ -109,21 +109,28 @@ class IdentityTenantPage {
109
109
  await this.searchUsersInput.fill(user);
110
110
  }
111
111
  async clickAssignUserFinalButton() {
112
- try {
113
- await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
114
- await this.assignUserFinalButton.click();
115
- await (0, test_1.expect)(this.page.getByText('Users assigned', { exact: true })).toBeVisible();
112
+ await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
113
+ await this.assignUserFinalButton.click();
114
+ const successToast = this.page.getByText('Users assigned', { exact: true });
115
+ const errorToast = this.page.getByText('An error occurred');
116
+ const alreadyExists = this.page.getByText('ALREADY_EXISTS');
117
+ await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
118
+ timeout: 30000,
119
+ });
120
+ if (await alreadyExists.isVisible()) {
121
+ console.log('User already assigned to tenant');
122
+ await this.cancelButton.click();
123
+ await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
124
+ return;
116
125
  }
117
- catch (e) {
118
- if (await this.page.getByText('ALREADY_EXISTS').first().isVisible()) {
119
- console.log('Tenant is already assigned to tenant');
120
- await this.cancelButton.click();
121
- await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
122
- }
123
- else {
124
- throw new Error('Assigning user to tenant failed' + e);
125
- }
126
+ if (await errorToast.isVisible()) {
127
+ await this.cancelButton.click().catch(() => { });
128
+ await (0, test_1.expect)(this.dialog)
129
+ .not.toBeVisible({ timeout: 15000 })
130
+ .catch(() => { });
131
+ throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
126
132
  }
133
+ // success: "Users assigned" toast visible
127
134
  }
128
135
  async clickRemoveUserButton() {
129
136
  await this.removeUserButton.click();
@@ -176,18 +183,34 @@ class IdentityTenantPage {
176
183
  return false;
177
184
  }
178
185
  async assignUserToTenant(tenantName, user, userEmail) {
179
- await (0, sleep_1.sleep)(1000);
180
- await this.clickTenant(tenantName);
181
- await this.clickAssignedUsersTab();
182
- if (await this.isRowVisible(userEmail)) {
183
- return;
186
+ const MAX_ATTEMPTS = 3;
187
+ for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
188
+ await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
189
+ await this.clickTenant(tenantName);
190
+ await this.clickAssignedUsersTab();
191
+ if (await this.isRowVisible(userEmail)) {
192
+ return;
193
+ }
194
+ try {
195
+ await this.clickAssignUsersButton();
196
+ await this.clickSearchUsersInput();
197
+ await this.fillSearchUsersInput(user);
198
+ await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
199
+ timeout: 30000,
200
+ });
201
+ await this.page.getByText(userEmail).click({ timeout: 30000 });
202
+ await this.clickAssignUserFinalButton();
203
+ return;
204
+ }
205
+ catch (e) {
206
+ console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
207
+ if (attempt >= MAX_ATTEMPTS) {
208
+ throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
209
+ }
210
+ await this.page.reload({ timeout: 30000 }).catch(() => { });
211
+ await (0, sleep_1.sleep)(5000);
212
+ }
184
213
  }
185
- await this.clickAssignUsersButton();
186
- await this.clickSearchUsersInput();
187
- await this.fillSearchUsersInput(user);
188
- await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
189
- await this.page.getByText(userEmail).click({ timeout: 30000 });
190
- await this.clickAssignUserFinalButton();
191
214
  }
192
215
  async removeUserFromTenant(tenantName) {
193
216
  await this.page.getByText(tenantName).first().click();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.571",
3
+ "version": "0.0.572",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",