@camunda/e2e-test-suite 0.0.1158 → 0.0.1159

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.
@@ -809,13 +809,15 @@ class OperateProcessInstancePage {
809
809
  async assertProcessVariableIsVisible(variableName, timeout = 30000, maxRetries = 3) {
810
810
  for (let retries = 0; retries < maxRetries; retries++) {
811
811
  try {
812
- await (0, test_1.expect)(this.connectorResultVariableName(variableName)).toBeVisible({ timeout: timeout });
812
+ await (0, test_1.expect)(this.connectorResultVariableName(variableName)).toBeVisible({ timeout });
813
813
  return;
814
814
  }
815
815
  catch (error) {
816
- console.log(`Variable ${variableName} is not visible yet (attempt ${retries + 1}): ${error}`);
817
- await this.page.reload();
818
- await (0, sleep_1.sleep)(10000);
816
+ console.log(`Variable ${variableName} is not visible yet (attempt ${retries + 1}/${maxRetries}): ${error}`);
817
+ if (retries < maxRetries - 1) {
818
+ await this.reload();
819
+ await this.variablesList.waitFor({ state: 'visible', timeout });
820
+ }
819
821
  }
820
822
  }
821
823
  throw new Error(`Variable ${variableName} was not visible after ${maxRetries} attempts.`);
@@ -49,6 +49,7 @@ export declare function deleteCluster(clusterName: string, homePage: HomePage, c
49
49
  export declare function modelAndRunConnectorsDocHandlingDiagram(modelerCreatePage: ModelerCreatePage, modelerHomePage: ModelerHomePage, processName: string, page: Page, connectorMarketplacePage: ConnectorMarketplacePage, clusterName: string, zeebeUrl: string, zeebeClientId: string, zeebeClientSecret: string): Promise<void>;
50
50
  export declare function modelAndRunConnectorsTimerEventDiagram(modelerCreatePage: ModelerCreatePage, modelerHomePage: ModelerHomePage, processName: string, page: Page, connectorMarketplacePage: ConnectorMarketplacePage, clusterName: string, connectorTemplatePage: ConnectorTemplatePage): Promise<void>;
51
51
  export declare function createAPIClient(apiClientName: string, homePage: HomePage, clusterDetailsPage: ClusterDetailsPage, clusterName: string, clusterPage: ClusterPage): Promise<void>;
52
+ export declare function ensureDefaultClusterApiCredentials(apiClientName: string, homePage: HomePage, clusterDetailsPage: ClusterDetailsPage, clusterName: string, clusterPage: ClusterPage): Promise<void>;
52
53
  export declare function expectCountToBeOneOf(locator: Locator, count1: number, count2: number): Promise<void>;
53
54
  export declare function assertTestUsesCorrectOrganizationFromModeler(page: Page): Promise<void>;
54
55
  export declare function waitForLoadingToFinish(page: Page, timeout?: number): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.waitForLoadingToFinish = exports.assertTestUsesCorrectOrganizationFromModeler = exports.expectCountToBeOneOf = exports.createAPIClient = exports.modelAndRunConnectorsTimerEventDiagram = exports.modelAndRunConnectorsDocHandlingDiagram = exports.deleteCluster = exports.deleteAllUserGroups = exports.assertTestUsesCorrectOrganization = exports.assertLatestAlertEmail = exports.clickInvitationLinkInEmail = exports.enableAuthorizations = exports.disableRBA = exports.goBackWithRetry = exports.runMultipleProcesses = exports.runProcess = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.openAppTabWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.modelDiagramFromFile = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
3
+ exports.waitForLoadingToFinish = exports.assertTestUsesCorrectOrganizationFromModeler = exports.expectCountToBeOneOf = exports.ensureDefaultClusterApiCredentials = exports.createAPIClient = exports.modelAndRunConnectorsTimerEventDiagram = exports.modelAndRunConnectorsDocHandlingDiagram = exports.deleteCluster = exports.deleteAllUserGroups = exports.assertTestUsesCorrectOrganization = exports.assertLatestAlertEmail = exports.clickInvitationLinkInEmail = exports.enableAuthorizations = exports.disableRBA = exports.goBackWithRetry = exports.runMultipleProcesses = exports.runProcess = exports.completeTaskWithRetry = exports.assertPageTextWithRetry = exports.openAppTabWithRetry = exports.assertLocatorVisibleWithRetry = exports.modelRestConnector = exports.modelDiagramFromFile = exports.withSessionRecovery = exports.isSignedOut = exports.loginWithRetry = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const ModelerHomePage_1 = require("./ModelerHomePage");
6
6
  const HomePage_1 = require("./HomePage");
@@ -814,6 +814,35 @@ async function createAPIClient(apiClientName, homePage, clusterDetailsPage, clus
814
814
  await clusterDetailsPage.clickCloseModalButton();
815
815
  }
816
816
  exports.createAPIClient = createAPIClient;
817
+ // The default-cluster ZEEBE_API_* env vars are set by the setup project's
818
+ // "Create Default Cluster" test and reach a spec only through Playwright's
819
+ // dependency env propagation, i.e. within one `playwright test` invocation.
820
+ // Runs that execute a spec without its setup project in that same invocation
821
+ // (the flakiness validate loop and the nightly fix agent's verification loop
822
+ // both pass --no-deps) leave them unset, and every Zeebe API call in the spec
823
+ // then fails before it is made. Provision a client of our own in that case,
824
+ // the same way operate-access-flow.spec.ts does, so a spec that talks to the
825
+ // Zeebe REST API does not depend on how it was launched.
826
+ //
827
+ // Requires `page` to already be logged in to Console as an org admin.
828
+ async function ensureDefaultClusterApiCredentials(apiClientName, homePage, clusterDetailsPage, clusterName, clusterPage) {
829
+ const required = [
830
+ 'ZEEBE_API_CLIENT_ID',
831
+ 'ZEEBE_API_CLIENT_SECRET',
832
+ 'ZEEBE_API_AUTH_URL',
833
+ 'ZEEBE_API_URL',
834
+ 'ZEEBE_API_TOKEN_AUDIENCE',
835
+ ];
836
+ if (required.every((key) => process.env[key])) {
837
+ return;
838
+ }
839
+ console.log('Default-cluster API credentials are not in the environment ' +
840
+ `(missing: ${required
841
+ .filter((key) => !process.env[key])
842
+ .join(', ')}); creating an API client on "${clusterName}".`);
843
+ await createAPIClient(apiClientName, homePage, clusterDetailsPage, clusterName, clusterPage);
844
+ }
845
+ exports.ensureDefaultClusterApiCredentials = ensureDefaultClusterApiCredentials;
817
846
  async function expectCountToBeOneOf(locator, count1, count2) {
818
847
  try {
819
848
  await Promise.race([
@@ -54,13 +54,26 @@ let authToken;
54
54
  _8_10_1.test.describe.configure({ mode: 'parallel' });
55
55
  _8_10_1.test.describe('AWS Connectors User Flows', () => {
56
56
  const clusterName = 'Test Cluster';
57
- _8_10_1.test.beforeAll(async () => {
58
- authToken = await (0, apiHelpers_1.authSaasAPI)();
59
- });
60
- _8_10_1.test.beforeEach(async ({ page, appsPage, loginPage }, testInfo) => {
57
+ // The Zeebe token is taken here rather than in a beforeAll because
58
+ // ensureDefaultClusterApiCredentials needs a logged-in Console page, which
59
+ // only exists once the test-scoped fixtures are up. It is a no-op whenever
60
+ // the setup project already put the credentials in the environment (the
61
+ // nightly's path), so this only costs anything on runs launched without it.
62
+ _8_10_1.test.beforeEach(async ({ page, appsPage, loginPage, homePage, clusterPage, clusterDetailsPage, operateHomePage, }, testInfo) => {
61
63
  await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
62
- await appsPage.clickCamundaApps();
63
- await appsPage.clickOperate(clusterName);
64
+ await (0, UtilitiesPage_1.ensureDefaultClusterApiCredentials)('AWS_Connectors_API_Client' + (await (0, _setup_1.generateRandomStringAsync)(3)), homePage, clusterDetailsPage, clusterName, clusterPage);
65
+ authToken = await (0, apiHelpers_1.authSaasAPI)();
66
+ // Gate the hand-off on Operate's own banner instead of returning as soon
67
+ // as the apps-menu click resolves, which is all `clickOperate` does. A
68
+ // hand-off that never landed leaves the tab on the page it started from
69
+ // — here the Console cluster-details view the API-client step above ends
70
+ // on — and the test then hunts for Operate's nav on a page that is not
71
+ // Operate. That is exactly what "Failed to click locator
72
+ // getByRole('link', { name: 'Processes', exact: true }) after 5
73
+ // attempts" reported here 3/3, and the failure `openOperateWithRetry`
74
+ // exists to catch: it re-enters through the apps menu until Operate
75
+ // itself is up, the same way smoke-tests.spec.ts does for this hop.
76
+ await appsPage.openOperateWithRetry(operateHomePage.operateBanner, clusterName);
64
77
  });
65
78
  _8_10_1.test.afterEach(async ({ page }, testInfo) => {
66
79
  await (0, _setup_1.captureScreenshot)(page, testInfo);
@@ -125,6 +125,29 @@ exports.retryOnTransientApiError = retryOnTransientApiError;
125
125
  // ---- Cluster Credentials Helper ----
126
126
  function getClusterCredentials(clusterType) {
127
127
  if (!clusterType) {
128
+ // These are produced by the setup project ("Create Default Cluster" ->
129
+ // createAPIClientAndReturnVariables) and reach a spec through Playwright's
130
+ // dependency env propagation, which only spans a single `playwright test`
131
+ // invocation. A run that executes a spec WITHOUT its setup project in the
132
+ // same invocation -- the flakiness validate loop and the nightly fix
133
+ // agent's verification loop both pass --no-deps -- sees them unset. Say so
134
+ // here: leaving the non-null assertions in place meant `undefined` reached
135
+ // apiRequestContext.post(), whose "First argument must be either URL
136
+ // string or Request" names neither the variable nor the cause.
137
+ const missing = [
138
+ 'ZEEBE_API_CLIENT_ID',
139
+ 'ZEEBE_API_CLIENT_SECRET',
140
+ 'ZEEBE_API_AUTH_URL',
141
+ 'ZEEBE_API_URL',
142
+ 'ZEEBE_API_TOKEN_AUDIENCE',
143
+ ].filter((key) => !process.env[key]);
144
+ if (missing.length > 0) {
145
+ throw new Error(`Default-cluster credentials not found: ${missing.join(', ')} unset. ` +
146
+ 'They are set by the test-setup project and only propagate to runs ' +
147
+ 'that include it; provision an API client first (see ' +
148
+ 'ensureDefaultClusterApiCredentials in pages/<version>/' +
149
+ 'UtilitiesPage.ts).');
150
+ }
128
151
  return {
129
152
  clientId: process.env.ZEEBE_API_CLIENT_ID,
130
153
  clientSecret: process.env.ZEEBE_API_CLIENT_SECRET,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1158",
3
+ "version": "0.0.1159",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",