Files
computer-playbook/roles/web-app-nextcloud/files/playwright/test-seaweedfs.js
kevinveenbirkenbachandClaude Opus 4.8 5e194d885d test(web-app-nextcloud): onion-harden the Playwright suite
Scale the login helper's waitForVisibleCandidate call-sites and the Sign In / Log out clicks through resolveTimeout, and wait for network idle after logout so the slow keycloak end-session redirect chain over Tor settles before the logged-out state is probed.

Skip the Talk-admin and SeaweedFS-filer specs on onion targets (WebRTC HPB/STUN/TURN and a clearnet-only filer UI). Assert the XWiki partner host against XWIKI_BASE_URL from the env instead of a hard-coded clearnet host, so the check holds on both clearnet and onion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 10:50:09 +02:00

50 lines
2.1 KiB
JavaScript

// SeaweedFS object-store scenario for Nextcloud.
//
// Nextcloud is configured with S3 primary storage (OBJECTSTORE_S3_*), so every
// file uploaded through the Files app is written to the consumer bucket as a
// `urn:oid:<id>` object. The action logs the administrator in and uploads a
// file; the shared check proves the bucket grew via the Filer UI.
const { test, expect } = require("@playwright/test");
const { resolveTimeout, isOnionTarget } = require("./timeouts");
const { skipUnlessServiceEnabled } = require("./service-gating");
const { runSeaweedfsStorageCheck } = require("./personas");
const shared = require("./_shared");
test.use({ ignoreHTTPSErrors: true });
test("seaweedfs: an uploaded Nextcloud file is stored in the SeaweedFS bucket", async ({ page, browser }) => {
skipUnlessServiceEnabled("seaweedfs");
test.skip(isOnionTarget(), "SeaweedFS filer UI is not a Tor surface on an onion node (headless backend)");
test.setTimeout(resolveTimeout(180_000));
await runSeaweedfsStorageCheck(page, browser, {
label: "a Nextcloud Files upload",
action: async (appPage) => {
await shared.loginToStandaloneNextcloud(appPage);
const filesUrl = new URL("apps/files/", shared.env.nextcloudBaseUrl).toString();
await appPage.goto(filesUrl, { waitUntil: "domcontentloaded" });
await shared.dismissBlockingNextcloudModals(appPage, appPage);
const markerBase = `infinito-storage-check-${Date.now()}`;
const marker = `${markerBase}.txt`;
await appPage
.locator('input[type="file"]')
.first()
.setInputFiles({
name: marker,
mimeType: "text/plain",
buffer: Buffer.from(`infinito storage check ${marker}`),
});
// Nextcloud renders the basename and the extension as separate nodes, so
// match the basename (a single text node).
await expect(
appPage.getByText(markerBase, { exact: false }).first(),
`the uploaded file '${marker}' must appear in the Nextcloud Files listing`,
).toBeVisible({ timeout: resolveTimeout(30_000) });
},
});
});