@camunda/e2e-test-suite 0.0.1516 → 0.0.1518

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.
@@ -371,9 +371,16 @@ class ModelerCreatePage {
371
371
  name: 'Toggle public access',
372
372
  });
373
373
  this.publicationTab = page.getByRole('tab', { name: 'Publication' });
374
- this.copyPublicLinkButton = page.getByRole('button', {
374
+ // Hub's PublicationDs.tsx renders each active public link as a
375
+ // design-system CodeBlock (<div data-slot="code-block"><pre><code>URL)
376
+ // instead of the legacy Carbon "Copy to clipboard" control, so accept
377
+ // either; getPublicationLink reads the URL from the <code>.
378
+ this.copyPublicLinkButton = page
379
+ .getByRole('button', {
375
380
  name: 'Copy to clipboard',
376
- });
381
+ })
382
+ .or(page.locator('[data-slot="code-block"]'))
383
+ .first();
377
384
  // Legacy Carbon toast vs. the design-system's Sonner-based toast
378
385
  // (data-sonner-toast, confirmed from a nightly DOM snapshot) -- same
379
386
  // migration already handled for the deploy/instance-started toasts
@@ -593,11 +600,14 @@ class ModelerCreatePage {
593
600
  // locator that dialog never had. Give it a real window to render before
594
601
  // deciding.
595
602
  const environmentRows = this.deployDiagramDialog.locator('[data-test^="environment-row-"]');
596
- const hasEnvironmentRows = await environmentRows
597
- .first()
598
- .waitFor({ state: 'visible', timeout: 10000 })
599
- .then(() => true)
600
- .catch(() => false);
603
+ // Wait for whichever dialog variant renders its content -- a fixed 10s
604
+ // probe for the environment rows alone was too short on a slow Hub, so
605
+ // the environment-based dialog fell through to the legacy branch.
606
+ const legacyClusterLabel = this.deployDiagramDialog
607
+ .locator('label')
608
+ .filter({ hasText: new RegExp(`^${clusterName}`) });
609
+ await (0, test_1.expect)(environmentRows.first().or(legacyClusterLabel).first()).toBeVisible({ timeout: 60000 });
610
+ const hasEnvironmentRows = (await environmentRows.count()) > 0;
601
611
  if (hasEnvironmentRows) {
602
612
  await (0, modelerCluster_1.selectDeployEnvironment)(this.deployDiagramDialog, clusterName);
603
613
  const targetRow = environmentRows.filter({ hasText: clusterName }).first();
@@ -607,9 +617,7 @@ class ModelerCreatePage {
607
617
  }
608
618
  else {
609
619
  //Select the correct cluster if multiple exist
610
- const clusterLabel = this.deployDiagramDialog
611
- .locator('label')
612
- .filter({ hasText: new RegExp(`^${clusterName}`) });
620
+ const clusterLabel = legacyClusterLabel;
613
621
  await (0, test_1.expect)(clusterLabel).toBeVisible({ timeout: 30000 });
614
622
  await clusterLabel.click();
615
623
  await (0, test_1.expect)(clusterLabel.getByRole('switch').or(clusterLabel.getByRole('radio'))).toBeChecked({ timeout: 30000 });
@@ -2044,15 +2052,29 @@ class ModelerCreatePage {
2044
2052
  await this.copyPublicLinkButton.click({ timeout: 60000 });
2045
2053
  }
2046
2054
  async getPublicationLink() {
2047
- // 'clipboard-write' must be granted BEFORE the click that copies the
2048
- // link -- the nightly trace showed the read always resolving empty
2049
- // (both attempts), with the click itself never observed to fail. The
2050
- // previous code only granted 'clipboard-read', after the click, which
2051
- // does nothing for the write the click triggers.
2055
+ await this.clickPublicationTab();
2056
+ // The Publication tab only lists a link once its 3s poll sees the public
2057
+ // endpoint on a healthy cluster, which can lag the deploy by a while.
2058
+ await (0, test_1.expect)(this.copyPublicLinkButton).toBeVisible({ timeout: 120000 });
2059
+ const codeBlockLink = this.page
2060
+ .locator('[data-slot="code-block"]')
2061
+ .first()
2062
+ .locator('code');
2063
+ if ((await codeBlockLink.count()) > 0) {
2064
+ // The design-system code block shows the URL as text; read it there
2065
+ // rather than through the clipboard.
2066
+ await (0, test_1.expect)(codeBlockLink).toContainText(/https?:\/\//, {
2067
+ timeout: 60000,
2068
+ });
2069
+ const link = (await codeBlockLink.innerText({ timeout: 10000 })).trim();
2070
+ (0, test_1.expect)(link).toMatch(/^https?:\/\//);
2071
+ console.log('Captured public link:', link);
2072
+ return link;
2073
+ }
2074
+ // Legacy Carbon copy button: 'clipboard-write' must be granted BEFORE the
2075
+ // click that copies the link.
2052
2076
  const context = this.page.context();
2053
2077
  await context.grantPermissions(['clipboard-read', 'clipboard-write']);
2054
- await this.clickPublicationTab();
2055
- await (0, test_1.expect)(this.copyPublicLinkButton).toBeVisible({ timeout: 60000 });
2056
2078
  await this.clickCopyPublicLinkButton();
2057
2079
  // Poll instead of one blind read after a fixed sleep -- the write is
2058
2080
  // async on the page's side and has no visible completion signal to wait
@@ -419,9 +419,11 @@ class ModelerHomePage {
419
419
  // Hub's newer nav (isNavV2) makes formBreadcrumbButton a no-op and moves
420
420
  // the dropdown behind a separate "<name> actions" kebab instead -- prefer
421
421
  // it when present, and only fall back to the legacy breadcrumb otherwise.
422
- const kebabVisible = await this.formActionsButton
423
- .isVisible({ timeout: 5000 })
424
- .catch(() => false);
422
+ // isVisible() does not wait (its timeout is ignored), so on a slow page
423
+ // the kebab was not rendered yet and the legacy breadcrumb -- absent in
424
+ // the newer nav -- was clicked instead. Wait for either control first.
425
+ await (0, test_1.expect)(this.formActionsButton.or(this.formBreadcrumbButton).first()).toBeVisible({ timeout: 60000 });
426
+ const kebabVisible = await this.formActionsButton.isVisible();
425
427
  if (kebabVisible) {
426
428
  await this.formActionsButton.click({ timeout: 60000 });
427
429
  }
@@ -112,7 +112,9 @@ class ProcessApplicationPage {
112
112
  pageReady() {
113
113
  return this.folderExplorer.or(this.breadcrumb).first();
114
114
  }
115
- async waitForProcessApplication(timeout = 90000) {
115
+ // 180s: the page alone can take ~35s to render on SaaS integration, and
116
+ // each reload inside waitWithReload costs ~15-20s more of the same budget.
117
+ async waitForProcessApplication(timeout = 180000) {
116
118
  await this.waitWithReload(this.pageReady(), timeout);
117
119
  }
118
120
  // Waits for the create menu inside the folder explorer, reloading when Hub
@@ -143,7 +143,9 @@ class NavigationPage {
143
143
  let attempt = 0;
144
144
  // Fast failures such as NS_ERROR_CONNECTION_REFUSED would exhaust
145
145
  // maxRetries in ~20s, so keep retrying until retryWindowMs has elapsed.
146
- while (attempt < maxRetries || Date.now() - startTime < retryWindowMs) {
146
+ // The loop only exits after at least maxRetries attempts AND the full
147
+ // window has elapsed, so a last attempt always runs at the deadline.
148
+ for (;;) {
147
149
  try {
148
150
  await this.page.goto(keycloakUrl);
149
151
  await (0, test_1.expect)(this.keyboardPageBanner).toBeVisible({ timeout: 60000 });
@@ -152,14 +154,14 @@ class NavigationPage {
152
154
  catch (error) {
153
155
  lastError = error;
154
156
  attempt++;
155
- const backoffMs = Math.min(5000 * attempt, 15000);
156
- if (attempt < maxRetries ||
157
- Date.now() - startTime + backoffMs < retryWindowMs) {
158
- await (0, sleep_1.sleep)(backoffMs);
159
- }
160
- else {
157
+ const remainingMs = retryWindowMs - (Date.now() - startTime);
158
+ if (attempt >= maxRetries && remainingMs <= 0) {
161
159
  break;
162
160
  }
161
+ const backoffMs = Math.min(5000 * attempt, 15000);
162
+ // Never sleep past the deadline, so the final attempt lands on it
163
+ // instead of being skipped when the next backoff would overshoot.
164
+ await (0, sleep_1.sleep)(remainingMs > 0 ? Math.min(backoffMs, remainingMs) : backoffMs);
163
165
  }
164
166
  }
165
167
  throw lastError instanceof Error
@@ -28,7 +28,6 @@ c8Run_8_9_1.test.beforeAll(async () => {
28
28
  await Promise.all([
29
29
  (0, zeebeClient_1.createInstances)('REST_Connector_Basic_Auth_Process', 1, 1),
30
30
  (0, zeebeClient_1.createInstances)('Intermediate_Event_Webhook_Connector_No_Auth_Process', 1, 1),
31
- (0, zeebeClient_1.createInstances)('REST_Connector_No_Auth_Process', 1, 1),
32
31
  (0, zeebeClient_1.createInstances)('REST_Connector_Bearer_Auth_Process', 1, 1),
33
32
  ]);
34
33
  await (0, sleep_1.sleep)(5000);
@@ -45,6 +44,9 @@ c8Run_8_9_1.test.describe('Connectors User Flow Tests @tasklistV2', () => {
45
44
  });
46
45
  // Skipped due to bug #8440: https://github.com/camunda/connectors/issues/8440
47
46
  c8Run_8_9_1.test.skip('REST Connector No Auth User Flow', async ({ page, operateHomePage, operateProcessInstancePage, operateProcessesPage, }) => {
47
+ // Created here rather than in the shared beforeAll so the quarantined
48
+ // scenario does not submit its connector job while the test is skipped.
49
+ await (0, zeebeClient_1.createInstances)('REST_Connector_No_Auth_Process', 1, 1);
48
50
  await c8Run_8_9_1.test.step('View Process Instance in Operate, assert it completes and assert result expression', async () => {
49
51
  await (0, test_1.expect)(operateHomePage.processesTab).toBeVisible({ timeout: 180000 });
50
52
  await operateHomePage.clickProcessesTab();
@@ -13,6 +13,7 @@ export declare function authAPI(environment: 'saas'): Promise<string>;
13
13
  export declare function authAPI(environment: 'sm'): Promise<string>;
14
14
  export declare function authAPI(environment: 'saas', audience?: string): Promise<string>;
15
15
  export declare function authAPI(environment: 'sm', audience?: string): Promise<string>;
16
+ export declare function parseRetryAfterMs(header: string | undefined, now?: number): number;
16
17
  export declare function authSaasAPI(audience?: string, clusterType?: string): Promise<string>;
17
18
  export declare function authSmAPI(): Promise<string>;
18
19
  export declare function authC8runAPI(name: string, password: string): Promise<void>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateClusterDataFilters = exports.getClusterDataFilters = exports.getTestClusterUuid = exports.authConsoleManagementAPI = exports.updateCollectionScope = exports.createSingleProcessReport = exports.setOptimizeSharing = exports.createDashboard = exports.createCollection = exports.getOptimizeCookieSm = exports.getOptimizeCoockie = exports.loginToOptimizeSession = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.createTenantClusterVariable = exports.waitForProcessInstanceVisible = exports.createProcessInstance = exports.deployProcess = exports.waitForOrchestrationClusterReady = exports.waitForInboundWebhookRegistered = exports.waitForConnectorsReady = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.buildZeebeApiUrl = exports.retryOnTransientApiError = exports.retryOn500 = exports.sendRequestAndAssertResponse = exports.assertUnauthorizedResponseBody = exports.expectUnauthorizedErrorBody = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
6
+ exports.updateClusterDataFilters = exports.getClusterDataFilters = exports.getTestClusterUuid = exports.authConsoleManagementAPI = exports.updateCollectionScope = exports.createSingleProcessReport = exports.setOptimizeSharing = exports.createDashboard = exports.createCollection = exports.getOptimizeCookieSm = exports.getOptimizeCoockie = exports.loginToOptimizeSession = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.createTenantClusterVariable = exports.waitForProcessInstanceVisible = exports.createProcessInstance = exports.deployProcess = exports.waitForOrchestrationClusterReady = exports.waitForInboundWebhookRegistered = exports.waitForConnectorsReady = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.parseRetryAfterMs = exports.authAPI = exports.buildZeebeApiUrl = exports.retryOnTransientApiError = exports.retryOn500 = exports.sendRequestAndAssertResponse = exports.assertUnauthorizedResponseBody = exports.expectUnauthorizedErrorBody = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
7
7
  const test_1 = require("@playwright/test");
8
8
  const sleep_1 = require("./sleep");
9
9
  const randomSleep_1 = require("./randomSleep");
@@ -265,6 +265,20 @@ async function authAPI(environment, audience = process.env.ZEEBE_API_TOKEN_AUDIE
265
265
  return bearerToken;
266
266
  }
267
267
  exports.authAPI = authAPI;
268
+ // `Retry-After` is either delta-seconds or an HTTP-date (RFC 9110). Returns the
269
+ // wait in milliseconds, or 0 when the header is missing, invalid or in the past.
270
+ function parseRetryAfterMs(header, now = Date.now()) {
271
+ const value = header?.trim();
272
+ if (!value) {
273
+ return 0;
274
+ }
275
+ if (/^\d+$/.test(value)) {
276
+ return Number(value) * 1000;
277
+ }
278
+ const dateMs = Date.parse(value);
279
+ return Number.isNaN(dateMs) ? 0 : Math.max(0, dateMs - now);
280
+ }
281
+ exports.parseRetryAfterMs = parseRetryAfterMs;
268
282
  async function authSaasAPI(audience, clusterType) {
269
283
  const creds = getClusterCredentials(clusterType);
270
284
  const tokenAudience = audience ?? creds.tokenAudience;
@@ -299,10 +313,7 @@ async function authSaasAPI(audience, clusterType) {
299
313
  const tokenJson = await tokenResponse.json();
300
314
  return `Bearer ${tokenJson.access_token}`;
301
315
  }
302
- const retryAfter = Number(tokenResponse.headers()['retry-after']);
303
- if (Number.isFinite(retryAfter) && retryAfter > 0) {
304
- retryAfterMs = Math.min(retryAfter * 1000, maxDelayMs);
305
- }
316
+ retryAfterMs = Math.min(parseRetryAfterMs(tokenResponse.headers()['retry-after']), maxDelayMs);
306
317
  const errorBody = await tokenResponse.text();
307
318
  lastErrorMessage = `HTTP ${tokenResponse.status()} - ${errorBody.slice(0, 200)}`;
308
319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1516",
3
+ "version": "0.0.1518",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",