Files
computer-playbook/roles/web-app-openwebui/files/playwright/test-seaweedfs.js
kevinveenbirkenbachandClaude Opus 5 a0dd564955 fix(openwebui): declare the sign-in every MCP spec actually needs
Each of these specs declared the service it exercises and then, as its first
action, signed in through the dashboard's OIDC button. In a round that ships
no identity provider that button does not exist, so the spec spent its whole
timeout waiting for it and reported the missing login rather than anything
about MCP. The junit already said as much, carrying the SSO_SERVICE_ENABLED
flag as the skip reason on the neighbouring tests.

Nine specs in the directory sign in that way; two already declared sso. The
other seven now do too, through the same gate they already imported.

Signing in as the deployed identity instead was not open to us: that helper
authenticates as the administrator whatever username it is handed, which
contradicts the non-member spec asserting the very endpoint the administrator
is asserted to reach. Nor can a native member stand in, because the account is
created by the OIDC login itself, so a round without one has no members to
grant anything to.

This buys the honest label at a price worth naming: a round that ships
seaweedfs without sso now reports green with no seaweedfs coverage, where it
used to report red for the wrong reason. Covering that needs a sign-in the
suite does not have yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 12:47:35 +02:00

66 lines
2.8 KiB
JavaScript

// SeaweedFS object-store scenario for Open WebUI.
//
// Open WebUI is configured with S3 file storage (env.j2: STORAGE_PROVIDER=s3 +
// S3_BUCKET_NAME/S3_ENDPOINT_URL/S3_ACCESS_KEY_ID/S3_SECRET_ACCESS_KEY/
// S3_REGION_NAME from the `objstore` lookup, which resolves to SeaweedFS when
// seaweedfs is the enabled engine). With STORAGE_PROVIDER=s3 the file-upload
// pipeline (POST /api/v1/files/) persists every raw uploaded file into the
// consumer bucket instead of the local volume. The simplest user action that
// triggers that upload is attaching a document to a chat: selecting a file in
// the message composer immediately uploads it through /api/v1/files/, which
// writes the object to S3. The action signs the administrator in over OIDC
// (mirroring playwright.spec.js via the shared signInViaDashboardOidc flow),
// attaches a small text document, and 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 Open WebUI document is stored in the SeaweedFS bucket", async ({ page, browser }) => {
test.skip(isOnionTarget(), "SeaweedFS filer UI is not a Tor surface on an onion node (headless backend)");
skipUnlessServiceEnabled("seaweedfs");
skipUnlessServiceEnabled("sso");
test.setTimeout(resolveTimeout(180_000));
await runSeaweedfsStorageCheck(page, browser, {
label: "an Open WebUI chat document upload",
action: async (appPage) => {
const baseUrl = shared.env.openwebuiBaseUrl.replace(/\/$/, "");
await appPage.context().clearCookies();
await shared.signInViaDashboardOidc(
appPage,
shared.env.adminUsername,
shared.env.adminPassword,
"administrator",
);
await appPage.goto(`${baseUrl}/`, { waitUntil: "domcontentloaded" });
await shared.dismissAllOpenModals(appPage);
const markerBase = `infinito-storage-check-${Date.now()}`;
const marker = `${markerBase}.txt`;
const fileInput = appPage
.locator("input[type='file'][accept], input[type='file'][multiple], input[type='file']")
.first();
await fileInput.waitFor({ state: "attached", timeout: resolveTimeout(60_000) });
await fileInput.setInputFiles({
name: marker,
mimeType: "text/plain",
buffer: Buffer.from(`infinito storage check ${marker}`),
});
await expect(
appPage.getByText(markerBase, { exact: false }).first(),
`the attached document '${marker}' must appear in the Open WebUI composer after upload`,
).toBeVisible({ timeout: resolveTimeout(60_000) });
},
});
});