feat(web): configure trace explorer links

This commit is contained in:
lyon
2026-06-20 16:20:41 +08:00
parent c5f51f2b1b
commit c73b19fcaa
11 changed files with 202 additions and 4 deletions
@@ -16,6 +16,28 @@ test("TraceTimeline renders readable rows and hides backend noise", async ({ pag
await saveScreenshot(page, testInfo, "trace-rendering-detail");
});
test("trace explorer link is gated by runtime config", async ({ page }) => {
await gotoWorkbench(page, "/workbench/sessions/ses_completed");
const card = page.locator(`${selectors.messageCard}[data-role="agent"]`).first();
await card.locator(".message-detail-button").click();
const dialog = page.locator(selectors.messageDetailDialog);
await expect(dialog.getByRole("button", { name: "复制 Trace" })).toBeVisible();
await expect(dialog.getByRole("link", { name: "打开 Trace" })).toHaveCount(0);
await dialog.getByRole("button", { name: "关闭" }).click();
await page.addInitScript(() => {
window.HWLAB_CLOUD_WEB_CONFIG = {
displayTime: { timeZone: "Asia/Shanghai", locale: "zh-CN", label: "北京时间" },
workbench: { traceExplorerUrlTemplate: "/v1/workbench/traces/{trace_id}/events" }
};
});
await page.reload();
await expect(page.locator(selectors.workspace)).toBeVisible();
const configuredCard = page.locator(`${selectors.messageCard}[data-role="agent"]`).first();
await configuredCard.locator(".message-detail-button").click();
await expect(dialog.getByRole("link", { name: "打开 Trace" })).toHaveAttribute("href", /\/v1\/workbench\/traces\/trc_completed\/events$/u);
});
test.describe("trace disclosure policy", () => {
test.use({ scenarioId: "event-replay" });