@camunda/e2e-test-suite 0.0.1217 → 0.0.1218
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.
|
@@ -22,7 +22,7 @@ export declare function isSignedOut(page: Page): boolean;
|
|
|
22
22
|
export declare function withSessionRecovery(page: Page, loginPage: LoginPage, appsPage: AppsPage, modelerBanner: Locator, testUser: {
|
|
23
23
|
username: string;
|
|
24
24
|
password: string;
|
|
25
|
-
}, loginStagger: number, action: () => Promise<void
|
|
25
|
+
}, loginStagger: number, action: () => Promise<void>, maxRecoveries?: number): Promise<void>;
|
|
26
26
|
export declare function modelDiagramFromFile(page: Page, modelerHomePage: ModelerHomePage, modelerCreatePage: ModelerCreatePage, processName: string, fileName?: string, nrOfRenamedUserTasks?: number, taskName?: string): Promise<void>;
|
|
27
27
|
export declare function modelRestConnector(modelerCreatePage: ModelerCreatePage, connectorSettingsPage: ConnectorSettingsPage, processName: string, url: string, auth: string, resultExpression: string, resultVariable?: string, basicAuthCredentials?: {
|
|
28
28
|
username: string;
|
|
@@ -235,7 +235,7 @@ function isSignedOut(page) {
|
|
|
235
235
|
}
|
|
236
236
|
exports.isSignedOut = isSignedOut;
|
|
237
237
|
// Runs `action`, and if it fails because the session was dropped mid-flow,
|
|
238
|
-
// signs back in, returns to the Modeler projects list and runs it
|
|
238
|
+
// signs back in, returns to the Modeler projects list and runs it again.
|
|
239
239
|
//
|
|
240
240
|
// Without this the caller's own locator retries keep hunting for app controls
|
|
241
241
|
// on the Auth0 form and expire against a page that is not the app at all —
|
|
@@ -243,21 +243,32 @@ exports.isSignedOut = isSignedOut;
|
|
|
243
243
|
// than as the sign-out it actually was. Only a confirmed sign-out is retried;
|
|
244
244
|
// any other failure propagates untouched, so a genuinely broken control still
|
|
245
245
|
// fails the test.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
246
|
+
//
|
|
247
|
+
// Recovers up to `maxRecoveries` times rather than once: under a concurrent
|
|
248
|
+
// login burst the SaaS `/api/internal/login` hand-off can 500 and bounce the
|
|
249
|
+
// tab back to Auth0 (see AppsPage.openModelerWithRetry) more than once in a
|
|
250
|
+
// row, so the lowest-staggered workers get dropped, recovered, then dropped
|
|
251
|
+
// again — spending the single recovery before landing a stable session. A
|
|
252
|
+
// bounded re-login loop (the same shape as loginWithRetry's own retries) lets
|
|
253
|
+
// those tail sessions settle; a session that never stabilises still exhausts
|
|
254
|
+
// the loop and fails, so a genuinely broken login is not masked.
|
|
255
|
+
async function withSessionRecovery(page, loginPage, appsPage, modelerBanner, testUser, loginStagger, action, maxRecoveries = 2) {
|
|
256
|
+
for (let recovery = 0; recovery <= maxRecoveries; recovery++) {
|
|
257
|
+
try {
|
|
258
|
+
await action();
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (!isSignedOut(page) || recovery === maxRecoveries) {
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
console.warn(`Session was dropped mid-flow (tab landed on ${page.url()}); ` +
|
|
266
|
+
`signing back in and retrying (recovery ${recovery + 1} of ` +
|
|
267
|
+
`${maxRecoveries}).`);
|
|
254
268
|
}
|
|
255
|
-
|
|
256
|
-
|
|
269
|
+
await loginWithRetry(page, loginPage, testUser, loginStagger);
|
|
270
|
+
await appsPage.openModelerWithRetry(modelerBanner);
|
|
257
271
|
}
|
|
258
|
-
await loginWithRetry(page, loginPage, testUser, loginStagger);
|
|
259
|
-
await appsPage.openModelerWithRetry(modelerBanner);
|
|
260
|
-
await action();
|
|
261
272
|
}
|
|
262
273
|
exports.withSessionRecovery = withSessionRecovery;
|
|
263
274
|
async function modelDiagramFromFile(page, modelerHomePage, modelerCreatePage, processName, fileName = '', nrOfRenamedUserTasks = 0, taskName = '') {
|