Files
computer-playbook/roles/web-app-wordpress/files/playwright/addons/daggerhart-openid-connect-generic.spec.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.4 KiB
JavaScript

const { test, expect } = require("@playwright/test");
const { resolveTimeout } = require("../timeouts");
const { skipUnlessAddonEnabled } = require("../addon-gating");
const { skipUnlessServiceEnabled } = require("../service-gating");
const shared = require("../_shared");
// daggerhart-openid-connect-generic is WordPress's OIDC login plugin: it
// has no dedicated user-facing page. Its observable surface is that the
// role's existing administrator OIDC login idiom (wpAdminLoginViaOidc →
// Keycloak round-trip → wp-admin) succeeds. We REUSE that idiom rather
// than reimplement OIDC mechanics, gating behind the addon flag and the
// sso service.
test("addon daggerhart-openid-connect-generic: administrator OIDC login lands in wp-admin", async ({ browser }) => {
skipUnlessAddonEnabled("daggerhart-openid-connect-generic");
skipUnlessServiceEnabled("sso");
const context = await browser.newContext({ ignoreHTTPSErrors: true });
const page = await context.newPage();
try {
await shared.wpAdminLoginViaOidc(
page,
shared.env.wpBaseUrl,
shared.env.adminUsername,
shared.env.adminPassword
);
await expect(page, "Expected to land in wp-admin after the OIDC round-trip").toHaveURL(
/\/wp-admin\/?/,
{ timeout: resolveTimeout(30_000) }
);
} finally {
await page.close().catch(() => {});
await context.close().catch(() => {});
}
});