Files
computer-playbook/roles/web-app-nextcloud/files/playwright/addons/whiteboard.spec.js
kevinveenbirkenbachandClaude Opus 4.8 4c91df5de7 test(e2e): forbid raw page.goto, migrate all specs to Tor-resilient gotoOnion
New lint test_no_raw_goto.py forbids raw `page.goto(...)` in role playwright specs + persona flows (the gotoOnion wrapper in personas/utils is exempt) so navigation retries transient Tor-transport errors over onion. Migrates every raw call across ~75 roles (343 sites) to `gotoOnion(page, ...)` and teaches gotoOnion to detect relative onion URLs (`isOnionCanonical`). gotoOnion is a behaviour-identical drop-in on clearnet (single attempt, same return). Verified: no-raw-goto lint green, eslint 0 errors, make test green.

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

55 lines
2.1 KiB
JavaScript

const { test, expect } = require("@playwright/test");
const { resolveTimeout } = require("../timeouts");
const { skipUnlessAddonEnabled } = require("../addon-gating");
const shared = require("../_shared");
const { gotoOnion } = require("../personas");
test.use({ ignoreHTTPSErrors: true });
test("whiteboard addon: admin whiteboard settings render and are wired to the collab backend", async ({ browser }) => {
skipUnlessAddonEnabled("whiteboard");
test.setTimeout(resolveTimeout(120_000));
const context = await browser.newContext({ ignoreHTTPSErrors: true });
const page = await context.newPage();
try {
await shared.loginToStandaloneNextcloud(page);
await gotoOnion(page,
new URL("settings/admin/whiteboard", shared.env.nextcloudBaseUrl).toString(),
{ waitUntil: "domcontentloaded", timeout: resolveTimeout(60_000) }
);
await shared.dismissBlockingNextcloudModals(page, page);
await expect(
page.locator("#app-content, #app-content-vue, #content").first(),
"the Whiteboard admin settings shell (settings/admin/whiteboard) must render, proving the whiteboard app is installed AND enabled (a disabled/broken app yields no section)"
).toBeVisible({ timeout: resolveTimeout(60_000) });
const urlState = page.locator("#initial-state-whiteboard-url");
await expect(
urlState,
"the whiteboard admin settings must inject its server-URL initial-state (#initial-state-whiteboard-url), proving the app's admin section rendered with its config"
).toHaveCount(1);
const rawUrl =
(await urlState.inputValue().catch(() => "")) ||
(await urlState.getAttribute("value").catch(() => "")) ||
"";
let url = "";
try {
url = JSON.parse(Buffer.from(rawUrl, "base64").toString("utf8"));
} catch {
url = "";
}
expect(
typeof url === "string" && /^https?:\/\//.test(url),
"the whiteboard collab-backend URL must be configured (NEXTCLOUD_WHITEBOARD_URL via plugin_configuration), not blank"
).toBeTruthy();
} finally {
await page.close().catch(() => {});
await context.close().catch(() => {});
}
});