deer-flow/frontend/tests/e2e-auth/artifact-viewer-showcase.spec.ts
Eilen Shin 81de0761ed
feat: improve file attachments and add Office artifact previews (#8009)
* feat(frontend): improve file attachment recovery and artifact presentation

* feat(extensions): add Office artifact previews with search and navigation

* fix: preserve public viewers and HTTP Office previews

* fix: address file preview and upload review findings

* fix: use typed upload errors and linear bookmark allocation

* fix(office-preview): isolate parsing and bound preview resources

* fix(ci): install Office preview fixture dependencies for E2E

* fix(ci): provision matching Playwright browsers before E2E tests

* fix(ci): isolate Python libraries and include Office documentation

* test(frontend): wait for download status to finish rendering
2026-11-12 20:30:17 +08:00

69 lines
2.1 KiB
TypeScript

import { expect, test } from "@playwright/test";
/**
* The default E2E config runs with auth disabled, so it cannot see this: the
* standalone artifact window must stay reachable for a logged-out visitor when
* the target is a public showcase artifact, and must not for anything else.
*/
// An allowlisted showcase artifact — see STATIC_DEMO_ARTIFACTS.
const DEMO_THREAD_ID = "3823e443-4e2b-4679-b496-a9506eae462b";
const DEMO_ARTIFACT = "/mnt/user-data/outputs/fei-fei-li-podcast-timeline.md";
function viewerUrl(params: Record<string, string>) {
return `/artifacts/view?${new URLSearchParams(params).toString()}`;
}
test.describe("standalone artifact viewer access", () => {
test("renders a public showcase artifact without a session", async ({
page,
}) => {
const errors: string[] = [];
page.on("pageerror", (error) => errors.push(error.message));
await page.goto(
viewerUrl({
path: DEMO_ARTIFACT,
thread_id: DEMO_THREAD_ID,
mock: "true",
}),
);
await expect(page).toHaveURL(/\/artifacts\/view/);
await expect(
page.getByText("fei-fei-li-podcast-timeline.md").first(),
).toBeVisible({ timeout: 15_000 });
await expect(page.locator("h1").first()).toBeVisible({ timeout: 15_000 });
await expect(
page.getByRole("button", {
name: "Download fei-fei-li-podcast-timeline.md",
exact: true,
}),
).toBeVisible();
expect(errors).toEqual([]);
});
test("sends a logged-out visitor to login for a non-public artifact", async ({
page,
}) => {
await page.goto(
viewerUrl({
path: "/mnt/user-data/outputs/private-notes.md",
thread_id: DEMO_THREAD_ID,
mock: "true",
}),
);
await expect(page).toHaveURL(/\/login\?next=/, { timeout: 15_000 });
});
test("sends a logged-out visitor to login when the mock flag is absent", async ({
page,
}) => {
await page.goto(
viewerUrl({ path: DEMO_ARTIFACT, thread_id: DEMO_THREAD_ID }),
);
await expect(page).toHaveURL(/\/login\?next=/, { timeout: 15_000 });
});
});