@camunda/e2e-test-suite 0.0.1424 → 0.0.1425

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.
@@ -11,6 +11,7 @@ const LoginPage_1 = require("./LoginPage");
11
11
  const fileUpload_1 = require("../../utils/fileUpload");
12
12
  const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
13
13
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
14
+ const hubOrganization_1 = require("../../utils/hubOrganization");
14
15
  async function clearWebStorage(page) {
15
16
  await page
16
17
  .evaluate(() => {
@@ -823,9 +824,7 @@ async function assertTestUsesCorrectOrganization(page) {
823
824
  // the URL. Its sidebar scopes the Clusters/Organization links to the active
824
825
  // org, so assert the expected org id there instead.
825
826
  if (await homePage.hubHeader.isVisible()) {
826
- await (0, test_1.expect)(homePage.hubSidebar
827
- .locator(`a[href*="/org/${process.env.ORG_ID}/"]`)
828
- .first()).toBeVisible({ timeout: 180000 });
827
+ await (0, hubOrganization_1.ensureHubOrganization)(page, homePage.hubSidebar);
829
828
  return;
830
829
  }
831
830
  await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
@@ -11,6 +11,7 @@ const LoginPage_1 = require("./LoginPage");
11
11
  const fileUpload_1 = require("../../utils/fileUpload");
12
12
  const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
13
13
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
14
+ const hubOrganization_1 = require("../../utils/hubOrganization");
14
15
  async function clearWebStorage(page) {
15
16
  await page
16
17
  .evaluate(() => {
@@ -823,9 +824,7 @@ async function assertTestUsesCorrectOrganization(page) {
823
824
  // the URL. Its sidebar scopes the Clusters/Organization links to the active
824
825
  // org, so assert the expected org id there instead.
825
826
  if (await homePage.hubHeader.isVisible()) {
826
- await (0, test_1.expect)(homePage.hubSidebar
827
- .locator(`a[href*="/org/${process.env.ORG_ID}/"]`)
828
- .first()).toBeVisible({ timeout: 180000 });
827
+ await (0, hubOrganization_1.ensureHubOrganization)(page, homePage.hubSidebar);
829
828
  return;
830
829
  }
831
830
  await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
@@ -10,6 +10,7 @@ const randomSleep_1 = require("../../utils/randomSleep");
10
10
  const SettingsPage_1 = require("./SettingsPage");
11
11
  const fileUpload_1 = require("../../utils/fileUpload");
12
12
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
13
+ const hubOrganization_1 = require("../../utils/hubOrganization");
13
14
  async function forceLogoutIfNeeded(page) {
14
15
  const settingsPage = new SettingsPage_1.SettingsPage(page);
15
16
  const loginMessage = page.getByText('Log in to continue to Camunda.');
@@ -526,9 +527,7 @@ async function assertTestUsesCorrectOrganization(page) {
526
527
  // the URL. Its sidebar scopes the Clusters/Organization links to the active
527
528
  // org, so assert the expected org id there instead.
528
529
  if (await homePage.hubHeader.isVisible()) {
529
- await (0, test_1.expect)(homePage.hubSidebar
530
- .locator(`a[href*="/org/${process.env.ORG_ID}/"]`)
531
- .first()).toBeVisible({ timeout: 180000 });
530
+ await (0, hubOrganization_1.ensureHubOrganization)(page, homePage.hubSidebar);
532
531
  return;
533
532
  }
534
533
  await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
@@ -11,6 +11,7 @@ const fileUpload_1 = require("../../utils/fileUpload");
11
11
  const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
12
12
  const hubTableRow_1 = require("../../utils/hubTableRow");
13
13
  const consoleApiHelpers_1 = require("../../utils/consoleApiHelpers");
14
+ const hubOrganization_1 = require("../../utils/hubOrganization");
14
15
  // Tracks which worker-derived `timeout` values have already paid the
15
16
  // stagger sleep below, so a worker only pays it once per process lifetime
16
17
  // rather than on every call -- see the comment at the call site.
@@ -523,9 +524,7 @@ async function assertTestUsesCorrectOrganization(page) {
523
524
  // the URL. Its sidebar scopes the Clusters/Organization links to the active
524
525
  // org, so assert the expected org id there instead.
525
526
  if (await homePage.hubHeader.isVisible()) {
526
- await (0, test_1.expect)(homePage.hubSidebar
527
- .locator(`a[href*="/org/${process.env.ORG_ID}/"]`)
528
- .first()).toBeVisible({ timeout: 180000 });
527
+ await (0, hubOrganization_1.ensureHubOrganization)(page, homePage.hubSidebar);
529
528
  return;
530
529
  }
531
530
  await (0, test_1.expect)(homePage.openOrganizationButton).toBeVisible({ timeout: 180000 });
@@ -0,0 +1,13 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ /**
3
+ * Makes Camunda Hub show the org the run is configured for.
4
+ *
5
+ * A user who belongs to several orgs lands in whichever one Hub opens first,
6
+ * which is not necessarily ORG_ID (prod's test user is in both "Automation QA"
7
+ * and "Automation QA 2"). Hub's header exposes a "Switch organization" menu,
8
+ * so pick the org by name when the sidebar's org-scoped links point elsewhere.
9
+ *
10
+ * Prod only: other environments use a throwaway org with a single membership,
11
+ * so there the sidebar assertion runs unchanged.
12
+ */
13
+ export declare function ensureHubOrganization(page: Page, sidebar: Locator): Promise<void>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureHubOrganization = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ /**
6
+ * Makes Camunda Hub show the org the run is configured for.
7
+ *
8
+ * A user who belongs to several orgs lands in whichever one Hub opens first,
9
+ * which is not necessarily ORG_ID (prod's test user is in both "Automation QA"
10
+ * and "Automation QA 2"). Hub's header exposes a "Switch organization" menu,
11
+ * so pick the org by name when the sidebar's org-scoped links point elsewhere.
12
+ *
13
+ * Prod only: other environments use a throwaway org with a single membership,
14
+ * so there the sidebar assertion runs unchanged.
15
+ */
16
+ async function ensureHubOrganization(page, sidebar) {
17
+ const orgId = process.env.ORG_ID;
18
+ const orgScopedLink = sidebar.locator(`a[href*="/org/${orgId}/"]`).first();
19
+ if (process.env.IS_PROD !== 'true') {
20
+ await (0, test_1.expect)(orgScopedLink).toBeVisible({ timeout: 180000 });
21
+ return;
22
+ }
23
+ const alreadyOnOrg = await orgScopedLink
24
+ .waitFor({ state: 'visible', timeout: 15000 })
25
+ .then(() => true)
26
+ .catch(() => false);
27
+ if (!alreadyOnOrg && process.env.ORG_NAME) {
28
+ await page
29
+ .getByRole('banner')
30
+ .getByRole('button', { name: 'Switch organization' })
31
+ .click({ timeout: 30000 });
32
+ await page
33
+ .getByRole('menuitem', { name: process.env.ORG_NAME, exact: true })
34
+ .click({ timeout: 30000 });
35
+ }
36
+ await (0, test_1.expect)(orgScopedLink).toBeVisible({ timeout: 180000 });
37
+ }
38
+ exports.ensureHubOrganization = ensureHubOrganization;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1424",
3
+ "version": "0.0.1425",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",