// Shared fediwall Playwright spec state: env vars, login/post helpers for // the cross-Fediverse posting flow, wall-content assertions, and the // `beforeEach` env-presence guard. `playwright.spec.js` wires the // lifecycle hook and `require()`s one test module per scenario so each const { resolveTimeout } = require("./timeouts"); // test stays atomar. const { expect } = require("@playwright/test"); const { decodeDotenvQuotedValue, gotoOnion, normalizeBaseUrl, performKeycloakLoginForm, runAdminFlow, runBiberFlow, runGuestFlow, } = require("./personas"); const { skipUnlessServiceEnabled } = require("./service-gating"); const appBaseUrl = normalizeBaseUrl(process.env.APP_BASE_URL || ""); const canonicalDomain = decodeDotenvQuotedValue(process.env.CANONICAL_DOMAIN || ""); const defaultSlug = decodeDotenvQuotedValue(process.env.FEDIWALL_DEFAULT_SLUG || ""); const wallSlugs = JSON.parse(decodeDotenvQuotedValue(process.env.FEDIWALL_WALL_SLUGS || "[]")); const mastodonBaseUrl = normalizeBaseUrl(process.env.MASTODON_BASE_URL || ""); const friendicaBaseUrl = normalizeBaseUrl(process.env.FRIENDICA_BASE_URL || ""); const biberUsername = decodeDotenvQuotedValue(process.env.BIBER_USERNAME || ""); const biberPassword = decodeDotenvQuotedValue(process.env.BIBER_PASSWORD || ""); async function beforeEach({ page }) { expect(appBaseUrl, "APP_BASE_URL must be set").toBeTruthy(); expect(canonicalDomain, "CANONICAL_DOMAIN must be set").toBeTruthy(); expect(defaultSlug, "FEDIWALL_DEFAULT_SLUG must be set").toBeTruthy(); await page.context().clearCookies(); } // Drive Mastodon's OIDC login flow as biber. Lands on the Mastodon home // timeline once Keycloak redirects back. First-time login auto-creates // biber's local Mastodon account through the openid_connect plugin. // // Mastodon renders the OIDC sign-in button as a Rails-UJS pseudo-form: // // … // // A plain Playwright click() submits a regular GET, which Mastodon // answers with HTTP 404 ("redirect endpoint expects POST"). We bypass // Rails-UJS by building and submitting an actual