mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-03 09:30:21 +08:00
Merge branch 'dev' into fix/close-background-sqlite-connections
This commit is contained in:
@@ -2431,12 +2431,10 @@ async def test_cold_start_stalled_provider_settles_with_bounded_retries(monkeypa
|
||||
assert failure.value.partial_response is (phase == "partial_stream")
|
||||
if phase != "connect":
|
||||
assert len(stopped) == len(attempts)
|
||||
assert (
|
||||
sum(event.metadata.get("error_code") == "provider_transport" for event in events) >= 1
|
||||
)
|
||||
finally:
|
||||
await bus.close()
|
||||
await consumer
|
||||
assert sum(event.metadata.get("error_code") == "provider_transport" for event in events) >= 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
8
web/tests/e2e/fixtures/task-board.ts
Normal file
8
web/tests/e2e/fixtures/task-board.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { TaskBoard } from "../../../lib/task-board-api";
|
||||
|
||||
export const emptyTaskBoard: TaskBoard = {
|
||||
cards: [],
|
||||
session_links: [],
|
||||
colors: { todo: "#2563eb", doing: "#a16207", done: "#15803d" },
|
||||
revision: 0,
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import { expect, test, type Locator } from "@playwright/test";
|
||||
import { jsPDF } from "jspdf";
|
||||
import { emptyTaskBoard } from "./fixtures/task-board";
|
||||
|
||||
const MATERIAL_ID = "dddddddddddddddd";
|
||||
const WORKSPACE_ID = "pdf-resize-workspace";
|
||||
@@ -50,6 +51,7 @@ test.beforeEach(async ({ page }) => {
|
||||
await page.route("**/api/**", async (route) => {
|
||||
const path = new URL(route.request().url()).pathname;
|
||||
const json = (payload: unknown) => route.fulfill({ json: payload });
|
||||
if (path === "/api/task-board") return json(emptyTaskBoard);
|
||||
if (path === "/api/auth/status") {
|
||||
return json({ enabled: false, authenticated: true });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { emptyTaskBoard } from "./fixtures/task-board";
|
||||
|
||||
const MATERIAL_A = "aaaaaaaaaaaaaaaa";
|
||||
const MATERIAL_B = "bbbbbbbbbbbbbbbb";
|
||||
@@ -86,6 +87,7 @@ test.beforeEach(async ({ page }) => {
|
||||
route.fulfill({ status, json: payload });
|
||||
|
||||
if (path === "/api/partners" || path === "/api/partner-groups") return json([]);
|
||||
if (path === "/api/task-board") return json(emptyTaskBoard);
|
||||
if (path === "/api/auth/status") {
|
||||
return json({ enabled: false, authenticated: true });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { emptyTaskBoard } from "./fixtures/task-board";
|
||||
|
||||
const MATERIAL_A = "aaaaaaaaaaaaaaaa";
|
||||
const MATERIAL_B = "bbbbbbbbbbbbbbbb";
|
||||
@@ -108,6 +109,7 @@ test.beforeEach(async ({ page }) => {
|
||||
route.fulfill({ status, json: payload });
|
||||
|
||||
if (path === "/api/partners" || path === "/api/partner-groups") return json([]);
|
||||
if (path === "/api/task-board") return json(emptyTaskBoard);
|
||||
if (path === "/api/auth/status") {
|
||||
return json({ enabled: false, authenticated: true });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { emptyTaskBoard } from "./fixtures/task-board";
|
||||
|
||||
const WORKSPACE_ID = "w3c-workspace";
|
||||
|
||||
@@ -83,6 +84,7 @@ test.beforeEach(async ({ page }) => {
|
||||
route.fulfill({ status, json: payload });
|
||||
|
||||
if (path === "/api/partners" || path === "/api/partner-groups") return json([]);
|
||||
if (path === "/api/task-board") return json(emptyTaskBoard);
|
||||
if (path === "/api/auth/status") {
|
||||
return json({
|
||||
enabled: false,
|
||||
|
||||
@@ -508,7 +508,7 @@ test("provider discovery stays staged and model choices preserve existing models
|
||||
await page.goto("/settings/connections?provider=llm:legacy", { waitUntil: "domcontentloaded" });
|
||||
await page.getByLabel("API key", { exact: true }).fill("new-unsaved-key");
|
||||
await page.getByRole("button", { name: "Test provider", exact: true }).click();
|
||||
await expect(page.getByRole("status").filter({ hasText: "Provider connected" })).toBeVisible();
|
||||
await expect(page.getByRole("status").filter({ hasText: "2 models available" })).toBeVisible();
|
||||
expect(probes[0]).toMatchObject({ api_key: "new-unsaved-key", profile_id: "legacy", service: "llm", extra_headers: { "X-Custom-Header": "preserve-me" } });
|
||||
expect(probes[0]).not.toHaveProperty("model");
|
||||
expect(state.writes).toEqual([]);
|
||||
@@ -602,12 +602,16 @@ test("a new provider can be tested with only a key and supplies discovered model
|
||||
});
|
||||
await page.goto("/settings/connections", { waitUntil: "domcontentloaded" });
|
||||
await page.getByRole("button", { name: "Add provider", exact: true }).click();
|
||||
await page.getByLabel("Provider type", { exact: true }).selectOption("openai");
|
||||
const providerType = page.getByRole("radiogroup", { name: "Provider type", exact: true })
|
||||
.getByRole("radio", { name: "OpenAI", exact: true });
|
||||
await providerType.focus();
|
||||
await page.keyboard.press("Space");
|
||||
await expect(providerType).toBeChecked();
|
||||
await page.getByRole("button", { name: "Continue", exact: true }).click();
|
||||
await expect(page.getByLabel("Provider URL", { exact: true })).toHaveValue("");
|
||||
await page.getByLabel("API key", { exact: true }).fill("new-key");
|
||||
await page.getByRole("button", { name: "Test provider", exact: true }).click();
|
||||
await expect(page.getByRole("status").filter({ hasText: "Provider connected" })).toBeVisible();
|
||||
await expect(page.getByRole("status").filter({ hasText: "1 models available" })).toBeVisible();
|
||||
expect(probes[0]).toMatchObject({ api_key: "new-key", base_url: "https://api.openai.com/v1" });
|
||||
await page.getByRole("region", { name: "Provider settings" }).getByRole("link", { name: "Language models", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Add model", exact: true }).click();
|
||||
|
||||
Reference in New Issue
Block a user