@camunda/e2e-test-suite 0.0.1229 → 0.0.1230

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,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OCIdentityRolesPage = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const UtilitiesPage_1 = require("../SM-8.9/UtilitiesPage");
6
+ const expectLocatorWithPagination_1 = require("../../utils/assertionHelpers/expectLocatorWithPagination");
7
+ const findLocatorWithPagination_1 = require("../../utils/assertionHelpers/findLocatorWithPagination");
6
8
  class OCIdentityRolesPage {
7
9
  page;
8
10
  selectResourceTypeTab;
@@ -100,6 +102,12 @@ class OCIdentityRolesPage {
100
102
  await this.selectResourceTypeTab('Mapping Rules').click();
101
103
  }
102
104
  async clickRole(roleID) {
105
+ // The roles table paginates at 10 rows and the cluster already ships six
106
+ // built-in roles, so a role this suite created is regularly on page 2 and
107
+ // is never in the DOM on page 1 - walk the pages before asserting.
108
+ await (0, findLocatorWithPagination_1.findLocatorWithPagination)(this.page, this.roleCell(roleID).first(), {
109
+ timeout: 60000,
110
+ });
103
111
  await (0, test_1.expect)(this.roleCell(roleID).first()).toBeVisible({ timeout: 60000 });
104
112
  await this.roleCell(roleID).first().click();
105
113
  }
@@ -122,15 +130,26 @@ class OCIdentityRolesPage {
122
130
  await this.createNameField.fill(role.name);
123
131
  await this.createRoleModalCreateButton.click();
124
132
  await (0, test_1.expect)(this.createRoleModal).not.toBeVisible();
125
- await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(this.page, this.rolesList
133
+ // A freshly created role sorts to the end of a table that paginates at 10
134
+ // rows, so on a cluster that already holds ten roles it lands on page 2.
135
+ // Polling page 1 can never see it - page through instead.
136
+ await (0, expectLocatorWithPagination_1.expectLocatorWithPagination)(this.page, this.rolesList
126
137
  .getByRole('cell', {
127
138
  name: role.name,
128
139
  })
129
- .first(), role.id, 10000, false, 10);
140
+ .first(), { maxRetries: 10 });
130
141
  }
131
142
  async deleteRole(name, options) {
132
143
  const { throwError = true } = options || {};
133
144
  try {
145
+ // Same pagination trap as createRole: the row - and therefore its
146
+ // Delete button - is regularly on page 2 by the time cleanup runs. With
147
+ // throwError:false the miss is swallowed, which is how stale roles pile
148
+ // up on the cluster and push later roles off page 1 in the first place.
149
+ const found = await (0, findLocatorWithPagination_1.findLocatorWithPagination)(this.page, this.deleteRoleButton(name), { timeout: 30000 });
150
+ if (!found) {
151
+ throw new Error(`Role "${name}" was not found on any page of the roles table`);
152
+ }
134
153
  await this.deleteRoleButton(name).click();
135
154
  await (0, test_1.expect)(this.deleteRoleModal).toBeVisible();
136
155
  await this.deleteRoleModalDeleteButton.click();
@@ -24,7 +24,7 @@ export declare function modelRestConnector(modelerCreatePage: ModelerCreatePage,
24
24
  username: string;
25
25
  password: string;
26
26
  }): Promise<void>;
27
- export declare function assertLocatorVisibleWithPaginated(page: Page, locator: Locator, text: string): Promise<void>;
27
+ export declare function assertLocatorVisibleWithPaginated(page: Page, locator: Locator, text: string, timeout?: number): Promise<void>;
28
28
  export declare function assertLocatorVisibleWithRetry(page: Page, locator: Locator, text: string, timeout?: number, notVisible?: boolean, maxRetries?: number, clickLocator?: Locator): Promise<void>;
29
29
  export declare function assertPageTextWithRetry(page: Page, text: string, notVisible?: boolean, timeout?: number, maxRetries?: number): Promise<void>;
30
30
  export declare function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage: ModelerCreatePage, modelerHomePage: ModelerHomePage, processName: string, page: Page, connectorMarketplacePage: ConnectorMarketplacePage, connectorTemplatePage: ConnectorTemplatePage, tenant?: string): Promise<void>;
@@ -48,10 +48,13 @@ async function assignMappingToRole(page, ocIdentityHomePage, ocIdentityRolesPage
48
48
  });
49
49
  }
50
50
  catch (error) {
51
- await ocIdentityRolesPage.createRole({ id: role, name: role });
51
+ // Register the id before creating so a create that fails part-way still
52
+ // leaves the role on the afterEach cleanup list; a leaked role stays on
53
+ // the cluster forever and pushes later roles onto page 2 of the table.
52
54
  if (testMappings && role.toLowerCase() != 'admin') {
53
55
  testMappings.roleIds.push(role);
54
56
  }
57
+ await ocIdentityRolesPage.createRole({ id: role, name: role });
55
58
  }
56
59
  await ocIdentityRolesPage.assignMappingRuleToRole(role, mappingRuleId);
57
60
  await assertLocatorVisibleWithPaginated(page, ocIdentityRolesPage.mappingRuleRow(mappingRuleId).first(), `${mappingRuleId} Mapping Rule`);
@@ -231,7 +234,7 @@ async function modelRestConnector(modelerCreatePage, connectorSettingsPage, conn
231
234
  await (0, sleep_1.sleep)(10000);
232
235
  }
233
236
  exports.modelRestConnector = modelRestConnector;
234
- async function assertLocatorVisibleWithPaginated(page, locator, text) {
237
+ async function assertLocatorVisibleWithPaginated(page, locator, text, timeout = 20000) {
235
238
  const maxRetries = 6;
236
239
  for (let attempt = 0; attempt < maxRetries; attempt++) {
237
240
  try {
@@ -240,7 +243,10 @@ async function assertLocatorVisibleWithPaginated(page, locator, text) {
240
243
  if (attempt > 2) {
241
244
  await (0, findLocatorInPaginatedList_1.findLocatorInPaginatedList)(page, locator);
242
245
  }
243
- await (0, test_1.expect)(locator).toBeVisible();
246
+ // Without an explicit budget this inherits the 5s expect default, so
247
+ // six attempts only poll for ~60s in total - not enough for a freshly
248
+ // assigned mapping rule to show up on the role detail page.
249
+ await (0, test_1.expect)(locator).toBeVisible({ timeout });
244
250
  return;
245
251
  }
246
252
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1229",
3
+ "version": "0.0.1230",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",