Files
computer-playbook/roles/web-app-friendica/files/playwright/test-side-by-side-sessions.js
kevinveenbirkenbachandClaude Opus 4.8 35dee215c8 test(playwright): route all timeouts through resolveTimeout for onion-compat
Add the global TIMEOUT_FACTOR and a shared timeouts.js helper: resolveTimeout(base) scales by TIMEOUT_FACTOR and, over a .onion target, an extra multiplier, so Tor's per-request latency no longer trips hard-coded timeouts. Migrate every raw timeout in the specs (timeout:/timeout=/setTimeout/waitForTimeout) to resolveTimeout, stage the helper in all three staging paths, and add test_no_raw_timeouts to forbid raw numeric timeouts. Clearnet behaviour is unchanged (factor 1: resolveTimeout(N) === N).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 10:38:06 +02:00

37 lines
1.6 KiB
JavaScript

const { test, expect } = require("@playwright/test");
const { resolveTimeout } = require("./timeouts");
// biber + administrator side-by-side: two isolated browser contexts log in
// independently, biber logs out first, admin session must persist. Exercises
// ldapauth's bridge for a non-admin LDAP user AND verifies session isolation
// between contexts. Skips when LDAP is disabled.
exports.register = function (shared) {
test("friendica: biber + administrator side by side in isolated contexts", async ({ browser }) => {
shared.skipUnlessServiceEnabled("ldap");
const login = shared.pickLoginPath();
const biberContext = await browser.newContext({ ignoreHTTPSErrors: true });
const adminContext = await browser.newContext({ ignoreHTTPSErrors: true });
try {
const biberPage = await biberContext.newPage();
await login(biberPage, shared.env.biberUsername, shared.env.biberPassword);
const adminPage = await adminContext.newPage();
await login(adminPage, shared.env.adminUsername, shared.env.adminPassword);
// biber logs out first — admin session must stay alive.
await shared.friendicaLogout(biberPage);
await adminPage.goto(`${shared.trimmedBaseUrl()}/network`, { waitUntil: "domcontentloaded" });
await expect(
adminPage.locator("#topbar-first, #navbar-apps-menu, a[href*='/logout']").first(),
).toBeVisible({ timeout: resolveTimeout(10_000) });
await shared.friendicaLogout(adminPage);
} finally {
await biberContext.close().catch(() => {});
await adminContext.close().catch(() => {});
}
});
};