@camunda/e2e-test-suite 0.0.1081 → 0.0.1082

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.
@@ -32,10 +32,15 @@ declare class NavigationPage {
32
32
  username: string;
33
33
  password: string;
34
34
  }): Promise<void>;
35
+ private goToWithoutAccess;
35
36
  goToOptimizeWithoutAccess({ username, password, }?: {
36
37
  username?: string;
37
38
  password?: string;
38
39
  }): Promise<void>;
40
+ goToModelerWithoutAccess({ username, password, }?: {
41
+ username?: string;
42
+ password?: string;
43
+ }): Promise<void>;
39
44
  goToKeycloak(): Promise<void>;
40
45
  goToOCIdentity(sleepTimeout?: number, credentials?: {
41
46
  username: string;
@@ -35,6 +35,10 @@ const RETRIABLE_NAVIGATION_NETWORK_ERRORS = [
35
35
  ];
36
36
  const NETWORK_OUTAGE_BUDGET = constants_1._1_MINUTE_IN_MS * 5;
37
37
  const NETWORK_OUTAGE_POLL_INTERVAL = constants_1._1_SECOND_IN_MS * 10;
38
+ // Statuses the ingress returns on its own behalf while a component has no
39
+ // ready backend — the component is restarting, not denying the request.
40
+ const GATEWAY_ERROR_STATUSES = [502, 503, 504];
41
+ const COMPONENT_UNAVAILABLE_BUDGET = constants_1._1_MINUTE_IN_MS * 3;
38
42
  class NavigationPage {
39
43
  page;
40
44
  modelerPageBanner;
@@ -88,11 +92,10 @@ class NavigationPage {
88
92
  async gotoWithNetworkRetry(url, networkOutageDeadline) {
89
93
  for (;;) {
90
94
  try {
91
- await this.page.goto(url, {
95
+ return await this.page.goto(url, {
92
96
  timeout: 60000,
93
97
  waitUntil: 'domcontentloaded',
94
98
  });
95
- return;
96
99
  }
97
100
  catch (error) {
98
101
  if (!this.isRetriableNavigationNetworkError(error) ||
@@ -181,15 +184,37 @@ class NavigationPage {
181
184
  async goToOptimize(sleepTimeout, credentials) {
182
185
  await this.goTo(OPTIMIZE_CONTEXT_PATH, this.optimizePageBanner, sleepTimeout, credentials);
183
186
  }
184
- // `goTo` ends by asserting the app banner, so it cannot be used to reach
185
- // Optimize as a user without the Optimize role: that request ends on a
186
- // `text/plain` 403 page carrying neither the banner nor a login form, and
187
- // every retry burns a full 60s timeout. Navigate and log in only; the
188
- // caller asserts what the denied page shows.
189
- async goToOptimizeWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
190
- await this.gotoWithNetworkRetry(OPTIMIZE_CONTEXT_PATH, Date.now() + NETWORK_OUTAGE_BUDGET);
187
+ // `goTo` ends by asserting the app banner, so it cannot be used to reach a
188
+ // component the user has no role for: the denied page carries neither the
189
+ // banner nor a login form, so every retry burns a full 60s timeout.
190
+ // Navigate and log in only; the caller asserts what the denied page shows.
191
+ // A gateway error is the ingress speaking, not the component (run
192
+ // 33703764920: nginx served "503 Service Temporarily Unavailable" for the
193
+ // whole Optimize step while its pod was rescheduled), so keep re-navigating
194
+ // until the component itself answers.
195
+ async goToWithoutAccess(url, username, password) {
196
+ const deadline = Date.now() + COMPONENT_UNAVAILABLE_BUDGET;
197
+ await (0, test_1.expect)(async () => {
198
+ const response = await this.gotoWithNetworkRetry(url, deadline);
199
+ (0, test_1.expect)(GATEWAY_ERROR_STATUSES).not.toContain(response?.status());
200
+ }).toPass({
201
+ timeout: COMPONENT_UNAVAILABLE_BUDGET,
202
+ intervals: [5000, 10000, 15000],
203
+ });
191
204
  await new LoginPage_1.LoginPage(this.page).login(username, password);
192
205
  }
206
+ // Optimize denies a user without the Optimize role with a `text/plain` 403
207
+ // page.
208
+ async goToOptimizeWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
209
+ await this.goToWithoutAccess(OPTIMIZE_CONTEXT_PATH, username, password);
210
+ }
211
+ // Web Modeler denies a user without the Web Modeler role by bouncing back
212
+ // to Keycloak, sometimes after briefly rendering its banner, so `goTo`'s
213
+ // closing banner assertion either never passes or passes by winning that
214
+ // race.
215
+ async goToModelerWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
216
+ await this.goToWithoutAccess(MODELER_CONTEXT_PATH, username, password);
217
+ }
193
218
  async goToKeycloak() {
194
219
  const keycloakUrl = process.env.KEYCLOAK_URL
195
220
  ? `${process.env.KEYCLOAK_URL}/auth`
@@ -206,14 +231,10 @@ class NavigationPage {
206
231
  async goToConsole(sleepTimeout, credentials) {
207
232
  await this.goTo(CONSOLE_CONTEXT_PATH, this.consolePageBanner, sleepTimeout, credentials);
208
233
  }
209
- // `goTo` ends by asserting the app banner, so it cannot be used to reach
210
- // Console as a user without the Console role: that request renders
211
- // Console's own "Something went wrong" error page, which has neither the
212
- // banner nor a login form, and every retry burns a full 60s timeout.
213
- // Navigate and log in only; the caller asserts what the denied page shows.
234
+ // Console denies a user without the Console role with its own
235
+ // "Something went wrong" error page.
214
236
  async goToConsoleWithoutAccess({ username = IDENTITY_FIRSTUSER_USERNAME, password = IDENTITY_FIRSTUSER_PASSWORD, } = {}) {
215
- await this.gotoWithNetworkRetry(CONSOLE_CONTEXT_PATH, Date.now() + NETWORK_OUTAGE_BUDGET);
216
- await new LoginPage_1.LoginPage(this.page).login(username, password);
237
+ await this.goToWithoutAccess(CONSOLE_CONTEXT_PATH, username, password);
217
238
  }
218
239
  async goToManagementIdentity(sleepTimeout, credentials) {
219
240
  await this.goTo(MANAGEMENT_IDENTITY_CONTEXT_PATH, this.managementIdentityPageBanner, sleepTimeout, credentials);
@@ -74,7 +74,7 @@ SM_8_9_1.test.describe('Identity User Flow Tests', () => {
74
74
  });
75
75
  });
76
76
  await SM_8_9_1.test.step('Ensure Modeler is not Accessible', async () => {
77
- await navigationPage.goToModeler(undefined, credentials);
77
+ await navigationPage.goToModelerWithoutAccess(credentials);
78
78
  await (0, test_1.expect)(modelerHomePage.modelerPageBanner).not.toBeVisible({
79
79
  timeout: 60000,
80
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1081",
3
+ "version": "0.0.1082",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",